NullReferenceException at VisitTypedefNameDecl
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Reproduce the MuJoCoSharp setup from the linked repository and start at CppSharp.AST.AstVisitor.VisitTypedefNameDecl, reached through ResolveIncompleteDeclsPass. Trace the typedef that triggers the NullReferenceException and use the existing stack trace and headers to identify the missing state; done means processing no longer crashes and the reported input is handled or diagnosed clearly.
Written by the indexing model from the issue text.
Description
Brief Description
I'm trying to create a wrapper for MuJoCo for c# in Linux. I've downloaded the library and its include files, and followed the Getting Started doc to create the setup below. I'm getting a NullReferenceException without any information about the offending source header code or how to solve it. Full code to reproduce the issue at https://github.com/emepetres/MuJoCoSharp
Setup:
var includeFiles = Directory.GetFiles(@"[LIBPATH]/include");
var options = driver.Options;
options.Verbose = true;
options.GeneratorKind = GeneratorKind.CSharp;
var module = options.AddModule("MuJoCo");
module.IncludeDirs.Add(@"[LIBPATH]/include");
module.Headers.AddRange(includeFiles);
module.LibraryDirs.Add(@"[LIBPATH]/bin");
module.Libraries.Add("libmujoco210.so");
Linux (Manjaro, dotnet 5.0, CppSharp v1.0.0)
Used headers
MuJoCo include files at https://github.com/deepmind/mujoco/tree/main/include
Target: C#
Stack trace or incompilable generated code
Parsing libraries...
Parsed 'libmujoco210.so'
Parsing code...
Unhandled type class 'Complex'
Parsed '/home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjrender.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/glfw3.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjui.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjvisualize.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/uitools.c, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mujoco.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjdata.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjxmacro.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/uitools.h, /home/jcarnero/source/MuJoCoSharp/build/mujoco210/include/mjmodel.h'
Processing code...
Pass 'CppSharp.Passes.ResolveIncompleteDeclsPass'
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at CppSharp.AST.AstVisitor.VisitTypedefNameDecl(TypedefNameDecl typedef)
at CppSharp.AST.AstVisitor.VisitTypedefDecl(TypedefDecl typedef)
at CppSharp.AST.TypedefDecl.Visit[T](IDeclVisitor`1 visitor)
at CppSharp.AST.AstVisitor.VisitDeclarationContext(DeclarationContext context)
at CppSharp.Passes.TranslationUnitPass.VisitTranslationUnit(TranslationUnit unit)
at CppSharp.Passes.TranslationUnitPass.VisitASTContext(ASTContext context)
at CppSharp.Passes.ResolveIncompleteDeclsPass.VisitASTContext(ASTContext c)
at CppSharp.Generators.BindingContext.<RunPasses>b__37_0(TranslationUnitPass pass)
at CppSharp.PassBuilder`1.RunPasses(Action`1 action)
at CppSharp.Generators.BindingContext.RunPasses()
at CppSharp.Driver.ProcessCode()
at CppSharp.ConsoleDriver.Run(ILibrary library)
at BindingGenerator.Program.Main(String[] args) in /home/jcarnero/source/MuJoCoSharp/src/BindingGenerator/Program.cs:line 12
- Dominant language
- C#
- Stars
- 3.4k
- Forks
- 541
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mono/CppSharp
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
How to get started Open
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100