Debug Read-through/Write-through/Write-behind in Visual Studio
If you wish to debug the providers for NCache like ReadThru
, WriteThru
, and WriteBehind
, you can do so by attaching the NCache Service to the application. This approach enables run-time debugging through the standard debugging commands. Attaching to a process allows you to debug applications or components that run outside of Visual Studio, such as services or background tasks, and offers full control to inspect the program state at runtime.
Important
- You must build the provider (Read-through/Write-through/Write-behind) in debug mode, as debugging is not enabled for projects created with a release configuration.
- Cache host processes for .NET 6 and above are called Alachisoft.NCache.CacheHost.exe and dotnet.exe for .NET.
Steps to Debug NCache Data Providers (Read-through/Write-through/Write-behind) in Visual Studio
Open Task Manager and go to the Details tab where processes running on your system are listed.
Depending upon the number of caches running on the node, select the appropriate cache. Right click on any column header within the Details tab (e.g., Name, PID, etc.) and choose Select columns.
A dialog box will appear, enable the Command line column so it is visible in the Details tab.
After selecting the appropriate cache host process from the available options, you can move to your application and attach the provider with the appropriate cache.
Note the PID for the cache host process against which you want to debug the provider.
Open Visual Studio, from the top menu bar click on Debug tab and select Attach to Process... option as shown below.
The following screen appears, ensure that the Show processes for all users option is selected.
Select
dotnet.exe
orAlachisoft.NCache.CacheHost.exe
in Process with the same PID you want to debug.
Click Attach.
In your application, insert a breakpoint from where you want to debug. Now, any operation being performed over NCache will throw an exception in the debug code allowing you to inspect and debug the flow of data in a clear and structured way.
By following the steps above, you can effectively debug NCache Providers in Visual Studio. This will enable you to examine and troubleshoot processes in real-time for improved problem solving.
Important
For further detail on attaching processes with various configurations to debug, please refer to Microsoft documentation.
See Also
Read-through
Write-through/Write-behind
Loader and Refresher