Skip to content

Commit 38c87d9

Browse files
committed
Merge branch 'fix-binaryformatter-usage' into net8.0
2 parents b7d0e53 + 54d089b commit 38c87d9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/runtime/StateSerialization/RuntimeData.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@ public static class RuntimeData
1818

1919
public readonly static Func<IFormatter> DefaultFormatterFactory = () =>
2020
{
21-
try
21+
var fw = RuntimeInformation.FrameworkDescription;
22+
if (fw.StartsWith(".NET Framework") || fw.StartsWith("Mono"))
2223
{
23-
return new BinaryFormatter();
24+
try
25+
{
26+
return new BinaryFormatter();
27+
}
28+
catch
29+
{
30+
return new NoopFormatter();
31+
}
2432
}
25-
catch
33+
else
2634
{
2735
return new NoopFormatter();
2836
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy