0
在发布版本中,在Microsoft Unity解析期间,如果有任何异常抛出,StackTrace没有发生异常的“行号”。 没有这些信息,调试可能会很麻烦.... 你们如何处理它?Microsoft Unity在发生异常时丢失了“行号”,我该怎么办?
我想这是由于Microsoft Uniy使用Reflection.Emit。 我的猜测是正确的吗?下面
是示例
Project ABC uses Microsoft Unity to resolve ViewModel XYZ during initilization.
XYZViewModel constructor throws an exception.
Source : Microsoft.Practices.Unity
Message : Resolution of the dependency failed, type = "XYZViewModel", name = "(none)".
Exception occurred while: Calling constructor XYZViewModel().
Exception is: Exception - test exception StrackTrace line number
在异常时,该容器是:
Resolving XYZViewModel,(none)
Calling constructor XYZViewModel()
////// no line number in XYZViewModel code
Type : Microsoft.Practices.Unity.ResolutionFailedException
TargetSite : System.Object DoBuildUp(System.Type, System.Object, System.String, System.Collections.Generic.IEnumerable`1[Microsoft.Practices.Unity.ResolverOverride])
StackTrace : at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 515
////// has line number in Microsoft Unity code
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 173
///// has line number in Microsoft Unity code
通常,您需要让C#编译器生成.pdb(符号文件)以及程序集(exe/dll),以便在应用程序执行时可以打印出行号信息。 –
thx Lex,您是对! – athos
管理员:Lex的评论是正确的解决方案,但他用评论而不是答案,我怎么能够关闭这个问题? – athos