LinqPad 9 winforms: class already exists
i am using lp since net48 days where i consumed some of my winforms assemblies without problems.
however in version 9 i get above error. the assembly i use is a net9-assembly which i have assigned in MyExtensionsHeNaRaMessageBox.Info("hallo");
creates the exception with this stacktrace
at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()
at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, WNDCLASS_STYLES classStyle)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Application.ThreadContext.get_MarshallingControl()
at System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
at LINQPad.UI.RuntimeUIServices.CreateSynchronizationContext()
at LINQPad.Util.CreateSynchronizationContext(Boolean reportActivity)
Answers
-
I've tried creating a WinForms project with a method to show a dialog, referenced it from My Extensions, and can call without error. I've also tried running it from a worker thread, again without error.
Can you provide a full repro, please?
-
hmmm. thank you. here is a simple winforms project https://dropbox.com/scl/fi/askp0zlg2rymyupjmaypj/WinFormsLib.7z?rlkey=5a9b25v8w6qt54ay0wwn83m7o&dl=0
in MyExtensions i wrap it like this
public static void ShowSimpleForm() => WinFormsLib.Class1.ShowForm();- then i compile and simply call it viaMyExtensions.ShowSimpleForm()from a new script. the form shows - the exceptions comes after the button on the form is clicked -
I still can't reproduce this. Is there anything unusual about your setup or environment? Can you double-check you don't also experience this error in LINQPad 8?
-
aaah, i am deeply sorry. instead of Linqpad 9 i was refering to Linqpad 8 all the time. our company plans the upgrade next month
-
so the title is confusing - it is all about Linqpad 8 - however the problem still exists. we are using .net9.
