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
Solved! Go to Solution.
"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.
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.
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.