Thread was being aborted when using GridDesktop in Legacy application

I am trying to use the GridDesktop control in a legacy winforms application.

This application is over 15 years old and has a lot of legacy code in it.

After calling the ImportExcelFile function on the GridDesktop I am getting the error included at the end.

I cannot reproduce this error outside of the legacy application so I am assuming something in the way the application is built is incompatible with the GridDesktop.

:

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

Thread was being aborted.


Void SleepInternal(Int32)


at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)
at System.Threading.Thread.Sleep(Int32 millisecondsTimeout)
at Aspose.Cells.GridDesktop.GridDesktop.()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

@philipstone,

Thanks for the details.

Are you using latest version/fix, i.e., Aspose.Cells.GridDesktop v18.7.x in your legacy application? Are you using Aspose.Cells.GridDesktop in multi-threading? I am afraid the stack trace is not very helpful to evaluate your issue properly, we need to reproduce the issue on our end. We appreciate if you could separate the issue and create a simple application (runnable) using v18.7.x, zip the project and post us here to reproduce the issue on our end. we will check it soon.

I am using 18.60.0.

I have been unable to reproduce outside of the legacy application that has 250,000+ lines of code.

I will continue on my end trying to isolate the issue.

@philipstone

Please narrow down the problem and then get back to us once you figure out this. We will proceed to help you accordingly.

Thread Abort.zip (5.6 MB)

  1. Open Advent.Geneva.Forms.Client.csproj
  2. After running 2 message boxes should appear with the unhandled exception.screenshot.png (67.0 KB)

@philipstone,

Thanks for the sample project and screenshot.

Please also provide your template file “blah.xlsx” which you are importing it into Aspose.Cells.GridDesktop, so we could evaluate your issue precisely.

blah.zip (49.3 KB)

I have narrowed down the issue further.

If you look in app.config, you will see the following line:
legacyUnhandledExceptionPolicy enabled=“1”

If you change this to
legacyUnhandledExceptionPolicy enabled=“0”

then the exception does not appear.

@philipstone,

I simply used a simple project and imported your template file on Form_Load using the following line of code and it works fine, I do not find any exception:
e.g
Sample code:

gridDesktop1.ImportExcelFile("e:\\test2\\blah.xlsx");

I am using Aspose.Cells.GridDesktop v18.7.

The form is not the issue.

The issue is the application I am using has legacyUnhandledExceptionPolicy enabled=“1” in the app.config

I am investigating on my end why my application has this set in app.config.

Thanks,
Phil

This is Microsoft’s explanation of the flag.

It seems like it has to do with the difference between .Net 1.0 and .Net 2.0.

My application is running .Net 4.6 now, so hopefully the flag wasn’t doing anything:)

If you look in app.config there is a comment saying

Prevents the client from closing after closing the exception dialog for an unhandled exception from a background thread

@philipstone

Thanks for your feedback.

Good to hear that your issue is sorted out with latest framework. Feel free to write us back if you have further comments or questions, we will be happy to assist you.