Skip to content

Null Reference Exception during generation in PInvokeGenerator.cs#L2960 #580

@JustArion

Description

@JustArion

sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs#L2960

While generating from extension.h a null reference exception is thrown.

ClangSharpArgs.rsp

--additional
-m64
--config
generate-tests-nunit
multi-file
-std
c++20
--include-directory
_\modengine2\include
--file-directory
_\modengine2\include\modengine
--file
extension.h
--namespace
ModEngine.Bindings
--output
./Bindings
--test-output
./ClangArtifacts
--methodClassName
Interop
--with-librarypath
*=ModEngine2

_ paths omitted for brevity

Stack Trace

\modengine2\include\modengine\extension.h:
    Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at ClangSharp.PInvokeGenerator.<GetCursorQualifiedName>g__AppendTemplateArgument|79_2(TemplateArgument templateArgument, StringBuilder qualifiedName) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 2960
   at ClangSharp.PInvokeGenerator.<GetCursorQualifiedName>g__AppendTemplateArguments|79_3(ClassTemplateSpecializationDecl classTemplateSpecializationDecl, StringBuilder qualifiedName, <>c__DisplayClass79_0&) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 3001
   at ClangSharp.PInvokeGenerator.GetCursorQualifiedName(NamedDecl namedDecl, Boolean truncateParameters) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 2893
   at ClangSharp.PInvokeGenerator.<VisitTypedefDecl>g__ForUnderlyingType|191_2(TypedefDecl typedefDecl, Type underlyingType, Boolean onlyHandleRemappings) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 3285
   at ClangSharp.PInvokeGenerator.VisitDecl(Decl decl) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 38
   at ClangSharp.PInvokeGenerator.Visit(Cursor cursor) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 6698
   at ClangSharp.PInvokeGenerator.Visit(IEnumerable`1 cursors) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 6731
   at ClangSharp.PInvokeGenerator.VisitNamespaceDecl(NamespaceDecl namespaceDecl) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 1179
   at ClangSharp.PInvokeGenerator.VisitDecl(Decl decl) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 89
   at ClangSharp.PInvokeGenerator.Visit(Cursor cursor) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 6698
   at ClangSharp.PInvokeGenerator.Visit(IEnumerable`1 cursors) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 6731
   at ClangSharp.PInvokeGenerator.VisitTranslationUnitDecl(TranslationUnitDecl translationUnitDecl) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 3195
   at ClangSharp.PInvokeGenerator.VisitDecl(Decl decl) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs:line 258
   at ClangSharp.PInvokeGenerator.Visit(Cursor cursor) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 6698
   at ClangSharp.PInvokeGenerator.GenerateBindings(TranslationUnit translationUnit, String filePath, String[] clangCommandLineArgs, CXTranslationUnit_Flags translationFlags) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 1730

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions