Debug Nuget packages?

Are the SS Nuget packages available with a debug build? Sometimes when stepping through the code with source link it is difficult as certain breakpoints and variables aren’t visible I guess due to the dll being built in release mode.

I downloaded the source code but I don’t really understand what is going on inside the build folder. I can build the project in VS and grab the DLL but then there are a lot of missing dependencies.

What is the best way to add a debug version of ServiceStack to a project?

Only release binaries are published in NuGet packages but they do contain embedded .pdb info inside each of the .dll’s.

If you’re using JetBrains Rider you should be able debug into the source code of ServiceStack which I believe is making use of the embedded pdb’s as it looks like debugging the original source code, I’d expect their decompile on-the-fly feature to result in more mangled decompiled source code.

I am using VS with resharper. The source code looks fine, I think it is being downloaded via source link.

When stepping through a release build often breakpoints get skipped and variables wont show a value inside inspector, at least this has been my experience when debugging a dll that is built in release mode. Usually swapping to debug build fixes these issues for me.

I have updated build/build.bat to (it was only place I could see build type):

for /f "usebackq tokens=*" %%i in (`vswhere.exe -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
  SET MSBUILD="%%i"
)
%MSBUILD% build.proj /property:Configuration=Debug;MinorVersion=8;PatchVersion=1

I tried to run this file directly but I got errors.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.target
s(131,5): error : The feed 'ServiceStack CI feed [https://build.servicestack.net/guestAuth/app/nuget/v1/FeedService.svc
]' lists package 'ServiceStack.Aws.5.8.1' but multiple attempts to download the nupkg have failed. The feed is either i
nvalid or required packages were removed while the current operation was in progress. Verify the package exists on the
feed and try again. [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\ServiceStack.sln]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.target
s(131,5): error :   Unable to find package 'ServiceStack.Aws.5.8.1'. [E:\Projects\testing\AutoQuerySourceTests\ServiceS
tack\src\ServiceStack.sln]

That is with default master branch, if I try to checkout 5.10.4 tag I get some extra errors:

"E:\Projects\testing\AutoQuerySourceTests\ServiceStack\build\build.proj" (default target) (1) ->
"E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\ServiceStack.sln" (Restore target) (2) ->
(Restore target) ->
  E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tes
ts.csproj : error NU1605: Detected package downgrade: ServiceStack.OrmLite from 5.9.0 to 5.8.1. Reference the package d
irectly from the project to select a different version.  [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\Ser
viceStack.sln]
E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tests
.csproj : error NU1605:  ServiceStack.Extensions.Tests -> ServiceStack.OrmLite.Sqlite 5.9.0 -> ServiceStack.OrmLite (>=
 5.9.0)  [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\ServiceStack.sln]
E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tests
.csproj : error NU1605:  ServiceStack.Extensions.Tests -> ServiceStack.OrmLite (>= 5.8.1) [E:\Projects\testing\AutoQuer
ySourceTests\ServiceStack\src\ServiceStack.sln]
  E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tes
ts.csproj : error NU1605: Detected package downgrade: ServiceStack.OrmLite from 5.9.0 to 5.8.1. Reference the package d
irectly from the project to select a different version.  [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\Ser
viceStack.sln]
E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tests
.csproj : error NU1605:  ServiceStack.Extensions.Tests -> ServiceStack.OrmLite.SqlServer 5.9.0 -> ServiceStack.OrmLite
(>= 5.9.0)  [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\ServiceStack.sln]
E:\Projects\testing\AutoQuerySourceTests\ServiceStack\tests\ServiceStack.Extensions.Tests\ServiceStack.Extensions.Tests
.csproj : error NU1605:  ServiceStack.Extensions.Tests -> ServiceStack.OrmLite (>= 5.8.1) [E:\Projects\testing\AutoQuer
ySourceTests\ServiceStack\src\ServiceStack.sln]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targ
ets(131,5): error : The feed 'ServiceStack CI feed [https://build.servicestack.net/guestAuth/app/nuget/v1/FeedService.s
vc]' lists package 'ServiceStack.Aws.5.8.1' but multiple attempts to download the nupkg have failed. The feed is either
 invalid or required packages were removed while the current operation was in progress. Verify the package exists on th
e feed and try again. [E:\Projects\testing\AutoQuerySourceTests\ServiceStack\src\ServiceStack.sln]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.target
s(131,5): error :   Unable to find package 'ServiceStack.Aws.5.8.1'. [E:\Projects\testing\AutoQuerySourceTests\ServiceS
tack\src\ServiceStack.sln]

Is there a script that builds the nuget packages locally? I saw “NuGetPack” in the build.cmd but couldn’t figure it out.

What is easiest way for me to get a nuget package built in debug mode?

I realised I should probably be using ServiceStack.Core.sln. It seems it is relying on lib and Nuget.Core directories that are not in repo.

All I want to be able to do is step through code without breakpoints getting missed and variables be in scope like as if I was running a local project.

Is there any way to achieve that?

The errors are because it’s referencing an old, no longer existing pre-release package on MyGet.
You would need to change the version in Directory.Build.props to reference to the next official package on NuGet, e.g. v5.9.0 (for v5.8.1).

But generally our official build is orchestrated in our TeamCity CI which calls the MSBuild /build/*.proj’s, although running them locally typically works, it isn’t a supported use-case. But you should be able to build individual projects as they’re just standard .csprojs.

Both Visual Studio and ReSharper should also support decompiling code on-the-fly while debugging.

But I’ve just tried debugging an empty Web App in Visual Studio and looks I’m able to debug into ServiceStack embedded pdb source files without issue:

If you want source-code level debugging experience I’d recommend instead to download all core ServiceStack Repos in a folder, i.e:

And have your projects reference the *.Source.csproj projects instead which reference other Source.csproj’s (i.e. instead of NuGet packages), so your solution only references source code projects. Then you can debug like it’s a normal source code project.

Thanks I will reference them directly and see how I get on. I am able to build the DLL but i was getting some dependency issues so I figured just having the package built as debug might have been easier.

Regarding the decompiling on the fly, that wasn’t the issue, I can decompile into code and hit a breakpoint but when you do that on a release package sometimes certain codebllocks are unable to have breakpoints hit and some variables which should be in scope dont show. I have seen it happen with many projects and swapping to debug build usually fixes it so that was my initial thought but I will work with project references…