ANTS Profiler for app that has NInject reference giving "Operation could destabilize the runtime"

690 views Asked by At

I am trying to profile an application which uses Ninject. I am using ANTS profiler and when it hits the line

   StandardKernel kernel = new StandardKernel();

the profiler is giving me the an error saying that the "Operation could destabilize the runtime". From reading around the ANTS forum and other places it seems to be due to the security settings in NInject. I am reluctante to change them and wouldn't really know how to with any confidence (I suspect its to do with how NInject creates objects, which is not through reflection, and so won't run in a medium trust environment, but that is pure speculation!). Has anyone come across this issue with Ninject and ANTS and if so how was it fixed?

The only thing I have tried so far is to ensure everything is run as administrator, but that doesn't make any difference. Also, the code works fine when I am not profiling it, and if anyone from ANTS is reading this, the code works if I turn off line level timings, so the issue is as decribed in the post linked above (but there was no solution...solution seems to involve changing the NInject assembly).

1

There are 1 answers

2
Mike Hanrahan On BEST ANSWER

Actually I found a workaround which allows me to profile. If I remove the .pdb file for the NInject dll and set the ANTS options to only profile where code is available then I am in business. Its not ideal, but as a work around it gets the job done.