Page 1 of 1

CreateImageByExtension Exception

Posted: 18 May 2018, 17:51
by dredgehqdev
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?

Re: CreateImageByExtension Exception

Posted: 18 May 2018, 18:47
by dredgehqdev
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.

Re: CreateImageByExtension Exception

Posted: 18 May 2018, 21:26
by support
Hello,

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

Mikhail