Navisworks API

Reply
Contributor
zhangle
Posts: 19
Registered: ‎07-05-2009
Message 1 of 13 (781 Views)
Accepted Solution

2013 API CodeRun error

781 Views, 12 Replies
06-12-2012 11:16 AM

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!

 

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.

 

 

Contributor
zhangle
Posts: 19
Registered: ‎07-05-2009
Message 2 of 13 (764 Views)

Re: 2013 API CodeRun error

06-14-2012 09:13 AM in reply to: zhangle

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

 

Contributor
zhangle
Posts: 19
Registered: ‎07-05-2009
Message 3 of 13 (759 Views)

Re: 2013 API CodeRun error

06-14-2012 11:06 AM in reply to: zhangle

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

Employee
saikat
Posts: 185
Registered: ‎08-16-2007
Message 4 of 13 (752 Views)

Re: 2013 API CodeRun error

06-14-2012 05:19 PM 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

Contributor
zhangle
Posts: 19
Registered: ‎07-05-2009
Message 5 of 13 (745 Views)

Re: 2013 API CodeRun error

06-15-2012 11:03 AM 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!

 

Employee
saikat
Posts: 185
Registered: ‎08-16-2007
Message 6 of 13 (707 Views)

Re: 2013 API CodeRun error

07-04-2012 10:59 AM 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

Contributor
zhangle
Posts: 19
Registered: ‎07-05-2009
Message 7 of 13 (701 Views)

Re: 2013 API CodeRun error

07-06-2012 09:06 AM 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

Active Contributor
ngombault
Posts: 45
Registered: ‎11-14-2012
Message 8 of 13 (369 Views)

Re: 2013 API CodeRun error

12-27-2012 05:39 PM 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

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 9 of 13 (348 Views)

Re: 2013 API CodeRun error

01-03-2013 07:48 PM 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? 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Active Contributor
ngombault
Posts: 45
Registered: ‎11-14-2012
Message 10 of 13 (344 Views)

Re: 2013 API CodeRun error

01-03-2013 08:08 PM 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

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.