Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

Longstanding WinForms bug:  System.ComponentModel.Win32Exception: Class already exists

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bern McCarty - 28 Apr 2005 18:08 GMT
http://groups-beta.google.com/group/microsoft.public.vsnet.vstools.office/browse
_frm/thread/35b4a645edcfbc3b/07f785365ada27b7?q=System.ComponentModel.Win32Excep
tion+%22Class+already+exists%22&rnum=3&hl=en#07f785365ada27b7


We are encountering this bug in our .NET 1.1 (SP1) application when loading
our own concept of an "AddIn" into non-default application domains.  We
desperately need this bug fixed.  The alternative seems to be to give up on
running AddIns in their own application domain and instead forcing them to
all run in the default application domain with the host application itself.
The disadvantages of that are obvious enough - we lose the nice isolation
and we lose the ability to unload the AddIn's assemblies until host process
exit.  We lose the ability to ensure that all of the resources being held by
the AddIn are let go.

I've done a lot of googling around to try to find out more about this
problem and the above link is the only case where I found any kind of
Microsoft response.  That workaround wouldn't fly for us and, though there
is really no follow-up in the thread once the workaround code was posted, I
really doubt it did the job for most VSTO developers either.  Just disposing
of ALL controls seems to assume there is only one AddIn that has created any
controls on the thread.  Not our model.  Also, I think that there are HWND
backed comnponents that are not controls aren't there?  Like ContextMenus,
etc.?

When googling around I found a handful of people reporting that they'd
encountered this bug over the last couple of years.  If anyone knows of an
approach to solving or working around this problem please share it.

Can someone from Microsoft comment on whether this bug is fixed in .NET 2?
Might a hotfix or something be forthcoming for .NET 1.1?  Has the bug been
acknowledged/logged by Microsoft yet?

Bern McCarty

Bentley Systems, Inc.
Dmytro Lapshyn [MVP] - 29 Apr 2005 16:20 GMT
There is a property on a Form called CreateParams. You can override this
property to provide your own values for such properties of CreateParams as
ClassName and ClassStyle.
Now, let's do the following trick. Each plug-in has an associated class name
for dialog windows. All plug-ins share a derived Form which accepts the
class name in the constructor.
Each plug-in registers and unregisters its own window class and upon showing
the dialog box, configures the derived Form to use the class name associated
with the plug-in.

Signature

Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]

> http://groups-beta.google.com/group/microsoft.public.vsnet.vstools.office/browse
_frm/thread/35b4a645edcfbc3b/07f785365ada27b7?q=System.ComponentModel.Win32Excep
tion+%22Class+already+exists%22&rnum=3&hl=en#07f785365ada27b7

>
[quoted text clipped - 29 lines]
>
> Bentley Systems, Inc.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.