dotnet / dotnet/wpf

System.ComponentModel.Win32Exception in a window component

Open
#5,754 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity2.visualstudio.com/t/SystemComponentModelWin32Exception-in-/1258475?preview=true)._

---

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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.