Unable to attach the revit.exe to visual studio debugger

Unable to attach the revit.exe to visual studio debugger

ritesh.solankeSKPPH
Enthusiast Enthusiast
3,505 Views
9 Replies
Message 1 of 10

Unable to attach the revit.exe to visual studio debugger

ritesh.solankeSKPPH
Enthusiast
Enthusiast

Hello,

 

I am developing the Revit plugin, for this I have created project from the shared sample in Visual Studio 2017. When I tried to attach the Revit.exe process to debugger in order to debug my plugin. I am getting the following errors. Can you suggest, how to tackle this.

I have attached the screenshot of errors.

 

 

 

 Capture.PNG

0 Likes
3,506 Views
9 Replies
Replies (9)
Message 2 of 10

stever66
Advisor
Advisor

I'm not sure this will fix your error, but I do know there is a "use managed compatibility mode" that sometimes needs checked:

 

https://forums.autodesk.com/t5/revit-api-forum/use-managed-compatibility-mode-or-enable-native-code-...

 

Also, there is another way to start revit by editing the CSPROJ. file.  See this:

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=20132893

 

Also, are you using the right version of .net for your version of revit?  Have you gone through the "my first plug in" tutorial?

Hope something there helps.

 

Message 3 of 10

ritesh.solankeSKPPH
Enthusiast
Enthusiast

thanks for your help, with this settings I am able to launch the Revit but I got exception. I am sharing the screenshot can you let me know the probable solution.

0 Likes
Message 4 of 10

stever66
Advisor
Advisor

I don't know what you mean by "using the shared sample".

And I don't know why your file is trying to load a apiuilink file.  I haven't heard of that file, and I don't see it on my system.

 

I suggest you start with going through the "my first plugin " tutorial and work from there.

0 Likes
Message 5 of 10

ritesh.solankeSKPPH
Enthusiast
Enthusiast

here is the detailed error.

 

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for '<Module>' threw an exception.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at Autodesk.Revit.UI.RevitManagedAppStartupAgency.RevitManagedAppStartup(UIControlledApplication pControlledApplication, AString* assemblyName, AString* className, AString* exceptionName, AString* exceptionMessage)
at Autodesk.Revit.UI.RevitManagedAppStartupAgency.RevitAPIStartup(UIControlledApplication pControlledApplication, AddInManifest* pMani)

Inner Exception 1:
TypeInitializationException: The type initializer for '笒' threw an exception.

Inner Exception 2:
TypeInitializationException: The type initializer for '<Module>' threw an exception.

Inner Exception 3:
AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

0 Likes
Message 6 of 10

RPTHOMAS108
Mentor
Mentor

Are you targeting the correct .net framework version for the version of Revit you are using (is 'shared sample' out of date)? Such exceptions can be a symptom of that. 4.5.2 is the minimum for Revit 2017.

0 Likes
Message 7 of 10

ritesh.solankeSKPPH
Enthusiast
Enthusiast

I am using the 4.6.1, I have tried with 4.5.2  but still same error.

Initially I got following exception if 

 

"Exception thrown at 0x00007FF8C5CA0000 (AgileDotNetRT64.dll) in Revit.exe: 0xC0000005: Access violation executing location 0x00007FF8C5CA0000."

 

If I continue the I got unhandled exception 

n unhandled exception of type 'System.TypeInitializationException' occurred in mscorlib.dll

 

can you comment.

 

 

0 Likes
Message 8 of 10

RPTHOMAS108
Mentor
Mentor

I have no further specific suggestions for this sorry.

 

Go back to the most basic sample included in the Revit SDK, check they work and compare what you have against those (including Target CPU is x64). If they don't work then check a non-Revit project to confirm it is definitely related to how you are interacting with Revit.

 

 

0 Likes
Message 9 of 10

ritesh.solankeSKPPH
Enthusiast
Enthusiast

I have checked the sample in Revit SDk but with that also same error is occurring. But working fine with non Revit project, even I tried with other non Revit exe it is working fine. It seems that issue with Revit. Can you suggest. 

0 Likes
Message 10 of 10

ritesh.solankeSKPPH
Enthusiast
Enthusiast

thanks for the reply I am able to solve the issue. This is due some  aadins that are causing the problem.

0 Likes