Autodesk Navisworks API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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!
Solved! Go to Solution.
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
i m attaching a screenshot of the error. the error appears even with empty code in the CodeRun.
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
additional screenshot in debut mode, which hopefully shows where is breaks down.
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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!
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: 2013 API CodeRun error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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\Bas
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\Cod
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
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


