我跟着these instructions to add IL offsets to Silverlight stack traces。这在DEBUG模式下构建时效果很好但是我们的生产/ qa构建过程使用RELEASE模式编译所有内容,这似乎松散了IL偏移信息。在释放模式下,所有IL偏移最终都是“0xffffffff”。使用反射器比较调试/发布程序集,我注意到DebuggableAttribute的使用方式不同。
DEBUG build:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.EnableEditAndContinue | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
[assembly: AssemblyConfiguration("Debug")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: Extension]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework("Silverlight,Version=v5.0", FrameworkDisplayName="Silverlight 4")]
[assembly: AssemblyCopyright("Copyright @ Foo Company 2010-2012")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Foo.Ria.Bar")]
[assembly: AssemblyCompany("Foo Company")]
[assembly: AssemblyProduct("Foo Product")]
vs RELEASE build:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyTitle("Foo.Ria.Bar")]
[assembly: AssemblyTrademark("")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework("Silverlight,Version=v5.0", FrameworkDisplayName="Silverlight 4")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Foo Company")]
[assembly: AssemblyProduct("Foo Product")
DebuggableAttribute类控制运行时如何处理模块中的代码。运行时可能会跟踪有关生成的代码的额外信息,并且可能会根据此属性中包含的值禁用某些优化。
有没有人有调整DebuggableAttribute设置的经验?是否有任何解决方法不涉及完全禁用优化(DebuggingModes.DisableOptimizations)?