Revit 2018, VS2015 and Edit&Continue

Revit 2018, VS2015 and Edit&Continue

Anonymous
Not applicable
1,171 Views
9 Replies
Message 1 of 10

Revit 2018, VS2015 and Edit&Continue

Anonymous
Not applicable

Hi everybody,

I'm a well experienced delevoper for AutoCAD plugins, but really new to Revit and its world.

I've read a lot and still setting up a nice environment to develope for Revit.

I'm still trying to achieve a way to debug Revit plugins with the Edit&Continue support on x64 machines.

 

Right now I tried:

- direct and simple debug launching Revit inside VS2015, as I used todo with AutoCAD: Revit would crash immediately unless I enable the Managed Compatibility Debug flag (that I believe revert to an older debug package without E&C).

The breakpoints works, but every code change requires a Revit restart.

 

- side lauch of Revit, loading of plugins through Add-in Manager and attach VS2015 to Revit process for debug: with the Managed Compatibiity mode enabled, the debug works, the breakpoints work, but obviously without E&C; without the Managed Compatibility mode the plugin still works (no crashes, Debug.print() works), but the breakpoints don't get caught... so useless for debug purposes...

 

Just to know: I'm I trying to achieve something possible? Is anyone able to debug on x64 machines with E&C support? Or simply isn't possible?

If it's possible, any help would be appreciated.

 

Max

0 Likes
Accepted solutions (1)
1,172 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable

Hi,

 

> direct and simple debug launching Revit inside VS2015, as I used todo with AutoCAD: Revit would crash immediately

 

This can be caused by a 3rd party addin that implements license checks (many 3rd party licensing clients have antidebugging). Try disabling 3rd party addins, and see if debugging starts working. In this mode, EnC should work.

 

> side lauch of Revit, loading of plugins through Add-in Manager and attach VS2015 to Revit process for debug ... but the breakpoints don't get caught... so useless for debug purposes...

 

Here, you probably have a configuration issue (e.g. check if the addin DLL is loaded from the correct location, and that its symbols are loaded - check Modules window in VS debugger to see both). However, AFAIK, EnC is not supported in this mode anyway.

0 Likes
Message 3 of 10

Anonymous
Not applicable

Hi hlg_s,

thank you for your reply...

 

About the direct debug launching Revit from VS2015, I forgot to say that Revit crashes only with the Managed Compatibility mode DISABLED. When enabled, it works, but obviously without E&C.

I don't think it's due to an antidebugging feature, since it works when the Managed Compatibility is enabled.

Anyway I tried without any other addin loaded and the result it's the same, it crashes in a few seconds and the journal reports this error:

 

'C 03-Oct-2018 15:58:01.935;   0:< Assertion failed: line 136 of Tasks\ChannelAccess.cpp 

 

When you say that it should work, it's because is working for you? Are you debugging on x64 machines and able to use E&C?

 

0 Likes
Message 4 of 10

jeremytammik
Autodesk
Autodesk

Dear Max,

 

Thank you for your query, both here and in your comment on The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/2018/09/revit-2019-visual-studio-net-add-in-wizards.html#co...

 

As I said there, I am not aware of anything in the works for this functionality in Revit.

 

If it is important for you, several different workarounds have been discussed and are explained in The Building Coder topic group on Edit and Continue, Debug without Restart, Live Development:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.49

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 10

Anonymous
Not applicable

> When you say that it should work, it's because is working for you? Are you debugging on x64 machines and able to use E&C?

 

Yes (to all).

 

> About the direct debug launching Revit from VS2015, I forgot to say that Revit crashes only with the Managed

> Compatibility mode DISABLED. When enabled, it works, but obviously without E&C.

> I don't think it's due to an antidebugging feature, since it works when the Managed Compatibility is enabled.

 

Those are different debugging APIs, and detection for them is also different (plus antidebugging techniques frequently suffer from bugs themselves).

 

> Anyway I tried without any other addin loaded and the result it's the same, it crashes in a few seconds and the journal reports this error:

 

How exactly does it crash? What messages are shown? How does call stack look like when you break into debugger? (For the latter, enable debugging native code, ensure that "Just my code" is disabled in VS debugging settings, and try again)

0 Likes
Message 6 of 10

Anonymous
Not applicable

Hi Jeremy,

thank you for your reply...

I've read a lot these days, and as you can see from my first message, I tried also one of the workaround suggested by your links... but yet, I couldn't find a definite answer to my query, I just want to know if anyone has been able to debug a Revit plugin under VS2015 on a x64 machine and still able to keep the E&C feature working.

You suggested workaround that also address other needs or problems, but in those messages I couldn't find a clear answer if E&C has been succesfully preserved. The Managed Compatibility flag is often shown as first candidate to fix many debug problems, and indeed it works, even if this means to revert to an older debug package without E&C support, AFAIK.

 

If simply it's not possible (like it has been for long even in AutoCAD), that's fine and good to know, so that I can stop looking for a solution. If someone succeded, I just wish to know which workaround he/she is using.

 

If not possible (for whatever reason) can someone confirm that on 32 bit platform is indeed possible? 

 

Also, may it be of anyone interest to look into the reason why Revit 2018 crashes immediately when launched for debug from inside VS2015 (with Managed Compatibility mode disabled, of course)?

Is this an expected behavior?

 

Kindest regards,

 

Max

 

0 Likes
Message 7 of 10

Anonymous
Not applicable

Hi hlg_s,

thank you for your reply!!!

 

Can you describe your general configuration? What's your debug startegy? I mean, do you attach the debug to Revit process? You Use the add-in manager to load your plugin or not?

 

If you did it, at least I know I'm not lousing time... 🙂

 

For the Revit crash I'll try to gather more information, but it crashes very quickly! I already reported the failed assertion journaled... it'd be nice is someone could look at that line of code... 😄

0 Likes
Message 8 of 10

Anonymous
Not applicable

Hi hlg_s,

sorry to bother you, but now I'm eager to know how to make it working...

 

I have a new x64 workstation with a fresh Windows 10, fresh VS2015.3 install and fresh Revit 2018.2 install. Install package downloaded from ADN and registered with ADN licence numbers... in theory, there shouldn't be much to check!

 

I'm still using test plugins solutions, taken from the Revit 2018.2 SDK or created from scratch using the wizard provided by Jeremy (thank you, BTW).

 

Do you see something different from your environment?

At this stage I can erase and reinstall everything if needed...

 

0 Likes
Message 9 of 10

Anonymous
Not applicable
Accepted solution

> sorry to bother you

 

Don't worry about that, this case is very interesting for me too 🙂

(I had sometimes to deal with similar issues for clients, and in those cases, it has always been someone's licensing; it would be interesting to know what it could be in this case)

 

> Can you describe your general configuration? What's your debug startegy? I mean, do you attach the debug

> to Revit process?

 

I start Revit under debugger (f.ex. by specifying path\revit.exe in "Start Action | Start external program" in project settings), and then use F5 to start debugging session (which launches Revit).

EnC is not supported when the debugger is attached to an already running process (AFAIK, and according to VS documentation).

 

> You Use the add-in manager to load your plugin or not?

 

No, my addins are usually registered via .addin file.

 

> I have a new x64 workstation with a fresh Windows 10, fresh VS2015.3 install and fresh Revit 2018.2 install.

 

Windows 7, VS2015.3, Revit 2018.3 (I don't think that Windows version could be the reason)

 

> For the Revit crash I'll try to gather more information, but it crashes very quickly! I already reported

> the failed assertion journaled...

 

IMO it would be the best course of action, try to determine why Revit crashes (who exactly crashes it). That's most likely what is preventing you from being able to debug in this case.

It is possible that the line in the journal file is not related to the problem. It would be best to see the exact message reported by Windows or by the debugger when Revit crashes, and the call stack (after breaking into debugger).

Message 10 of 10

Anonymous
Not applicable

Hi Hlg_s!

trying to follow your configuration I just updated Revit to 2018.3.1 and ... bingo! I tried a simple test application and it worked! Just as by manual... 

 

So I can confirm that E&C works as expected on x64 machines with VS2015.3 and Revit 2018.3.

I can also say that, for me, 2018.2 doesn't work and crashes as soon as it's launched from VS2015, unless you enable the Managed Compatibility debug flag. In this case it works, but of course E&C would be not available, by design.

 

For the records, I forgot to say my environment is localized for ITA (Italy), both VS2015 and Revit. This shouldn't be a problem, but a few years a go I filed a bug for Inventor where some API weren't working only when applying a language pack, so I don't take it for granted.

 

I wish to thank again hlg_s for his support.