-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' #85553
Comments
What do you mean? Do you mean you recall that it maybe worked fine, or that your opinion is that it worked fine? |
I used version 4.1.3 before and I don't remember seeing that exception message in the compilation output. |
Then please do test that it does work there 🙂 |
v4.1.3.stable.mono.official [f06b6836a] throws an exception as well. |
Encountered the same issue here, using Arch ECS with 4.2 stable. [Query, All<MapGenContext, MapGenStepCorridors>]
void MapGenCorridors(in Entity entity)
{
// ...
} Causes the warning:
Rolling back to 4.1.2, yes, the same warning crops up. At first, it appeared it didn't, as the warning didn't show up in the project initially, even after building, running, and manually re-running the analyzers, but as soon as I made a change to the file the analyzer warning appeared. Should note it is simply a warning and doesn't seem to have any effect on the project otherwise, I can build and run fine and the annotations seem to behave as expected. So the analyzer failure doesn't seem to be indicating an actual problem with the annotation definition. Edit: not entirely certain what this particular analyzer is supposed to be doing tbh but it seems the scope is just too wide? var typeParamSymbol = parentSymbol switch {
IMethodSymbol methodSymbol => methodSymbol.TypeParameters[typeArgumentIndex],
INamedTypeSymbol typeSymbol => typeSymbol.TypeParameters[typeArgumentIndex],
_ => null,
}; This is the failing code, MS docs say that Thing is - none of the classes or methods in question are in the Godot context - the class isn't extending a godot type, and the attribute I'm defining is to do with my ECS library and not Godot. So it seems like the scope of what attributes should be analysed needs to be limited to just GodotSharp attributes? |
The error is happening when it tries to extract the generic type before checking if the type is (or it isn't) annotated with the |
Godot version
v4.2.stable.mono.official [46dc277]
System information
Ubuntu Linux
Issue description
Source generator MustBeVariantAnalyzer throws exception System.IndexOutOfRangeException when generic attributes are declared in my own Godot project.
I think that generic attributes worked fine with Godot version 4.1.3.Steps to reproduce
<LangVersion>latest</LangVersion>
to csproj so that C# 'generic attributes' feature can be usedLevel
Level
nodeLevel.cs
fileLevel
class with the attribute i.e.Analyzer 'Godot.SourceGenerators.MustBeVariantAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'
If you compile the project from CLI using command
dotnet build --no-incremental -v d
you can see that the exception is thrown from methodMustBeVariantAnalyzer.ShouldCheckTypeArgument
.Minimal reproduction project
GodotTest.zip
The text was updated successfully, but these errors were encountered: