我们最近升级了一个web / mvc应用程序以使用StrucutreMap 3.0.4
现在,当尝试使用RedGate Ant的分析器在“Line Level Timings,All Methods with Source”或更高级别上分析应用程序时,我们会收到以下错误
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
添加到web.config中的system.web
答案 0 :(得分:4)
可能是一个老问题,但它仍然是谷歌搜索结果中的第一个,所以这里就是。
我能够通过在分析之前删除structuremap的pdb文件来解决这个问题。
答案 1 :(得分:1)
我能够通过将以下内容添加到导致问题的类库的AssemblyInfo.cs来解决此问题。
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
我在Redgate forum discussion中找到了此解决方案。
答案 2 :(得分:1)
加
<assemblyName>StructureMap</assemblyName>
到%LOCALAPPDATA%\Red Gate\ANTS Performance Profiler 9\LineLevelBlacklist.xml
做了这个伎俩。