Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2013 API CodeRun error

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
zhangle
1768 Views, 12 Replies

2013 API CodeRun error

Hi there! I am able to run the AppInfo sample project, but not able to run the CodeRun example in the Navisworks 2013 API.

What I did is open the Examples.sln solution with all the examples in VS2012. Then build the CodeRun project (get a CodeRun.ADSK.dll) and CodeRunLib project (get a CodeRunLib.dll). Then I created a CodeRun.ADSK folder in <NaviFolder>\Plugins and copy the CodeRun.ADSK.dll; created a Compilers folder in the CodeRun.ADSK folder and put the CodeRunLib.dll.

I am able to open the CodeRun addin in Navisworks and get the code template, but when I click the "Run", it output the following error message: 

 

System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:   at CodeRunLib.BaseGenerator.Generate(CodeDomProvider codeProvider, String sourceCode, String classToCreate, String callFunction, String& errors, String& consoleOutput)
   at CodeRunLib.CodeRunCSharp.Generate(String code, String fullClassName, String mainFunction, String& errors, String& consoleOutput)
   at CodeRun.Control.CodeRunControl.Generate(CodeRun codeRunner, String code, String fullClassName, String mainFunction, String& errors, String& consoleOutput)

Any suggestions are highly appreciated! Thanks!

 

12 REPLIES 12
Message 2 of 13
zhangle
in reply to: zhangle

i m attaching a screenshot of the error. the error appears even with empty code in the CodeRun.

 

Message 3 of 13
zhangle
in reply to: zhangle

additional screenshot in debut mode, which hopefully shows where is breaks down.

Message 4 of 13
saikat
in reply to: zhangle

Hi Zhangle

 

I am not sure if this is the reason but can you build the CodeRun and CodeRunLib projects to target .NET Framework 4.0. You mentioned you have used VS 2012 and I am not sure if that is causing the exceptions you have included. Unfortunately I only have VS 2010 and I used it to build the projects using .NET Framework 4.0 and it works fine.

 

In my set up, I only see the similar exception when there is a mismatch between the namespace and the class in the code as compared to that in the Full Class Name field in CodeRun UI.

 

cheers

Saikat

 

 



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 5 of 13
zhangle
in reply to: saikat

Thanks Saikat for the suggestion.

 

But while I am checking, it seems the default Framewok used is already 4 (which i think might be the result of the project setting). Any other thought?

 

Thanks!

 

Message 6 of 13
saikat
in reply to: zhangle

Hi

 

I had some follow up discussions with my colleagues from the Development and the primary suspect still seems to be VS 2012. Since VS 2012 is still not supported with NW - can you please try compiling CodeRun with VS 2010 and see if that works.

 

Cheers

Saikat



Saikat Bhattacharya
Senior Manager - Technology Consulting
Message 7 of 13
zhangle
in reply to: zhangle

Thanks Saikat. 

 

Sad that I do not have access to VS2010. I think I will keep working on 2012, since no other issues are identified so far. 

 

Thanks and hope this will be solved soon. 

 

Regards, 

Le Zhang

Message 8 of 13
ngombault
in reply to: zhangle

Hi,

 

I know this is an old topic but I am facing the same issue and couldn't find any solution.

I did try to re-install VS2010 and recompile both CodeRun and CodeRun & CodeRunLib and made sure they were in the appropriate folder.

 

I still got the error.

Any other tips?

 

Thanks,

Nicolas

Message 9 of 13
xiaodong_liang
in reply to: ngombault

Hi,

 

Did you get the same error posted in message 2 & 3? As my colleauge indicated, that looks an issue with VS2012. but with VS2010, we did not hit an error. Could you share some screenshots and the machine configuration? 

Message 10 of 13
ngombault
in reply to: zhangle

yes, same error:

 

System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:   at CodeRunLib.BaseGenerator.Generate(CodeDomProvider codeProvider, String sourceCode, String classToCreate, String callFunction, String& errors, String& consoleOutput) in C:\Program Files\Autodesk\Navisworks Manage 2013\api\net\examples\Tools\CodeRun\CodeRunLib\BaseGenerator.cs:line 108
   at CodeRunLib.CodeRunVB.Generate(String code, String fullClassName, String mainFunction, String& errors, String& consoleOutput) in C:\Program Files\Autodesk\Navisworks Manage 2013\api\net\examples\Tools\CodeRun\CodeRunLib\CodeRunVB.cs:line 46
   at CodeRun.Control.CodeRunControl.Generate(CodeRun codeRunner, String code, String fullClassName, String mainFunction, String& errors, String& consoleOutput) in C:\Program Files\Autodesk\Navisworks Manage 2013\api\net\examples\Tools\CodeRun\CodeRunControl.cs:line 173

 

Like I explained, It use to work with visual studio 2010. The error did occure after the installation of VS 2012, but I can't say this is the trigger. Also I did rebuild the solution in VS 2010 so it should have fixed it no?

 

The machine configuration is:

windows 7 x64 professional SP1

proc i7 Q820

16Gb ram

VS 2012 Ultimate

Navisworks Manage 2013 (64bit) V10.0.0.84082 Built Mar 5 2012

 

 

let me know if you need anything else,

thanks

 

Nic

Message 11 of 13
xiaodong_liang
in reply to: ngombault

Thanks for the info. It looks to me this may be still related with VS2012. I logged this issue. The suggestion I can think of now is to work on a machine with VS2010 only. Sorry.

Message 12 of 13
xiaodong_liang
in reply to: zhangle

Hi all,

 

We finally addressed this issue. Please refer to the blog:

http://adndevblog.typepad.com/aec/2013/01/coderun-sample-cannot-work-with-vs2012.html

 

Sorry for the inconvenience caused.

 

 

Message 13 of 13
ngombault
in reply to: xiaodong_liang

Fixed it, thanks - you rock!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report