Conversation
|
/cc: @kirsan31 @weltkante |
There are certain code paths where we are unable to track the lifetime of the object,
for example in the following scenarios:
this.imageList1.ImageStream = (System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"));
or
resources.ApplyResources(this.listView1, "listView1");
In those cases the loose instances will be collected by the GC.
Undo the regression introduced in dotnet#3526.
Fixes dotnet#3567
Closes dotnet#4928
104a4c5 to
706b64a
Compare
src/System.Windows.Forms/src/System/Windows/Forms/ImageList.NativeImageList.cs
Show resolved
Hide resolved
|
I think this in scope (may be I am wrong). Was introduced in same PR #3526. Is it does anything? Due to ImageStream property implementation:winforms/src/System.Windows.Forms/src/System/Windows/Forms/ImageList.cs Lines 197 to 209 in 706b64a |
src/System.Windows.Forms/tests/IntegrationTests/MauiTests/ImageListTests/MauiImageListTests.cs
Outdated
Show resolved
Hide resolved
Apologies, I am struggling to follow your train of thought/question. Could you please rephrase? |
The regression was introduced in #3526. Also in this PR this line of code was added to and this line does nothing (useful), due to ImageStream property implementation:winforms/src/System.Windows.Forms/src/System/Windows/Forms/ImageList.cs Lines 197 to 209 in 706b64a 🤗 |
Ah, yes! Thank you. Removed |
JeremyKuhne
left a comment
There was a problem hiding this comment.
It would be nice if we could avoid introducing more BinaryFormatter usage here (even in tests). We'll need an answer at some point for ImageListStreamer. I'd suggest adding an internal void ImageListStreamer.ToStream(Stream stream) and internal ImageListStream(Stream stream) to avoid the BF. Should be straight forward to implement and we can follow up with an API proposal for it.
Outside of that there are a few minor comments.
src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/ImageList.NativeImageList.cs
Show resolved
Hide resolved
I'm reusing the existing test infra that is relying on the BF. Since this is a separate piece of work not directly related to this fix I'm going to do this in a separate PR. |
|
Reworked the BF in #4966 |
|
|
|
I've requested a permission to service, will find out soon. |
|
Approved for servicing. We need a servicing PR. @RussKie |

Fixes #3567
Fixes #4913
Closes #4316
Closes #4928
Proposed changes
There are certain code paths where we are unable to track the lifetime of the object,
for example in the following scenarios:
or
In those cases the loose instances will be collected by the GC.
Undo the regression introduced in #3526.
Customer Impact
NativeImageListobjects.Regression?
Risk
Test methodology
Manual tests harness:
Before
After
Microsoft Reviewers: Open in CodeFlow