punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.25k stars 392 forks source link

When I drag an element in the listbox, an error occurred #461

Closed yingshaonian closed 1 year ago

yingshaonian commented 1 year ago

Describe the bug When I drag an element in the listbox, an error occurs, but sometimes it does not

Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x61ab3039, on thread 0x2b48 . The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.'

*My Code

<Window x:Class="AttachedPropertyTest_1.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:dd="urn:gong-wpf-dragdrop"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:AttachedPropertyTest_1"
        xmlns:viewModels="clr-namespace:AttachedPropertyTest_1.ViewMoldes"
        d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
        xmlns:System="clr-namespace:System;assembly=mscorlib" 
        mc:Ignorable="d"
        Title="MainWindow" Height="347" Width="655">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <ListBox x:Name="list1" Grid.Column="0"                
                 dd:DragDrop.IsDragSource="True"
                 dd:DragDrop.IsDropTarget="True"
                 ItemsSource="{Binding Collection1}">
        </ListBox>
        <ListBox x:Name="list2" Grid.Column="1"                 
                 dd:DragDrop.IsDragSource="True"
                 dd:DragDrop.IsDropTarget="True">
            <System:String>t1</System:String>
            <System:String>t2</System:String>
        </ListBox>
        <Button x:Name="btn" Click="btn_Click" Content="Click" Grid.Row="1" Height="30"/>
    </Grid>
</Window>
yingshaonian commented 1 year ago

I tested that if the target platform is 64 bit, there will be no crash