We observe random exceptions like this in GridDesktop:
Exception-Type: System.InvalidOperationException
Message: Invoke oder BeginInvoke kann für ein Steuerelement erst aufgerufen werden, wenn das Fensterhandle erstellt wurde.
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at Aspose.Cells.GridDesktop.GridDesktop.()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
The message translates to “Invoke or BeginInvoke cannot be called on a control until the window handle has been created”.
We use the “GridDesktop” component in read only mode - this is the only code snippet that we invoke:
this.gridDesktop.ImportExcelFile("myfile.xslx", passwordtoOpen: null, passwordtoModify: null,
openasReadOnly: true, runFormulas: true);
Unfortunately, we don’t have further details and cannot reproduce it, we just observed this error a few times in our azure cloud, but cannot see which program code lead to this error and have no user feedback.
There is something special in our app: we create a thread for each main form, and all dialogs that are shown from button clicks of this main form (like our GridDesktop viewer) run on the thread of the parent form. So, if you internally use components that cannot be reused across threads, this might be the reason for this error.
Do you have any idea about this? The obfuscated stack trace of your code makes it hard to see which code caused the error.
The error happened with version 24.8.0 and 25.1.0.
Best regards
Wolfgang