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

CsWinRT fails during code generation with NullReferenceException #1837

Open
ppoirier1 opened this issue Oct 17, 2024 · 0 comments
Open

CsWinRT fails during code generation with NullReferenceException #1837

ppoirier1 opened this issue Oct 17, 2024 · 0 comments

Comments

@ppoirier1
Copy link

Describe the bug
Build fails with the following during code generation:
CSC : warning CS8785: Generator 'SourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'NullReferenceException' with message 'Object reference not set to an instance of an object.'.

Version Info
CsWinRT version 2.1.1 and higher
Windows SDK 22621

Additional context
Broke at 2.1.1. Version 2.0.8 and earlier versions worked fine. Tried up to the current version 2.1.6
Log.txt:
...
output: C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha
time: 65ms

Adding C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha\AuthoringMetadataTypeMappingHelper.cs
Adding C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha\InitalizeProjection.cs
Adding C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha\Tasks.cs
Adding C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha\WinRTEventHelpers.cs
Adding C:\Users\user\AppData\Local\Temp\CsWinRT\q22y5fj2.4ha\WinRT_Module.cs
System.NullReferenceException: Object reference not set to an instance of an object.
at Generator.WinRTTypeWriter.<>c.b__80_1(VtableAttribute vtableAttribute, Int32 _)
at System.Linq.Enumerable.d__192.MoveNext() at System.Linq.Enumerable.<UnionIterator>d__671.MoveNext()
at System.Linq.Enumerable.d__641.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at Generator.WinRTTypeWriter.GenerateWinRTExposedClassAttributes(GeneratorExecutionContext context)
at Generator.ComponentGenerator.Generate()

@ppoirier1 ppoirier1 added the bug Something isn't working label Oct 17, 2024
@Sergio0694 Sergio0694 removed the bug Something isn't working label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants