8000 Use the BinaryFormatter only on .NET FW and Mono by filmor · Pull Request #2470 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Use the BinaryFormatter only on .NET FW and Mono #2470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

filmor
Copy link
Member
@filmor filmor commented Oct 1, 2024

Should fix #2469

@filmor filmor force-pushed the fix-binaryformatter-usage branch from b696f83 to 4ccde5b Compare October 27, 2024 12:46
Copy link
Member
@lostmsu lostmsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good, but I'd like NITs to be fixed and the commit squashed

@@ -33,6 +33,10 @@ static T SerializationRoundtrip<T>(T item)
{
using var buf = new MemoryStream();
var formatter = RuntimeData.CreateFormatter();

if (formatter == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to make the whole test class [Obsolete] to prevent warnings

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, for the time being, we still by default support this functionality on .NET FW and Mono. Which warning are you referring to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obsolete code warning that comes from using BinaryFormatter. You can see it on GitHub review page.

@filmor filmor force-pushed the fix-binaryformatter-usage branch from 4ccde5b to 1c0afe6 Compare October 28, 2024 07:52
@filmor
Copy link
Member Author
filmor commented Oct 28, 2024

Well, without the stashing, Shutdown+Initialize cycles are broken. This is going to be a lot more work than anticipated.

@lostmsu
Copy link
Member
lostmsu commented Oct 28, 2024

We could consider dropping the support for Shutdown/Initialize for .NET Core+. I don't know if there are any good scenarios for it. It is much safer to spawn a new process.

@filmor filmor force-pushed the fix-binaryformatter-usage branch from 958dd30 to 3cd685e Compare February 20, 2025 16:29
@@ -124,6 +132,12 @@ internal static void RestoreRuntimeData()

private static void RestoreRuntimeDataImpl()
{
IFormatter? formatter = CreateFormatter();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think coming here should be an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BinaryFormatter deprecation issue while using PythonEngine.Shutdown()
2 participants
0