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

[1.1.5] Extended methods with variadic arguments eat the first element #89

Open
kurone-kito opened this issue Dec 11, 2022 · 0 comments · May be fixed by #90
Open

[1.1.5] Extended methods with variadic arguments eat the first element #89

kurone-kito opened this issue Dec 11, 2022 · 0 comments · May be fixed by #90
Labels
bug Something isn't working

Comments

@kurone-kito
Copy link

Describe the bug in detail:

When calling an extended method that has variadic arguments, the first element of the variadic argument disappears.

Provide steps/code to reproduce the bug:

public static void Dump(this string value, params string[] args)
{
    Debug.Log($"Dump: {value}, {string.Join(", ", args)}");
}
"a".Dump("b", "c", "d");

Expected behavior:

Expected:

Dump: a, b, c, d

Actual:

Dump: a, c, d

Additional Information:

If I pass no arguments to the above function, it should generally receive an empty array as a variadic argument, but a compile error occurs.

[UdonSharp] Assets/Scripts/Resources/ResultPreviewer.cs(50,9): System.OverflowException
  at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_array_new_specific(intptr,int)
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.VisitInvocationExpression (Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax node) [0x0037c] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:471 
  at Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00003] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00065] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:51 
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.VisitExpressionStatement (Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax node) [0x00001] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:270 
  at Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00003] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00065] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:51 
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.VisitBlock (Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax node) [0x00049] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:261 
  at Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult] visitor) [0x00000] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor`1[TResult].Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00003] in <9c2eb1fd370b4c31a981729c5e257f1b>:0 
  at UdonSharp.Compiler.Binder.BinderSyntaxVisitor.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x00065] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BinderSyntaxVisitor.cs:51 
  at UdonSharp.Compiler.Symbols.MethodSymbol.Bind (UdonSharp.Compiler.Binder.BindContext context) [0x00170] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\Symbols\MethodSymbol.cs:162 
  at UdonSharp.Compiler.Symbols.UdonSharpBehaviourMethodSymbol.Bind (UdonSharp.Compiler.Binder.BindContext context) [0x000b5] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\Symbols\UdonSharpBehaviourMethodSymbol.cs:55 
  at UdonSharp.Compiler.Symbols.TypeSymbol.Bind (UdonSharp.Compiler.Binder.BindContext context) [0x00193] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\Symbols\TypeSymbol.cs:137 
  at UdonSharp.Compiler.Binder.BindContext.Bind () [0x0001b] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\Binder\BindContext.cs:35 
  at UdonSharp.Compiler.UdonSharpCompilerV1+<>c__DisplayClass22_0.<BindAllPrograms>b__0 (System.ValueTuple`2[T1,T2] rootTypeSymbol) [0x00030] in C:\Users\kurone-kito\src\my\the-mind-mirror\Packages\com.vrchat.udonsharp\Editor\Compiler\UdonSharpCompilerV1.cs:618 
@kurone-kito kurone-kito added the bug Something isn't working label Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant