Azure / hpcpack

The repo to track public issues for Microsoft HPC Pack product.
MIT License
30 stars 11 forks source link

Exception connecting to HPC Pack Cluster with HPC Pack .Net SDK (6.3.*) from a .NET8 Minimal API WebService #39

Closed JDA88 closed 7 months ago

JDA88 commented 7 months ago

Problem Description

We are currently using the HPC Pack 2016 SDK to connect to multiple HPC Pack 2016 cluster.

I am trying to convert it to use the HPC Pack .Net SDK in .NET8. In Winform i have no issue, it work flawlessly. But from a Minimal API WebService, no matter the method used to connect to the cluster I get the following exception : Microsoft.Hpc.Scheduler.Properties.SchedulerException: "Could not register with the server. Try again later."

Is there anything special I have to do to be able to connect to an HPC cluster from a Minimal API WebService?

Steps to Reproduce

var Connection = new Microsoft.Hpc.Scheduler.Scheduler();
Connection.Connect(SchedulerName);

Additonal Comments

Using the HPC Pack .Net SDK (6.3.8022-beta)

YutongSun commented 7 months ago

@JDA88 , there is a known issue for using .Net SDK with .Net 8. The BinaryFormatter which is used in HPC Pack client & server has been disabled in .Net 8. Please refer to this doc. The workaround is to add the following in your project file to build with the SDK.

<PropertyGroup>
    ...
    <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>
JDA88 commented 7 months ago

Setting the value to true fixed the issue, thank you very much for that, I didn’t know BinaryFormatter was used for communication. I suppose the fact that it worked on a WinForms SDK project imply that those set it to true implicitly.

Is there a way to have a better error message or a more way to detect the fact that BinaryFormatter is not enabled at compile time? Because having a SDK compatible with .NET8+ means lots of people will use the SDK format and face the issue.

Looking at the roadmap if I understand correctly the BinaryFormatter is supposed to be removed completely from .NET9, hare you planning to have an alternative?

YutongSun commented 7 months ago

@JDA88 , that's right, we shall move away from BinaryFormatter which keeping the back-compatibility for old clients & servers.