Closed ventrebd closed 1 month ago
@ventrebd , good catch, there is a known issue https://github.com/Azure/hpcpack/issues/39. We need to use BinaryFormatter for backward compatibility and will migrate off it in the next major release.
Excellent, thanks. Not sure why that issue didn't come up in my searches (sure would have saved some time!). I will close this one.
Problem Description
Microsoft.HPC.SDK 6.3.8187-beta in a .NET 8.0 application fails to connect to the server -- the
scheduler.Connect
call throws a System.AggregateException with the message "Could not register with the server. Try again later."The core issue turns out to be the use of BinaryFormatter deep inside the HPC code. The deserializer has been removed & now throws "System.NotSupportedException" in the EventListener.cs source file. Microsoft docs at:
I followed the not-recommended methods in the above documentation to add the unsupported System.Runtime.Serialization.Formatters NuGet package and
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
property to my project. Unfortunately, this is not a suitable long-term solution.Steps to Reproduce
In a .NET 8.0 console application:
Expected Results
Program should execute with no errors
Actual Results
Connect
call throws a "System.AggregateException" with the message "Could not register with the server. Try again later." The debug output in Visual Studio reports many "System.NotSupportedException" errors in System.Runtime.Serialization.Formatters.dll and Microsoft.Hpc.Scheduler.Store.dllWork-around (unsafe!)
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
within<PropertyGroup>
of the csproj file.