.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debugging WinForm in AutoCAD 2014 with VS2010

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
AET_AJa
1011 Views, 5 Replies

Debugging WinForm in AutoCAD 2014 with VS2010

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

5 REPLIES 5
Message 2 of 6
sszabo
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.

Message 3 of 6
AET_AJa
in reply to: sszabo

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

Message 4 of 6
sszabo
in reply to: AET_AJa

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

Message 5 of 6
AET_AJa
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.

 

 

Message 6 of 6
norman.yuan
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.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost