Can't debug using Sharpdevelop

Can't debug using Sharpdevelop

Anonymous
Not applicable
3,248 Views
8 Replies
Message 1 of 9

Can't debug using Sharpdevelop

Anonymous
Not applicable

I keep getting the following error when I press "Step Into" in the Macro Manager:

 

Cannot intercept exception. Debugged program can not be continued and properties can not be evaluated.
System.ExecutionEngineException
   at static System.Void <Module>.‫‌‍‬‮‍‌‬‪‍‎‌‏‌‍‎​‪‏‮‎‮‍‏‮(System.Object )
   at static System.Void System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
   at static System.Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
   at static System.Void System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state)
   at System.Void System.Threading.ThreadHelper.ThreadStart(System.Object obj)

I have to completely shut down Revit and can't debug anything. I am running Revit 2016 under Windows 10 (64bit).

Accepted solutions (1)
3,249 Views
8 Replies
Replies (8)
Message 2 of 9

AAAStructural
Contributor
Contributor

Dear pkhlineworks:

Did you make progress in using SharpDevelop for Revit?  I am looking into this to create macros for my design work, and I find the Rvit 2017 SharpDevelop  VB.net menu to be lacking the debug commands.  The SharpDevelop website shows a complete Debug menu, which was posted by Matt Ward.

 

Gratefully,

Scott

0 Likes
Message 3 of 9

Anonymous
Not applicable

No I have not been able to resolve this.

0 Likes
Message 4 of 9

AAAStructural
Contributor
Contributor

Dear PKHLINEWORKS, The code is beyond my beginning skills!  Thank you for replying.  An Architect named Michael Kilkelly helped me with my debugger questions.  I didn't realize you had to enter debug from Revit dialog box.  Perhaps you can contact him at Archsmarter.com.  Point here is finding the resources when you get stuck, however skilled.  I hate getting stuck!

 

0 Likes
Message 5 of 9

RmsMali
Contributor
Contributor
Accepted solution

 @Anonymous ,

Hello,

 

  • I used to have the same threading issue when I started to code few years back. At one point, I got really frustrated and had to reinstall my OS. After some time, the same issue started to pop up. After several sleepless nights and almost at the verge of losing my senses, I found why it happens.
  • Some of the add-ins that you have installed might be causing this issue. Reason behind this is the add-in could be obfuscated with "Anti-Debug Protection". More common to happen if the addin was obfuscated using "confuser" application.
  • While controlling the way how an add-in is obfuscated is not in your reach, you can control the way they affect your debugging standards. The solution that i follow is as below.
    1. After compiling the code using sharpdevelop. Close Revit.
    2. Go to "C:\ProgramData\Autodesk\ApplicationPlugins" . Copy all the folders/contents inside this folder and move them to somewhere safe. I usually move them to a folder in my Mydocuments.
    3. Open Revit. Do the debugging. It should run like a charm.
    4. Once the Debugging is complete and satisfied with the work, you can move your addins back to the Application plugins folder.

 

 

 

 

Message 6 of 9

Anonymous
Not applicable

That got it. I guess SharpDev is trying to load debugging symbols from all the addins, not just the macros.

 

Also check the users home directory and look under "appdata\roaming\Autodesk\Revit\Addins" there could be some more addins installed there.

0 Likes
Message 7 of 9

Anonymous
Not applicable

This helped me.  I created a script to set all of my addins "disabled" and i don't get the annoying threading glitches.  Thanks!

0 Likes
Message 8 of 9

Anonymous
Not applicable

I had no idea that this could be a problem!

But this just solved the problem of the day. One of the addins that we purchaised has this kind of protection and it completely kills revit when you attach the visual studio debugger . Just spent over an hour trying to figure out what the problem was. 

 

As a developer I think this kind of practice is a awful. Find another way of protecting your code!

0 Likes
Message 9 of 9

sebastianB65SE
Explorer
Explorer

Thanks you sooo much!! This really saved my week 😉

0 Likes