Profiling C# and mscorlib.ni.dll
Asked Answered
B

1

25

I am currently profiling a console application with CPU sampling. The OS is Windows 8 Enterprise 64 bit with Microsoft Visual Studio Ultimate 2012 Update 4. I see that the 34% of Exclusive Samples is inside the mscorlib.ni.dll. Then on the Modules view I open the mscorlib.ni.dll and I see that all calls are made to unknwon lines.

I downloaded them firstly with ngen following these instruction: http://blogs.msdn.com/b/visualstudioalm/archive/2012/12/10/creating-ngen-pdbs-for-profiling-reports.aspx but with no luck. Despite the presence of the pdb in the correct position and correctly referenced on the VS options.

After this I tried to get all possible symbols with this PS script: http://knagis.miga.lv/gen_ngen_pdb.txt but still no luck. Even if the pdb is (still) there.

Does someone has already had this issue? I have seen another answer Code profiling to improve performance : see CPU cycles inside mscorlib.dll? but does not resolve at all...

Enrico

Bradney answered 16/4, 2014 at 9:56 Comment(11)
There are just too many things that go wrong here. Add some data points to your question. How large is the .pdb file you got? What happens when you use instrumenting mode? When you debug the program with unmanaged debugging enabled, does the Debugger + Windows + Modules window tell you that symbols are loaded for mscorlib.ni.dll?Anglomania
Thanks for the answer! - Another native module, System.ni.dll is not loaded despite being present on the local symbol cache - The pdb, with the hash 51e2934144ba15628ba5a31be2dae7dc1 (mscorlib.ni.pdb) shown by the profiler is 6.056.960 bytes. - During the profile loading the following error message is shown: Failed to load symbols for C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\51e2934144ba15628ba5a31be2dae7dc\mscorlib.ni.dllBradney
- Debugging with native symbols tells that the mscorlib.ni.dll is loaded but with "No native symbols in symbol file." - After the line referencing the mscorlib.ni, regarding the mscorlib.dll appears the message "Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled." Just my code is in fact enabled - Running the profiler with the just my code disabled does not change the situation.Bradney
- With instrumentation a VS2012 exception appears "Could not load file or assembly Microsoft.VisualStudio.VCProjectEngine, Version=11.0.0.0" This was probably because of ReSharper (see youtrack.jetbrains.com/issue/RSRP-385263) but uninstalling it did'nt changed the situation. As reinstalling from scratch Visual StudioBradney
The "Failed to load symbols" notification points at the essential problem. Sounds like you didn't take care of Step 3 in the blog post.Anglomania
Hi Hans, you were totally right!! The most important part is that the symbol files location added (C:\Symbols) MUST BE THE SAME specified under the "Cache symbols in this directory! How can i reward your answer?Bradney
EDR - you can reward Hans by clicking "arrow up" icon (to the left of comment - showing on mouse over. It says : "This comment adds something useful to the post" :)Modernity
@Bradney as you did figure out the answer, you should summarize the key points as an answer and accept it.Kuska
@Bradney what are you using to profile the application? Visual studio or some other tool like dotTrace / dotMemory?Peel
Hi, at the time I was using Visual StudioBradney
@HansPassant you probably can add your explanation as answer. it would be useful to community. anyone can add to answer but I feel you are the correct person who should answer her.Brandabrandais
M
1

Have a look at the reference project for .net in mscorelib. I am copying the text here:

In order to configure Visual Studio 2013 do the following in the Tools -> Options -> Debugging -> General menu:

  • Disable just my code
  • Disable step over properties and operators
  • Disable require source files to exactly match the original version
  • Enable .NET framework source stepping
  • Enable source server support I can imagine that not all classes are supported, some will have proprietary code in it, however a list of supported DLL's in regards to mscorelib can be found here.

enter image description here

Mackmackay answered 31/8, 2019 at 8:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.