Known Issue with ElementHost/WindowsFormsHost?

337 views
Skip to first unread message

rudigrobler

unread,
Jul 5, 2008, 10:00:02 AM7/5/08
to WPF Disciples
Is this a known problem?

I have a WindowsForms application with a ElementHost hosting a WPF
UserControl. In this user control I use WindowsFormHost to host a
WinForms control... This works when I run this but it always crashes
my VS? Sometimes when I open the designer else if I close VS? Is this
a known issue?

Regards,

Rudi

PS. This is a XP machine running XP SP3 and VS2008 (SP1 is NOT
installed)?

Josh Smith

unread,
Jul 5, 2008, 10:03:24 AM7/5/08
to wpf-di...@googlegroups.com
I don't know about that bug, but here's a possible workaround.  Have your project launch a shim exe that just opens your real exe.  That might prevent VS from crashing, tho you'll have to attach the debugger to your exe when you want to debug it.

Josh

rudigrobler

unread,
Jul 5, 2008, 10:13:08 AM7/5/08
to WPF Disciples
Wow, do you guys never sleep.. work on weekends, etc...

Tnx Josh,

The problem is not that my exe is crashing VS but that the project
(Winforms) that hosts a WPF usercontrol with a winforms control on it
crashes... Even if I do not run it!!!

If the designer is not open, my project opens file... If I then open
the winforms for, that host my user control... then it crashes or if I
then close VS...

I only saw this now while preparing for my talks at tech-ed where i am
doing some WPF/WinForms interop stuff...

Try the following:

Create a WinFroms app and add a elementhost. Create a WPF user control
and in this user control add a expander. In the expander add a
winformshost and in the winformshost, add a winforms monthcalander!

This is exactly what crashes my VS? Please note that my VS is without
SP1? Don't know if it is a bug or if SP1 even fixed it?
> > installed)?- Hide quoted text -
>
> - Show quoted text -

Corrado Cavalli

unread,
Jul 6, 2008, 7:55:49 AM7/6/08
to wpf-di...@googlegroups.com
If you would like to test it on SP1 just send me a sample that reproduces
the problem.
Corrado

rudigrobler

unread,
Jul 8, 2008, 8:46:24 AM7/8/08
to WPF Disciples
Ok, it gets a little weirder...

If I un-install stylecop it gets better... now my designer never
crashes but when I close the solution I still get the VS eeror occured
dialog, do you want VS to restart...

Weird!

Also have a look at this article...

http://www.wiredprairie.us/blog/index.php/archives/399

rudigrobler

unread,
Jul 21, 2008, 6:13:39 AM7/21/08
to WPF Disciples
Just a quick note... just installed SP1 and it seemed to fix the
issues I had!
Reply all
Reply to author
Forward
0 new messages