{"id":39534,"date":"2020-06-18T06:00:26","date_gmt":"2020-06-18T13:00:26","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/premier-developer\/?p=39534"},"modified":"2020-06-15T06:45:27","modified_gmt":"2020-06-15T13:45:27","slug":"how-to-debug-and-step-into-service-fabric-sdk-source-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/how-to-debug-and-step-into-service-fabric-sdk-source-code\/","title":{"rendered":"How to Debug and Step Into Service Fabric SDK Source Code"},"content":{"rendered":"<p>In this blog, Premier Consultant Kurt Schenk shows how to debug into the source code of the Service Fabric SDK which is used to develop Reliable Services and Reliable Actors. Service Fabric is open source, including the SDK which is on GitHub <a href=\"https:\/\/github.com\/Microsoft\/service-fabric-services-and-actors-dotnet\">here<\/a>.<\/p>\n<hr \/>\n<p><strong>#1. Determine what commit to check out of GitHub<\/strong><\/p>\n<p>You need to match the source code that you check out with the NuGet package that you are referencing. For example, using Visual Studio we can see that my service is referencing these Service Fabric NuGet packages.<\/p>\n<p><img decoding=\"async\" width=\"1191\" height=\"675\" class=\"wp-image-39582\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-microsoft-serv.png\" alt=\"Machine generated alternative text: Microsoft.ServiceFabric by Microsoft This package contains the reference assemblies required to build a Service Fabric service. Microsoft.ServiceFabric.Actors by Microsoft This package contains the common Actor Framework APIs for building and connecting to reliable services on Microsoft Service Fabric. Microsoft.ServiceFabric.Data by Microsoft This package contains the runtime assemblies required by Service Fabric's ReliableCoIIections APIs. Microsoft.ServiceFabric.Data.Extensions by Microsoft This package contains assemblies required by Service Fabric's ReliableCoIIections APIs. Microsoft.ServiceFabric.Data.lnterfaces by Microsoft This package contains the interfaces required by Service Fabric's ReliableCoIIections APIs. Microsoft.ServiceFabric.Diagnostics.lnternal by Microsoft This package provides Diagnostics functionality to be used by Service Fabric Actors and Service framework. This package is intended to be used by other official Microsoft ServiceFabric packages only. Microsoft.ServiceFabric.FabricTransport.lnternal by Microsoft This package provides FabricTransport to be used as the communication mechanism for Service Fabric microservices. This package is intended to be used by other official Microsoft ServiceFabric packages only. Microsoft.ServiceFabric.Services by Microsoft This package contains the common Service Framework APIs for building and connecting to reliable services on Microsoft Service Fabric. Microsoft.ServiceFabric.Services.Remoting by Microsoft This package contains the Service Framework Remoting APIs for building and connecting to reliable services on Microsoft Service Fabric. v6A.6i8 v7.14D9 v3v3.6i8 v3v3.6i8 VI 4.658 v3v3.6i8 v3v3.6i8 v3v3.6i8 v3v3.6i8 v3v3.6i8 \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-microsoft-serv.png 1191w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-microsoft-serv-300x170.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-microsoft-serv-1024x580.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-microsoft-serv-768x435.png 768w\" sizes=\"(max-width: 1191px) 100vw, 1191px\" \/><\/p>\n<p>This is 6.4 CU6 release of Service Fabric, on May 2nd, 2019, which you can verify by going to <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/service-fabric\/release-notes\">https:\/\/docs.microsoft.com\/en-us\/azure\/service-fabric\/release-notes<\/a> and clicking on &#8220;release notes&#8221; in section &#8220;Service Fabric 6.4 releases&#8221; for May 2, 2019. You will see the following table showing that this release is compatible with Service Fabric .NET SDK (3.3.658) \/ Microsoft.ServiceFabric (6.4.658)<\/p>\n<p><img decoding=\"async\" width=\"861\" height=\"235\" class=\"wp-image-39583\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-service-fabric.png\" alt=\"Machine generated alternative text: Service Fabric Runtime Service Fabric for Windows Server .NET SDK Java SDK Service Fabric PowerShell and CLI Ubuntu Windows Service Fabric Standalone Installer Package Windows .NET SDK Microsoft. ServiceFabric Reliable Services and Reliable Actors ASP.NET Core Service Fabric inte Java for Linux SDK AzureRM PowerShell Module SFCTL Visual Studio Toolin Ecli Toolin 6.4.649.1 6.4658 03.15 207 \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-service-fabric.png 861w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-service-fabric-300x82.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-service-fabric-768x210.png 768w\" sizes=\"(max-width: 861px) 100vw, 861px\" \/><\/p>\n<p>If you are referencing the latest version (Major.Minor) of a Service Fabric release (6.4, 6.5, 7.0, 7.1, <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/service-fabric\/release-notes\">https:\/\/docs.microsoft.com\/en-us\/azure\/service-fabric\/release-notes <\/a>) then you can check out the release branch as shown below. So branch release_3.3 is 6.4 CU7 released May 28, 2019 which is .NET SDK (3.3.664) \/ Microsoft.ServiceFabric (6.4.664).<\/p>\n<p><img decoding=\"async\" width=\"313\" height=\"529\" class=\"wp-image-39584\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-switch-branche.png\" alt=\"Machine generated alternative text: Switch branches\/tags Filter branches\/tags Branches develop Tags release 3.1 release 3.2 release 3.3 release 3.4 release 4. I rem otingrnesh \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-switch-branche.png 313w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-switch-branche-178x300.png 178w\" sizes=\"(max-width: 313px) 100vw, 313px\" \/><\/p>\n<p>If you navigate to <a href=\"https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet\/blob\/release_3.3\/properties\/service_fabric_common.props\">https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet\/blob\/release_3.3\/properties\/service_fabric_common.props<\/a> you will see the same confirmed there.<\/p>\n<pre class=\"prettyprint\">&lt;NugetPkg_Version_Microsoft_ServiceFabric&gt;6.4.644&lt;\/NugetPkg_Version_Microsoft_ServiceFabric&gt;\r\n\r\n&lt;NugetPkg_Version_Microsoft_ServiceFabric_Diagnostics_Internal&gt;3.3.644&lt;\/NugetPkg_Version_Microsoft_ServiceFabric_Diagnostics_Internal&gt;\r\n\r\n&lt;NugetPkg_Version_Microsoft_ServiceFabric_Data&gt;3.3.644&lt;\/NugetPkg_Version_Microsoft_ServiceFabric_Data&gt;\r\n\r\n&lt;NugetPkg_Version_Microsoft_ServiceFabric_FabricTransport_Internal&gt;3.3.644&lt;\/NugetPkg_Version_Microsoft_ServiceFabric_FabricTransport_Internal&gt;\r\n\r\n\r\n\r\n\r\n&lt;MajorVersion&gt;3&lt;\/MajorVersion&gt;\r\n\r\n&lt;MinorVersion&gt;3&lt;\/MinorVersion&gt;\r\n\r\n&lt;BuildVersion&gt;17&lt;\/BuildVersion&gt;\r\n\r\n&lt;Revision&gt;0&lt;\/Revision<\/pre>\n<p>However, in my sample project I am using a slighter earlier version of the Service Fabric SDK and therefore have to go back a few commits, from 6.4.664 back 6.4.658. To find an exact match, look at AssemblineInformationVersion for one of the Service Fabric SDK assemblies referenced in the service, and match to MajorVersion.MinorVersion.BuildVersion.Revision in service_fabric.common.props. For example, looking at bin\\x64\\Release\\Microsoft.ServiceFabric.Actors.dll with ILSpy, I see AssemblineInformationVersion 3.3.15.0.<\/p>\n<pre class=\"prettyprint\">[assembly: TargetFramework(\".NETFramework,Version=v4.5\", FrameworkDisplayName = \".NET Framework 4.5\")]\r\n\r\n[assembly: AssemblyCompany(\"Microsoft\")]\r\n\r\n[assembly: AssemblyConfiguration(\"Release\")]\r\n\r\n[assembly: AssemblyCopyright(\"Copyright (c) Microsoft Corporation. All rights reserved.\")]\r\n\r\n[assembly: AssemblyFileVersion(\"3.3.15.0\")]\r\n\r\n[assembly: AssemblyInformationalVersion(\"3.3.15.0\")]\r\n\r\n[assembly: AssemblyProduct(\"Microsoft Azure Service Fabric\")]\r\n\r\n[assembly: AssemblyTitle(\"Microsoft.ServiceFabric.Actors\")]\r\n\r\n[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]\r\n\r\n[assembly: AssemblyVersion(\"6.0.0.0\")]\r\n<\/pre>\n<p>Going back a bit in commit history there is a match here: <a href=\"https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet\/blob\/fe334251815b33aa3d29f243d0c9a2ae5ea8d8d6\/properties\/service_fabric_common.props\">https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet\/blob\/fe334251815b33aa3d29f243d0c9a2ae5ea8d8d6\/properties\/service_fabric_common.props<\/a>.<\/p>\n<p>Now we can check out commit fe334251815b33aa3d29f243d0c9a2ae5ea8d8d6 and this will be an exact match for the Service Fabric SDK source code.<\/p>\n<ul>\n<li>Download and install GitHub Desktop (<a href=\"https:\/\/desktop.github.com\/\">https:\/\/desktop.github.com\/<\/a>)<\/li>\n<li>Go to the repo at <a href=\"https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet\">https:\/\/github.com\/microsoft\/service-fabric-services-and-actors-dotnet<\/a>.<\/li>\n<li>Clone repository, Open in Desktop<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"409\" height=\"261\" class=\"wp-image-39585\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-12.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-12.png 409w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-12-300x191.png 300w\" sizes=\"(max-width: 409px) 100vw, 409px\" \/><\/p>\n<ul>\n<li>Set the local path for the repo<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"511\" height=\"305\" class=\"wp-image-39586\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-13.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-13.png 511w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-13-300x179.png 300w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><\/p>\n<ul>\n<li>The repo has the latest commit from June 1<sup>st<\/sup>, 2020<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"739\" height=\"191\" class=\"wp-image-39587\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-14.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-14.png 739w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-14-300x78.png 300w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/p>\n<ul>\n<li>Open command prompt in Git Desktop<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"405\" height=\"331\" class=\"wp-image-39588\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-15.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-15.png 405w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-15-300x245.png 300w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/p>\n<ul>\n<li>Checkout commit above<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"1275\" height=\"449\" class=\"wp-image-39589\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-16.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-16.png 1275w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-16-300x106.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-16-1024x361.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-16-768x270.png 768w\" sizes=\"(max-width: 1275px) 100vw, 1275px\" \/><\/p>\n<ul>\n<li>We can see we have the version we were looking for in service-fabric-services-and-actors-dotnet\\properties\\service_fabric_common.props<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"993\" height=\"131\" class=\"wp-image-39590\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-17.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-17.png 993w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-17-300x40.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-17-768x101.png 768w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/p>\n<ul>\n<li>To go go back to the most recent local commit type git checkout develop<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" width=\"1047\" height=\"317\" class=\"wp-image-39591\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-18.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-18.png 1047w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-18-300x91.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-18-1024x310.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-18-768x233.png 768w\" sizes=\"(max-width: 1047px) 100vw, 1047px\" \/><\/p>\n<p>Git for Windows (<a href=\"https:\/\/gitforwindows.org\/\">https:\/\/gitforwindows.org\/<\/a>) is a great tool that you could use for this as well.<\/p>\n<p><strong>#2. Run code that will execute the code path that you want to test <\/strong><\/p>\n<p>This will ensure that the that the relevant assemblies have loaded into the process. In my case, I go to <a href=\"http:\/\/localhost:8181\/api\/Actors\/1\">http:\/\/localhost:8181\/api\/Actors\/1<\/a> in my browser, and the ASP.NET Core controller then calls a Service Fabric Actor service using an ActorProxy andService Fabric Remoting. The Actor method throws a custom FabricNotReadableException, MyFabricTransientException(&#8220;My custom FabricTransientException&#8221;), and after some retries the ActorProxy fails and throws an exception.<\/p>\n<p><img decoding=\"async\" width=\"1683\" height=\"409\" class=\"wp-image-39592\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost.png\" alt=\"Machine generated alternative text: CD O localhost:8181\/api\/Actors\/1 An unhandled exception occurred while processing the request. TaskCanceIedException: A task was canceled. func, CancellationToken cancellationToken, Type0 daNotRetryExceptionTypes) Query Cookies Headers TaskCanceIedException: A task was canceled. func, CancellationTcken cance'IatianTaken, Typec dcNctRetryExceptianTypes: headers, byteC requestVsg3cdy, CancelletianTaken cancelLationToken) interfaceld, int method'd, abject requestVsgBodyVa'ue, CancelletianTaken cancellation Token) id, int deLayMs) in ActorsContr011er. return await Task. \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost.png 1683w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost-300x73.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost-1024x249.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost-768x187.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-cd-o-localhost-1536x373.png 1536w\" sizes=\"(max-width: 1683px) 100vw, 1683px\" \/><\/p>\n<p><strong>#3 Attach to the service you want to debug<\/strong><\/p>\n<p>Now attach to the service, which in my case is a Stateless Service called StatlessWebApp2 that has the ASP.NET Core code I want to debug. I am using Visual Studio 2019, with a local development cluster.<\/p>\n<p><img decoding=\"async\" width=\"817\" height=\"323\" class=\"wp-image-39593\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-attach-to-proc.png\" alt=\"Machine generated alternative text: Attach to Process Connection type: Connection target: Default KS800K Find... Connection type information The default connection lets pu select processes on this computer or a remote computer running the Visual Studio Remote Debugger (MSVSMON.EXE). Attach to: Available processes Process Stateless'UebApp2.exe Automatic: Managed (v4.6, v4.5, v4.O) code Tltle web Type Managed User Name NETUORK SERVICE \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-attach-to-proc.png 817w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-attach-to-proc-300x119.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-attach-to-proc-768x304.png 768w\" sizes=\"(max-width: 817px) 100vw, 817px\" \/><\/p>\n<p><strong>#4. Load Service Fabric SDK assemblies<\/strong><\/p>\n<p>You may need to set the symbol path in Visual Studio. To do that go File Menu, to Debug\\Options\\, then to Debugging\\Symbols. And make sure that Microsoft Symbol Servers checkbox is selected. You could add a reference to symbols for your code as well here. If you have set _NT_SYMBOL_PATH environment variable, which I hav, it will show up in the UI here as well.<\/p>\n<p><img decoding=\"async\" width=\"469\" height=\"115\" class=\"wp-image-39594\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-19.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-19.png 469w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/word-image-19-300x74.png 300w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/p>\n<p>In order for your breakpoint to be hit, you have to be sure that the Service Fabric SDK symbols are loaded. Since you executed the code path you are interested in (#2), now you can go to Debug\/Windows\/Modules and load the symbols needed. You will see <em>Symbol Status: Symbols loaded<\/em> if this successful. Symbols may not be found for some assemblies, like Microsoft.ServiceFabric.Internal.dll, which does not have public symbols.<\/p>\n<p><img decoding=\"async\" width=\"1523\" height=\"299\" class=\"wp-image-39595\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-modules-searc.png\" alt=\"Machine generated alternative text: Modules Search: fab ric.dll MicrosoftServicZicServices.dII MicrosoftServicZic.InternaI.dII SystemZricStrings.dII MicrosoftServicZic.Diagnostics.dII MicrosoftServic ric.AspNetCore.dII aricAspNetCore.KestreI.dII MicrosoftServic ZicActors.dII MicrosoftServic MicrosoftServic ricServices.Remoting.dII Microsoft. Serviceric\u2022z ricTransport.dII SystemZric.Ma na gement.ServiceModeI.dII Microsoft. Serviceri nternaI.Strings.dII Path bf3856ad364e... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg.... bf38S6... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg.... C: \\SfD ebAppTy ebApp2Pkg.... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg.... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg.... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg... C: \\SfD evCIuster\\ ebAppTy ebApp2Pkg.... Optimized Yes Yes User Code N\/A N\/A N\/A N\/A N\/A N\/A N\/A N\/A N\/A N\/A N\/A N\/A Symbol Status Symbols loaded. Symbols loaded. Cannot find or open the P... Symbols loaded. Cannot find or open the P... Symbols loaded. Symbols loaded. Symbols loaded. Symbols loaded. Symbols loaded. Symbols loaded. Cannot find or open the P... Symbol File D: m bo Is\\Syste m D: m bo Is\\Syste m D: m bo Is\\Syste m O 13 14 111 112 115 116 117 Version 701 409.95... 303.150 604.658.95... 701 409.95... 604.658.95... 303.10 303.10 303.150 303.150 604.658.95... 604.658.95... 604.658.95... Timestamp 4\/11\/2D20 PM &lt; Unknown&gt; 4\/25\/2019 1225 PM 4\/11\/2020 PM 4\/25\/2019 1225 PM &lt; Unknown&gt; &lt; Unknown&gt; &lt; Unknown&gt; &lt; Unknown&gt; 4\/25\/2019 1226 PM 4\/25\/2019 1223 PM 4\/25\/2019 1224 PM \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-modules-searc.png 1523w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-modules-searc-300x59.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-modules-searc-1024x201.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-modules-searc-768x151.png 768w\" sizes=\"(max-width: 1523px) 100vw, 1523px\" \/><\/p>\n<p><strong>#5. Set a breakpoint in the Service Fabric SDK<\/strong><\/p>\n<p>Now you are ready to find the source file you are interested in and set a breakpoint. For example in \\src\\Microsoft.ServiceFabric.Services.Remoting\\Client\\ServiceRemotingExceptionHandler.cs in order to see how certain exceptions are handled on the client side.<\/p>\n<p><img decoding=\"async\" width=\"881\" height=\"299\" class=\"wp-image-39596\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-if-the-excepti.png\" alt=\"Machine generated alternative text: if the exception is handled; bool IExceptionHand1er. TryHand1eException( Exceptionlnformation exceptionlnformation, OperationRetrySettings retrySettings, ExceptionHand1ingResu1t out otherwise, false.&lt;\/returns&gt; O 82 if (exceptionlnformation. Exception is FabricNotPrimaryException if (exceptionlnformation. TargetRep1ica = TargetRep1icaSe1ector. PrimaryRep1ica) esul ExceptionHand1ingRetryResu1t( new exceptionlnformation . Exception , false, retrySettings , retrySettings . DefaultmaxRetryCountForNonTransientErrors) ; \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-if-the-excepti.png 881w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-if-the-excepti-300x102.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-if-the-excepti-768x261.png 768w\" sizes=\"(max-width: 881px) 100vw, 881px\" \/><\/p>\n<p><strong>#6. Execute Code that will hit the breakpoint set in the Service Fabric SDK<\/strong><\/p>\n<p>When I navigate to <a href=\"http:\/\/localhost:8181\/api\/Actors\/1\">http:\/\/localhost:8181\/api\/Actors\/1<\/a> again, this code on the client side is hit in the Service Fabric SDK source code. Now I can inspect variables and step through the Service Fabric SDK source code.<\/p>\n<p><img decoding=\"async\" width=\"1609\" height=\"743\" class=\"wp-image-39597\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex.png\" alt=\"Machine generated alternative text: MiceRemotingExceptionHandIer.cs -E Miscellaneous Files Startup.cs Service Manifest x ml Program.cs TestControIIer Web Host Environment.cs setup.cmd.backup Web Listener Program.cs Settings .x ml Startup.cs MicrosoftServiceFabricServices.Remoting.CIientServiceRemotingExceptionHandIer TyHandIeException(ExceptionInformation exceptionlnformation, OperationRetySettings retry' 824 &lt;summary&gt; Examines the exception and determines how that exception can be handled. &lt; \/ summary&gt; (param name=&quot;exceptionInformation&quot;&gt;The information about the exception . (param name=&quot;retrySettings&quot;&gt;The operation retry preferences (param name=&quot;resu1t&quot;&gt;The result of the exception handling. &lt;returns&gt;true if the exception is handled; otherwise, false.&lt;\/returns&gt; bool IExceptionHand1er. TryHand1eException( Exceptionlnformation exceptionlnformation, OperationRetrySettings retrySettings, ExceptionHand1ingResu1t result) out a\u2014if (exceptionlnformaticn. Exception is FebrickctPrimaryException if (exceptionlnformation. TargetRep1ica = TargetRep1icaSe1ector. PrimaryRep1ica) result \u2014 ExceptionHand1ingRetryResu1t( new exceptionlnformation. Exception , false, retrySettings , retrySettings . DefaultmaxRetryCountForNonTransientErrors) ; return true; ServiceTrace. Source. Writelnfo( 110% Watch I Search (Ctrl+E) Name No issues found TraceType , Search Depth: 3 Value {&quot;My custom FabricTransientException&quot;'r In: 82 Ch: 13 sec CRI X Call Stack Name exceptionlnformation.&amp;ception Add item to watch Type System.Exception {Th... O MicrosoftServiceFabricServices.Remoting.dII!MicrosoftServiceFabricServices.Remoting.CIientServiceRemotingExceptionHandIer.Microso... C# Microsoft ServiceFabricServices.dII! Microsoft Microsoft ServiceFabricServices.dII! Microsoft ServiceFabricServices.Communication.CIient.CommunicationCIientFactory8ase&lt; Microsoft S Microsoft ServiceFabricServices.dII! Microsoft MicrosoftServiceFabricServices.Remoting.dII!MicrosoftServiceFabricServices.Remoting.VI .FabricTransport.CIient.FabricTransportServiceRe... C# Microsoft ServiceFabricServices.dII! Microsoft ServiceFabric.Services.Communication.CIient.ServicePartitionCIient&lt; Microsoft ServiceFabric.\u201e. \" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex.png 1609w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex-300x139.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex-1024x473.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex-768x355.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/06\/machine-generated-alternative-text-miceremotingex-1536x709.png 1536w\" sizes=\"(max-width: 1609px) 100vw, 1609px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, Premier Consultant Kurt Schenk shows how to debug into the source code of the Service Fabric SDK which is used to develop Reliable Services and Reliable Actors.<\/p>\n","protected":false},"author":582,"featured_media":39596,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[80,6699,1,113],"tags":[2678,116,82],"class_list":["post-39534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-c","category-permierdev","category-visual-studio","tag-azure-service-fabric","tag-c","tag-debug"],"acf":[],"blog_post_summary":"<p>In this blog, Premier Consultant Kurt Schenk shows how to debug into the source code of the Service Fabric SDK which is used to develop Reliable Services and Reliable Actors.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/39534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=39534"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/39534\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/39596"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=39534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=39534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=39534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}