在 Visual Studio 中调试动态创建的类C#
我的项目使用一个库,该库又使用 Microsoft.Practices.Unity 动态创建一个类并运行它的一些方法。该类在创建后会抛出错误。
我是否可以使用 Visual Studio 调试器来单步调试这个动态类?我有 Reflector Pro,它使我能够尽可能地深入挖掘。
注意:我已经尝试联系我正在使用的库的开发人员,但他们目前似乎不愿意解决此问题。因此,我正在尝试自己深入研究。
更新
我指的不是动态关键字。堆栈跟踪的第一行是
DynamicModule.ns.Wrapped_OpenAccessMetaDataProvider_bf5ed2b8ccd24dacab4923be24786366.Initialize(String providerName, NameValueCollection config, Type managerType) +506
Google 搜索 DynamicModule.ns.Wrapped_
导致 Unity 的 InterfaceInterceptorClassGenerator
类。鉴于这个类“用于生成代理类......”,它似乎是有意义的。我很难找到合适的代码示例,因为看起来围绕此类的构造有一个重要的面向对象框架。
更新2
Unity类抛出异常:
无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。
该异常没有 LoaderExceptions 属性,因此没有帮助。我不想用细节来解决这个问题,但简而言之,就是这样:我的 CMS(将保持匿名)使用了过时版本的 Facebook C# SDK。更新 Facebook SDK 程序集时,会引发此错误。这是有道理的,因为 SDK 发生了变化。我试图深入了解 OpenAccessMetaDataProvider 类和 Facebook SDK 之间的连接。
My project uses a library which in turn uses Microsoft.Practices.Unity
to dynamically create a class and run some of its methods. This class is throwing an error after it is created.
Is it possible for me to use the Visual Studio debugger to step into and debug this dynamic class? I have Reflector Pro which has enabled me to dig down as far as I have.
Note: I already tried contacting the developer of the library I am using and they do not seem willing to address this issue at this time. Therefore, I am trying to dig down into it myself.
UPDATE
I don't mean the dynamic keyword. The top line of the stack trace is
DynamicModule.ns.Wrapped_OpenAccessMetaDataProvider_bf5ed2b8ccd24dacab4923be24786366.Initialize(String providerName, NameValueCollection config, Type managerType) +506
Googling the DynamicModule.ns.Wrapped_
leads to Unity's InterfaceInterceptorClassGenerator
class. This class would seem to make sense given that it is "used to generate proxy classes...". I am having trouble finding a suitable code sample because it looks like there is a significant OO framework around the construction of this class.
UPDATE 2
The unity class is throwing an exception:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
The exception didn't have a LoaderExceptions
property so that doesn't help. I didn't want to bog down the question with details but in short it is this: my CMS (which will remain nameless) uses an outdated version of the Facebook C# SDK. Upon updating the Facebook SDK assemblies, this error is thrown. That makes sense because the SDK changed. I am trying to gain insight onto the connection between the OpenAccessMetaDataProvider class and the Facebook SDK.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是动态类方面的专家,但请尝试 System.Diagnostics.Debugger.Break() ...
I'm no expert on dynamic classes, but try System.Diagnostics.Debugger.Break() ...