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

C#: Using dynamic object resolving results in CSC : warning AD0001: Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' #91345

Closed
MikeSchulze opened this issue Apr 30, 2024 · 3 comments · Fixed by #91368

Comments

@MikeSchulze
Copy link

MikeSchulze commented Apr 30, 2024

Tested versions

<Project Sdk="Godot.NET.Sdk/4.2.2">
It occurs also on latest dev

   > Godot.SourceGenerators      4.3.0-dev.5   4.3.0-dev.5
   > GodotSharp                  4.3.0-dev.5   4.3.0-dev.5
   > GodotSharpEditor            4.3.0-dev.5   4.3.0-dev.5

System information

Windows 11, ubuntu

Issue description

I build my own C# unit test framework and have an issue with using dynamic object resolving.

When using dynamic e.g. public static dynamic AssertThat<TValue>(TValue? current) in combination with typed methods, it shows a warning.
CSC: warning AD0001: Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [D:\development\workspace\gdUnit4Net\example\exampleProject.csproj::TargetFramework = net8.0]

This is a problem when other developers use my API and this type of warning is displayed very often.
As workaround, we can disable the warning in your project, but this should not be the standard.
<NoWarn>$(NoWarn);AD0001</NoWarn>

Steps to reproduce

Download the example project and build.

Minimal reproduction project (MRP)

AD001.zip

@MikeSchulze MikeSchulze changed the title Using dynamic object resolving results in CSC : warning AD0001: Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' C#: Using dynamic object resolving results in CSC : warning AD0001: Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' Apr 30, 2024
@AThousandShips AThousandShips added this to the 4.3 milestone Apr 30, 2024
@MikeSchulze
Copy link
Author

@raulsntos It still occurs on 4.3.0-dev.6, it which version is the fix included?

@raulsntos
Copy link
Member

It's in beta1, you can check the interactive changelog.

@MikeSchulze
Copy link
Author

MikeSchulze commented Jun 15, 2024

It's in beta1, you can check the interactive changelog.

I can confirm that the warnings have disappeared 👍

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

Successfully merging a pull request may close this issue.

3 participants