dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.07k stars 1.17k forks source link

System.ComponentModel.Win32Exception in a window component #5754

Open vsfeedback opened 2 years ago

vsfeedback commented 2 years ago

This issue has been moved from a ticket on Developer Community.


Hi,

i have this errore when i try to show a preview in the window control, i know that there is dll for fixing thi problem in a web application, is there also a dll for a wpf application?

Best regards

Alberto C.


Original Comments

Fiona Niu[MSFT] on 11/17/2020, 10:55 PM:

Thank you for your feedback! In order for us to investigate this further, could you please provide repro steps, a more detailed description of the faulty behavior and the actions you were taking when the issue appeared to help us better understand this scenario? Does this reproduce for specific wpf application? If so, It would be very helpful if you could provide a sample project or some screenshots of this problem.

We look forward to hearing from you!

Alberto Cantele on 11/19/2020, 11:41 PM:

Hi,

here below you will find in order the image of exception

the stack trace

at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet) at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam) at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)


and the code use


string FrxFile = ReportGenerator.ReportStructureGenerator.ReportObject.SaveToString(); previewControl1 = new FastReport.Preview.PreviewControl();

win = new PreviewWnd(); win.Owner = System.Windows.Application.Current.MainWindow; win.WindowStartupLocation = WindowStartupLocation.CenterScreen; ReportGenerator.ReportStructureGenerator.ReportObject.Preview = win.PreviewControl; ReportGenerator.ReportStructureGenerator.ReportObject.Prepare(); ReportGenerator.ReportStructureGenerator.ReportObject.ShowPrepared(); win.PreviewControl.Buttons = FastReport.PreviewButtons.Find | FastReport.PreviewButtons.Navigator | FastReport.PreviewButtons.Print | FastReport.PreviewButtons.Save | FastReport.PreviewButtons.Zoom;

win.ShowDialog();


The preview control is define in a window called PreviewWnd and here below the xaml of the window


<Window x:Class="StampeWpf.PreviewWnd" xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="https://schemas.microsoft.com/expression/blend/2008" xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:frpreview="clr-namespace:FastReport.Preview;assembly=FastReport" xmlns:local="clr-namespace:StampeWpf" mc:Ignorable="d" Title="Anteprima report" Height="900" Width="900"> <Grid> <!--<FRControls:Viewer Name="Viewer1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> ion demos fast report wpfviewer--> <WindowsFormsHost> <frpreview:PreviewControl x:Name="PreviewControl"/> </WindowsFormsHost> </Grid> </Window>


where i don't have only the constructor in the code behind.


My goal is to show the result of Fastreport preview in the window control, if i use their preview i don't have this exception, if i put the result in the window yes.

I noticed that i have this error only when the result have a lot of pages, in this case 220.

Tell me if this is enough for finding the problem.

Best regards

Alberto C.

Feedback Bot on 11/19/2020, 11:59 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Alberto Cantele on 12/22/2020, 02:47 AM:

Hi,

have you find a possible fix to apply?

Best eegards

Alberto C.

Feedback Bot on 2/19/2021, 10:06 PM:

I detected that this issue hasn’t received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it’s my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.


Original Solutions

(no solutions)

batzen commented 2 years ago

This also just happend on my machine. It happened while moving the window of the application by dragging it on it's titlebar.

Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.Runtime.InteropServices.COMException
   bei System.Windows.Media.Composition.DUCE+Channel.SyncFlush()
   bei System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean, System.Nullable`1<ChannelSet>)
   bei System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr)
   bei System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)
   bei System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

This also resulted in the graphics driver to stop responding and being restarted shortly after the exception from my .NET application.

Der Anzeigetreiber "nvlddmkm" reagiert nicht mehr und wurde wiederhergestellt.

The application that crashed only has a single real window and 4 additional glow windows (as it's based on MahApps.Metro).

Additional entries from the event log:

Name der fehlerhaften Anwendung: FunkSharp.exe, Version: 1.0.0.0, Zeitstempel: 0xc17608db
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 10.0.19041.1202, Zeitstempel: 0xc9db1934
Ausnahmecode: 0xe0434352
Fehleroffset: 0x0000000000034f99
ID des fehlerhaften Prozesses: 0x440
Startzeit der fehlerhaften Anwendung: 0x01d7e36b6e173e8a
Pfad der fehlerhaften Anwendung: C:\Entwicklung\CurrentBranch\Open\BUILD\release\tools\FunkSharp\FunkSharp.exe
Pfad des fehlerhaften Moduls: C:\WINDOWS\System32\KERNELBASE.dll
Berichtskennung: a3ffd9e3-3693-45fa-b306-a3fbb428ef45
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 
Name der fehlerhaften Anwendung: FunkSharp.exe, Version: 1.0.0.0, Zeitstempel: 0xc17608db
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 10.0.19041.1202, Zeitstempel: 0xc9db1934
Ausnahmecode: 0xc000041d
Fehleroffset: 0x0000000000034f99
ID des fehlerhaften Prozesses: 0x440
Startzeit der fehlerhaften Anwendung: 0x01d7e36b6e173e8a
Pfad der fehlerhaften Anwendung: C:\Entwicklung\CurrentBranch\Open\BUILD\release\tools\FunkSharp\FunkSharp.exe
Pfad des fehlerhaften Moduls: C:\WINDOWS\System32\KERNELBASE.dll
Berichtskennung: eb93e55f-05ad-4c96-9240-a43e7360ae99
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 
pchaurasia14 commented 2 years ago

@batzen - Could you please share the sample application that reproduces the behavior.