CreateImageByExtension Exception

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
dredgehqdev
Posts: 5
Joined: 19 Sep 2016, 19:51

CreateImageByExtension Exception

Post by dredgehqdev » 18 May 2018, 17:51

I'm getting an exception when calling CreateImageByExtension

CADImport.CADImage cadImage = CADImage.CreateImageByExtension(filename);

System.InvalidOperationException: 'Cross-thread operation not valid: Control 'MainForm' accessed from a thread other than the thread it was created on.'

I'm calling CreateImageByExtension in a Task returned from an async method. I have a MainForm in my project, but I also see the text "MainForm" in CadImport.xml.

Any ideas?

dredgehqdev
Posts: 5
Joined: 19 Sep 2016, 19:51

Re: CreateImageByExtension Exception

Post by dredgehqdev » 18 May 2018, 18:47

I forgot to register my license for CAD.NET. CAD import was trying to show the registration dialog and caused a cross-threading issue. This should be fixed in CAD.NET, though. The demo version should support asynchronous code.

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Re: CreateImageByExtension Exception

Post by support » 18 May 2018, 21:26

Hello,

Could you please create a small project which reproduces this issue and send it to the Technical Support e-mail for investigation?

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply