0
votes

I'm trying to integrate a new WPF control into an existing WinForms application and I'm using an ElementHost(Dock-Fill) to host the following XAML UserControl. (.NET 4)

When I set the WinForm to Maximised my entire operating system crashes. I have updated to the latest NVidia Drivers for my video card, but I still end up with a BlueScreen in nvlddmkm.sys. I have searched around for others that are experiencing crashes like this, but haven't found anything other than "update video card drivers".

The CustomerOrderReadyControl specified in the UserControl is in C#, but given it's just a basic UserControl that displays the Message I haven't included it, but if you think I should, please specify in the comments.

Is there a setting that I am missing that could be causing my Application to be causing the Machine to bluescreen when I maximise the Form? Are there any other ways that I could make this scenario work given that the existing application is very heavy GDI+ for the rendering of other parts of the application?

<UserControl x:Class="WPFDisplay.CustomerOrderDisplayControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    d:DesignHeight="480" d:DesignWidth="640" xmlns:my="clr-namespace:WPFDisplay">
    <UserControl.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FFEEEEEE" Offset="0.05"/>
            <GradientStop Color="#FF333333" Offset="0.95"/>
        </LinearGradientBrush>
    </UserControl.Background>
        <Grid Name="mainGrid">

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition  Name="imageRow" Height="125" />
        </Grid.RowDefinitions>

        <my:CustomerOrderReadyControl Grid.Row="0"  x:Name="customerOrderReadyControl1" 
               Message="The Message" />
        <Image Margin="0,0,6,7" Name="displayLogo" Grid.Row="1" VerticalAlignment="Bottom" 
               HorizontalAlignment="Right" Width="302" Height="107" Stretch="None" IsHitTestVisible="False" />
    </Grid>
</UserControl>

The InitializeComponent sub in my WinForms is really this simple.

Private Sub InitializeComponent()
    Me.ElementHost1 = New System.Windows.Forms.Integration.ElementHost()
    Me.CustomerOrderDisplayControl1 = New WPFDisplay.CustomerOrderDisplayControl()
    Me.SuspendLayout()
    '
    'ElementHost1
    '
    Me.ElementHost1.Dock = System.Windows.Forms.DockStyle.Fill
    Me.ElementHost1.Location = New System.Drawing.Point(0, 0)
    Me.ElementHost1.Name = "ElementHost1"
    Me.ElementHost1.Size = New System.Drawing.Size(1058, 617)
    Me.ElementHost1.TabIndex = 0
    Me.ElementHost1.Text = "ElementHost1"
    Me.ElementHost1.Child = Me.CustomerOrderDisplayControl1
    '
    'CustomerOrderDisplayForm
    '
    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    Me.ClientSize = New System.Drawing.Size(1058, 617)
    Me.Controls.Add(Me.ElementHost1)
    Me.Name = "CustomerOrderDisplayForm"
    Me.Text = "CustomerOrderDisplayForm"
    Me.ResumeLayout(False)

End Sub

EDIT: Additional info.. If I host this control in a Pure WPF application and maximise the WPF Form, then it all works fine.

1
Does this fail only on one machine? If so, you could try these troubleshooting settings: msdn.microsoft.com/en-us/library/aa970912.aspxJoe White
my machine sadly. NVidia Quadro NVS295. Tested on another machine and it's fine. Looks like replace this crappy card with something ... BUT will it bite me in when distributed.Paul Farry
tried with the various setting mentioned there, still crashesPaul Farry

1 Answers

2
votes

Turns out this was the video card (NVidia NVS295) just not handling the WPF operations. It ended up not mattering whether it was in a full blown WPF application or embedded inside an ElementHost if the screen display full screen (1900x1200) then the machine bluescreened.