"Операция может дестабилизировать среду выполнения" при использовании профилировщика ANTS в приложении StructureMap
Недавно мы обновили веб /mvc-приложение для использования StrucutreMap 3.0.4.
Теперь при попытке профилировать приложение с помощью профилировщика RedGate Ant на уровне "Временные рамки на уровне строки, все методы с источником" или на более высоком уровне мы получаем следующую ошибку
Operation could destabilize the runtime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.VerificationException: Operation could destabilize the runtime.
Source Error:
Line 174:
Line 175: Initialise(context);
Line 176: ObjectFactory.Initialize(x => { x.AddRegistry<BWebsiteIoc>(); });
Line 177: }
Line 178: }
Source File: c:\_Development\NT\Platform\WebSite\Global.asax.cs Line: 176
Stack Trace:
[VerificationException: Operation could destabilize the runtime.]
StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\ObjectFactory.cs:42
Nga.Platform.Website.FirstRequestInitialisation.Initialise(HttpContext context) in c:\_Development\NT\Platform\WebSite\Global.asax.cs:176
Nga.Platform.Website.MvcApplication.Application_BeginRequest(Object source, EventArgs e) in c:\_Development\NT\Platform\WebSite\Global.asax.cs:106
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +182
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
Я попытался добавить в system.web в web.config в соответствии с http://documentation.red-gate.com/display/APP8/Operation+could+destabilize+the+runtime+error+profiling+ASP.NET
3 ответа
Может быть, старый вопрос, но он все еще один для меня в результатах Google, так что здесь.
Я смог решить эту проблему, удалив pdb-файлы structmap перед профилированием.
Добавленной<assemblyName>StructureMap</assemblyName>
в %LOCALAPPDATA%\Red Gate\ANTS Performance Profiler 9\LineLevelBlacklist.xml
который сделал свое дело.
Я смог обойти эту проблему, добавив следующее в AssemblyInfo.cs библиотеки классов, вызывающей проблему.
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
Я нашел это решение в обсуждении на форуме Redgate.