Add .NET 8/9/10 target frameworks to fix BinaryFormatter crash in GViewer#396
Open
Copilot wants to merge 5 commits into
Open
Add .NET 8/9/10 target frameworks to fix BinaryFormatter crash in GViewer#396Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
…works - GraphViewerGDI: add net8.0-windows, net9.0-windows, net10.0-windows TFMs - GraphViewerGDI: add GenerateResourceUsePreserializedResources=true for net472 fix - GraphViewerGDI.nuspec: add NuGet entries for new TFMs - All tool, test, and sample projects: add net8/9/10-windows TFMs
Copilot
AI
changed the title
[WIP] Fix crash in .NET 9 due to missing BinaryFormatter
Add .NET 8/9/10 target frameworks to fix BinaryFormatter crash in GViewer
Jun 3, 2026
Restore lines clobbered while adding net8/9/10 TFMs: - RootNamespace in TestForGDI, Test01, DebugCurveViewer, FormForGViewer - UseWPF in WpfGraphControl, GraphmapsWpfControl - UseWindowsForms/WarningLevel in agl Fixes invalid XML (MSB4025) and broken WPF builds so all projects build on net9/net10 while keeping the BinaryFormatter crash fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
snechaev
reviewed
Jun 4, 2026
Comment on lines
+49
to
+57
| <group targetFramework="net8.0-windows7.0"> | ||
| <frameworkReference name="Microsoft.WindowsDesktop.App.WinForms" /> | ||
| </group> | ||
| <group targetFramework="net9.0-windows7.0"> | ||
| <frameworkReference name="Microsoft.WindowsDesktop.App.WinForms" /> | ||
| </group> | ||
| <group targetFramework="net10.0-windows7.0"> | ||
| <frameworkReference name="Microsoft.WindowsDesktop.App.WinForms" /> | ||
| </group> |
Contributor
Contributor
levnach
approved these changes
Jun 4, 2026
GraphViewerGDI.nuspec: remove frameworkReference entries for net8/9/10 (only net6 kept); adding Microsoft.WindowsDesktop.App.WinForms for modern TFMs triggers issue #390 (NETSDK1073). WpfGraphControl.nuspec: add dependency groups and lib file entries for net8/9/10-windows so the WPF package ships the new TFM build artifacts, without adding frameworkReference entries (beware of issue #390). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
levnach
approved these changes
Jun 4, 2026
There was a problem hiding this comment.
Pull request overview
This PR expands the target frameworks across MSAGL’s WinForms/WPF viewer components, tools, tests, and samples to produce dedicated net8.0*, net9.0*, and net10.0* binaries so that .NET 9+ consumers avoid the BinaryFormatter-based ImageListStreamer .resx deserialization crash, and updates NuGet packaging accordingly.
Changes:
- Multi-targets Windows desktop projects with
net8.0-windows,net9.0-windows,net10.0-windows(in addition to existingnet472/net6.0-windows). - Updates
GraphViewerGDIbuild settings for binary.resxresources viaGenerateResourceUsePreserializedResources=true. - Extends
.nuspecdependency groups andlib/assets to ship assemblies for the new TFMs.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| GraphLayout/WriteToSvgSample/WriteToSvgSample.csproj | Adds net8.0;net9.0;net10.0 multi-targeting for the non-Windows SVG sample. |
| GraphLayout/tools/WpfGraphControl/WpfGraphControl.nuspec | Adds dependency groups and lib/ entries for net8/9/10 assets. |
| GraphLayout/tools/WpfGraphControl/WpfGraphControl.csproj | Adds net8/9/10-windows TFMs to build WPF control binaries for newer runtimes. |
| GraphLayout/tools/GraphViewerGDI/GraphViewerGDI.nuspec | Adds dependency groups and lib/ entries for net8/9/10 assets. |
| GraphLayout/tools/GraphViewerGDI/GraphViewerGDI.csproj | Adds net8/9/10-windows TFMs and enables preserialized resources for binary .resx. |
| GraphLayout/tools/GraphmapsWpfControl/GraphmapsWpfControl.csproj | Adds net8/9/10-windows TFMs for downstream WPF control. |
| GraphLayout/tools/FormForGViewer/FormForGViewer.csproj | Adds net8/9/10-windows TFMs for downstream tool/library. |
| GraphLayout/tools/DebugCurveViewer/DebugCurveViewer.csproj | Adds net8/9/10-windows TFMs for downstream tool. |
| GraphLayout/tools/agl/agl.csproj | Adds net8/9/10-windows TFMs for downstream tool. |
| GraphLayout/TinyClickDemo/TinyClickDemo.csproj | Adds net8/9/10-windows TFMs for a demo app. |
| GraphLayout/Test/VoronoiDiagramTest/VoronoiDiagramTest.csproj | Adds net8/9/10-windows TFMs for test app. |
| GraphLayout/Test/TestGraphmaps/TestGraphmaps.csproj | Extends existing test multi-targeting to include net9/10-windows. |
| GraphLayout/Test/TestFormForGViewer/TestFormForGViewer.csproj | Adds net8/9/10-windows TFMs for test project. |
| GraphLayout/Test/TestForGDI/TestForGDI.csproj | Adds net8/9/10-windows TFMs for test app. |
| GraphLayout/Test/Test01/Test01.csproj | Adds net8/9/10-windows TFMs for test app. |
| GraphLayout/Samples/WpfApplicationSample/WpfApplicationSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/WpfApplicationSample_OnnxViewer/WpfApplicationSample_OnnxViewer.csproj | Converts single target to multi-target including net8/9/10-windows. |
| GraphLayout/Samples/WindowsApplicationSample/WindowsApplicationSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/UsingMDSLayoutSample/UsingMDSLayoutSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/SvgLayerSample/SvgLayerSample.csproj | Adds net8.0;net9.0;net10.0 multi-targeting for the non-Windows SVG sample. |
| GraphLayout/Samples/SimplestWinFormsSample/SimplestWinFormsSample.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/SameLayerSample/SameLayerSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/PopulateGViewerWithPrecalculatedDrawingGraph/PopulateGViewerWithPrecalculatedDrawingGraph.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/PhyloTreeSampleOverGDI/PhyloTreeSampleOverGDI.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/PhyloTreeFromGeometrySample/PhyloTreeFromGeometrySample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/NodesWithImages/NodesWithImages.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/MinWpfApp/MinWpfApp.csproj | Adds net8/9/10-windows TFMs for WPF sample. |
| GraphLayout/Samples/LocationLabeling/LocationLabeler.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/LoadingDgmlGraph/LoadingDgmlGraph.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/LayoutOfADisconnectedGraphWithSugiyama/LayoutOfADisconnectedGraphWithSugiyama.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/LayerConstraintsFromGeometrySample/LayerConstraintsFromGeometrySample.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/GeometryRoutinesSample/GeometryRoutinesSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/FindEmptySpotSample/FindEmptySpotSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/FastIncrementalLayoutWithGdi/FastIncrementalLayoutWithGdi.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/Editing/Editing.csproj | Adds net8/9/10-windows TFMs for WinForms sample. |
| GraphLayout/Samples/EdgeRoutingSample/EdgeRoutingSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/EdgeDirectionTest/EdgeDirectionTest.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/DrawingFromGeometryGraphSample/DrawingFromGeometryGraphSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
| GraphLayout/Samples/AspectRatioSample/SettingGraphBoundsSample.csproj | Adds net8/9/10-windows TFMs for sample app. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+36
| <group targetFramework="net8.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> | ||
| <group targetFramework="net9.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> | ||
| <group targetFramework="net10.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> |
Comment on lines
+35
to
+43
| <group targetFramework="net8.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> | ||
| <group targetFramework="net9.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> | ||
| <group targetFramework="net10.0-windows7.0"> | ||
| <dependency id="Msagl.Drawing" version="BuildVersion" /> | ||
| </group> |
NikolajBjorner
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GViewer()crashes on .NET 9+ withPlatformNotSupportedExceptionbecauseGViewer.resxembeds anImageListStreamerasapplication/x-microsoft.net.object.binary.base64— a format requiringBinaryFormatter, which was completely removed in .NET 9.Windows Forms in .NET 9+ reimplemented
ImageListStreamerdeserialization withoutBinaryFormatter. The fix is to ship dedicated TFM binaries so .NET 9/10 consumers get the runtime that handles this natively.Core library (
GraphViewerGDI)TargetFrameworks:net472;net6.0-windows→net472;net6.0-windows;net8.0-windows;net9.0-windows;net10.0-windows<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>— required by the .NET 10 SDK for projects with binary.resxresources targetingnet472GraphViewerGDI.nuspecwith dependencies and<files>entries for the three new TFMsDownstream projects
Add
net8.0-windows,net9.0-windows,net10.0-windowsTFMs to:FormForGViewer,DebugCurveViewer,agl,WpfGraphControl,GraphmapsWpfControlTestFormForGViewer,TestForGDI,Test01,VoronoiDiagramTest,TestGraphmapsnet472;net6.0-windowsornet6.0-windowsWriteToSvgSample/SvgLayerSample(non-Windows): extend withnet8.0,net9.0,net10.0