【发布时间】:2010-09-20 15:22:37
【问题描述】:
我从 Scott Hanselmans 网页上遵循了这个例子: http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx
我的目标是从引发异常的位置获取行号,而不是从捕获异常的位置获取行号。
当我使用以下构建脚本编译代码时,它不会工作
SET FXROOT=%Systemroot%\Microsoft.NET\Framework\v4.0.30319
DEL *.exe /q
"%FXROOT%\csc.exe" /t:exe /out:NormalRelease.exe /debug:pdbonly /o+ NormalProgram.cs
NormalRelease.exe > NormalRelease32.txt
输出:
System.ApplicationException: generic bad thing
at NormalProgram.Main(String[] args) in c:\Development\DebugSymbols\DebugSymConsole\NormalProgram.cs:line 8
当我用这个构建脚本编译代码时,它会起作用
SET FXROOT=%Systemroot%\Microsoft.NET\Framework\v2.0.50727
DEL *.exe /q
"%FXROOT%\csc.exe" /t:exe /out:NormalRelease.exe /debug:pdbonly /o+ NormalProgram.cs
NormalRelease.exe > NormalRelease32.txt
输出:
System.ApplicationException: generic bad thing
at NormalProgram.badMethod() in c:\Development\DebugSymbols\DebugSymConsole\NormalProgram.cs:line 18
at NormalProgram.Main(String[] args) in c:\Development\DebugSymbols\DebugSymConsole\NormalProgram.cs:line 8
不同之处在于,在我的第一个示例中,我针对 .net2-framework 进行编译,而在我的第二个示例中,我针对 .net4-framework 进行了编译。
任何解决我的问题的方法都将不胜感激,谢谢。
【问题讨论】:
标签: c# visual-studio .net-2.0 .net-4.0