Not easy to debug

nservicebus

(Kiran Nandedkar) #1

I am using visual studio 2017. I have put breakpoints inside my saga and i run application locally . I do few things in my frontend and then it hits breakpoint inside my saga but when i try to step in then debugger jumps here and there. It can be because servicebus is fetching other messages. How can i debug smoothly step by step?


(Ramon Smits) #2

You can decrease the maximum concurrency for your endpoint to 1, you then process all your messages sequentially:

endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);

Source: https://docs.particular.net/nservicebus/operations/tuning#configuration

You can combine this with a debugger check at start to only do this if there is a debugger running:

if(System.Diagnostics.Debugger.IsAttached)
{
    endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);
}

(Sean Feldman) #3

In addition to what @ramonsmits suggested, you can use ServiceInsight to visualize your sagas. More info https://docs.particular.net/serviceinsight/#the-saga-view


(Sean Feldman) #5

That would be in your endpoint configuration code.
Search where you create EndpointConfiguration object and add "endpointConfiguration.LimitMessageProcessingConcurrencyTo(1); there.