{"id":1433,"date":"2007-07-13T19:47:28","date_gmt":"2007-07-13T19:47:28","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2007\/07\/13\/kb928365-for-ms07-040-leaves-some-managed-applications-sluggish\/"},"modified":"2019-02-17T15:30:15","modified_gmt":"2019-02-17T22:30:15","slug":"kb928365-for-ms07-040-leaves-some-managed-applications-sluggish","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/kb928365-for-ms07-040-leaves-some-managed-applications-sluggish\/","title":{"rendered":"KB928365 for MS07-040 Leaves Some Managed Applications Sluggish"},"content":{"rendered":"<p>After installing <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyId=BA3CEB78-8E1B-4C38-ADFD-E8BC95AE548D\">Security Update KB928365<\/a> for the Microsoft .NET Framework 2.0 to fix <a href=\"http:\/\/www.microsoft.com\/technet\/security\/bulletin\/MS07-040.mspx\">MS07-040<\/a>, some users are noticing some managed applications &#8211; especially those developed using the Windows Presentation Framework (WPF) &#8211; are running sluggish.<\/p>\n<p>The apparent problem is that native images, which are <a href=\"http:\/\/msdn2.microsoft.com\/library\/ht8ecch6(VS.80).aspx\">assemblies already compiled to native code<\/a>, do not exist for all assemblies but a few. Those assemblies for which native images do not exist, like <em>PresentationCore.dll<\/em> for WPF, must be <a href=\"http:\/\/msdn2.microsoft.com\/library\/ht8ecch6(VS.80).aspx\">just-in-time compiled<\/a>, or JIT&#8217;d, when code must be executed each time the assembly is loaded until they compiled to native code (NGEN&#8217;d) while the machine is idle.<\/p>\n<p>To work around this issue,<\/p>\n<ol>\n<li>Open a console.  \n<ol>\n<li>On Windows Vista and newer, click on the <strong>Start<\/strong> button and type &#8220;cmd.exe&#8221; (without quotes). When found, right-click on the item and select &#8220;Run as administrator&#8221;.  <\/li>\n<li>On Windows 2000, XP, and 2003, click on the <strong>Start<\/strong> button, click <strong>Run<\/strong>, type &#8220;cmd.exe&#8221; (without quotes) and click <strong>OK<\/strong>.<\/li>\n<\/ol>\n<\/li>\n<li>Type the following and press <strong>Enter<\/strong>.\n<p><code>%WINDIR%Microsoft.NETFrameworkv2.0.50727ngen.exe executeQueuedItems<\/code><\/li>\n<\/ol>\n<p>This will take some time but applications will run more quickly again since assemblies will not have to be JIT&#8217;d.<\/p>\n<p>The root problem is that the patch only targets a single Windows Installer package, or MSI, and the <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043\">Microsoft .NET Framework 3.0<\/a>&nbsp;redistributable is actually composed of multiple MSIs including the .NET Framework 2.0 MSI. Inside of some of these MSIs is a custom action that queues assemblies the MSI installs to be compiled to native images, or NGEN&#8217;d, at different priorities. Priority 1 assemblies are NGEN&#8217;d immediately at the end of each MSI installation. All other assemblies to be NGEN&#8217;d that are not explicitly queued are given the default priority of 3 and will, by default, be NGEN&#8217;d when the machine is idle.<\/p>\n<p>When you initially installed the Microsoft .NET Framework 3.0 redistributable, all MSIs were installed and so the custom actions in each MSI were run. Some assemblies like <em>mscorlib.dll<\/em> and <em>System.dll<\/em> in the .NET Framework 2.0 MSI were queued as priority 1 while others were queued as priority 3. Some assemblies like <em>PresentationCore.dll<\/em> in the WPF MSI were queued as priority 1 as well. But when a <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/09\/12\/464047.aspx\">patch is installed<\/a>, only installed products that the patch targets are reinstalled. In the case of KB928365 only the .NET Framework 2.0 MSI is reinstalled so only its custom actions are executed to re-queue some of its assemblies at priority 1. All other assemblies dependent on any updates are queued at the default priority of 3.<\/p>\n<p>Toward the end of the patch installation, priority 1 assemblies are NGEN&#8217;d immediate but priority 3 assemblies will only be NGEN&#8217;d when the machine is idle. For those curious, priority 2 assemblies are aggressively compiled after priority 1 assemblies.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After installing Security Update KB928365 for the Microsoft .NET Framework 2.0 to fix MS07-040, some users are noticing some managed applications &#8211; especially those developed using the Windows Presentation Framework (WPF) &#8211; are running sluggish. The apparent problem is that native images, which are assemblies already compiled to native code, do not exist for all [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[20,27,35],"class_list":["post-1433","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-installation","tag-news","tag-security"],"acf":[],"blog_post_summary":"<p>After installing Security Update KB928365 for the Microsoft .NET Framework 2.0 to fix MS07-040, some users are noticing some managed applications &#8211; especially those developed using the Windows Presentation Framework (WPF) &#8211; are running sluggish. The apparent problem is that native images, which are assemblies already compiled to native code, do not exist for all [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/1433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=1433"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/1433\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=1433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=1433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=1433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}