views:

42

answers:

2

Hi all. I have a windows form application in which I'm attempting to utilize a plugin (class library). In the code I have it load the assembly from a dll file, which means I have not been able to debug. Furthermore I have not found out how to compile the library so I've had to use the debuged dll version for testing. I've run into a bug in which I create a new object and send that data through an interface to the plugin in an attempt to retrieve a blank slate group box from the plugin. However instead of reading the parameter as a new object i managed to step through the code once (don't ask me how, I don't know and I haven't been able to repeat it) and it appeared that the code was registering the parameter as "nothing" thus why I received a null reference error in the main program.

Is there a better way to debug this mechanism and find out where the problem is? Any ideas on what the problem could be. As I read over this is seems somewhat vague and I'm not sure how to describe it, but I'm willing to host a connect now meeting if anyone is willing to look at what is going on and I'm not making myself understood very well.

+1  A: 

I'm not sure if I follow exactly what you're doing but I usually find that the best way to debug a class library is by in the solution for the class library I add a new project, either a WinForms one or a Console one, I then set this new project as the start up project and add a reference to the Class Library project (via the Project tab in the Add Reference dialog).

You'll then be able to call the methods in the class library from the other project and you can put breakpoints anywhere to see what's really going on easily.

ho1
I'm not sure I fully understand what you mean. Adding a reference to the plugin would allow me to call functions from the stub, but it would not allow me to create an instance of the plugin...to the best of my knowledge. The class library implements as a plugin and is not passing on the correct information to the best of my knowledge...Part of my challenge is I really don't know how to explain any better what is going on, which is why if this doesn't clarify I'd like to know if it would be possible to arrange a desktop sharing meeting?
Assimilater
I'm not sure if plugin is a defined term when it comes to .Net, I just assumed that you just meant a dll, but I now assume you mean that you dynamically load the dll and probably access it via interfaces etc. Either way, I would have thought that you'd be able to do F5 to step into the dll code, but it's been quite a while since I did any dynamic loading so I might be forgetting something. Sorry, I don't have time for that.
ho1
Well you're right about what I'm doing now. But it does not appear to be letting me step through the code.
Assimilater
I saw some question about that recently here on stackoverflow but I can't find it. I'd suggest trying to search for it and otherwise creating a new question where you specifically ask for why you're unable to step into class libraries. You might get more responses then.
ho1
I did search for it and didn't find an answer, but I eventually found the problem.
Assimilater
A: 

Ok, so the problem was that any time you edit the class library you have to compile (and the only way I know how is debugging, I can't find a compile button and the publish button doesn't work and building doesn't appear to make a dll). But anyways you have to compile, transfer the file so you are reading the most recent one. If you edit the code during runtime it does NOT update the dll in use...which was my problem.

Assimilater
Ah yes, I used to have this issue when I did C++ COM dlls, also using interfaces etc. Building should create the DLL though, `Ctrl + Shift + B`.
ho1
Where does it put them?
Assimilater