Closed Liv-Goh closed 2 days ago
@Liv-Goh does #11614 fix this?
@Liv-Goh does #11614 fix this?
@elachlan No, the issue still repro on https://github.com/dotnet/winforms/pull/11614 branch
Stack trace:
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink) in C:\Users\v-rbossan\source\repos\winforms\11657\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs:line 175
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) in C:\Users\v-rbossan\source\repos\winforms\11657\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs:line 916
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) in C:\Users\v-rbossan\source\repos\winforms\11657\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs:line 962
We're dependent on BinaryFormatter for CodeDomSerialization. Validated this doesn't happen with the package reference added.
Verified the issue on the latest DemoConsole test app of Winforms repo from main branch, the issue still repro, ListView clears all item in ListView instead of undo previous move.
Sorry, I misread this. An exception is being thrown here:
> System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string exceptionText, string helpLink) Line 175 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string name, System.CodeDom.CodeExpression expression) Line 916 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string name, System.CodeDom.CodeExpression expression) Line 962 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string name, System.CodeDom.CodeExpression expression) Line 845 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, System.CodeDom.CodeStatement statement) Line 424 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.ResolveName(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string name, bool canInvokeManager) Line 313 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.Deserialize(System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, System.Collections.Generic.Dictionary<string, System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.CodeDomComponentSerializationState> objectState, System.Collections.Generic.List<string> objectNames, bool applyDefaults) Line 101 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.CodeDomSerializationStore.Deserialize(System.IServiceProvider provider, System.ComponentModel.IContainer container, bool validateRecycledTypes, bool applyDefaults, System.Collections.Generic.List<object> objects) Line 251 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.CodeDomSerializationStore.DeserializeTo(System.IServiceProvider provider, System.ComponentModel.IContainer container, bool validateRecycledTypes, bool applyDefaults) Line 274 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.Serialization.CodeDomComponentSerializationService.DeserializeTo(System.ComponentModel.Design.Serialization.SerializationStore store, System.ComponentModel.IContainer container, bool validateRecycledTypes, bool applyDefaults) Line 177 C#
System.ComponentModel.TypeConverter.dll!System.ComponentModel.Design.Serialization.ComponentSerializationService.DeserializeTo(System.ComponentModel.Design.Serialization.SerializationStore store, System.ComponentModel.IContainer container) Unknown
System.Windows.Forms.Design.dll!System.ComponentModel.Design.UndoEngine.UndoUnit.ChangeUndoEvent.Undo(System.ComponentModel.Design.UndoEngine engine) Line 148 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.UndoEngine.UndoUnit.UndoCore() Line 424 C#
System.Windows.Forms.Design.dll!System.ComponentModel.Design.UndoEngine.UndoUnit.Undo() Line 369 C#
DesignSurfaceExt.dll!DesignSurfaceExt.UndoEngineExt.Undo() Line 29 C#
DesignSurface.dll!TestConsole.MainForm.undoToolStripMenuItem_Click(object sender, System.EventArgs e) Line 340 C#
It looks like the variable name isn't right. This appears to be fallout from #11062, I'm looking further into it.
Verified this issue on winforms repo from main branch, it was fixed: undo a move that perform on ListView will undo previous move.
https://github.com/user-attachments/assets/9da4320f-1d4c-459a-8edb-90e31ee30d8d
.NET version
.NET 9.0 main branch of WinForms repo
Did it work in .NET Framework?
Not tested/verified
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes, this is a regression issue. Not repro on .NET 8.0 from Release/8.0 branch of WinForms repo
Issue description
Current Behavior (.NET 9.0) : In DemoConsole test app of WinForms repo, undo a move that perform on ListView clears all item in ListView instead of undo previous move.![demoConsoleUndoListViewCurrent](https://github.com/dotnet/winforms/assets/169347065/437e6279-15b9-4273-a995-04dc007f5084)
Expected Behavior (.NET 8.0) : In DemoConsole test app of WinForms repo, undo a move that perform on ListView will undo previous move.![demoConsoleUndoListViewExpected](https://github.com/dotnet/winforms/assets/169347065/bb774d77-a492-4d55-ae82-8b5921f9b45b)
Steps to reproduce
Test sample: DemoConsole in Winforms repo
More Info