The VerificationException is thrown while profiling

Use this forum to discuss and/or suggest future improvements of .NET Memory Profiler and to report bugs.

Moderator: SciTech Software

The VerificationException is thrown while profiling

Postby amckenzie » Mon Oct 05, 2015 9:56 am

If the .Net Framework 4.6 is installed on the machine than the VerificationException is thrown while profiling assembly with AlowPartiallyTrustedCallers attribute. The case is similar to that dsescribent in Cannot profile AnyCPU app using Reactive Extensions topic, but now it can be reprodused with the latest version of Memory Profiler(5.0.117)
Attachments
mempropftest.zip
(11.54 KiB) Downloaded 223 times
amckenzie
 
Posts: 4
Joined: Fri Oct 02, 2015 10:03 am

Re: The VerificationException is thrown while profiling

Postby Andreas Suurkuusk » Mon Oct 05, 2015 7:16 pm

I have tried to reproduce the VerificationException using the attached solution, but I am not able to see any exception. I have tried to run under .NET runtime 4.6.96 and 4.6.106.

What version are you using?
How do you start profiling the application, and what settings have you selected?
Do you have any other configuration settings on your system, e.g. any assembly redirects?
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 977
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: The VerificationException is thrown while profiling

Postby amckenzie » Tue Oct 27, 2015 11:24 am

Sorry for delay.
I have updated Memory Profiler to 5.0.122 version and the problem still exists.
I have installed profiler on a virtual machine and have no problem there. The both machines have installed Windows 7 x64. The primary machine have .NET runtime 4.6.81 and 4.6.100 with all recent updates. On the virtual machine only 4.6.81 is present. On the both machines all options in Tools->Options menu are the same.
I have tried to see the native code of the problematic method (IDisposable.Dispose of the ClassLibrary1.Class1 in the earlier sample) and have found that there is no code present related to the method functionality. Than I have tried to get IL body before JIT compilation. Before JITCompilationStarted method of the profiler callback is called the GetILFunctionBody method returns on the both machines the following bytes as body (length 0x1B) 6A 00 72 6F 00 00 70 72 61 00 00 70 28 13 00 00 0A 00 02 17 28 08 00 00 06 00 2A. After this method call on the virtual machine I have got the following bytes (length 0x2C) 03 30 08 00 20 00 00 00 00 00 00 00 02 28 1A 00 00 0A 00 72 6F 00 00 70 72 61 00 00 70 28 13 00 00 0A 00 02 17 28 08 00 00 06 00 2A. But on the problematic machine I have got different bytes: (length 0x3B) 03 30 08 00 2F 00 00 00 00 00 00 00 02 20 90 43 F5 03 6E 21 00 3F 19 D5 FE 07 00 00 28 19 00 00 0A 00 72 6F 00 00 70 72 61 00 00 70 28 13 00 00 0A 00 02 17 28 08 00 00 06 00 2A.
I hope this information will help you to resolve issue.
amckenzie
 
Posts: 4
Joined: Fri Oct 02, 2015 10:03 am

Re: The VerificationException is thrown while profiling

Postby Andreas Suurkuusk » Wed Oct 28, 2015 10:56 am

Thank you for the detailed information. The IL generated depends on whether the profiler has detected that NGEN images are used or not. Most likely, this is the reason that you see different IL bytes on your different machines. I don't know why the profiler detects NGEN differently, but this is something we will look into futher. We will also make sure that the generated IL is correct for both machines. I will get back to you when I have some more information or questions.

How is it possible to have both .NET runtime 4.6.81 and 4.6.100 installed on the same machine?
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 977
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: The VerificationException is thrown while profiling

Postby amckenzie » Wed Oct 28, 2015 3:47 pm

Visual Studio show .Net Framework Version 4.6.00081. But individual files have different versions:
4.6.100.0 : mscorlib.dll, clr.dll, mscorlib.dll, clrjit.dll
4.6.81.0 : System.Windows.Forms.dll, System.dll, mscoreei.dll

I found the cause of the problem. I have installed an image that can be used under profiler by NGEN for the mscorlib.dll assembly (ngen.exe install /profile mscorlib.dll). When I have removed the image for profiler the problem has gone.
amckenzie
 
Posts: 4
Joined: Fri Oct 02, 2015 10:03 am

Re: The VerificationException is thrown while profiling

Postby Andreas Suurkuusk » Thu Oct 29, 2015 4:09 pm

Thanks for the update. The profiler should handle profiler enabled NGEN images without causing an exception. We will look further into this and see if we are able to reproduce the issue.

The version of the NET Framework and the .NET runtime can be different. The profiler is mainly affected by the runtime version (i.e. the version of clr.dll).
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 977
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden


Return to Future Improvements

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron