4

I have a WCF service that I can debug. I put a breakpoint in the code at the point at which I want to debug and get the message

The breakpoint will not currently be hit.  The source code is different from the original version.

I have been struggling with this for 3 days now and have tried everything I have found in other posts.

One thing that I notice is that if I go to Debug -> Windows -> Modules the module that I want to debug is not in that list. I think this may have something to do with it. Does anyone know what I should do.

Thanks,

Sachin

EDIT:

I have tried all these things and many more, but for some reason I still have the same problem. Is there any solution to this at all?

Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304

3 Answers3

3

Try closing down visual studio after closing any files open in it. Then go into your bin folder for debug and delete all .pdb files. Now reopen visual studio and rebuild your project or do a clean and build ensuring you are in debug mode and not release mode. This issue can arise if your pdb files become locked. If you have a pdb file present for that dll then it should pick up that module for debugging.

If that doesnt work have you restarted your machine? If not try a reboot as sometimes the process can get caught up in Windows, and restarting will release the lock to overwrite the files.

Quick question. Is the module in question an external module or is it part of your current solution that you are debugging? If it is an internal module then the solutions above should definetly work as you will generate a new .pdb file for that assembly.

CSharpened
  • 11,674
  • 14
  • 52
  • 86
1

Right click on the project inside the solution explorer and choose to Clean. Build a new version of the project and the breakpoint will work again. If this not work, try to delete everything from the bin and obj folders, and build again your project.

Alexandru Dicu
  • 1,151
  • 1
  • 16
  • 24
1

To state the obvious, this error means that compiled service does not match the source code i.e. source code has changed since service run. Make sure you rebuild your solution.

What I do to debug WCF services is to have 2 instances of Visual Studio. One runs a WCF service hosting app (console) and the other runs a client. Make sure you are running debug version. It should work (and debug) fine as long as the client can successfully connect to your service.

You get

The breakpoint will not currently be hit.

when a module with that breakpoint has not been loaded (yet). Your service will not be loaded until a client connects.

Maciej
  • 7,871
  • 1
  • 31
  • 36
  • Also, you can use the both projects in the same solution. In this way, you won't need to have two instances of Visual Studio running. You can right click on your solution and add an existing project. – Alexandru Dicu Jun 21 '12 at 10:34
  • I find it easier to work that way. You can stop everything in one instance (Shift-F5) not worrying that you are stopping the other part. Easier debugging means working faster and making less errors. – Maciej Jun 21 '12 at 10:40