Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentException in ClangSharp generator dotnet tool #413

Closed
kostya9 opened this issue Jan 8, 2023 · 2 comments · Fixed by #424
Closed

ArgumentException in ClangSharp generator dotnet tool #413

kostya9 opened this issue Jan 8, 2023 · 2 comments · Fixed by #424

Comments

@kostya9
Copy link

kostya9 commented Jan 8, 2023

Looks like the exception is similiar to #403

Version: 15.0.2

STR:

  1. clone https://github.com/kostya9/NetObsBindings
  2. Run ./build.ps1 (it uses clangsharp generator dotnet tool)
  3. Observe exception
Unhandled exception: System.ArgumentException: Stream was not writable.
   at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding, Int32 bufferSize, Boolean leaveOpen)
   at ClangSharp.PInvokeGenerator.<Close>g__GenerateNativeInheritanceAttribute|56_0(PInvokeGenerator generator, Stream stream, Boolean leaveStreamOpen) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 367
   at ClangSharp.PInvokeGenerator.Close() in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 311
   at ClangSharp.PInvokeGenerator.Dispose(Boolean isDisposing) in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 1789
   at ClangSharp.PInvokeGenerator.Dispose() in /_/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs:line 1260
   at ClangSharp.Program.Run(InvocationContext context) in /_/sources/ClangSharpPInvokeGenerator/Program.cs:line 781
   at System.CommandLine.Handler.<>c__DisplayClass1_0`1.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.<>c__DisplayClass2_0.<.ctor>g__Handle|0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
@teo-tsirpanis
Copy link
Contributor

I can reproduce it as well.

@teo-tsirpanis
Copy link
Contributor

Looks like the fix in #393 was applied only to GenerateTransparentStructs while it should have also been applied to the other helper class generation methods.

@kostya9 as a workaround, can you try generating the bindings without passing the generate-helper-types option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants