Troubleshooting
This page guides you about the possible exceptions which you may encounter while using the NCache along with the appropriate workarounds to deal with them.
Disabling BinaryFormatter Serialization And Deserialization
Message: BinaryFormatter serialization and deserialization are disabled within this application.
You'll encounter this exception with ASP.NET 5.0 or above and .NET 8.0 or above. As in both cases, the Binary Formatter is disabled by default. This issue can be solved by using the following workarounds.
Workaround
- Enable the Binary Formatter by adding the following tag in
project.csproj
file:
<PropertyGroup>
...
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
...
</PropertyGroup>
Note
This is explained further here.
- Alternatively, you can use JSON Serialization instead of Binary Serialization as the serialization format at the time of cache creation.
Note
It is recommended that you use the JSON serialization.
No sigar-amd64-winnt.dll in java.library.path
If you haven't included the sigar-amd64-winnt.dll
file for Windows or the sigar-amd64-winnt.so
file for Linux in your class path, you will encounter this warning, and when this happens, you won't be able to monitor your counters (in Java).
Workaround
Include the sigar-amd64-winnt.dll
file for Windows or the sigar-amd64-winnt.so
file for Linux in your classpath.
InvalidOperationException: Missing 'UseWindowsThreadPool' Flag in Runtime Configuration
Message: The flag 'System.Threading.ThreadPool.UseWindowsThreadPool' is not set to true in application runtimeconfig.json. It is mandatory for .NET 7.0 and greater versions.
You'll encounter this exception with .NET 7.0 and above if you haven't set the System.Threading.ThreadPool.UseWindowsThreadPool
flag to true in the application runtime configuration. Without this configuration, the application cannot utilize the Windows Thread Pool for optimized thread scheduling and execution.
Workaround
Set the System.Threading.ThreadPool.UseWindowsThreadPool
flag to true in the application configuration:
{
"runtimeOptions": {
"configProperties": {
"System.Threading.ThreadPool.UseWindowsThreadPool": true
}
}
}
InvalidConfigurationException: Missing or Insufficient 'MinThreads' Setting in Runtime Configuration
Message: The flag 'System.Threading.ThreadPool.MinThreads' is not set to 100 or greater in application runtimeconfig.json. It is mandatory for .NET 7.0 and greater versions.
This exception occurs because the System.Threading.ThreadPool.MinThreads
flag in the application runtime configuration is not set to a value of 100 or greater in Linux. This setting is mandatory in .NET 7.0 and later versions.
Workaround
Set the MinimumThreads
flag to a value of 100 in the application configuration to ensure proper functionality with NCache.
{
"runtimeOptions": {
"configProperties": {
"System.Threading.ThreadPool.MinThreads": 100
}
}
}