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?

4
  • Can you clean all of the dll's (search you don't have any copies anywhere else on the computer) and then clean the solution and build it? Commented Jun 21, 2012 at 10:31
  • See here: stackoverflow.com/questions/2468852/… Commented Jun 21, 2012 at 10:32
  • @CSharpened seen that post already - gone through it Commented Jun 21, 2012 at 10:34
  • I have added another answer for you to try. Commented Jun 21, 2012 at 10:38

3 Answers 3

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.

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

Comments

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.

2 Comments

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.
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.
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.

Comments

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.