.NET

Reply
Contributor
AET_AJa
Posts: 19
Registered: ‎06-23-2005
Message 1 of 6 (336 Views)
Accepted Solution

Debugging WinForm in AutoCAD 2014 with VS2010

336 Views, 5 Replies
12-13-2013 03:03 AM

Hello,

 

I can't believe why this isn't a bigger issue on the forums. When I place a breakpoint inside a Windows form i get the message "No Source Available" from Visual Studio.

 

I'm using Application.ShowModalDialog(..) to launch the dialog.

 

How can people develop code without being able to debug? This has been an issue for some versions now and the NEXTFIBERWORLD=0 is not a solution for me since the whole AddIn acts strange when i do that. All I find when searching for this is the NEXTFIBERWORLD trick.

 

Does anyone have a solution to this problem

Uh!? What issues with using modal dialog box are you referring to that lead to your conclusion of not using it?

 

As matter of fact, most dialog boxes in most custom AutoCAD add-in tools usually are modal dialog box. To say "do not use modal dialog box" is a bit too much, IMO.

 

To the OP:

 

Yes, iin order to debug code behind win form, you need to set FIBERWORLD to 0. with AutoCAD 2010 to 2014. I am not sure what other things you say about AutoCAD not working properly when FIBERWORLD=0, other than menu/ribbon stopped working, which can be worked around by using command line.

 

If you structure your code well (e.g. simplifying the dialog box' code behind to only handle user interaction itself and moing heavy AutoCAD processing code outside the form code), you can focus on debugging the form code while setting FIBERWORLD=0 and after that, set it back to 1 and debugging your AutoCAD processing code. It is a bit hussle to switch FIBERWORLD between 0 and 1, because each time you need to restart AutoCAD. But there is nothing we can do for now. We can only hope the FIBER thing goes away in future AutoCAD release(s), as Autodesk hinted, one day.

 

Also, if you do use modeless dialog box for some reasons (in most case you probably should not), make sure you need to lock the document before doing anything to a document/database, or you'll run into eLockViolation error.

 

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 2 of 6 (325 Views)

Re: Debugging WinForm in AutoCAD 2014 with VS2010

12-13-2013 05:22 AM in reply to: AET_AJa

"I'm using Application.ShowModalDialog(..) to launch the dialog."

 

Don't, modal dialogs have lots of issues inside AutoCAD, layout tabs freezing weird flickering when closing etc.  I could never make them work properly.

Contributor
AET_AJa
Posts: 19
Registered: ‎06-23-2005
Message 3 of 6 (321 Views)

Re: Debugging WinForm in AutoCAD 2014 with VS2010

12-13-2013 05:32 AM in reply to: sszabo

OK, but how would you recommend launching a modal dialog.

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 4 of 6 (316 Views)

Re: Debugging WinForm in AutoCAD 2014 with VS2010

12-13-2013 05:35 AM in reply to: AET_AJa

Why would you want to use modal?!  Is it positioning relative to the parent you are interested in?!

Contributor
AET_AJa
Posts: 19
Registered: ‎06-23-2005
Message 5 of 6 (309 Views)

Re: Debugging WinForm in AutoCAD 2014 with VS2010

12-13-2013 05:51 AM in reply to: sszabo

If I set NEXTFIBERWORLD=1 and use .ShowModelessDialog(..) i get strange eLockViolation errors that shouldn't occur.

 

BlockTableRecord blk = (BlockTableRecord)tr.GetObject(blkId, OpenMode.ForWrite, false);

 

I guess NEXTFIBERWORLD is the only workaround of any use, except it seems to have side effects in my case.

 

How Autodesk can live with this is a mystery to me. How can anyone develop code without the use of a debugger? I is like going back in time.

 

 

*Expert Elite*
norman.yuan
Posts: 1,016
Registered: ‎04-27-2009
Message 6 of 6 (301 Views)

Re: Debugging WinForm in AutoCAD 2014 with VS2010

12-13-2013 06:36 AM in reply to: sszabo

Uh!? What issues with using modal dialog box are you referring to that lead to your conclusion of not using it?

 

As matter of fact, most dialog boxes in most custom AutoCAD add-in tools usually are modal dialog box. To say "do not use modal dialog box" is a bit too much, IMO.

 

To the OP:

 

Yes, iin order to debug code behind win form, you need to set FIBERWORLD to 0. with AutoCAD 2010 to 2014. I am not sure what other things you say about AutoCAD not working properly when FIBERWORLD=0, other than menu/ribbon stopped working, which can be worked around by using command line.

 

If you structure your code well (e.g. simplifying the dialog box' code behind to only handle user interaction itself and moing heavy AutoCAD processing code outside the form code), you can focus on debugging the form code while setting FIBERWORLD=0 and after that, set it back to 1 and debugging your AutoCAD processing code. It is a bit hussle to switch FIBERWORLD between 0 and 1, because each time you need to restart AutoCAD. But there is nothing we can do for now. We can only hope the FIBER thing goes away in future AutoCAD release(s), as Autodesk hinted, one day.

 

Also, if you do use modeless dialog box for some reasons (in most case you probably should not), make sure you need to lock the document before doing anything to a document/database, or you'll run into eLockViolation error.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.