4

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.

8
  • Can you show us any source code that shows how you are creating a class and calling its methods? Commented Oct 4, 2011 at 17:33
  • Do you mean an object that is dynamic (keyword), or an anonymous class? Commented Oct 4, 2011 at 17:33
  • @GalacticCowboy No, not the dynamic keyword. Please see my edit for clarification. Commented Oct 4, 2011 at 19:39
  • @JGWeissman The construction of this object and the population of its members are spread out over many classes that I am currently wading through. It does look like Unity's InterfaceInterceptorClassGenerator is the class that is doing the actual construction though. Hopefully that helps. Commented Oct 4, 2011 at 19:41
  • What exeception is begin thrown by the unity created class ? Commented Oct 4, 2011 at 20:39

1 Answer 1

1

I'm no expert on dynamic classes, but try System.Diagnostics.Debugger.Break() ...

Sign up to request clarification or add additional context in comments.

1 Comment

How would I put that inside code that is generated at runtime?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.