Options

Exception -> Operation could destabilize the runtime

cjlotzcjlotz Posts: 45
Hi

I've installed the new ANTS 6 Profiler after using the EAP successfully on and off during the last 2-3 months. We are using the new command line profiling features to get the profiler running in the background. We then use soapUI from the command line as well to create some load against our services. This gives us a sort-of-automated performance test run.

As mentioned, all of this was working at some point-in-time using one of the EAP builds. However, when following the same process using the RTW, we get the following exception:
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:


[No relevant source lines]


Source File: D:\Projects\VS 2008\ninject.extensions.wcf\source\Ninject.Extensions.Wcf\NinjectWcfApplication.cs Line: 0

Stack Trace:


[VerificationException: Operation could destabilize the runtime.]
Ninject.Extensions.Wcf.NinjectWcfApplication.Application_Start(Object sender, EventArgs e) in D:\Projects\VS 2008\ninject.extensions.wcf\source\Ninject.Extensions.Wcf\NinjectWcfApplication.cs:0

[HttpException (0x80004005): Operation could destabilize the runtime.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +587
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +194
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +405
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +368

[HttpException (0x80004005): Operation could destabilize the runtime.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +646
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +771




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

I've verified that we can successfully profile our application using the ANTS UI, so it seems to be related to profiling from the command line only. The problem also isn't related to soapUI as we use it just to create a load on the server. However, just to verify I also ran the profiler from the command line without using soapUI and got the same exception when browsing to the web site.

We are running directly against IIS and not using Cassini. Here is the command line we use for driving the profiler:
"C:\Program Files\Red Gate\ANTS Performance Profiler 6\Profile.exe" /project:"D:\PragmaDev\OK52\pOnKey\Main\Metrics\PerformanceTests\Pragma.OnKey5.app6" /verbose /lineLevel /onlyWithSource /force /timeout:60 /data:"D:\PragmaDev\OK52\pOnKey\Main\Metrics\PerformanceResults\2010_07_11\StaffMember\00_53\StaffMember.app6results" /htmlreport:"D:\PragmaDev\OK52\pOnKey\Main\Metrics\PerformanceResults\2010_07_11\StaffMember\00_53\StaffMember.Summary.html"

I tried looking in the logs folder, but the command line profiler doesn't seem to create any log entries. Can you please assist.

Thanks
Carel

Comments

  • Options
    Yes- we'll get to the bottom of this one quickly, I'm sure. Were you able to send off an exception report to us? (If the dialog came up automatically).
  • Options
    Remember this only happens when running the profiler in command line mode and I get not exception dialog box popping up. Had a look in the log folder and the command line profiler didn't seem to write out anything there either. What additional info can I provide?
  • Options
    Could you get a mini-dump please and we'll analyze that here.
  • Options
    Is there a link to an article somewhere that describes the process of creating a mini-dump?
  • Options
    This error generally happens because the line-level timings won't work when applied to partially trusted code. You can try adding an option to the command line parameters to turn this feature off, or you could temporarily change the assembly that's throwing the exception to be full-trust for profiling.

    We're considering alternative ways of achieving the line-level support that will avoid this particular problem for v7.
    Andrew Hunter
    Software Developer
    Red Gate Software Ltd.
  • Options
    Andrew

    I can confirm that I don't get the exception when using the /methodLevel option on the command line. I would ideally like to have the line-level details via die command line profiler as well. Why does this work via the UI though? Shouldn't we hit the same problems?
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    It happens in the UI as well as the command-line. The settings must be different regarding the line-level timings.

    I have a test case that demonstrates the problem - put a [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand)] attribute on the Page_Load method of an ASPX codebehind file, set Web.Config to trust level="medium", and run it in the 4.0 version of development webserver and you wil see the error.

    Change the profiler settings to use the "2.0" version of development webserver and there is no problem. Change web.config to trust level="Full" and there is no problem on either webserver.

    The only way to make it work all-round at this time is to go through all methods in the application and take the SecurityPermission attributes off or do Code Access Policy the .NET 4.0 way.
  • Options
    When profiling an app that uses NInject I am getting an error that says "Operation could destabilize the runtime" if I use line level timings. As I have no control over this assembly I can't remove the security attributes. Is there any solution you could suggest to remedy this?

    Thanks,

    Mike.
    Mike Hanrahan
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Did you try setting web.config to Full Trust?
    http://www.red-gate.com/supportcenter/c ... 0903000361
  • Options
    I was able to solve it by removing the NInject .pdb files and setting ANTS to only profile where code is available. Not ideal, but it will work until NInject remove the security policies that are causing this. Thanks.
    Mike Hanrahan
  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Another customer was able to resolve this issue by adding

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

    to the assembly.cs file of the offending assemblies.

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • Options
    Hi, I can confirm that this helped also in our project:

    [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
Sign In or Register to comment.