在 StructureMap 应用程序上使用 ANTS 分析器时,“操作可能会破坏运行时的稳定性”

Dav*_*ave 5 ants structuremap3

我们最近升级了一个 web/mvc 应用程序以使用 StrucutreMap 3.0.4

现在,当尝试在“Line Level Timings, All Methods with Source”或更高级别使用 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
Run Code Online (Sandbox Code Playgroud)

我尝试按照http://documentation.red-gate.com/display/APP8/Operation+could+destabilize+the+runtime+error+profiling+ASP.NET在 web.config 中添加到 system.web

小智 4

可能是一个老问题,但它仍然是我在谷歌结果上的第一个问题,所以这里是。

我能够通过在分析之前删除结构图的 pdb 文件来解决该问题。