Cannot profile AnyCPU app using Reactive Extensions

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
petegoo
Posts: 3
Joined: Mon Sep 17, 2012 10:34 pm

Cannot profile AnyCPU app using Reactive Extensions

Post by petegoo » Mon Sep 17, 2012 10:43 pm

I think this is due to the AlowPartiallyTrustedCallers assembly attribute on the Rx assemblies but I get an "Operation could destabilize the runtime" error when trying to profile our application that uses Reactive Extensions (from MS).

If I comment out the Rx code, it will profile fine. If I run without profiling it will run fine. If I switch to Low profiling level it will profile fine (but obviously this reduces the usefulness of the tool)

Repro project can be found at https://skydrive.live.com/redir?resid=4 ... p1DXnT72hU

Operation could destabilize the runtime.
Message: Operation could destabilize the runtime.
Exception Type: System.Security.VerificationException
Source: System.Reactive
Help Link:
Trace: at System.Reactive.Concurrency.CurrentThreadScheduler.Trampoline.Dispose()
at System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
at System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, Func`3 action)
at System.Reactive.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at ...

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Cannot profile AnyCPU app using Reactive Extensions

Post by Andreas Suurkuusk » Wed Sep 19, 2012 6:59 am

I tried running your repro under .NET Memory Profiler, but I did not see any error message. Do you have some more information about how you profile the repro? What OS and .NET Framework version are you using?

The error message indicates a problem with the dispose tracker. Can you try to disable the dispose tracker and see if it works better? The dispose tracker can be disabled using the "Tools->Settings" command. The dispose tracker setting is available under the General settings. Note that the this setting is part of the profiling level, so when you change it, the profiling level will be set to "Custom".
Best regards,

Andreas Suurkuusk
SciTech Software AB

petegoo
Posts: 3
Joined: Mon Sep 17, 2012 10:34 pm

Re: Cannot profile AnyCPU app using Reactive Extensions

Post by petegoo » Thu Sep 20, 2012 10:13 pm

Sorry for the late reply. For some reason I didn't get a notification.

Yes, disabling the dispose tracker did allow profiling on Medium level although I was rather hoping to be able to get this information while profiling.

MY environment is Wn7, .Net 4.0 (4.5 not installed), VS 2010SP1,

petegoo
Posts: 3
Joined: Mon Sep 17, 2012 10:34 pm

Re: Cannot profile AnyCPU app using Reactive Extensions

Post by petegoo » Thu Sep 20, 2012 10:17 pm

It's also worth noting that if I change the App to x86, it is fine. Only fails when AnyCPU or x64

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Re: Cannot profile AnyCPU app using Reactive Extensions

Post by Andreas Suurkuusk » Mon Sep 24, 2012 1:35 pm

I have tried to reproduce the error using a machine with Windows 7 x64, and Visual Studio 2010 (RTM and SP1), but I have still not seen any error. I have just started the applications in the repro project (WpfApplication1 and ConsoleApplication1) under the profiler and then I have collected a snapshot. The snapshots was collected without any problems, and no exception occurred in the profiled applications.

Do you have any additional information about how you run your applications when the error occurs? What is the exact version of you .NET Framework installation?
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests