Troubleshooting
This page guides you through 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 Core 5.0 or later and .NET 8.0 or later. As in both cases, the Binary Formatter is disabled by default. This issue can be solved by using the following workarounds.
Note
Binary Serialization is not supported in NCache 5.3.7 and onwards.
Workaround
- Enable the Binary Formatter by adding the following tag in
project.csprojfile:
<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.
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.
Unable to Handle Custom Types with JSON Serialization
Message: Unable to serialize or deserialize the specified type using JSON serialization.
You may encounter this issue when your application uses JSON serialization and a specific object type requires custom serialization or deserialization logic. This can happen when the default JSON serialization behavior is not enough for your object model.
Workaround
Configure an external Newtonsoft JsonConverter for the required custom type. For details, see External Newtonsoft JsonConverter Support.