Skip to content
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

Need an alternative solution for the ImageList.ImageStream in the .NET 9 designer. #12310

Open
ElavazhaganSF4422 opened this issue Oct 11, 2024 · 6 comments
Assignees
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues 📭 waiting-author-feedback The team requires more information from the author 💤 no-recent-activity

Comments

@ElavazhaganSF4422
Copy link

Environment

VS professional 2022 preview
17.12.0 preview 2.1

.NET version

.NET 9.0

Did this work in a previous version of Visual Studio and/or previous .NET release?

Yes, in the .NET 8.0 version, we are able to see the images in the designer. The ImageList.ImageStream is not supported starting from .NET 9 due to binary formatter serialization. Therefore, we have tried to avoid using ImageStream and added the images directly to the ImageList. In this case, the images load properly at runtime, but we are unable to see the images in the designer of projects targeted for .NET 9.

Issue description

Due to BinaryFormatter not supported in .NET 9 the ImageList.ImageStream will not support in .NET 9. . Therefore, we have tried to avoid using ImageStream and added the images directly to the ImageList. In this case, the images load properly at runtime, but we are unable to see the images in the designer of projects targeted for .NET 9.

Refer the screenshot from below,

ImageList with ImageStream screenshots in .NET 9 designer

Image

**.ImageList with directly added images in .NET 9 designer **

Image

We expected the image should be shown in the designer, but it is not shown properly. Is there any alternative solution we have to achieve this in both runtime and DesignTime

Steps to reproduce

1.Open the sample.
2.And then try to open the designer.

ImageList.zip

Observed Behavior : The Image List images are not shown in the designer.
Image

Expected Behavior : The Image List images should be shown in the designer.
Image

Diagnostics

No response

@ElavazhaganSF4422 ElavazhaganSF4422 added the untriaged The team needs to look at this issue in the next triage label Oct 11, 2024
@elachlan elachlan added the area-VSDesigner Windows Forms out-of-proc designer related issues label Oct 13, 2024
@SathiyathanamSathish
Copy link

@everyone - Could you please share the work around to overcome this?

@Zheng-Li01
Copy link
Member

@SathiyathanamSathish, thanks for your update. reference this known issue #9701, if your Visual Studio version newer than 17.12 preview2, and when your project upgrade to .NET 9 any form/control using an ImageList will not cause anything to break.

See comments that actually the System.Runtime.Serialization.Formatters nuget package will be installed by default if you Visual Studio version more than 17.12 preview2.

@JeremyKuhne
Copy link
Member

@ElavazhaganSF4422 binary formatted designer resources (designer.resx) will work without needing to take the BinaryFormatter package dependency.

The .NET runtime can extract most embedded binary formatted resources without needing the BinaryFormatter package. Embedded resources are considered "trusted" data as they are part of the assembly, so we've put some effort into making this work, specifically with the WinForms design scenario in mind.

@ElavazhaganSF4422
Copy link
Author

@Zheng-Li01
The BinaryFormatter exception was thrown while using ImageList.ImageStream in .NET 9 samples with SDK version 9.5. However, after upgrading to .NET 9.0 SDK version RC1, the exception is no longer thrown. Why is this the case? Has ImageList.ImageStream been updated to use a different serialization method?"

@JeremyKuhne
Copy link
Member

@ElavazhaganSF4422 as I mentioned above #12310 (comment) this scenario was enabled in the most recent previews of .NET 9. ImageList.ImageStream still uses the BinaryFormatter to serialize as an embedded designer resource.

@JeremyKuhne JeremyKuhne added 📭 waiting-author-feedback The team requires more information from the author and removed untriaged The team needs to look at this issue in the next triage labels Nov 6, 2024
Copy link
Contributor

This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 14 days.

It will be closed if no further activity occurs within 7 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues 📭 waiting-author-feedback The team requires more information from the author 💤 no-recent-activity
Projects
None yet
Development

No branches or pull requests

6 participants