.NET

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

Debugging WinForm in AutoCAD 2014 with VS2010

215 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

Valued Contributor
Posts: 80
Registered: ‎09-05-2012
Message 2 of 6 (204 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
Posts: 19
Registered: ‎06-23-2005
Message 3 of 6 (200 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
Posts: 80
Registered: ‎09-05-2012
Message 4 of 6 (195 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
Posts: 19
Registered: ‎06-23-2005
Message 5 of 6 (188 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*
Posts: 887
Registered: ‎04-27-2009
Message 6 of 6 (180 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.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community