As mentioned before, Revit 2012 is built with the .NET Framework Runtime 4.0 and forces its addins to use the same version as indicated in its configuration file, revit.exe.config:
<configuration>
…
…
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
However, it is documented that the .NET Framework 3.5 can also be used to debug Revit 2012 addins from inside Visual Studio 2010. Since Revit Addin Wizard (RevitAddinWizard) works with both Visual Studio 2008 and 2010, supports starting Revit from inside the IDE of either Visual Studio so as to debug the resultant addin assemblies immediately and automatically, and finally will create addin projects for both Revit 2011 and 2012 in the same wizard UI of a single deployment, some experiments are done regarding Revit 2012, Visual Studio 2010, .NET Framework 3.5 Runtime, and Debugging. And something different is found out (not really surprising though, to me at least).
There seems no way to debug into the assembly in case the .NET Framework 3.5 Runtime is targeted at in the addin project created by either Visual Studio 2010 or 2008, supposing the supportedRuntime option in revit.exe.config file is never touched upon.
In Visual Studio 2010, after the revit.exe full path is filled out property in the Debug settings of the addin project (do not worry about this matter at all if Revit Addin Wizard is used to create the project), pressing F5 can successfully launch the specified Revit 2012. But the breakpoint will not be hit regardless where it is set.
Launching Revit 2012 from outside of the Visual Studio 2010 IDE and manually attach the VS Debugger to the Revit process through the following UIs:
Get us no avail even if the code type is switched from automatic code mode to manual and/or between different code types back and forth.
If we try to debug from inside the IDE of Visual Studio 2008, the famous debugger not compatible with debuggee problem will just come up:
Trying to launch Revit 2012 from outside of Visual Studio 2008 and manually attach its process to the debugger gets us no avail either:
If cursor is hovered on the breakpoint, Visual Studio will warn us something like:
“The breakpoint will not currently be hit. No symbols have been loaded for this document.”
It may indicate that the PDB format is different now in 2012 than 2008, likely what the ‘debugger protocol’ really points to.
So we can reach our conclusion now, I believe.
If Visual Studio 2010 is used, please do not target at the .NET Framework Runtime other than the version 4.0 for Revit 2012 addin projects. Otherwise, you just get yourselves into unnecessary great troubles. Not sure why this cannot be more obvious fact could be mixed up!
Revit Addin Wizard (RevitAddinWizard) follows this simple and good advice.
If Visual Studio 2008 is used, please target at the .NET Framework Runtime with the highest version (3.5 actually) for Revit 2012 addin projects and commenting out the supportedRuntime line in the revit.exe.config so as to debug the assemblies. We have covered it a few times.
Recent Comments