<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="www.w3.org/2005/Atom" xmlns:sy="purl.org/rss/1.0/modules/syndication/" xmlns:dc="purl.org/dc/elements/1.1/" xmlns:content="purl.org/rss/1.0/modules/content/" xmlns:wfw="wellformedweb.org/CommentAPI/" xmlns:slash="purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Developer Support Languages - VC++, C# and VB.NET</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dsvc/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dsvc/feed.xml</link>
    <description>Welcome to Microsoft Developer Support, Languages team blog! You will find a lot of language related troubleshooting resources here.</description>
    <lastBuildDate>Thu, 21 Sep 2017 22:37:43 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Diagnosing STATUS_INVALID_IMAGE_FORMAT (C000007B) Errors</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/diagnosing-status_invalid_image_format-c000007b-errors</link>
      <pubDate>Wed, 20 Sep 2017 23:29:27 GMT</pubDate>
      <dc:creator><![CDATA[Scot Br - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/?p=1006</guid>
      <description><![CDATA[The Symptom
There are instances where you may encounter an error message that says something like,...]]></description>
      <content:encoded><![CDATA[<h2>The Symptom</h2>
There are instances where you may encounter an error message that says something like, “The application was unable to start correctly” with an error code of C000007B.  There are other error codes where you may see that message, but I'm only going to focus on the STATUS_INVALID_IMAGE_FORMAT C000007B here.  In fact, there are more than 100 places in the Windows code where the load of an executable image (.exe, .dll, .ocx, etc.) is being attempted, but fails with this error code. As you might expect, there are many criteria for an executable image to be considered valid for loading.  For this reason, you may search the Internet and find all sorts of different suggestions for how to solve this type of problem, and those solutions are typically limited to just a subset of the reasons for this error.
<h3>Really an Invalid Image Format?</h3>
The most obvious reason for this error would be that the file itself truly is in a bad state, and is truly not an executable image.  This could mean the file was corrupted in some way, or a file that really isn't an executable was renamed to have .exe, .dll, or .ocx extension even though it isn't truly that type of file.  If you happen to know which image file is being rejected, the best resolution might be to ensure that the file system is in good shape (check the disk for errors and repair) and replace the file with a good copy, which could mean reinstalling the software that should have put it in place.
<h3>Or was it just meant for another architecture?</h3>
But quite often, the reason is that the executable file doesn't match the current architecture, even though the file would be a valid image if used in the architecture for which it was built.  For instance, an x64 process is told to load a DLL, and the DLL that is found was built for x86.  Since a 32-bit DLL doesn't match the expected 64-bit architecture, the system returns the error that it has an invalid format. Or, a 64-bit .exe can't be run on a 32-bit Windows machine.  Likewise, binaries built for operating systems with other architectures (ARM, IA64, etc.) won't run on a Windows edition that expects an IA32 or AMD64 instruction set.  In my experience, the vast majority of times this error is encountered, it is for a reason like this.  This current blog post was inspired by a customer case in which the underlying problem turned out to be that the x86 (32-bit) build of the mfc140ud.dll had been copied into the folder where the x64 (64-bit) build was expected.  His 64-bit application tried to load the 32-bit DLL, and a cryptic error was logged in the Application event log with "Faulting module name: ntdll.dll" and "Exception code: 0xc000007b".  No more clue about the DLL in question was given.

Many times, it will not be clear to you exactly which file is being rejected.  You may be executing a program that loads numerous files, and the system just tells you that the application was unable to start correctly. You may also find the code C000007B in the event log, and not know what's going on.  There are a handful of ways that you can try to pin it down.
<h2>Diagnosis Tactics</h2>
<h3>Dependency Walker</h3>
The <a href="www.dependencywalker.com/">Dependency Walker utility </a>was written many years ago to help identify the hierarchy of dependencies required for an executable to load.  One of its main purposes was to identify things that may be missing.  It also helps to identify which DLLs will be loaded, from which locations, and which exported symbols from each dependency are used by the other binaries that depend on them.  It has been an extremely useful tool for a lot of reasons, and should probably be in your "tool box" if you do software development, system administration, or other similar jobs.  There are a few different builds of this tool for different architectures, and you'll probably want to install at least a couple of these.

Install and run the build of depends.exe that matches the architecture of the binary you are trying to execute.  In my customer's case, we ran the x64 build of depends because his .exe was built for that architecture.  It's quite likely that you will see some warnings about some missing DLLs.  Some of these can be ignored, and the FAQ for Dependency Walker will discuss some of these.  In the top left, there will be a tree view with the dependency hierarchy. In the middle section below that, there will be a list of the dependency modules identified.  Right click on one of the file names in that list, and ensure that "Full Paths" is selected.  In one of the columns to the right, labeled "CPU", you should see the architecture that matches your main executable.  In my customer's case, we saw "x64" for almost all of the modules, but "x86" in red on the row for the mfc140ud.dll that was wrong.  Because we could see the full path to the DLL, it became obvious pretty quickly that the 32-bit build of that DLL was in the folder where the 64-bit build belonged, and the resolution was obvious (put the 64-bit build there in its place).
<h3>Process Monitor</h3>
The <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/procmon">Process Monitor tool </a>is also a "must have" for anyone in IT for a Windows system.  It captures all file system, registry, and other process/thread activity executing on the machine.  This can be an enormous amount of data, but fortunately it can be filtered either during capture or during review of the log.  It will also reveal all attempts to find and load a DLL, along with the result of these attempts.  In our case, the attempt to execute his program led to the Windows Error Reporting (WER) to raise an error message and an event log entry.  So, we used the filter option to include only those events where the Process Name was the name of his executable, or where it was werfault.exe (two different filter criteria).  This reduced the quantity of entries to examine.  We could see the point at which werfault.exe had been launched, telling us that the problem had occurred right before that.  Looking above that, we found the last entries triggered by his application, and that it was searching for mfc140ud.dll in several other location where it didn't exist, with "NAME NOT FOUND" results, before raising the fatal error about the invalid image format.  Prior to searching all the places where it didn't exist, we saw that it found mfc140ud.dll in the folder where the 64-bit DLLs reside.  But it wasn't obvious right away why it kept on looking in the wrong places.  In retrospect, we now understand that it was because it found the 32-bit build, determined it was wrong, and kept looking for a 64-bit build.  When it didn't find one, it then complained about the invalid image format of the 32-bit DLL.  In the future, we'll know how to interpret that pattern.
<h3>WinDbg with Loader Snaps</h3>
The Windows Debugger and the Global Flags tool are two among the many <a href="https://developer.microsoft.com/en-us/windows/hardware/download-windbg">Debugging Tools for Windows</a>, yet another suite of valuable tools for anyone who needs to diagnose software problems. When diagnosing a failure of a program to start, whether because of the invalid image format error, or any of a hundred other reasons, you need to know how to use gflags.exe and windbg.exe to examine the "loader snaps".  These are detailed diagnostic messages emitted by the Windows loader as it attempts to load and initialize all the dependencies of an executable. To enable the display of loader snaps in the debugger, first run the Global Flags tool (gflags.exe) from the folder where your Debugging Tools for Windows were installed.  Select the "Image File" tab, type the name of your main executable (like "myprogram.exe") in the text box, then press the Tab key to refresh the display.  This should cause all the checkboxes that were grayed out before to be selectable.  Near the top left, you will see "Show loader snaps".  Check that box.  It will be worthwhile to you to read about the other options here for the future.  For now, this is the only one we need.  Press "OK".  This gflags tool creates or modifies subkeys of the "Image File Execution Options" key in the registry.  You could learn what changes to make there directly, but using gflags is easier and safer. [Note: "safer" does not mean absolutely safe.  You still have the capability to make improper registry changes even using gflags.  For instance, using a page file that is too small with system-wide full-page heap could render the system unbootable.  Read about any settings you consider using.]

Now that loader snaps are enabled, run the Windows Debugger (windbg.exe) for the appropriate bitness of the application you are debugging.  From the File menu, choose "Open Executable".  Complete the form for any command line arguments and starting directory options you may need, and press "OK".  You should see an enormous amount of information in the output window as the loader emits all the details of what it's doing.  When it encounters an invalid image (or any other problem) and fails to load, you should see details of exactly what it tried up to that point, and some information about what it didn't like.  Most likely, you'll want to read this information from the bottom up, since the error will be near the end, and you can look backwards from there to get a clearer picture of how things went awry.  A lot of this output may be excessive or arcane detail to you, but it's rare that you shouldn't be able to discover the cause of a loading problem by looking at this detail.  In my customer's case, we didn't need to use this tactic.  But loading problems are not always identifiable by Dependency Walker or Process Monitor, so this final step should nail it down if the other ones didn't.
<h2>Still Didn't Figure it Out?</h2>
If you got this far and still don't have the answer, it may be time to open a support case.  If you are the developer of the application failing to load, or if it's a Microsoft application, <a href="https://support.microsoft.com/en-us">create a support case directly with Microsoft</a>.  If not, contact the vendor of the application for support, and they may need to create a case with us if they can't figure it out.]]></content:encoded>
    </item>
    <item>
      <title>Unable to code sign appx package in Visual Studio: A look at build process and certificate issues.</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/unable-to-code-sign-appx-package-in-visual-studio-a-look-at-build-process-and-certificate-issues</link>
      <pubDate>Thu, 22 Dec 2016 09:49:00 GMT</pubDate>
      <dc:creator><![CDATA[Nandeesh Swami]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/?p=955</guid>
      <description><![CDATA[It all started with issues in code signing. My client was using Signtool to sign his package and...]]></description>
      <content:encoded><![CDATA[It all started with issues in code signing. My client was using Signtool to sign his package and they were getting bunch of errors. The below screen grab shows us the errors.
Errors like
<em>MakeAppx failed to extract Appx to App.Windows10_0.0.2.0_ARM</em>
<em> Ensure AppxManifest and signing cert Publishers name match..</em>
<em> Get-Content:Cannot find path 'C:\Temp\APPXOutput\App...\AppxManifest.xml' because it does not exist.</em>
<em> At C:\Program Files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\...\BuildMDILAPPX.ps1:464 char:31</em>
<em> You cannot call a method on null valued expression</em>

Well searching about such issues online you can see that there are lot of hits.

[caption id="attachment_995" align="alignnone" width="300"]<a href="https://msdnshared.blob.core.windows.net/media/2016/12/Untitled.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/12/Untitled-300x182.png" alt="Click To Enlarge" width="300" height="182" class="size-medium wp-image-995" /></a> Click To Enlarge[/caption]

My hypothesis after reading this msdn <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/jj835835(v=vs.85).aspx">link</a> is “The issue they were facing was because the subject name of the certificate must match the <strong>Publisher</strong> attribute that is contained in the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/br211441.aspx"><strong>Identity</strong></a> element of the AppxManifest.xml file that is stored within the package. “ So in other words before we even sign the application we have to add the pfx file in Packaging Tab of Appxmanifest, is that happening correctly? So I set out to verify how is he getting his packages. Right when we had to add the pfx file into Visual Studio we were getting the error,

<strong>“The Manifest Designer cannot import the certificate”.</strong>

<strong>The certificate you have selected is not valid for signing because it is either expired or has other issues.</strong>

Clearly the certificate had not expired. I tried the same with a Test Cert I had created and it worked splendidly. I went to check out the certificate properties of our customer. I found out that Code Signing in Enhanced Key usage was not checked. From my experience in the past I know that the certificate needs to have Code Signing as an Enhanced Key Usage. This <a href="https://msdn.microsoft.com/en-us/library/windows/apps/br230260(v=vs.110).aspx">link</a> enlists How Visual Studio validates certificates.
We went through lot of work arounds online . One of which is to go to <strong>Certificate Properties - Certificate Purposes - Enable only the following properties</strong> and unchecking properties that were invalid for this purpose (everything but Code Signing). That doesn't work.
<h2><a href="https://msdn.microsoft.com/en-us/library/windows/apps/br230260(v=vs.110).aspx"><span style="text-decoration: underline"><em>Validating Certificates</em></span></a></h2>
<em>During packaging, Visual Studio validates the specified certificate in the following ways:</em>
<ul>
 	<li><em>Verifies the presence of the Basic Constraints extension and its value, which must be either Subject Type=End Entity or unspecified.</em></li>
 	<li><em>Verifies the value of the Enhanced Key Usage property, which must contain Code Signing and may also contain Lifetime Signing. Any other EKUs are prohibited.</em></li>
 	<li><em>Verifies the value of the KeyUsage (KU) property, which must be either Unset or DigitalSignature.</em></li>
 	<li><em>Verifies the existence of a private key exists.</em></li>
 	<li><em>Verifies whether the certificate is active, hasn’t expired, and hasn't been revoked</em></li>
</ul>
&nbsp;

Now that we have verified that customer’s certificate is not valid for code signing. So the obvious next step is  to acquire a certificate which meets the above conditions. What I am proposing below is not a solution for the issue. Solution is to acquire certificate matching the requirements. This is to provide some insight into the files used while building.
This customer wanted to get the product out in their test hardware for now and then eventually buy a cert which would meet the requirements and asked us if we can do something that could allow them to continue with their plans. Please note that the below<strong> is not recommended. Microsoft requires you to use proper code signing certificates. </strong>I would not call this a work around. But it gives you a good idea of how the build happens. <a href="https://msdn.microsoft.com/en-us/library/wea2sca5(v=vs.90).aspx">Msbuild </a>is the build engine that builds all types of applications in Visual Studio. What msbuild does is it uses targets which contain tasks to divide the work, kick in different tools and build the components. We went to on of such target files which conatins flags for certain validation checks C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage. In there we got hold of  Microsoft.AppxPackage.Targets. This target file contains flags, one of which is EnableSigningChecks

&nbsp;

&lt;!-- Flags controlling certain features --&gt;

&lt;PropertyGroup&gt;

.
.

&lt;AppxPrependPriInitialPath Condition="'$(AppxPrependPriInitialPath)' == ''"&gt;true&lt;/AppxPrependPriInitialPath&gt;

<em><strong>&lt;EnableSigningChecks Condition=" '$(EnableSigningChecks)' == '' "&gt;true&lt;/EnableSigningChecks&gt;</strong></em>

&lt;AppxStrictManifestValidationEnabled Condition="'$(AppxStrictManifestValidationEnabled)' == ''"&gt;true&lt;/AppxStrictManifestValidationEnabled&gt;

.

.

&lt;/PropertyGroup&gt;

We changed this flag to false . After this we restarted Visual Studio and we were able to add the certificate which is obvious provided the falg turned off. This just disables the signing checks and you will be able to add the cert. This is clearly not some thing we recommend, certificate with valid conditions has to be used for your appx files. I hope this gives some insight into these target files. Previously I had written a <a href="https://blogs.msdn.microsoft.com/dsvc/2014/02/17/using-msbuild-to-build-windows-store-application-without-signing-the-appxpackage/">blog</a> giving you similar insights. I hope the information is useful. Feel free to put your questions in comment section.

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>How to get line numbers in your code for specific events, viz., exception?</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/how-to-get-line-numbers-in-your-code-for-specific-events-viz-exception</link>
      <pubDate>Mon, 18 Apr 2016 16:53:16 GMT</pubDate>
      <dc:creator><![CDATA[Nandeesh Swami]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/?p=911</guid>
      <description><![CDATA[One of my clients came up with a requirement to track down the line of the code immediately when the...]]></description>
      <content:encoded><![CDATA[One of my clients came up with a requirement to track down the line of the code immediately when the exception is thrown, note that this is 'without the use of the debuggers'. My research led me to lot of questions online about this and hence I am trying to write a succinct blog about what can be done and what should not be done. This blog applies to MANAGED CODE. The key to getting line numbers in your managed code is PDBs. These are also known as symbol files. What gets stored in PDB is different from native and managed code. Native PDBs hold quite a lot of information and they are "mandatory" for <span style="text-decoration: underline">effective</span> native debugging. Managed PDBs contain line numbers and source file names, which may be vital on occasions but not "mandatory". Read this <a href="www.wintellect.com/devcenter/jrobbins/pdb-files-what-every-developer-must-know">Blog Post</a> to decode your qualms of PDBs.

Now that we know PDBs are very important to get line numbers. We should work with PDBs to get the line numbers. For all praical puposes it's a bad idea to ship PDBs to your client along with your product, there are disadvantages too with this method which I will speak about. I found out three ways to achieve this , one of them is a straight forward way and the other two are quite similar but need some amount of work. So here we go,

1. This is a straight forward way of using .net classes to get line numbers from frames. This requires your PDBs to be with the assemblies i.e in the same folder. You cannot use symbol path or any Environment variable to have them in separate folders. What this essentially means is that, you will have to ship the PDBs too!

<span style="font-family: 'Calibri',sans-serif;color: #222a35">catch (Exception ex)</span>

<span style="font-family: 'Calibri',sans-serif;color: #222a35">           {</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">   StackTrace st = new StackTrace(ex, true); </span><span style="font-family: 'Calibri',sans-serif;color: #222a35">//Get the first stack frame
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                StackFrame frame = st.GetFrame(0);</span><span style="font-family: 'Calibri',sans-serif;color: #222a35"> </span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                //Get the file name
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                 fileName = frame.GetFileName();</span><span style="font-family: 'Calibri',sans-serif;color: #222a35"> </span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                //Get the method name
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                 methodName = frame.GetMethod().Name;
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35"> </span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                //Get the line number from the stack frame
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                 line = frame.GetFileLineNumber();
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                string Line = line.ToString();</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                //Get the column number
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                 col = frame.GetFileColumnNumber();
</span><span style="font-family: 'Calibri',sans-serif;color: #222a35">                string Col = col.ToString();
</span>}

Here is the <a href="https://msdn.microsoft.com/en-us/library/system.diagnostics.stackframe.getfilelinenumber(v=vs.110).aspx%20">msdn link </a>for the api. Apart from the above disclaimer about not shipping your PDBs there are some obvious drawbacks with this mechanism. Assuming that you have a product which installs dlls into GAC, where would you place the PBs? The foremost requirement for this type of design is to have your pdbs beside your assemblies. Now with this requirement it is a strict "NO" to mess with the GAC structure i.e to place PDBs in GAC.

&nbsp;

2. The other 2 methods is what I would recommend, especially the current one. During your build process, use <a href="https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fblogs.msdn.com%2fjmstall%2farchive%2f2005%2f08%2f25%2fpdb2xml.aspx&amp;data=01%7c01%7cnsuhas%40064d.mgd.microsoft.com%7cf3678a7669dd42d12b4108d31c0cd627%7c72f988bf86f141af91ab2d7cd011db47%7c1&amp;sdata=T0JiwIIUTZCM1%2b9qJMXazXSUvN0H859MosmeJmcEXQ4%3d">Mike Stall's pdb2xml converter</a>, distributed as part of <a href="https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fblogs.msdn.com%2fjmstall%2farchive%2f2005%2f11%2f08%2fmdbg_linkfest.aspx&amp;data=01%7c01%7cnsuhas%40064d.mgd.microsoft.com%7cf3678a7669dd42d12b4108d31c0cd627%7c72f988bf86f141af91ab2d7cd011db47%7c1&amp;sdata=jG0YfylrCMMA2%2btyxbvT1RlCP5Eq%2bct20dFTMtxsOQo%3d">MDbg managed code debugger</a>, and store them some place secure (e.g., source control). When you get a stack trace back from the client, you can query the IL offset from the XML data to determine the relevant line number. If your stack traces get submitted to a website, you can even automate the conversion, so that developers will already be getting fully detailed stack traces by the time the cases hit their inbox or it could be part of your catch block logic. Here is a <a href="https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.timstall.com%2f2008%2f07%2fgetting-file-and-line-numbers-without.html&amp;data=01%7c01%7cnsuhas%40064d.mgd.microsoft.com%7cf3678a7669dd42d12b4108d31c0cd627%7c72f988bf86f141af91ab2d7cd011db47%7c1&amp;sdata=jmtwXPYbffiI%2fs2Ko4fD%2fyXSfEd%2bShHFaAa52KEn488%3d">link</a> online which pretty demonstrates its use.

&nbsp;

3. Third method is somewhat similar to second method and partialy derives the code from my second point, however it customizes pdb look up for source information. The <a href="https://blogs.msdn.com/b/rmbyers/archive/2007/06/21/customizing-pdb-lookup-for-source-information-in-stacktrace.aspx">link</a> details the information.  This pretty much resolves the GAC issue that I mentioned above. The code would be something as below.

catch (System.Exception e)

{

st = new StackTrace(e, true);

StackTraceSymbolProvider stsp = new StackTraceSymbolProvider(searchPath,

SymSearchPolicies.AllowSymbolServerAccess |

SymSearchPolicies.AllowOriginalPathAccess |

SymSearchPolicies.AllowReferencePathAccess |

SymSearchPolicies.AllowRegistryAccess);

Console.WriteLine("Custom stack trace:");

Console.WriteLine(stsp.StackTraceToStringWithSourceInfo(st));

A sample is already written and is <a href="https://blogs.msdn.com/b/rmbyers/archive/2007/06/21/code-sample-stacktrace-with-manual-symbol-lookup.aspx">here</a>.

The obvious advantage of the second and third method is that they have the ability to isolate the PDBs and you can exercise control over it's access. Developers have to smart in their architecture and use one of the 2 methods to carefully design an effective PDB lookup module. All it really boils down to is apis or libraries utilizing <a href="https://msdn.microsoft.com/en-us/library/ms232935(v=vs.110).aspx">GetReaderforFile2</a> api . This native api in it's own words provides you extensive search abilities. I hope the above points of discussion aid you in your development! That's all for today, Adios!

-Nandeesh Swami]]></content:encoded>
    </item>
    <item>
      <title>Swallowing SEH Exceptions is EVIL!</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/swallowing-seh-exceptions-is-evil</link>
      <pubDate>Thu, 11 Feb 2016 18:10:39 GMT</pubDate>
      <dc:creator><![CDATA[Steve Horne]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2016/02/11/swallowing-seh-exceptions-is-evil/</guid>
      <description><![CDATA[This case was a good case-in-point of why crashing can sometimes be a good thing – at least it helps...]]></description>
      <content:encoded><![CDATA[<p>This case was a good case-in-point of why crashing can sometimes be a good thing – at least it helps you find and fix your bugs! This issue was reported as ‘my application just randomly disappears’.&#160; We had the developer run this app under <a href="https://technet.microsoft.com/en-us/sysinternals/dd996900.aspx" target="_blank">procdump</a> with unhandled exceptions being caught – ‘procdump -ma -e Test.exe’. They could still randomly reproduce the issue when loading the app, but we never were able to capture a crash dump. Even after <a href="https://dzone.com/articles/page-heap-useful-diagnostic" target="_blank">enabling page-heap</a> to trap memory buffer overwrites. Frustrating, time consuming…expensive.</p>  <p>At that point, we just enabled first-chance exception dumping – ‘procdump -n 100 -ma -e 1 Test.exe’. This generated many, many dump files. Did I mention this was a mixed-mode managed app that contains both managed and native code? Managed code can potentially throw a lot of first-chance exceptions – even a lot of AV first chance exceptions as the managed NullReferenceException starts out a first-chance AV.</p>  <p>After looking at a lot of dump files I was able to notice a pattern of native code FCE.</p>  <p>The Windbg callstack looks like:</p>  <p>This dump file has an exception of interest stored in it.   <br />The stored exception information can be accessed via .ecxr.    <br />(c3c.c88): Access violation - code c0000005 (first/second chance not available)    <br />eax=0bd3f000 ebx=7ffffff6 ecx=00000073 edx=00000007 esi=01282138 edi=0bd3eff0    <br />eip=6ad71891 esp=0019eae4 ebp=0019ef68 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl nz na pe nc    <br />cs=001b&#160; ss=0023&#160; ds=0023&#160; es=0023&#160; fs=003b&#160; gs=0000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00010206    <br />msvcr100!_woutput_l+0x93b:    <br />6ad71891 66833800&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmp&#160;&#160;&#160;&#160; word ptr [eax],0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ds:0023:0bd3f000=????    <br /></p>  <p>0:000&gt; k   <br />ChildEBP RetAddr&#160; <br />0019ef68 6ad71af1 msvcr100!_woutput_l+0x93b [output.c @ 1625]    <br />0019efac 6ad71b38 msvcr100!_vsnwprintf_l+0x8e [vswprint.c @ 155]    <br />0019efc8 01281043 msvcr100!_vsnwprintf+0x18 [vswprint.c @ 227]    <br />0019f000 012810d0 Test!EvilFunc+0x43 [c:\test.cpp @ 19]    <br />0019f834 0128125a Test!main+0x60 [c:\test.cpp @ 38]    <br />0019f878 7726ee6c Test!__tmainCRTStartup+0x122 [crtexe.c @ 555]</p>  <p>This is my after the fact repro code of course, developers are never kind enough to identify bad code as EvilFunc. This little sample shows the two bugs they had interacting to produce this scenario:</p>  <p>#define _CRT_SECURE_NO_WARNINGS   <br />#include &lt;stdio.h&gt;    <br />#include &lt;stdarg.h&gt;    <br />#include &lt;tchar.h&gt;    <br />#include &lt;string.h&gt;</p>  <p>// Build /Eha to catch SEH Exceptions   <br />void EvilFunc(wchar_t * pWChar, ...)    <br />{    <br />&#160;&#160;&#160; wchar_t sz[1024] = { 0 };    <br />&#160;&#160;&#160; int nBufLen = (sizeof(sz) / sizeof(sz[0])) - 1;    <br />&#160;&#160;&#160; va_list args;</p>  <p>&#160;&#160;&#160; va_start(args, pWChar);   <br />&#160;&#160;&#160; int nBuf = 0;</p>  <p>&#160;&#160;&#160; try   <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; nBuf = _vsnwprintf(sz, nBufLen, pWChar, args);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Do something with sz...    <br />&#160;&#160;&#160; }    <br />&#160;&#160;&#160; catch(...)    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160; }</p>  <p>&#160;&#160;&#160; va_end(args);   <br />}</p>  <p>   <br />int main()    <br />{    <br />&#160;&#160;&#160; long count = 1;</p>  <p>&#160;&#160;&#160; while(true)   <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; char* szUserName = _strdup(&quot;Steve Horne&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; EvilFunc(_T(&quot;The UserName is : %s&quot;), szUserName));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; printf(&quot;loop count %d\n&quot;, count++); </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; free(szUserName);   <br />&#160;&#160;&#160; }</p>  <p>&#160;&#160;&#160; return 0;   <br />}</p>  <p>EvilFunc is using the ‘…’ vararg syntax in C/C++. The first parameter they were passing was a wide-char – they didn’t explicitly declare it wchar_t*, they were using one of the OLE macros which compiled to wchar_t* – I’ve simplified things down to the minimum repro here. </p>  <p>The first bug is passing in a char* as the … variable params. The compiler doesn’t type check the … so it was happily calling&#160; _vsnwprintf with a wide-char format string and char string, just like the developer told it to.</p>  <p>The page-heap enabled crash dump shows the problem with that. They walked off the end of the char* string in CRT code (it was looking for a wchar_t two-byte NULL string termination) and started accessing&#160; memory unintentionally:</p>  <p>0:000&gt; r   <br />eax=0bd3f000 ebx=7ffffff6 ecx=00000073 edx=00000007 esi=01282138 edi=0bd3eff0    <br />eip=6ad71891 esp=0019eae4 ebp=0019ef68 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl nz na pe nc    <br />cs=001b&#160; ss=0023&#160; ds=0023&#160; es=0023&#160; fs=003b&#160; gs=0000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00010206    <br />msvcr100!_woutput_l+0x93b:    <br />6ad71891 66833800&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font style="background-color: #ffffff">cmp&#160;&#160;&#160;&#160; word ptr [eax],0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ds:0023:0bd3f000=????</font></p>  <p>0:000&gt; db @eax   <br />0bd3f000&#160; ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??&#160; ????????????????    <br />0bd3f010&#160; ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??&#160; ????????????????    <br />0bd3f020&#160; ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??&#160; ????????????????</p>  <p>   <br />0:000&gt; db @eax-10    <br />0bd3eff0&#160; 53 74 65 76 65 20 48 6f-72 6e 65 00 d0 d0 d0 d0&#160; Steve Horne.....    <br />0bd3f000&#160; ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??&#160; ????????????????    <br />0bd3f010&#160; ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??&#160; ????????????????</p>  <p>This was corrupting the heap after the _strdup allocation – unless you turn on the wonderful page-heap which book-ends the allocation with non-writable memory so the overwrite faults.</p>  <p>The second bug, or issue is the catch(…) filter used with the /Eha compiler option. This allows the catch(…) to catch all SEH exceptions, completely hiding the AV from procdump or any other tool trying to trap unhandled exceptions. I’m not positive why this was done, but my suspicion is that they couldn’t figure out why this code kept crashing and just added the catch for SEH exceptions to keep the process up. Not a good idea. It’s far, far, far better to have you app crash and fix that crash than to mask a heap corrupting bug. </p>  <p>Heap corruption is an insidious evil. When you finally do get a crash or hang due to a heap corruption, it’s impossible to look back in time and find the cause of the heap corruption – even if you are able to figure out that your issue is actually caused by heap corruption.&#160; Whatever code corrupted the heap is long past executed and not in any current stack frames. Page-heap can easily help you track down these types of buffer over-run issues – but not if you hide the exceptions from the debugging tools!</p>  <p>This repro requires an older CRT –&#160; VS 2010 was the version being used here. Later versions of the CRT do not reproduce this buffer overwrite due to changes in the CRT implementation.</p>]]></content:encoded>
    </item>
    <item>
      <title>Enumerating all Modules in a Managed Process</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/enumerating-all-modules-in-a-managed-process</link>
      <pubDate>Wed, 16 Dec 2015 18:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Steve Horne]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/12/16/enumerating-all-modules-in-a-managed-process/</guid>
      <description><![CDATA[I recently helped a developer that needed to enumerate all of the modules in an arbitrary...]]></description>
      <content:encoded><![CDATA[<div class="WordSection1">   <p class="MsoNormal" style="line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">I recently helped a developer that needed to enumerate all of the modules in an arbitrary process. They are given a Process ID (PID) and need to enumerate all of the modules, both native and managed that have been loaded by the process.       <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />They started by creating a <span class="SpellE"><span class="GramE">System.Diagnostics.Process</span></span> object for the given PID with <span class="SpellE">Process.GetProcessById</span>. With the managed process <span class="GramE">object</span> they were then able to get a collection of loaded modules with the Modules property. All well and good but they discovered that not all managed assemblies that are loaded in the process are included in the collection returned by the Modules property.        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />This is actually expected behavior for framework versions 4 and above. The <a href="https://msdn.microsoft.com/en-us/library/ee941656(VS.100).aspx">.NET Framework 4 Migration Issues</a> article in the section 'Assembly loading' describes this. It was an optimization created such that <span class="SpellE">LoadLibrary</span> is not used for managed assembly loading -- The <span class="SpellE">MapViewOfFile</span> Win32 <span class="SpellE">api</span> is used instead. An effect of this is that the windows loader does not see these module loads and <span class="SpellE">Process.Modules</span>, or native <span class="SpellE">api</span> that enumerate loaded modules via the Process Environment Block (PEB) are not aware of the assemblies.        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />We had looked at various resolutions to this problem -- attaching a managed debugger was considered. This would allow the enumeration of <span class="SpellE">AppDomains</span> and their assemblies which would give a list of all managed assemblies. This was rejected primarily because it would prevent debugging of the application after the managed debugger was attached.         <br clear="all" />        <br clear="all" />The developer had also started investigating some undocumented ways of finding all file handles in the process and matching those with file names. <span class="SpellE">SysInternals</span> seems to use this method for some of their tools if you are interested in searching for that resolution. CSS cannot recommend or investigate solutions that use undocumented <span class="SpellE">api -- t</span>hese are subject to change at any time so it's a dangerous path.        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />A managed profiler would also be a way to capture managed module loads -- but that would require the profiler to be loaded in every managed process which was not a viable solution for this developer either.        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />Lee Culver suggested his excellent Microsoft Diagnostics Runtime (ClrMD) package as a way to accomplish this goal.        <br clear="all" />        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">ClrMD is an open source project on GitHub:       <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />&#160;&#160;&#160;&#160; <a href="https://github.com/Microsoft/clrmd">https://github.com/Microsoft/clrmd</a>        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />It's also available as a <span class="SpellE">NuGet</span> package:        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />&#160;&#160;&#160; <a href="www.nuget.org/packages/Microsoft.Diagnostics.Runtime/0.8.31-beta">www.nuget.org/packages/Microsoft.Diagnostics.Runtime/0.8.31-beta</a>        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />This is still not officially released so when you search for it in the Visual Studio package manager, make sure you select the 'Include prerelease' checkbox so it can be found.        <br clear="all" /></span><span style="font-size: 9pt; font-family: &#39;Arial&#39;,sans-serif; color: black; mso-fareast-font-family: &#39;Times New Roman&#39;">       <br clear="all" />Here is a simple console app which uses <span class="SpellE">ClrMD</span> to enumerate the assemblies in an instance of Visual Studio. Add this code to a Wizard generated C# console app that has the <span class="SpellE">ClrMD</span> <span class="SpellE">NuGet</span> package added to the solution (Project menu, Manage <span class="SpellE">NuGet</span> Packages...).</span></p>    <pre class="brush: csharp; smart-tabs: false;">using System;
using System.Linq;
using System.Diagnostics;
using Microsoft.Diagnostics.Runtime;

/*
 This requires the Microsoft.Diagnostics.Runtime NuGet package (which 
 is marked pre-release, so it won't show up unless you check that box
 in NuGet).
*/<br clear="all" />
class Program
{
    static void Main(string[] args)
    {
        string processName = &quot;devenv&quot;;
        int pid = Process.GetProcessesByName(processName).First().Id;

        /*
         The key here is to use the Passive attach flag.This will &quot;attach&quot; to
         the process by using OpenProcess / ReadProcessMemory but it does not 
         attach a debugger to it or pause the process in any way.
        */
        DataTarget dt;
        using (dt = DataTarget.AttachToProcess(pid, 5000, AttachFlag.Passive))
        {
            /*
             To see native module list, use dt.EnumerateModules.However, this
             is NOT what the customer was looking for, since it has the same 
             problem they report. Instead we will request the managed module 
             list from the runtime object.
            */

            // First, loop through each Clr in the process (there may be 
            // multiple in the side-by-side scenario).
            foreach (ClrInfo clrVersion in dt.ClrVersions)
            {
                ClrRuntime runtime = clrVersion.CreateRuntime();
                foreach (ClrModule module in runtime.Modules)
                {
                    if (module.IsFile)
                        Console.WriteLine(module.FileName);
                }

                /*
                 Note that ClrMD builds state in caches with every API call.
                 Since the process is live and constantly changing this means 
                 subsequent calls to ClrRuntime.Modules will get the same  
                 data back over and over. Instead you need to call 
                 ‘ClrRuntime.Flush’ if your reuse the runtime object to check 
                 the module list repeatedly:
                */

                /*
                 Uncomment this if you ever loop through ClrRuntime.Modules
                 again, expecting updated results.
                */
                // runtime.Flush();
            }
        }
    }
}</pre>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Migration from VS2012 to VS2015 IDE only  throws compiler upgrade warning</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/migration-from-vs2012-to-vs2015-ide-only-throws-compiler-upgrade-warning</link>
      <pubDate>Sun, 13 Dec 2015 03:55:02 GMT</pubDate>
      <dc:creator><![CDATA[Nitish Nagpal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/12/13/migration-from-vs2012-to-vs2015-ide-only-throws-compiler-upgrade-warning/</guid>
      <description><![CDATA[Irfan Ahmed, Senior Support Escalation(Languages EMEA team) brings to us this amazing write up in...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><strong>Irfan Ahmed, Senior Support Escalation(Languages EMEA team)</strong> brings to us this amazing write up in his own words. Read on!!</span></p>
<p>&nbsp;<span style="font-size: small;">While work on an issue; I came across a requirement where customer is migrating his project from VS2012 IDE to VS2015 IDE. Currently they are migrating only IDE of the project where they are still using the old compiler. There was a reason behind this. Let's don't go into that part.</span><span style="font-size: small;">This brings a problem. Whenever a developer opens a the solution file, it throws a&nbsp; dialog warning "Update VC++ Compiler and Libraries" about the old compiler settings and ask you to upgrade. Screen Shot below. </span><span style="font-size: small;">Looks familiar?</span></p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/8206.a.png" original-url="blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/8206.a.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/8206.a.png" original-url="blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/8206.a.png" alt="" border="0" /></a></p>
<p><span style="font-size: small;">Its fine till the time you are choosing the right option of not upgrading to newer compiler but there are many developers working on the same project, there are chances that a developer migrate the compiler settings and checking in the source safe as well. This cause a bigger problem when all the developers will do get latest and get a copy where </span><span style="font-size: small;">compiler setting is also updated and developers start getting different errors.</span></p>
<p><span style="font-size: small;">&nbsp;Now the solution part. To make sure that developers doesn&rsquo;t get the warning every time open the solution, make the following changes in the project file.</span></p>
<p><span style="font-size: small;">&nbsp;&nbsp;&lt;PropertyGroup Label="Globals"&gt;</span></p>
<p>&nbsp;&nbsp;&nbsp;<br /><span style="font-size: small;">&lt;ProjectGuid&gt;{75254B93-8568-4DE7-81F0-A67FBD62FDA7}&lt;/ProjectGuid&gt;</span></p>
<p>&nbsp;&nbsp;&nbsp;<br /><span style="font-size: small;">&lt;Keyword&gt;Win32Proj&lt;/Keyword&gt;</span></p>
<p>&nbsp;&nbsp;&nbsp;<br /><span style="font-size: small;">&lt;RootNamespace&gt;UserGPOInfo&lt;/RootNamespace&gt;</span></p>
<p><span style="color: #000000; font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="background-color: #ffff00;">VCProjectUpgraderObjectName&gt;NoUpgrade&lt;/VCProjectUpgraderObjectName&gt;</span></span></p>
<p>&nbsp;<br /><span style="font-size: small;">&lt;/PropertyGroup&gt;</span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;"><strong>Note: </strong>Please remove the above property once you are ready to migrate to new compiler.</span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;"><strong>Alternative approach ( Not recommended)</strong></span></p>
<p><span style="font-size: small;">There is no project bases setting saved in the registry key and shouldn&rsquo;t be. We need to make sure that any settings or change should be on solution/project bases. Having said that, I noticed that warning only comes when you first open the project in VS2015. Once you press OK or cancel, it saves it and don&rsquo;t prompt warning again when you reopen the</span><br /><span style="font-size: small;">project in VS2015. Internally, it creates a .VS folder which is hidden. This folder does have a project corresponding .suo file which contains this information. To avoid repetitive work of cancelling the warning, you can save the .VS folder for solution/project. It will be a one time job and keeping this folder in the solution file folder and save it to your source safe, will not throw you compiler warning again.</span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;">Hope the above post will be helpful.</span></p>
<p>&nbsp;</p>
<p><strong><span style="font-size: small;">Written and approved by: Irfan Ahmed, Senior Support Escalation Engineer</span></strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Debugging an intermittent freeze issue in a winforms application, managed memory leak detection using SOS: Methodology and Approach</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/debugging-an-intermittent-freeze-issue-in-a-winforms-application-managed-memory-leak-detection-using-sos-methodology-and-approach</link>
      <pubDate>Mon, 16 Nov 2015 07:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Nandeesh Swami]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/11/16/debugging-an-intermittent-freeze-issue-in-a-winforms-application-managed-memory-leak-detection-using-sos-methodology-and-approach/</guid>
      <description><![CDATA[Hello, I am back to my old habits of blogging about some interesting things that we do. So recently...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: 'times new roman', times; font-size: small;">Hello, I am back to my old habits of blogging about some interesting things that we do. So recently we were approached </span><span style="font-family: 'times new roman', times; font-size: small;">by one of our important partners<span class="apple-converted-space">&nbsp;</span>regarding a Freeze in their Winforms application which was 'intermittent'. This freeze </span><span style="font-family: 'times new roman', times; font-size: small;">or hang per say was accompanied with the below exception,&nbsp;</span></p>
<pre style="margin: 6pt;"><span style="font-family: 'times new roman', times; font-size: small;">Exception: System.ComponentModel.Win32Exception<br />Message: Error creating window handle.</span>&nbsp;</pre>
<p><span style="font-family: 'times new roman', times; font-size: small;">It was pretty evident from the error message that we are unable to create handles and one other aspect of the issue was that&nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">we really had high no of<span class="apple-converted-space">&nbsp;</span>objects in the Task manager. An important point to note here is that we do not see a crash in the</span><br /><span style="font-family: 'times new roman', times; font-size: small;"> application. To make sure we have the right data,<span class="apple-converted-space">&nbsp;</span>I had to capture a first chance exception dump on Win32Exception. </span><span style="font-family: 'times new roman', times; font-size: small;">For more information on First chance exception please<span class="apple-converted-space">&nbsp;</span>read the&nbsp;<span style="text-decoration: underline;"><a href="https://blogs.msdn.com/b/carmelop/archive/2012/11/06/first-chance-exception-vs-second-chance-exception.aspx">Blog</a></span>. There are loads of tools you could use to capture this&nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">dump, DebugDiag is an user friendly UI tool which helps you fiddle around with<span class="apple-converted-space">&nbsp;</span>exception names. Considering the issue to&nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">be intermittent Debugdiag is an ideal tool in this scenario as all we have to do is to set up a rule and DebugDiag will take &nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">care of the rest. While the DebugDiag UI is pretty straight forward , Once you open DebugDiag , Click on Add Rule-&gt;Crash</span><span style="font-family: 'times new roman', times; font-size: small;">-&gt;Click Next-&gt;<span class="apple-converted-space">&nbsp;</span>A Specific Process(This feature to be used for exes)-&gt;Now Select the process (from the process list or write the&nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">Application name if it is not running)-&gt; Click Next . On this windows I would add specific actions considering I want a first&nbsp;</span><span style="font-family: 'times new roman', times; font-size: small;">chance dump for a particular exception. Now click on Exceptions-&gt;Add Exception. Further Select E0434352 and add the </span><span style="font-family: 'times new roman', times; font-size: small;">corresponding details as shown below.</span></p>
<p><span style="font-family: 'times new roman', times; font-size: small;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/2110.blog1.png" original-url="blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/2110.blog1.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/2110.blog1.png" original-url="blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/2110.blog1.png" alt="" border="0" /></a></span></p>
<p><span style="font-family: 'times new roman', times; font-size: small;">After all the above steps , it is important to<span class="apple-converted-space">&nbsp;</span><strong>RESTART YOUR&nbsp;APPLICATION.</strong>&nbsp;</span></p>
<p><span style="font-size: small; font-family: 'times new roman', times;"> Well after the above steps we did receive the dump file and here is how we nailed down the issue. Excerpts from analysis below.&nbsp;I believe windbg is a&nbsp;powerful&nbsp;debugger and I prefer to use it, any other debugger can be used to debug the dumps. Visual Studio&nbsp;has many inbuilt feature for memory analysis , a very handy tool to be used in High memory scenarios.</span></p>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !pe</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">Exception object: 024c96bc</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">Exception type: System.ComponentModel.Win32Exception</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">Message: Error creating window handle.</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">InnerException: &lt;none&gt;</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">StackTrace (generated):</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> SP IP Function</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DED08 6692CF75 System_Windows_Forms_ni!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams)+0x2c5</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DED80 6692CBA5 System_Windows_Forms_ni!System.Windows.Forms.Control.CreateHandle()+0x115</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEDDC 6692E9FC System_Windows_Forms_ni!System.Windows.Forms.Control.get_Handle()+0x4c</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEDEC 668DB724 System_Windows_Forms_ni!System.Windows.Forms.Control.CreateGraphicsInternal()+0x8</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEDF4 67090D38 System_Windows_Forms_ni!System.Windows.Forms.ThreadExceptionDialog..ctor(System.Exception)+0x800</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEEF8 66E8EA1E System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.OnThreadException(System.Exception)+0xb6</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEF34 66E7A782 System_Windows_Forms_ni!System.Windows.Forms.Control.WndProcException(System.Exception)+0x16</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEF40 66E7BA6A System_Windows_Forms_ni!System.Windows.Forms.Control+ControlNativeWindow.OnThreadException(System.Exception)+0xa</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DEF44 6692E18B System_Windows_Forms_ni!System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)+0x9b</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 00000000 00000001 System_Windows_Forms_ni!System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)+0x2</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DF1E0 6693DCA1 System_Windows_Forms_ni!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)+0x24d</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DF26C 6693D921 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)+0x155</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DF2BC 6693D792 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)+0x4a</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DF2E8 668E14BD System_Windows_Forms_ni!System.Windows.Forms.Application.Run(System.Windows.Forms.Form)+0x31</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001DF2FC 00414203 Example1!Example1.Program.Main(System.String[])+0x143</span><br /> <br /><span style="font-family: 'times new roman', times; font-size: small;">The above exception is triggered, we have to find our which user objects are being used that lead to this. <br />Although the nature of the objects occupying memory may vary , we have to understand that&nbsp;we should <br />only be worried about UI objects </span><span style="font-family: 'times new roman', times; font-size: small;">precisely which would make the application </span><span style="font-family: 'times new roman', times; font-size: small;">throw such an error, namely <br />Dialogs, Windows, timers, Ui controls etc. We will use a command !address -summary to find out which <br />objects occupy what amount of memory.</span></pre>
<pre><strong><span style="font-family: 'courier new', courier; font-size: x-small;">MT Count Size Class Name</span></strong><br /><span style="font-family: 'courier new', courier; font-size: x-small;">66974944 619 9904 System.Windows.Forms.PropertyStore+SizeWrapper</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">68097098 226 9944 System.Reflection.Emit.OpCode</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">66975558 242 10344 System.Windows.Forms.PropertyStore+IntegerEntry[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680ccfc8 6 10952 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.String, mscorlib]][]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6ab68ea0 463 20372 System.Drawing.Font</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">004298e4 588 21168 QSYS.MSG.MessageText</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680d8b40 898 21552 System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">67589644 229 28396 System.ComponentModel.ReflectPropertyDescriptor</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6808ef70 521 29176 System.Reflection.RuntimePropertyInfo</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6758749c 1525 30500 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">669749f8 591 30732 System.Windows.Forms.CreateParams</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dd288 598 31096 System.Collections.Hashtable</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680db970 82 32140 System.Char[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6a975f6c 584 32704 System.Configuration.ConfigurationProperty</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">669743e0 592 33152 System.Windows.Forms.Control+ControlNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">08e31cc4 355 39760 com.ibsag.qsys.svr.system.XDQSFormItem</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dc738 335 42496 System.Int32[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6697497c 602 51124 System.Windows.Forms.PropertyStore+ObjectEntry[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">08e32b80 5 56100 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[QSYS.WindowsControls.BL.LayoutTranslationEngine+LayoutItem, QSYS_WindowsControls]][]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680cee64 838 56984 System.Reflection.RuntimeParameterInfo</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680d7618 1338 58872 System.Signature</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">00b02918 348 64032 QSYS.WindowsControls.IBSControls.Button</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680d8ce0 5899 70788 System.WeakReference</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680db350 6080 72960 System.Object</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dae80 599 76224 System.Collections.Hashtable+bucket[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680d7940 1529 91740 System.Reflection.RuntimeMethodInfo</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6697476c 1 101040 System.Windows.Forms.NativeWindow+HandleBucket[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dc168 5157 144396 System.RuntimeType</span><br /><span style="font-family: 'courier new', courier; font-size: x-small; background-color: #ffff00;">66975130 5110 163520 System.Windows.Forms.NativeMethods+WndProc</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680d08a0 5535 177120 System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small; background-color: #ffff00;"><span style="background-color: #339966;">66961308 </span> 4976 238848 System.Windows.Forms.Timer</span><br /><span style="font-family: 'courier new', courier; font-size: x-small; background-color: #ffff00;">6696306c 4970 258440 System.Windows.Forms.Timer+TimerNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6808ae88 5854 369200 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">004bbc98 15 565718 Free</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dafb0 14211 911970 System.String</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">680dd244 501 958102 System.Byte[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">6808e948 94719 3031008 System.Globalization.DaylightTime</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">Total 192318 objects</span><span style="font-family: 'Times New Roman', serif; font-size: small;"><br /></span></pre>
<pre><span style="font-size: small;"><span style="font-family: 'Times New Roman', serif;">Based on the above summary it is very clear that for now we will have to ignore System.String objects and <br />concentrate on </span><span style="font-family: 'Times New Roman', serif;">these UI objects. Having known the highlighted objects occupy a fair amount of memory <br />we can look into our code to see </span><span style="font-family: 'Times New Roman', serif;">where we use these objects and see if we are leaking memory somewhere. <br />We can further debug in the memory dumps to </span><span style="font-family: 'Times New Roman', serif;">find out the exact roots of&nbsp;these objects and track them<br />accordingly, So I set out to find out the roots for alacrity to our </span><span style="font-family: 'Times New Roman', serif;">customer as to where exactly does he have<br />to look into. I would dump the objects using !dumpheap -mt Methodtable to </span><span style="font-family: 'Times New Roman', serif;">dump the below info.</span></span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">02423764 </span><span style="background-color: #339966;">66961308 </span><span style="font-family: 'courier new', courier; font-size: x-small;"> 48 <br /></span><span style="font-family: 'courier new', courier; font-size: x-small;">02423a54 66961308 48 </span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: xx-small;">.</span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">.<br />02425dac 66961308 48 </span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">02426144 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024261e0 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242627c 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: xx-small;">.<br /></span>.<br /><span style="font-family: 'courier new', courier; font-size: x-small;">02426f44 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02426fe0 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242707c 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02427118 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02428938 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">.</span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">.</span></pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">0242baa0 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242bb3c 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242bbf8 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242bc94 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242bd50 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c118 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c224 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c2c0 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c35c 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c3f8 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c4b4 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c550 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c764 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c82c 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242c9c4 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0242cab4 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02434f28 66961308 48 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"><span style="background-color: #00ff00;">02435010</span> 66961308 48 </span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Statistics:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> MT Count TotalSize Class Name</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">66961308 4976 238848 System.Windows.Forms.Timer</span><br /><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot -nostacks <span style="background-color: #00ff00;">02435010</span></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02353720 System.Windows.Forms.Timer</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 SPCInsp.MainFormSPCInsp</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0217de18 SPCInsp.LoginCenter</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02434fe4 SPCInsp.AutoPnrHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02435010 System.Windows.Forms.Timer</span></pre>
<pre style="margin-top: 6.0pt; margin-right: 6.0pt; margin-bottom: 6.0pt; margin-left: 0in;"><span style="font-size: small;"><span style="font-family: 'Times New Roman', serif;">You can observe that we have found the roots at <span style="background: lime;">02435010</span>. I can confirm that most of the other roots were very <br />synonymous. </span><span style="font-family: 'Times New Roman', serif;">Further we should look at the other type of objects from what we had yellow marked from <br />!address -Summary, let&rsquo;s look </span><span style="font-family: 'Times New Roman', serif;">at the other object in a similar way.</span></span>&nbsp;</pre>
<pre><span style="font-family: 'courier new', courier; font-size: x-small;">024388b4 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: xx-small;">.<br /></span>.<br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448874 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448a3c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448a5c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448a7c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448ad8 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448b34 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448b90 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448be4 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448c40 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">02448c60 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">.<br />.<br />024c6500 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6520 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6540 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6560 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6580 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c65dc 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6610 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6630 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c6650 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c66ac 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c66cc 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c66ec 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c670c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c672c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c674c 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c67a8 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c70f0 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7110 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7130 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7150 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7170 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7288 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c72a8 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c72c8 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c72e8 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7308 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7328 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">024c7348 66975130 32 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"><span style="background-color: #00ffff;">024c7368</span> 66975130 32 </span><br /><br /><span style="font-family: 'times new roman', times; font-size: small;">Randomly dumping the objects with roots,<br /></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot -nostacks <span style="background-color: #00ffff;">024c7368 </span></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; <strong>02353720 System.Windows.Forms.Timer</strong></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 Example1.MainFormExample1</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02435378 Example2.WindowsControls.Controls.Capturing.Inspections.Inspections</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024356dc System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c8ec System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02446224 Example2.WindowsControls.Example3.ComboBox</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024463d4 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487ab8 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487aa4 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a90 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a7c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a68 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a54 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024484d4 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02448124 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248abbc System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248ab8c System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02448104 System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02444bf4 Example2.WindowsControls.Controls.Capturing.AcquisitionControl.SearchPage</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02445008 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a40 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a2c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a18 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02487a04 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024879f0 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024491d8 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cb554 System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cb534 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024491b8 System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0244463c Example2.WindowsControls.Controls.Capturing.AcquisitionControl.Acquisition</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024448ec System.Windows.Forms.Control+ControlNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024c7368 System.Windows.Forms.NativeMethods+WndProc</span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Found 1 unique roots (run '!GCRoot -all' to see all roots).</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot -nostacks 024c5de0 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; <strong>02353720 System.Windows.Forms.Timer</strong></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 Example1.MainFormExample1</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02435378 Example2.WindowsControls.Controls.Capturing.Inspections.Inspections</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024c5c28 System.Windows.Forms.LayoutEventArgs</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02482048 Infragistics.Win.UltraWinTabControl.UltraTabControl</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489f2c Infragistics.Win.UltraWinTabControl.UltraTabsCollection</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489fac System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489fc4 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0243570c Infragistics.Win.UltraWinTabControl.UltraTab</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024358e0 Infragistics.Win.UltraWinTabControl.UltraTabPageControl</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024c5da4 Infragistics.Win.UIAutomation.UiaProviderControlNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024c5de0 System.Windows.Forms.NativeMethods+WndProc</span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Found 1 unique roots (run '!GCRoot -all' to see all roots).</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot -nostacks 02483e7c </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; <strong>02353720 System.Windows.Forms.Timer</strong></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 Example1.MainFormExample1</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02435378 Example2.WindowsControls.Controls.Capturing.Inspections.Inspections</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024356dc System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c8ec System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02477260 Example2.WindowsControls.Example3.ComboBox</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02477410 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489638 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489624 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489610 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895fc System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895e8 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895d4 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479510 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479160 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c2bc System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c28c System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479140 System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02475c50 Example2.WindowsControls.Controls.Capturing.AcquisitionControl.SearchPage</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02476064 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895c0 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895ac System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489598 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489584 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489570 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247a178 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cc60c System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cc5ec System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247a158 System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02475698 Example2.WindowsControls.Controls.Capturing.AcquisitionControl.Acquisition</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02475a4c System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024894e4 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024894d0 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024894bc System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024894a8 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489494 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02481638 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cc58c System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024cc574 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02481618 System.Windows.Forms.MouseEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02471e64 Example2.WindowsControls.Controls.Capturing.MontageCapturing.MontageCapturing</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024721b4 System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02481848 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247af90 Example2.WindowsControls.Example3.InfraTextEditor</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247b924 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489b9c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489b88 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489b74 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02483d6c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247fbb0 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247fb7c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247fb48 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247f480 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247f40c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247bb60 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247b95c System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247b948 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247f440 System.Windows.Forms.ControlEventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247a8bc Example2.WindowsControls.Controls.Capturing.MontageCapturing.MontageEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02486000 System.Windows.Forms.LayoutEventArgs</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247aca8 Example2.WindowsControls.Example3.GroupBox</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02485ff0 System.Windows.Forms.LayoutEventArgs</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247adc8 Example2.WindowsControls.Example3.TableLayoutPanel</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247ae84 System.Windows.Forms.PropertyStore</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02481170 System.Windows.Forms.PropertyStore+ObjectEntry[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247ee28 System.Windows.Forms.Layout.TableLayout+ContainerInfo</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247ff68 System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247f044 System.Windows.Forms.Layout.TableLayout+LayoutInfo</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0247c1dc Example2.WindowsControls.Example3.InfraTextEditor</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02483e40 Infragistics.Win.UltraWinEditors.TextEditorControlBase+TextEditorControlBaseNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02483e7c System.Windows.Forms.NativeMethods+WndProc</span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Found 1 unique roots (run '!GCRoot -all' to see all roots).</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot -nostacks 02479c60 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt;<strong> 02353720 System.Windows.Forms.Timer</strong></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 Example1.MainFormExample1</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02435378 Example2.WindowsControls.Controls.Capturing.Inspections.Inspections</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024356dc System.Collections.ArrayList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c8ec System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02477260 Example2.WindowsControls.Example3.ComboBox</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02477410 System.ComponentModel.EventHandlerList</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489638 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489624 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02489610 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895fc System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895e8 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 024895d4 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479510 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479160 System.ComponentModel.EventHandlerList+ListEntry</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c2bc System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0248c28c System.Object[]</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479140 System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02475c50 Example2.WindowsControls.Controls.Capturing.AcquisitionControl.SearchPage</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02476abc Infragistics.Win.UltraWinEditors.UltraOptionSet</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02476bd4 System.Windows.Forms.Control+ControlNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 02479c60 System.Windows.Forms.NativeMethods+WndProc</span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Found 1 unique roots (run '!GCRoot -all' to see all roots).</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">0:000&gt; !gcroot 0242d0d0 </span><br /><span style="font-family: 'courier new', courier; font-size: x-small;">HandleTable:</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> 001f1130 (strong handle)</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt;<strong> 02353720 System.Windows.Forms.Timer</strong></span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0235375c System.EventHandler</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0205d524 Example1.MainFormExample1</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0242cbd0 Infragistics.Win.UltraWinTabControl.UltraTab</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0242ce2c Infragistics.Win.UltraWinTabControl.UltraTabPageControl</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0242d094 Infragistics.Win.UIAutomation.UiaProviderControlNativeWindow</span><br /><span style="font-family: 'courier new', courier; font-size: x-small;"> -&gt; 0242d0d0 System.Windows.Forms.NativeMethods+WndProc</span><br /> <br /><span style="font-family: 'courier new', courier; font-size: x-small;">Found 1 unique roots (run '!GCRoot -all' to see all roots).</span></pre>
<div>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: 'times new roman', times;">With all the above objects our customer had handful objects to look at , what we eventually found out is that&nbsp;the timer object was&nbsp;created multiple times, even if it already existed . The timer was not stopped, and the tick event not unsubscribed, so here was&nbsp;the problem. They eventually made sure that timer object was created only once. Post this change we observed that there was<span class="apple-converted-space">&nbsp;</span>no problem with the memory and there was no freeze.</span><span style="font-family: 'times new roman', times;"><br /></span></span><span style="font-size: small; font-family: 'times new roman', times;"> <br /> Keep Coding!<br /> Nandeesh Swami</span></p>
</div>
<p class="MsoNormal">&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Creating user-mode crash dumps on production machine</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/creating-user-mode-crash-dumps-on-production-machine</link>
      <pubDate>Mon, 18 May 2015 23:48:55 GMT</pubDate>
      <dc:creator><![CDATA[Nitish Nagpal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/05/18/creating-user-mode-crash-dumps-on-production-machine/</guid>
      <description><![CDATA[Prabhat Tandon, Support Escalation Engineer, brings this amazing write up summarising his experience...]]></description>
      <content:encoded><![CDATA[<p><strong>Prabhat Tandon, Support Escalation Engineer,</strong> brings this amazing write up summarising his experience while working with one of his customers.</p>
<p>Recently I was troubleshooting an intermittent, hard to reproduce application crash in the production environment. We had a restriction to install debuggers. In such situation, Windows Error Reporting (WER) comes as a handy tool. Here are the settings that we need:</p>
<p>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\ManagedCorruption.exe]</p>
<p>"<strong>DumpFolder</strong>"= REG_EXPAND_SZ: C:\WERDumps</p>
<p>"DumpCount"=dword:00000005</p>
<p>"DumpType"=dword:00000002</p>
<p>Here you need to replace the &lsquo;ManagedCorruption&rsquo; with your executable. You can also change the path C:\WERDumps as per your preference.</p>
<p>We made the necessary entries on customer&rsquo;s machine, but the dumps were not created when the application crashed. The same settings were working fine on other machines, but not on the production machine. What do we do now?</p>
<p>On further research we found that &ldquo;Windows Error Reporting Service&rdquo; was disabled on the machine.</p>
<p>Here is how you can verify:</p>
<ol>
<li>Start-&gt;Run-&gt;services.msc</li>
<li>Select &ldquo;Windows Error Reporting Service&rdquo;.</li>
<li>Set its startup type to &ldquo;Manual (Trigger Start)&rdquo; :&nbsp;</li>
</ol>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/0447.p1.png" original-url="blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/0447.p1.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/0447.p1.png" original-url="blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/0447.p1.png" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/6433.p2.png" original-url="blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/6433.p2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/6433.p2.png" original-url="blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/6433.p2.png" alt="" border="0" /></a></p>
<p>Once we enabled the service, the dumps were collected successfully.</p>
<p>This is particularly very useful in situations like Fatal Execution Engine error where the application doesn&rsquo;t throw exceptions. So make sure that &ldquo;Windows Error Reporting Service&rdquo; is enabled on the machine.</p>
<p>&nbsp;</p>
<p>Here is the MSDN article which speaks about <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181.aspx">Collecting User-Mode Dumps</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Issues while migration of website from .Net Framework 3.5 to .Net Framework 4.0 with Web Server on .Net Framework 4.5</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/issues-while-migration-of-website-from-net-framework-3-5-to-net-framework-4-0-with-web-server-on-net-framework-4-5</link>
      <pubDate>Mon, 18 May 2015 23:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Nitish Nagpal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/05/18/issues-while-migration-of-website-from-net-framework-3-5-to-net-framework-4-0-with-web-server-on-net-framework-4-5/</guid>
      <description><![CDATA[Irfan Ahmed, Senior Support Escalation Engineer, brings to us another solution to a unique problem,...]]></description>
      <content:encoded><![CDATA[<p><strong>Irfan Ahmed, Senior Support Escalation Engineer, brings to us another solution to a unique problem, while working with one of his customers.</strong></p>
<p>I have come across this issue where customer has migrated his website from .NET Framework 3.5 to .NET Framework 4.0 and the Web server has .NET Framework 4.5. 1 installed. The web application faces intermittently hangs. During our troubleshooting and different dump analysis we found that the process is hung due to a deadlock scenario between two threads.&nbsp;</p>
<p>Dump analysis on the Hang dump taken</p>
<p><strong>&nbsp;0:046&gt; kL</strong>&nbsp;</p>
<p># ChildEBP RetAddr&nbsp;</p>
<p>00 01d1ef70 77928e44 ntdll!ZwWaitForSingleObject</p>
<p>01 01d1efd4 77928d28 ntdll!RtlpWaitOnCriticalSection</p>
<p>02 01d1effc 7405bf8f ntdll!RtlEnterCriticalSection</p>
<p>03 (Inline) -------- clr!UnsafeEnterCriticalSection</p>
<p><strong><span style="background-color: #ffff00;">04 01d1f010 73fb3b2f clr!CrstBase::SpinEnter</span></strong></p>
<p>05 01d1f030 740a7337 clr!CrstBase::Enter</p>
<p>06 (Inline) -------- clr!CrstBase::AcquireLock</p>
<p>07 (Inline) -------- clr!CrstBase::CrstHolder::{ctor</p>
<p>08 01d1f0d0 73fd4a5b clr!ClassLoader::LoadTypeHandleForTypeKey_Body</p>
<p>09 01d1f114 73fd56ca clr!ClassLoader::LoadTypeHandleForTypeKey</p>
<p>0a 01d1f19c 73fd1ca7 clr!ClassLoader::LoadTypeDefThrowing</p>
<p>0b 01d1f210 73fc23a2 clr!ClassLoader::LoadTypeDefOrRefThrowing</p>
<p>0c 01d1f2c8 73fc599b clr!SigPointer::GetTypeHandleThrowing</p>
<p>0d 01d1f3a4 73fd2f90 clr!SigPointer::GetTypeHandleThrowing</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0e 01d1f3e4 73fffd83 clr!ClassLoader::LoadTypeDefOrRefOrSpecThrowing</p>
<p><strong>&nbsp;0:046&gt; .frame 0n4;dv /t /v</strong></p>
<p>04 01d1f010 73fb3b2f clr!CrstBase::SpinEnter&nbsp;&nbsp;</p>
<p>@esi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class CrstBase * this = 0x1ebff438</p>
<p>@ebx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long iter = 0xa</p>
<p>@edi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long i = 0</p>
<p>&lt;unavailable&gt;&nbsp;&nbsp;&nbsp;&nbsp; int delayCount = &lt;value unavailable&gt;</p>
<p>&nbsp;</p>
<p>0:046&gt; dt _RTL_CRITICAL_SECTION&nbsp; 0x1ebff438</p>
<p>w3wp!_RTL_CRITICAL_SECTION</p>
<p>&nbsp;&nbsp; +0x000 DebugInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0x1ec36c38 _RTL_CRITICAL_SECTION_DEBUG</p>
<p>&nbsp;&nbsp; +0x004 LockCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0n-14</p>
<p>&nbsp;&nbsp; +0x008 RecursionCount&nbsp;&nbsp; : 0n1</p>
<p>&nbsp;&nbsp; +0x00c OwningThread&nbsp;&nbsp;&nbsp;&nbsp; : 0x000023d0 Void&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background-color: #ffff00;"><strong>&gt;&gt; thread 47</strong></span></p>
<p>&nbsp;&nbsp; +0x010 LockSemaphore&nbsp;&nbsp;&nbsp; : 0x00000f20 Void</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; +0x014 SpinCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0</p>
<p><strong>&nbsp;This is how 47 looks like</strong></p>
<p>0:047&gt; kL</p>
<p># ChildEBP RetAddr&nbsp;</p>
<p>00 1dddd3f0 77928e44 ntdll!ZwWaitForSingleObject</p>
<p>01 1dddd454 77928d28 ntdll!RtlpWaitOnCriticalSection</p>
<p>02 1dddd47c 7405bf8f ntdll!RtlEnterCriticalSection</p>
<p>03 (Inline) -------- clr!UnsafeEnterCriticalSection</p>
<p>04 1dddd490 73fb3b2f clr!CrstBase::SpinEnter</p>
<p>05 1dddd4b0 740a7337 clr!CrstBase::Enter</p>
<p>06 (Inline) -------- clr!CrstBase::AcquireLock</p>
<p>07 (Inline) -------- clr!CrstBase::CrstHolder::{ctor</p>
<p>08 1dddd550 73fd4a5b clr!ClassLoader::LoadTypeHandleForTypeKey_Body</p>
<p>09 1dddd594 73fd56ca clr!ClassLoader::LoadTypeHandleForTypeKey</p>
<p>0a 1dddd61c 73fd1ca7 clr!ClassLoader::LoadTypeDefThrowing</p>
<p>0b 1dddd690 73febfc9 clr!ClassLoader::LoadTypeDefOrRefThrowing</p>
<p>0c 1dddd6e0 73feab99 clr!ClassLoader::LoadApproxTypeThrowing</p>
<p>0d 1dddd714 73fe7ae7 clr!ClassLoader::LoadApproxParentThrowing</p>
<p>0e 1dddd8c4 73fd8330 clr!ClassLoader::CreateTypeHandleForTypeDefThrowing</p>
<p><strong>&nbsp;0:047&gt; dt this&nbsp; 0x1ecd5878</strong></p>
<p>Local var @ esi Type CrstBase*</p>
<p>&nbsp;&nbsp;+0x000 m_criticalsection : _RTL_CRITICAL_SECTION</p>
<p>&nbsp;&nbsp; +0x000 m_pHostCrst&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0x028714c8 IHostCrst</p>
<p>&nbsp;&nbsp; +0x018 m_dwFlags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0xc0000023</p>
<p>&nbsp;</p>
<p>0:047&gt; dt _RTL_CRITICAL_SECTION&nbsp; 0x1ecd5878</p>
<p>w3wp!_RTL_CRITICAL_SECTION</p>
<p>&nbsp;&nbsp; +0x000 DebugInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0x028714c8 _RTL_CRITICAL_SECTION_DEBUG</p>
<p>&nbsp;&nbsp; +0x004 LockCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0n-10</p>
<p>&nbsp;&nbsp; +0x008 RecursionCount&nbsp;&nbsp; : 0n1</p>
<p>&nbsp;&nbsp; +0x00c OwningThread&nbsp;&nbsp;&nbsp;&nbsp; : 0x00001e20 Void&nbsp;&nbsp;&nbsp;&gt;&gt; <span style="background-color: #ffff00;"><strong>thread 46</strong></span></p>
<p>&nbsp;&nbsp; +0x010 LockSemaphore&nbsp;&nbsp;&nbsp; : 0x00000f1c Void</p>
<p>&nbsp;&nbsp; +0x014 SpinCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0</p>
<p><strong>&nbsp;One of the waiting thread</strong></p>
<p>&nbsp;0:320&gt; kM10</p>
<p># ChildEBP RetAddr&nbsp;</p>
<p>00 3fe5d690 77928e44 ntdll!ZwWaitForSingleObject</p>
<p>01 3fe5d6f4 77928d28 ntdll!RtlpWaitOnCriticalSection</p>
<p>02 3fe5d71c 7405bf8f ntdll!RtlEnterCriticalSection</p>
<p>03 (Inline) -------- clr!UnsafeEnterCriticalSection+0x7</p>
<p><span style="background-color: #ffffff;">04 3fe5d730 73fb3b2f clr!CrstBase::SpinEnter</span></p>
<p>05 3fe5d754 73fc7e99 clr!CrstBase::Enter</p>
<p><span style="background-color: #ffff00;"><strong>06 (Inline) -------- clr!ListLockEntry::FinishDeadlockAwareEnter</strong></span></p>
<p>07 3fe5d784 73fe38a5 clr!ListLockEntry::LockHolder::DeadlockAwareAcquire</p>
<p>08 3fe5d85c 73ff1ebe clr!MethodDesc::MakeJitWorker</p>
<p>09 3fe5d8d0 73fc50f6 clr!MethodDesc::DoPrestub</p>
<p>0a 3fe5d938 73fb42b9 clr!PreStubWorker</p>
<p>0b 3fe5d968 23b36012 clr!ThePreStub</p>
<p>This has been found as bug and has been fixed in the latest release of CLR. The other work around for .NET 4.0 , 4.5.1 and 4.5.2 is to disable&nbsp;<strong>profileGuidedOptimizations</strong>. This is a new feature added in .NET 4.5. this workaround may add fractional increase in the startup time.</p>
<p><strong>Written by: Irfan Ahmed, Senior Support Escalation Engineer, EMEA/INDIA Team</strong></p>
<p><strong>Reviewed by: Rachan Rosario, Escalation Engineer&nbsp;</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Tips on troubleshooting Visual Studio Performance issues</title>
      <link>https://docs.microsoft.com/archive/blogs/dsvc/tips-on-troubleshooting-visual-studio-performance-issues</link>
      <pubDate>Mon, 18 May 2015 23:30:44 GMT</pubDate>
      <dc:creator><![CDATA[Nitish Nagpal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dsvc/2015/05/18/tips-on-troubleshooting-visual-studio-performance-issues/</guid>
      <description><![CDATA[Another nice write up from Senior Support Escalation Engineer, Irfan Ahmed on Visual Studio...]]></description>
      <content:encoded><![CDATA[<blockquote>
<div class="WordSection1">
<p>Another nice write up from<strong> Senior Support Escalation Engineer, Irfan Ahmed</strong> on <strong>Visual Studio performance</strong>.</p>
<p>Visual Studio performance is always a topic in discussion. I was working on a Visual Studio performance issue recently and got to know something which I believe should be shared and hence this blog for you. Hope you will find it useful.</p>
<p>The performance problem I was troubleshooting was that the project was migrated to VS2013 Update 3 recently and it was taking minutes to find all reference of a method and caused Visual Studio to go in &ldquo;<strong>Not responding</strong>&rdquo; Mode. This solution contained 75 projects in total. In similar project sometime it takes time to move from one break point to another. This seems to be related to first part of the issue.</p>
<p>Working on this issue further, process monitor log&nbsp; showed that devenv was accessing a particular file multiple times and this is a&nbsp; pattern for multiple files in the project. Analyzing these files we found that there is&nbsp;&nbsp;<a href="https://msdn.microsoft.com/en-us/library/wbx7zzdd.aspx">partial type</a>&nbsp;defined and that is spread across a lot of files. This is by design that we keep looking into partial types for reference. With big projects and most of the files has partial type causes performance issue in Visual Studio.&nbsp;</p>
<p>The following call stack(snippet) and the process monitor log ( snippet) had observed.</p>
<p># ChildEBP RetAddr&nbsp;&nbsp;</p>
<p>00 0041bdb0 5aef6292 cslangsvc!NameTable::AddString+0x9f</p>
<p>01 (Inline) -------- cslangsvc!NameTable::AddString+0x9c</p>
<p>02 0041bdf4 5af1b8b0 cslangsvc!NameTable::AddLen+0xad</p>
<p>03 (Inline) -------- cslangsvc!NameManager::AddString+0x10</p>
<p>04 0041bed0 5af1c7b1 cslangsvc!CLexer::ScanToken+0x315</p>
<p>05 0041bf1c 5af1c473 cslangsvc!CSourceData::CTokenizer::ScanTokens+0x48</p>
<p>06 0041bfd4 5af1d51d cslangsvc!CSourceData::CTokenizer::CreateTokenStream+0x3b5</p>
<p>07 0041c0e0 5af1cd86 cslangsvc!CSourceData::CreateTokenStream+0x14d</p>
<p>08 0041c134 5af1cf4b cslangsvc!CSourceData::SetEditInformation+0x9d</p>
<p>09 0041c1ec 5af1cfcc cslangsvc!CSourceModule::ApplyEditsToSourceData+0x159</p>
<p>0a 0041c264 5b00f3ac cslangsvc!CSourceModule::GetSourceData+0xd2</p>
<p>0b 0041c2bc 5b00f311 cslangsvc!CClosedFilesCache::GetSourceSizeInBytes+0x1e</p>
<p>0c 0041c328 5b00e546 cslangsvc!CClosedFilesCache::AddOrReplace+0x96</p>
<p>0d 0041c3a4 5af29523 cslangsvc!CSourceModuleFactory::CClosedFilesCacheSourceModuleGetter::TryGetSourceModule+0x193</p>
<p>0e 0041c3e4 5af2e065 cslangsvc!CSourceModuleFactory::CreateInstance+0x77</p>
<p>0f (Inline) -------- cslangsvc!CSourceModuleFactory::CreateInstance+0x16</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/0207.image011.png" original-url="blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/0207.image011.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/40/0207.image011.png" original-url="blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-40/0207.image011.png" alt="" border="0" /></a>&nbsp;</p>
<p><strong>There are two workaround suggested to resolve this issue.</strong></p>
<ol>
<li>Leave that particular file open in VS.&nbsp; The language service caches the parse tree for files that are open in the editor, which should eliminate the reparsing that you are seeing.</li>
<li>If it is feasible (code in that project doesn&rsquo;t change often, etc), remove the project containing this project from the solution, and use a reference to its outputted metadata instead of the project itself.</li>
</ol>
<p><strong>&nbsp;Written by Irfan Ahmed, Senior Support Escalation Engineer, India/Emea Team</strong></p>
<p><strong>Reviewed by: Rachan Rosario, Escalation Engineer, Languages Team</strong></p>
<p>&nbsp;</p>
</div>
</blockquote>]]></content:encoded>
    </item>
  </channel>
</rss>