icsharpcode / WpfDesigner

The WPF Designer from SharpDevelop
MIT License
949 stars 251 forks source link

Application freezes on element selection #33

Closed mnusr closed 7 years ago

mnusr commented 7 years ago

Steps to reproduce:

  1. New WPF project and reference nuget package.
  2. In MainWindow:
    <Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        xmlns:design="http://sharpdevelop.net"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <design:DesignSurface x:Name="designSurface" ></design:DesignSurface>
    </Grid>
    </Window>
  3. In the main window constructor:
    using (var xmlReader = XmlReader.Create(@"C:\temp\NewFileTemplate.xaml"))
    {
                designSurface.LoadDesigner(xmlReader, new XamlLoadSettings());
    }
  4. The XAML file:
    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="640" Height="480">
    <Grid>
        <Button Content="test" Height="20" Width="73"></Button>
    </Grid>
    </Window>
  5. Run the application and select "test" button. There the entire application freezes, and when using the source I pause and I can see it's actually stuck in AdornerPanel.cs line 137.

Am I doing something wrong here? You're help is greatly appreciated.

PS. something went wrong with my other account, so had to close the other issue.

jogibear9988 commented 7 years ago

Look at my SimpleSample in the Repository. I've updated to the newest Nuget, changed the content of the "xaml" variable in the MainWindow CodeBehind to your Content (from step 5.).

After that I run and Selected the Button. Does work without any Problem

mnusr commented 7 years ago

Thanks for your response. I've just noticed that this seems to be happening when targeting .NET Framework 4.7 and if I downgrade to 4.6.2 it seems to be working. Is there a way around this?

jogibear9988 commented 7 years ago

Should be fixed in newest nuget