moq/labs

Moq4 compiled in debug mode?

kendallb opened this issue · 5 comments

Hi Guys,

I am having issues with Moq4 as I recently moved up to it from Moq3 via NuGet, but it appears the NuGet package was compiled with debugging turned on so Visual Studio keeps trying to find the source files under the c:\projects\moq4 directory, which of course I do not have.

This is extremely annoying when trying to debug unit tests, so is there a way to turn this off or can the project be compiled in release mode with debugging information so it works the way it used to?

stakx commented

@kendallb, you're asking at the wrong repository, Moq 4.x is over at moq/moq4. This here is the repo for Moq vNext.

stakx commented

That said, you need to simply adjust your VS debugger settings under Tools > Options. Do either of those:

  • Enable SourceLink support. Then, instead of just complaining that there are no files under that path, the debugger will automatically fetch them from GitHub and allow you to step into it.

  • Enable Just My Code. This should make the debugger ignore Moq's debug symbols completely.

I will ask the question on the moq4 area, but I already have Just My Code enabled. The core issue is the NuGet package is compiled in full debug mode from the way it is behaving. It is one thing to include PDB symbols but another to compile in full debug mode where it will try to find source files on your local system.

Well I turned on source symbol support in VS2015 and it simply crashed trying to find the source files.

But at the end of the day IMHO this is wrong. Moq is a mocking engine so when I am debugging my unit tests the last thing I want to do when I step into something that Moq is hiding in front of as a proxy is to be suddenly debugging into the Moq code itself? I don't care about the Moq code at that point, I just want to step into the function on the other end of the proxy that is my test function.

This is how it used to work in Moq so IMHO this a step backwards.

stakx commented

@kendallb - Please let's move this discussion to devlooped/moq#483.