Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dispatcher processing has been suspended
Message
From
13/02/2013 14:27:05
 
 
To
13/02/2013 10:01:12
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01565872
Message ID:
01565940
Views:
39
>>>Hi,
>>>
>>>I'm trying deploy a WPF application which uses the Windows Report Viewer. My application crashes every time I try to display the report.
>>>
>>>This is the error that shows up in the Event Viewer:
>>>
>>>"Event Type: Error
>>>Event Source: IBC Express Billing System
>>>Event Category: None
>>>Event ID: 0
>>>Date: 2/13/2013
>>>Time: 9:44:05 AM
>>>User: N/A
>>>Computer: CUSTOMS
>>>Description:
>>>Dispatcher processing has been suspended, but messages are still being processed.
>>>Source: WindowsBase
>>>Target Site: IntPtr WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
>>>Stack Trace: at System.Windows.Threading.Dispatcher.WndProcHook(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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
>>>
>>>
>>>For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp."
>>>
>>>This is my code:
>>>
>>>
>>>using System;
>>>using System.Collections.Generic;
>>>using System.Linq;
>>>using System.Text;
>>>using System.Windows;
>>>using System.Windows.Controls;
>>>using System.Windows.Data;
>>>using System.Windows.Documents;
>>>using System.Windows.Input;
>>>using System.Windows.Media;
>>>using System.Windows.Media.Imaging;
>>>using System.Windows.Shapes;
>>>using System.IO;
>>>using OakLeaf.MM.Main.WPF;
>>>
>>>namespace SamaanSystems.IBC.WPF
>>>{
>>>    /// <summary>
>>>    /// Interaction logic for ReportViewer.xaml
>>>    /// </summary>
>>>    public partial class InvoiceWithDetailReportViewer : ABusinessWindow
>>>    {
>>>        private string manifestNumbers;
>>>
>>>        public InvoiceWithDetailReportViewer(string ManifestNumbers)
>>>        {
>>>            this.manifestNumbers = ManifestNumbers;
>>>            InitializeComponent();
>>>            _reportViewer.Load += ReportViewer_Load;
>>>        }
>>>
>>>        private bool _isReportViewerLoaded;
>>>
>>>        private void ReportViewer_Load(object sender, EventArgs e)
>>>        {
>>>            if (!_isReportViewerLoaded)
>>>            {
>>>                if (File.Exists("./Reports/InvoiceReport.rdlc"))
>>>                {
>>>                    Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
>>>                    InvoiceReportDataSet dataset = new InvoiceReportDataSet();
>>>                    dataset.BeginInit();
>>>                    reportDataSource1.Name = "DataSet1";
>>>
>>>                    reportDataSource1.Value = dataset.InvoicesSelectByManifestNumber;
>>>                    this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
>>>
>>>
>>>                    this._reportViewer.LocalReport.ReportPath = "./Reports/InvoiceReport.rdlc";
>>>                    dataset.EndInit();
>>>
>>>                    InvoiceReportDataSetTableAdapters.InvoicesSelectByManifestNumberTableAdapter invoiceTableAdapter = new InvoiceReportDataSetTableAdapters.InvoicesSelectByManifestNumberTableAdapter();
>>>
>>>                    invoiceTableAdapter.ClearBeforeFill = true;
>>>                    invoiceTableAdapter.Fill(dataset.InvoicesSelectByManifestNumber, this.manifestNumbers);
>>>
>>>                    _reportViewer.RefreshReport();
>>>                    _isReportViewerLoaded = true;
>>>
>>>                }
>>>            }
>>>        }
>>>    }
>>>}
>>>
>>>
>>>I have a feeling it has got something to do with the rdlc file not being found, but that's just a hunch, no scientific basis.
>>>
>>>I do have the report in a folder caled Reposrt below the folder where my exe resides, so it should be found.
>>>
>>>Can anyone help me solve this puzzle, please?
>>
>>I know nothing about Windows Report Viewer but this looks like a WPF /Dispatcher problem. How is the method called? If, as it looks, it is from a UI Event that *may* be a problem. IIRC using Dispatcher.BeginInvoke() might help - but I'm afraid that's only a vague recollection of this type of problem.....
>>
>>Update: this seems to confirm :http://social.msdn.microsoft.com/forums/en-US/wpf/thread/44962927-006e-4629-9aa3-100357861442
>
>Thanks Viv,
>
>I'd been trying to understand that post but couldn't (and still can't) grok it. Are you telling me that I need to add in that command somewhere in my code? Maybe in my ReportViewer_Load? Why would this work on my development machine as is but not at the client's site?

I don't think I can give you a definitive answer to this. I've wracked my brain (something it currently doesn't take kindly to :-}) to remember where I came across this before. Essentially, I don't think it is a good idea to trigger something like this from a UI event.
Using Dispatcher.Invoke(), IIRC, ensures that UI processing is completed before the work begins.

Also haven't a clue why it would work on your development machine but not on the production one. OS differences ?

I'll sleep on this. If anything more intelligent occurs to me I come back ......
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform