Board index » Visual Studio » Report Viewer Asynchronous thread abort error

Report Viewer Asynchronous thread abort error

Visual Studio52
Hi All



I have a VB.net 2005 app which uses MS Report Viewer to create reports



Occassionally I get the following error when changing to a different report



User code running on thread 196 has attempted to abort thread 3560. This may

result in a corrupt state or resource leaks if the thread being aborted was

in the middle of an operation that modifies global state or uses native

resources. Aborting threads other than the currently running thread is

strongly discouraged.



The error occurs in

ReportViewer1_RenderingComplete event. Code below....



Try



Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)



Me.ReportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent

******** line where error occurs



mypath = ReportViewer1.LocalReport.ReportPath



If mypath = reportpath & "DailyCashFlow.rdlc" Or mypath = reportpath &

"Staff.rdlc" Or mypath = reportpath & "rebookings.rdlc" Or mypath =

reportpath & "SalesbyPaymentType.rdlc" Then



Me.ReportViewer1.ZoomPercent = 80



Else



Me.ReportViewer1.ZoomPercent = 90



End If



Catch ex As Exception



mymsgbox(ex.Message)



End Try



Any ideas



Regards



Steve


-
 

Re:Report Viewer Asynchronous thread abort error

Hi Steve,



Based on my understanding, you get an error occassionally when changing a

different report for a ReportViewer control in your VB.NET 2005 WinForms

application. If I'm off base, please feel free to let me know.



You have mentioned that it is when you're trying to change a different

report in the ReportViewer that you get an error. But the sample code you

demonstrate doesn't change the current report in the ReportViewer control

at all.



I have performed a test based on your sample code but didn't reproduce the

problem you described.



FYI, to change the report in a ReportViewer control, you could set the

ReportViewer. LocalReport.ReportPath property to the file path of a

different .rdlc file. Note that you must call the ReportViewer control's

Reset method to reset the ReportViewer before you attach a different report

to it.



If the problem still exists, you may send your sample project that could

just reproduce the problem to me. To get my actual email address, remove

'online' from the displayed email address.





Sincerely,

Linda Liu

Microsoft Online Community Support



==================================================

Get notification to my posts through email? Please refer to

msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx">msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx

ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues

where an initial response from the community or a Microsoft Support

Engineer within 1 business day is acceptable. Please note that each follow

up response may take approximately 2 business days as the support

professional working with you may need further investigation to reach the

most efficient resolution. The offering is not appropriate for situations

that require urgent, real-time or phone-based interactions or complex

project analysis and dump analysis issues. Issues of this nature are best

handled working with a dedicated Microsoft Support Engineer by contacting

Microsoft Customer Support Services (CSS) at

msdn.microsoft.com/subscriptions/support/default.aspx.">msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.



-

Re:Report Viewer Asynchronous thread abort error

Hi Linda



Sorry about the lack of detail



In another routine I reset the the Reportviewer then set it to a local path

.rdlc then populate the datasource e.g

ReportViewer1.Reset()



ReportViewer1.ProcessingMode =

Microsoft.Reporting.WinForms.ProcessingMode.Local



If ReportViewer1.LocalReport.DataSources.Count>0 Then



ReportViewer1.LocalReport.DataSources.RemoveAt(0)



End If



sql = "SELECT * from customers order by surname"



dtsales = getdata(sql)



dtsales.Columns.Add("myheading", GetType(System.String))



If dtsales.Rows.Count>0 Then



dtsales.Rows(0)("myheading") = "All Customers"



End If



ReportViewer1.LocalReport.DataSources.Add(New

Microsoft.Reporting.WinForms.ReportDataSource("GeePosDataSet_Customers",

dtsales))



ReportViewer1.LocalReport.ReportPath = reportpath & "Customers.rdlc"



ReportViewer1.RefreshReport()



I only get the error on 1 computer and I beginning to suspect it may have

some hardware issues. I also only get the error when running the code from

within VB IDE not from running the application .exe



Regards



steve











"Linda Liu [MSFT]" <v-lliu@online.microsoft.com>wrote in message

Quote
Hi Steve,



Based on my understanding, you get an error occassionally when changing a

different report for a ReportViewer control in your VB.NET 2005 WinForms

application. If I'm off base, please feel free to let me know.



You have mentioned that it is when you're trying to change a different

report in the ReportViewer that you get an error. But the sample code you

demonstrate doesn't change the current report in the ReportViewer control

at all.



I have performed a test based on your sample code but didn't reproduce the

problem you described.



FYI, to change the report in a ReportViewer control, you could set the

ReportViewer. LocalReport.ReportPath property to the file path of a

different .rdlc file. Note that you must call the ReportViewer control's

Reset method to reset the ReportViewer before you attach a different

report

to it.



If the problem still exists, you may send your sample project that could

just reproduce the problem to me. To get my actual email address, remove

'online' from the displayed email address.





Sincerely,

Linda Liu

Microsoft Online Community Support



==================================================

Get notification to my posts through email? Please refer to

msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx">msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx

ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues

where an initial response from the community or a Microsoft Support

Engineer within 1 business day is acceptable. Please note that each follow

up response may take approximately 2 business days as the support

professional working with you may need further investigation to reach the

most efficient resolution. The offering is not appropriate for situations

that require urgent, real-time or phone-based interactions or complex

project analysis and dump analysis issues. Issues of this nature are best

handled working with a dedicated Microsoft Support Engineer by contacting

Microsoft Customer Support Services (CSS) at

msdn.microsoft.com/subscriptions/support/default.aspx.">msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no

rights.







-

Re:Report Viewer Asynchronous thread abort error

Hi Steve,



Thank you for your reply and the detailed information.



Since the problem only exists when it is run under VS IDE on one pc, you

may check what the differences are in the particular machine and other

machines.



Hope this helps.



Sincerely,

Linda Liu

Microsoft Online Community Support



-