SymbolsCodeGenerator: System.NullReferenceException
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start at CppSharp.Passes.SymbolsCodeGenerator.GetFunctionName and the CppSharp.AST.QualifiedType.Visit stack frame, then reproduce the failure with the listed gRPC headers and driver settings. Done means processing those headers no longer raises System.NullReferenceException and C# binding generation completes.
Written by the indexing model from the issue text.
Description
Brief Description
Hello,
I'm trying to generate C# bindings for a project made with grpc (https://grpc.io/), using all headers used by the grpc interface.
I am using CppSharp for the first time and I am getting the following exception:
System.NullReferenceException: Object reference not set to an instance of an object
at CppSharp.AST.QualifiedType.Visit[T] (CppSharp.AST.ITypeVisitor`1[T] visitor) [0x0000e] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.SymbolsCodeGenerator.<GetFunctionName>m__6 (CppSharp.AST.TemplateArgument a) [0x00000] in <ee554a8a50744b808e95927caba493c0>:0
at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () [0x00048] in <3fb92ec709f44a579da6a23087df403d>:0
at System.String.Join (System.String separator, System.Collections.Generic.IEnumerable`1[T] values) [0x0006b] in <4fdc5ed61a074cafb49fa42deb20d521>:0
at CppSharp.Passes.SymbolsCodeGenerator.GetFunctionName (CppSharp.AST.Function function, System.String namespace) [0x00073] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.TakeFunctionAddress (CppSharp.AST.Function function) [0x00073] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.VisitFunctionDecl (CppSharp.AST.Function function) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.VisitMethodDecl (CppSharp.AST.Method method) [0x00074] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.Method.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitFunctionDecl (CppSharp.AST.Function function) [0x000d5] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.AstVisitor.VisitMethodDecl (CppSharp.AST.Method method) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitClassDecl (CppSharp.AST.Class class) [0x001d1] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitClassDecl (CppSharp.AST.Class class) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.Class.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x00054] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.TranslationUnitPass.VisitTranslationUnit (CppSharp.AST.TranslationUnit unit) [0x00034] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.TranslationUnitPass.VisitASTContext (CppSharp.AST.ASTContext context) [0x0001b] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitASTContext (CppSharp.AST.ASTContext context) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Generators.BindingContext.<RunPasses>m__0 (CppSharp.Passes.TranslationUnitPass pass) [0x00029] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.PassBuilder`1[T].RunPasses (System.Action`1[T] action) [0x0001b] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Generators.BindingContext.RunPasses () [0x00007] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Driver.ProcessCode () [0x00007] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary library) [0x00128] in <ee554a8a50744b808e95927caba493c0>:0
at Wrapper.WrapperClass.Main (System.String[] args) [0x00006] in <28f4e98ae36f41a297e59a8b423f1898>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at CppSharp.AST.QualifiedType.Visit[T] (CppSharp.AST.ITypeVisitor`1[T] visitor) [0x0000e] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.SymbolsCodeGenerator.<GetFunctionName>m__6 (CppSharp.AST.TemplateArgument a) [0x00000] in <ee554a8a50744b808e95927caba493c0>:0
at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () [0x00048] in <3fb92ec709f44a579da6a23087df403d>:0
at System.String.Join (System.String separator, System.Collections.Generic.IEnumerable`1[T] values) [0x0006b] in <4fdc5ed61a074cafb49fa42deb20d521>:0
at CppSharp.Passes.SymbolsCodeGenerator.GetFunctionName (CppSharp.AST.Function function, System.String namespace) [0x00073] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.TakeFunctionAddress (CppSharp.AST.Function function) [0x00073] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.VisitFunctionDecl (CppSharp.AST.Function function) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.SymbolsCodeGenerator.VisitMethodDecl (CppSharp.AST.Method method) [0x00074] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.Method.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitFunctionDecl (CppSharp.AST.Function function) [0x000d5] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.AstVisitor.VisitMethodDecl (CppSharp.AST.Method method) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitClassDecl (CppSharp.AST.Class class) [0x001d1] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitClassDecl (CppSharp.AST.Class class) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.AST.Class.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x00054] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitNamespace (CppSharp.AST.Namespace namespace) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.Namespace.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.AST.AstVisitor.VisitDeclarationContext (CppSharp.AST.DeclarationContext context) [0x0029d] in <7e1a31dac5fd4a36b487efa8f6f3a798>:0
at CppSharp.Passes.TranslationUnitPass.VisitTranslationUnit (CppSharp.AST.TranslationUnit unit) [0x00034] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.TranslationUnitPass.VisitASTContext (CppSharp.AST.ASTContext context) [0x0001b] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Passes.GenerateSymbolsPass.VisitASTContext (CppSharp.AST.ASTContext context) [0x00001] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Generators.BindingContext.<RunPasses>m__0 (CppSharp.Passes.TranslationUnitPass pass) [0x00029] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.PassBuilder`1[T].RunPasses (System.Action`1[T] action) [0x0001b] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Generators.BindingContext.RunPasses () [0x00007] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.Driver.ProcessCode () [0x00007] in <ee554a8a50744b808e95927caba493c0>:0
at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary library) [0x00128] in <ee554a8a50744b808e95927caba493c0>:0
at Wrapper.WrapperClass.Main (System.String[] args) [0x00006] in <28f4e98ae36f41a297e59a8b423f1898>:0
OS: OS X
Used headers
I am using quite a lot of headers:
Used settings
void ILibrary.Setup(Driver driver)
{
var options = driver.Options;
driver.ParserOptions.EnableRTTI = true;
options.GeneratorKind = GeneratorKind.CSharp;
var module = options.AddModule("OctaneGRpc_Alex");
module.IncludeDirs.Add("/Users/maxnagy/Downloads/Archive/OctaneGRpc_Alex");
module.IncludeDirs.Add("/usr/local/include");
module.IncludeDirs.Add("/usr/local/include/grps++/impl/codegen");
module.IncludeDirs.Add("/usr/local/include/grps++/impl/codegen/security");
module.Headers.Add("/Users/maxnagy/Downloads/Archive/OctaneGRpc_Alex/include/atomicops.h");
module.Headers.Add("/Users/maxnagy/Downloads/Archive/OctaneGRpc_Alex/include/grpc-cpp-gen/ThirdPartyServer.pb.h");
module.Headers.Add("/Users/maxnagy/Downloads/Archive/OctaneGRpc_Alex/include/readerwriterqueue.h");
module.Headers.Add("/Users/maxnagy/Downloads/Archive/OctaneGRpc_Alex/include/grpc-cpp-gen/ThirdPartyServer.grpc.pb.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/async_stream.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/async_unary_call.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/byte_buffer.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/call.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/call_hook.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/channel_interface.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/completion_queue.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/completion_queue_tag.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/client_context.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/client_unary_call.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/config.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/config_protobuf.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/core_codegen.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/core_codegen_interface.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/create_auth_context.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/grpc_library.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/metadata_map.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/method_handler_impl.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/proto_utils.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/rpc_method.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/rpc_service_method.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/security/auth_context.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/serialization_traits.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/server_context.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/server_interface.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/service_type.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/slice.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/status.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/status_code_enum.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/string_ref.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/stub_options.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/sync_stream.h");
module.Headers.Add("/usr/local/include/grpc++/impl/codegen/time.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/common.h");
module.Headers.Add("/usr/local/include/google/protobuf/io/coded_stream.h");
module.Headers.Add("/usr/local/include/google/protobuf/arena.h");
module.Headers.Add("/usr/local/include/google/protobuf/arenastring.h");
module.Headers.Add("/usr/local/include/google/protobuf/generated_message_table_driven.h");
module.Headers.Add("/usr/local/include/google/protobuf/generated_message_util.h");
module.Headers.Add("/usr/local/include/google/protobuf/metadata.h");
module.Headers.Add("/usr/local/include/google/protobuf/message.h");
module.Headers.Add("/usr/local/include/google/protobuf/repeated_field.h");
module.Headers.Add("/usr/local/include/google/protobuf/extension_set.h");
module.Headers.Add("/usr/local/include/google/protobuf/unknown_field_set.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/port.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/atomicops.h");
module.Headers.Add("/usr/local/include/google/protobuf/arena_impl.h");
module.Headers.Add("/usr/local/include/google/protobuf/arena.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/logging.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/type_traits.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/casts.h");
module.Headers.Add("/usr/local/include/google/protobuf/stubs/port.h");
}
Target: Clang
- 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