Closed Tanya-Solyanik closed 1 year ago
This is blocking WinForms out of process designer from using resources and controls, such as ImageList. https://github.com/microsoft/winforms-designer/issues/5233
This appears to be a regression from 8.0 Preview 4, where the scenario worked correctly. I'm trying to narrow down the change.
Some initial assessment of various file contents follow. Note the unintentional inclusion of EnableUnsafeBinaryFormatterSerialization = false by default in the coreapp's runtimeconfig.json for P5 and the WindowsDesktop's runtimeconfig.json for P6. I'll ask around to see if anybody knows how these settings got added to these files.
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0-preview.4.23259.5\Microsoft.NETCore.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}
C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.0-preview.4.23260.1\Microsoft.WindowsDesktop.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"rollForward": "LatestPatch",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0-preview.4.23259.5"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0-preview.5.23280.8\Microsoft.NETCore.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.0-preview.5.23281.1\Microsoft.WindowsDesktop.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"rollForward": "LatestPatch",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0-preview.5.23280.8"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0-preview.6.23280.5\Microsoft.NETCore.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.0-preview.6.23280.3\Microsoft.WindowsDesktop.App.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "net8.0",
"rollForward": "LatestPatch",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0-preview.5.23276.1"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
The root cause of this bug seems to be https://github.com/dotnet/sdk/issues/32969.
Verified issue https://github.com/microsoft/winforms-designer/issues/5233 on .NET SDK 8.0.100-preview.5.23301.12 test pass build, it was fixed. In winforms VB project, 'Explorer Form' template form designer(contains ImageList) can be loaded successfully.
Describe the bug
The intent behind this change - https://github.com/dotnet/sdk/commit/ccfcbe828cda905f1f995f63f26485dd9a7a7dd5 was that projects with these properties
Have BinaryFormatter.Serialize/Deserialize methods enabled in .NET8. However in SDK Preview6, we are getting a
NotSupportedException
To Reproduce
<NoWarn>SYSLIB0011</NoWarn>
to the project fileResult: _System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information. at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at WinFormsApp29.Form1.button1Click(Object sender, EventArgs e) in C:\Users\tanyaso\source\repos\WinFormsApp29\WinFormsApp29\Form1.cs:line 17
Further technical details
or
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
BinaryFormatter serializes successfully.