
Downloading the Source code
The NServiceBus downloads page explains how to download the source code. I went for version 2.0 of the code.
You can get the source for the 2.0 release here.
Compiling the source code to get at the pdb files.
Once you’ve downloaded the source code you’ll need to extract it:
- Open up a command prompt and go to the extract folder
- Type in build.bat
- If it’s working it should immediately create a folder called “build” as in the following picture:
- It takes a while to complete. Once it’s done you should see “BUILD SUCCEEDED”
Setting up Visual Studio to support NServiceBus debugging
Once the build has finished, you can now reference the dlls and more importantly the pdb files which should be in:
NServiceBus-NServiceBus-280b6d9\build\output
To demo this we’ll create a new NServiceBus client using the Generic Host and the “Lite” profile.
- Open up visual studio
- File >> New >> Project
- Select "Class Library"
- Call it “NServiceBusDemo1”
- Click Ok
- When your solution has loaded right click on the Solution in the Solution Explorer and click “Open Folder in Windows Explorer”
- Create a new folder called “Dependencies”
- Copy in the following 7 files:
- NServiceBus-NServiceBus-280b6d9\build\output\NServiceBus.dll
- NServiceBus-NServiceBus-280b6d9\build\output\NServiceBus.pdb
- NServiceBus-NServiceBus-280b6d9\build\output\NServiceBus.Core.dll
- NServiceBus-NServiceBus-280b6d9\build\output\NServiceBus.Core.pdb
- NServiceBus-NServiceBus-280b6d9\build\output\host\NServiceBus.Host.exe
- NServiceBus-NServiceBus-280b6d9\build\output\host\NServiceBus.Host.pdb
- NServiceBus-NServiceBus-280b6d9\build\tools\log4net.dll
from wikipedia:
“PDB stands for Program Database, a proprietary file format (developed by Microsoft) for storing debugging information about a program (or, commonly, program modules such as a DLL or EXE). PDB files commonly have a .pdb extension. A PDB file is typically created from source files during compilation. It stores a list of all symbols in a module with their addresses and possibly the name of the file and the line on which the symbol was declared. This symbol information is not stored in the module itself, because it takes up a lot of space.”
Which means that without the pdb files you won’t be able to step into the code and debug NServiceBus. The reason I like to recompile the source code is that the pdb files point to the directory containing the source code which makes life easier. Also it’s good practise anyway, so that if you want to change any of the source code you can.
- This should result in a folder like this:
- Go back to visual studio and add references to the dlls and exe
- Now we’ll create a very basic NServiceBus solution to demo the debugging:
Creating an NServiceBus “Client” to demo debugging
To demo this I copied the over the following 4 files from the FullDuplex example project into my new project:
- NServiceBus-NServiceBus-280b6d9\Samples\FullDuplex\MyClient\App.config
- NServiceBus-NServiceBus-280b6d9\Samples\FullDuplex\MyClient\ClientEndpoint.cs
- NServiceBus-NServiceBus-280b6d9\Samples\FullDuplex\MyClient\DataResponseMessageHandler.cs
- NServiceBus-NServiceBus-280b6d9\Samples\FullDuplex\MyClient\EndpointConfig.cs
- Go back to visual studio and include all the above files in the project
- Next I’ll delete “Class1.cs”
- If you try to compile at this point it will moan about the missing “message” project. So let's create that now:
- Right Click on the solution in the solution explorer and click Add >> New Project
- Call the new Project “NServiceBusDemo1_Messages”
- Copy over the following file into the “NServiceBusDemo1_Messages” project folder:
- NServiceBus-NServiceBus-280b6d9\Samples\FullDuplex\MyMessages\Messages.cs
- Open up visual studio and include this file into the “NServiceBusDemo1_Messages” project :
- Delete “Class1.cs”
- Include Reference to NServiceBus
- We’ll need to reference the “NServiceBusDemo1_Messages” project from the “NServiceBusDemo1” project:
- Now we’ll need to update the app.config to reference the new project. Change the line:
<add Messages="MyMessages" Endpoint="MyServerInputQueue" />
to
<add Messages="NServiceBusDemo1_Messages" Endpoint="MyServerInputQueue" />

- The solution should now build. Press F6 to test
- Finally we’ll need to run the project using the generic host.
- Right Click on the “NServiceBusDemo1” project and select properties
- Click the Debug Tab
- Select Start Action “Start external program:”
- Browse to the bin/Debug folder of the “NServiceBusDemo1” project and select the generic host:
- You should now be able to run the “NServiceBusDemo1” project in debug. To test put a break point on the Console.WriteLine( in the ClientEndpoint.cs file
- Right Click on the “NServiceBusDemo1” project in the solution explorer and select Debug >> Start new instance
- The program should break on the Console.WriteLine
- Now press F10 until you get to the Bus.Send<RequestDataMessage>(m => line
- Press F11 to step into the code
- That it. You’re now debugging the code and should be able to use this to help solve your own problems :)
Thank you for your sharing of information. Here is the resource to solve the problem of api-ms-win-crt-runtime-l1-1-0.dll missing https://fix4dll.com/apimswincrtruntimel110_dll. If you will have it. Because I have been spent much time to fix that. No need to thank.
ReplyDeleteGreat Article. Thank you for sharing! Really an awesome post for every one.
DeleteProject Centers in Chennai
JavaScript Training in Chennai
Final Year Project Domains for IT
JavaScript Training in Chennai
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
ReplyDeleteor Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.
Nice Post.
ReplyDeleteEthical Hacking Training in chennai
Best Training Institute in Chennai
data sgp
ReplyDeletedata sydney
datahk
syair sydney
syairsgp
datasgp
paito warna
http://warungsgp.com/
live hk 6d
live sydney
ReplyDeleteاعالى الخليج تقدم افضل خدمات نقل العفش الدولى المتميزه باسعار متميزة ومنها :
شركة شحن عفش من الرياض الى الامارات
نقل عفش من الرياض الى الاردن شركة شحن عفش من الرياض الى الاردن
This comment has been removed by the author.
ReplyDeleteLooks much easier than finding the best vmware backup solution
ReplyDelete