<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx</link><description>The C# compiler in Visual Studio 2008 and the .NET 3.5 Framework (csc.exe) is now generating PE files with the NXCOMPAT bit set. What is that bit and who cares, you ask? You may very well care if your application interops with native binaries or exposes</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#6768569</link><pubDate>Fri, 14 Dec 2007 11:07:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6768569</guid><dc:creator>goran.kimovski</dc:creator><description>&lt;p&gt;Hey Ed,&lt;/p&gt;
&lt;p&gt;your blog is timed as if I asked for it ;-)&lt;/p&gt;
&lt;p&gt;I have a question around the impact of NXCOMPAT and DEP on ASP.NET applications which use interops to work with COM components, in particular when the native components are built with pre-VS2005, i.e. link o/use pre-ATL80.&lt;/p&gt;
&lt;p&gt;My understanding is that the ASP.NET worker process is not marked with NXCOMPAT, thus even if the C# compiler outputs NX compatible assembly, when run on IIS, DEP should not prevent the ASP.NET app from running. Is this correct?&lt;/p&gt;
&lt;p&gt;If this is not correct, i.e. the process is NXCOMPAT, my next question would be if aspnet_compiler.exe also produces NXCOMPAT assemblies when .NET 2.0 fwk SP1 is installed on the IIS machine? If that is true, is there a risk that an ASP.NET app that was running fine with .NET 2.0 fwk RTM all of a sudden starts to fail when the ASPX files get recompiled?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Kima&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#6776020</link><pubDate>Sat, 15 Dec 2007 12:43:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6776020</guid><dc:creator>rbirkby</dc:creator><description>&lt;p&gt;To complicate matters further, there are 2 versions of sn.exe - 32bit and 64bit. The 64bit one AFAIK isn't shipped with the NDP. It comes as part of the Windows SDK.&lt;/p&gt;
</description></item><item><title>Community Convergence XXXVIII</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#6959137</link><pubDate>Wed, 02 Jan 2008 23:49:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6959137</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Welcome to the thirty-eighth Community Convergence. These posts are designed to keep you in touch with&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7128334</link><pubDate>Wed, 16 Jan 2008 12:02:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7128334</guid><dc:creator>Spike0xFF</dc:creator><description>&lt;p&gt;Hi Ed - I just ran into this problem - or rather, a panicky user of my company's ActiveX control ran into it.&lt;/p&gt;
&lt;p&gt;It's listed as an open issue over on the Connect site, so I pointed to your blog entry as a possible work-around.&lt;/p&gt;
&lt;p&gt;I'm torn between absolutely admiring your work - I've worked on a few compilers - and needing to say, this NXCOMPAT thing was kind of rude. &amp;nbsp;I don't mean that personally - may I explain?&lt;/p&gt;
&lt;p&gt;Figure 10,000 developers out there, who maintain apps that use 3rd party ActiveX controls and who are working in VS. They upgrade their IDE at some point, then (possibly at a completely different time) their app gets launched on Vista. Up comes this message: &amp;quot;Unable to get window handle for the EZTwainX control, windowless ActiveX controls are not supported.&amp;quot; &amp;nbsp;Notice that the message names the control, and precisely describes the problem (incorrectly, but precisely.) &amp;nbsp;What does the developer do? Goes off to ding the vendor of the control, because it has been clearly identified as the cause of the problem: &amp;quot;Hey, your control doesn't work on Vista!&amp;quot; The control vendor, if they still exist, scratches their head - in my case, my control has been in development and use on Vista since August. I check the code: Nope, it's always windowed. What the heck? Google, read, google, read some more - with luck and patience, find your blog entry.&lt;/p&gt;
&lt;p&gt;Solutions:&lt;/p&gt;
&lt;p&gt;1. Rebuild my control using VS 2005 or 2008, retest, and redistribute to app developer, who updates it in his app, retests, and redistributes his (or her) app... &lt;/p&gt;
&lt;p&gt;2. Have developer rework their build process using your suggestions.&lt;/p&gt;
&lt;p&gt;3. Or, as suggested by one poster - disable NX on any affected Vista machine! (it's a one-liner)&lt;/p&gt;
&lt;p&gt;Suppose the control and application developers manage to handle each incident for 100$. &amp;nbsp;Cost in the field: $1,000,000 (US). &amp;nbsp;Unless you have reason to believe there are fewer than 10,000 developers babysitting apps that use ActiveX controls built with VS2003 or earlier? &amp;nbsp;Personally, I'd bet the number is higher. &amp;nbsp;I understand the asymmetry of the situation, just wanted to put &amp;quot;a bug in your ear&amp;quot; as my mother used to say.&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7153669</link><pubDate>Sat, 19 Jan 2008 01:26:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7153669</guid><dc:creator>Spike0xFF</dc:creator><description>&lt;p&gt;I forgot to say what really made me mad about this NXCOMPAT thing: It's wrong! It's a bug! &amp;nbsp;Writing a file with the NXCOMPAT flag, without making *any effort* to verify that the file is actually NX-compatible, is a bug. &amp;nbsp;It may be politically correct, but it isn't any less of a bug than marking all exe's as '64-bit code' because &amp;quot;64 bits is twice as cool!&amp;quot; &amp;nbsp;Investing effort to implement a bug, and then shipping it?? What were you thinking?&lt;/p&gt;
</description></item><item><title>在VS 2008中使用非托管DLL以及DEP</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7173159</link><pubDate>Sun, 20 Jan 2008 18:27:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7173159</guid><dc:creator>laue</dc:creator><description>&lt;p&gt;在VS 2008中使用非托管DLL的时候，可能出现内存位置访问无效的错误，文章介绍了我找寻到的解决方案&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7186351</link><pubDate>Mon, 21 Jan 2008 20:59:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7186351</guid><dc:creator>kadorken</dc:creator><description>&lt;p&gt;We are now busy tracking down DEP errors (from within the .NET library) in OUR application (i.e. we are now testing Microsoft's code in our application) &amp;nbsp;just because we now have .NET SP1 installed on our development computer. Our (just) released application was built just before .NET SP1 magically appeared on our build computer so our current customers are SAFE for now. However, I just discovered our build computer has been updated; Magically our application has now been blessed with NXCOMPAT; it will now fail (IN the MICROSOFT .NET LIBRARY NOT OUR CODE). Good thing people have started blogging about this (and we found this one) before I inadvertently (WITHOUT KNOWLEDGE) released a update to our application with potential bugs in it.&lt;/p&gt;
&lt;p&gt;Thanks for NOT providing a compiler switch so I can add even MORE lines to our Postbuild.cmd process.&lt;/p&gt;
&lt;p&gt;Not a happy camper.&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7354726</link><pubDate>Thu, 31 Jan 2008 21:25:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7354726</guid><dc:creator>behearn</dc:creator><description>&lt;p&gt;This decision has a big impact for our product, too. &amp;nbsp;We're about to release a new version and suddenly QA starts finding the DEP error in web pages, where there were none before. &amp;nbsp;Product management is freaking out. There is no indication in the error messages or logs we can find about exactly what the problem is. &amp;nbsp;So I end up googling it and find this blog. &amp;nbsp;Well, I sincerely appreciate that it's documented somewhere, but...&lt;/p&gt;
&lt;p&gt;We use many third party components in our ASP.NET and WinForms applications that we cannot recompile.&lt;/p&gt;
&lt;p&gt;It is an extremely poor decision on Microsoft's part to have made a &amp;quot;breaking change&amp;quot; like this in a service pack that gets automatically deployed via windows update! &amp;nbsp;We are upset about this because we didn't expect breaking changes in a service pack, and now have to dedicate time to deal with it. &amp;nbsp;We have enough problems of our own to deal with without Microsoft making matters worse. &amp;nbsp;My feedback is this: put &amp;quot;breaking changes&amp;quot; into major releases of the framework, rather than into a &amp;quot;mandatory&amp;quot; service pack. &amp;nbsp; &lt;/p&gt;
&lt;p&gt;Disappointed and wary of future service packs&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#7837885</link><pubDate>Thu, 21 Feb 2008 17:08:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7837885</guid><dc:creator>hkabla</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a piece of code that compiles under MS Studio 2008 and works fine on Windows Vista. But the same .exe generates a 'execution denied' error on XP. Is there a chance that this strange behavior on XP comes from DEP? Could you help me find the way to fix this?&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#8422834</link><pubDate>Fri, 25 Apr 2008 01:00:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8422834</guid><dc:creator>GWardell</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;So far I haven't been bit by this so I think this is funny because not executing data pages has been built into Intel chips since the 80386 and on into the current Pentium chips. &amp;nbsp;This was a &amp;quot;feature&amp;quot; of the old CTOS operating system when running in &amp;quot;protected mode&amp;quot;.&lt;/p&gt;
&lt;p&gt;The problem was Windows 32 bit mode didn't take advantage of it, choosing instead to use all 32bits for a memory address instead of using the segment descriptor and offset method needed for protected mode.&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#8878679</link><pubDate>Tue, 19 Aug 2008 16:01:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8878679</guid><dc:creator>awe</dc:creator><description>&lt;p&gt;I tried to run it on my exe, and it worked fine.&lt;/p&gt;
&lt;p&gt;Then I tried to include it in the post-build event like you said:&lt;/p&gt;
&lt;p&gt;call $(DevEnvDir)..\tools\vsvars32.bat&lt;/p&gt;
&lt;p&gt;editbin.exe /NXCOMPAT:NO $(TargetPath)&lt;/p&gt;
&lt;p&gt;This gave the following error when I build it:&lt;/p&gt;
&lt;p&gt;The command &amp;quot;call C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\..\tools\vsvars32.bat&lt;/p&gt;
&lt;p&gt;editbin.exe /NXCOMPAT:NO D:\Work\DotNet\RadiusStudio.NET\RadiusStudio\bin\Release\StudioVision.exe&amp;quot; exited with code 9009.&lt;/p&gt;
&lt;p&gt;This is also a problem inside Visual Studio, because it is a GUI control that fails to load in the forms designer. Could this be solved by running EDITBIN.EXE on devenv.exe?&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#8958302</link><pubDate>Fri, 19 Sep 2008 09:26:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8958302</guid><dc:creator>rajshreedugar</dc:creator><description>&lt;p&gt;Hi Awe,&lt;/p&gt;
&lt;p&gt;try the following in the post build event command line:-&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\vcvars32.bat&amp;quot;&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\editbin.exe&amp;quot; /NXCOMPAT:NO &amp;quot;$(TargetPath)&amp;quot;&lt;/p&gt;
&lt;p&gt;This works fine for VS2005. You might want to change the location if you are using any other versions of VS. But be sure to include the path within quotes.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Rajshree&lt;/p&gt;
</description></item><item><title>Disable DEP on applications</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#8961725</link><pubDate>Tue, 23 Sep 2008 03:05:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8961725</guid><dc:creator>Gaurav Bodar's Blog</dc:creator><description>&lt;p&gt;Windows vista wont Allow ATL control on the machine. We have Data Execution Prevention to stop Executing&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#9001994</link><pubDate>Thu, 16 Oct 2008 19:57:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9001994</guid><dc:creator>N!kky</dc:creator><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I've got a similar issue. I've got a bug with by COM Interop and by using the following command in my build it get rids of the issue:&lt;/p&gt;
&lt;p&gt;call $(DevEnvDir)..\tools\vsvars32.bat&lt;/p&gt;
&lt;p&gt;editbin.exe /NXCOMPAT:NO $(TargetPath) &lt;/p&gt;
&lt;p&gt;I've got it to work without signing my assemblies with a strong Name. However when we release our software we need to sign our assemblies using a .snk file. I've added the above code to my post build event however i can no longer run my app since it fails with Strong Validation Failed. What i need to do is call the above code and then sign my .exe file. How do i do this through the post build events? I'm currently using the Signing tab in visual studio 9 in my projects properties to sign my assemblies. Is there any other way to do this via the post build event?&lt;/p&gt;
&lt;p&gt;Have seen the following command but can not get it to work because i dont know what to put for MyModule.netmodule parameter&lt;/p&gt;
&lt;p&gt;al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk&lt;/p&gt;
&lt;p&gt;Any ideas? Any suggestions will be help. Thanks in advance.&lt;/p&gt;
&lt;p&gt;Regards Nik&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#9129652</link><pubDate>Thu, 20 Nov 2008 19:49:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9129652</guid><dc:creator>ajsllc</dc:creator><description>&lt;p&gt;I added this to my post-build event on a VB project.&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\vcvars32.bat&amp;quot;&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\editbin.exe&amp;quot; /NXCOMPAT:NO &amp;quot;$(TargetPath)&amp;quot;&lt;/p&gt;
&lt;p&gt;It executes successfully, but if the &amp;quot;primary output&amp;quot; of that project is included in a deployment project, the exe that gets included in the output MSI does NOT have DEP disabled.&lt;/p&gt;
&lt;p&gt;I have found that targetpath points to .....\projectname\\bin\x86\Release\projectname.exe&lt;/p&gt;
&lt;p&gt;by experimentation, I have also found that if I edit bin ......\projectname\bin\x86\Release\\..\..\..\obj\x86\release\projectname.exe&lt;/p&gt;
&lt;p&gt;that is, the obj folder instead of the bin folder&lt;/p&gt;
&lt;p&gt;then the exe that gets included in the MSI DOES have DEP disabled.&lt;/p&gt;
&lt;p&gt;I'm a happy camper, my problem is resolved, but I am curious as to why.&lt;/p&gt;
&lt;p&gt;Is it that the deployment project pulls the output from the wrong folder,&lt;/p&gt;
&lt;p&gt;or is it some timing issue about when things are copied from obj to bin?&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#9129730</link><pubDate>Thu, 20 Nov 2008 20:15:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9129730</guid><dc:creator>ajsllc</dc:creator><description>&lt;p&gt;I should have added that I am using Visual Studio 2008&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#9188574</link><pubDate>Wed, 10 Dec 2008 04:06:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9188574</guid><dc:creator>sdasari</dc:creator><description>&lt;p&gt;I am using VS 2005 and Mappoint Active X control, when i build the application on Vista i am getting the error Mappoint Failed to Load. The i have added the &amp;nbsp;&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\vcvars32.bat&amp;quot;&lt;/p&gt;
&lt;p&gt;call &amp;quot;$(DevEnvDir)..\..\VC\bin\editbin.exe&amp;quot; /NXCOMPAT:NO &amp;quot;$(TargetPath)&amp;quot;&lt;/p&gt;
&lt;p&gt;and executed the application, this time Mappoint is working fine. When i deploy same project with ClickOnce deployment, i am getting Mappoint Failed to load on Vista Desktop. Please suggest me, how can i solve this problem.&lt;/p&gt;
</description></item><item><title>re: NXCOMPAT and the C# compiler</title><link>http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx#9883970</link><pubDate>Tue, 25 Aug 2009 21:45:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9883970</guid><dc:creator>rowter</dc:creator><description>&lt;p&gt;I got a mappoint failed to load error.&lt;/p&gt;
&lt;p&gt;What should i include in the &amp;quot;$(TargetPath&amp;quot;)&amp;quot; . What should this be pointing to?&lt;/p&gt;
</description></item></channel></rss>