Debug NCache Providers in Visual Studio
In case you wish to debug the providers for NCache like ReadThru
, WriteThru
, WriteBehind
, you can do so by attaching the NCache Service to the application. This enables run time debugging through the standard debugging commands.
Important
- The provider must be built in Debug mode. Debugging will not be enabled for projects built in Release configuration.
- Cache host processes for .NET Framework are named as Alachisoft.NCache.CacheHost.exe and for .NET Core server are named as dotnet.exe.
Open up Task Manager and go to the details page where processes will be listed depending upon the number of caches running on the node.
To select the appropriate cache, enable the Command Line column so that it is visible in the details tab.
After selecting the cache, now you can move to your application and attach the provider with the appropriate cache.
Note the PID for the cache against which you want to debug the provider and then in Attach to Process... window select the process with same PID you want to debug.
In your application, insert a breakpoint in your application from where you want to debug.
From the menu bar click on Debug and select Attach to Process... option as shown below.
- Select
Alachisoft.NCache.CacheHost.exe
in Processes.
Make sure that options Show processes from all users and Show processes in all sessions are selected.
Click Attach.
Any operation now being performed over NCache will throw a hit in the debug code, allowing in depth debugging of the feature.
Important
For more detail on attaching processes with various configurations to debug, please refer to this Microsoft documentation.
See Also
Memcached Wrapper and Gateway Support for NCache
Entity Framework Core Caching