0

I have this wierd problem. I am loading at run time a DLL and creating instance of it. The dll is a project at my solultion and I have downloaded the NewtonJSon from nuget to it's refrences.

The problem: Whenever I am trying to debug that dll, if visual studio see's that I am using an object from NewtonJSon (For example: JObject), then it just skips that code. When removing the use of NewtonJSon, then I can debug without any problem.

How wierd is that?

Daniel Rahamim
  • 285
  • 2
  • 18
  • Why do you load dll at runtime? Just give reference to your project? About your question, when you load dll at runtime VS cannot create pdb file for that dll. As VS doesn't know this dll at compile time, it cannot debug related codes to this DLL. – ahmet Aug 18 '16 at 08:21
  • Not only it doesn't debug, it also not running that code. just skipes it! So, it is not related to PDB. – Daniel Rahamim Aug 18 '16 at 08:27
  • Looks like I needed to add a reference the NewtonJSon dll to the project which loads the dll dynamically. – Daniel Rahamim Aug 18 '16 at 08:46
  • I think your solution is here http://stackoverflow.com/questions/18362368/loading-dlls-at-runtime-in-c-sharp – ahmet Aug 18 '16 at 08:52
  • @Daniel Rahamim, Could you share the code about how you really load the dll file? If you install the NuGet package to your project, it would add dlls as the reference for you current project in solution explorer window, if you don't add it as the reference, I don't think you could debug this library, and it would have the compiled error or warning if you run it using "start without debugging". – Jack Zhai Aug 18 '16 at 12:55
  • @JackZhai, I am sorry but I am not allowed to share the code. All I can say is I am loading the DLL in run time, and then creating an instance from it. The Nuget is installed to the project which I am dynamically loading it's DLL. After installing the Nuget also to the project which loads that DLL, then it worked. – Daniel Rahamim Aug 19 '16 at 12:47
  • @Daniel, since it works well after you add the reference, it would be a nice solution, you could add it as the answer. Another suggestion is that you could add the library and pdb files to the current project's output path(bin\debug), check it again. – Jack Zhai Aug 22 '16 at 02:36

0 Answers0