5

我们最近升级了一个 web/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

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

4

3 回答 3

4

可能是一个老问题,但它仍然是我在谷歌搜索结果中的第一个问题,所以就这样吧。

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

于 2015-06-16T17:17:23.703 回答
2

添加 <assemblyName>StructureMap</assemblyName>%LOCALAPPDATA%\Red Gate\ANTS Performance Profiler 9\LineLevelBlacklist.xml哪个诀窍。

于 2018-03-29T21:19:44.037 回答
1

通过将以下内容添加到导致问题的类库的 AssemblyInfo.cs 中,我能够解决该问题。

[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]

我在Redgate 论坛讨论中找到了这个解决方案。

于 2016-10-25T11:42:41.043 回答