Skip to content

"Exceeded limit on consecutive []" with five attribute lists #1340

Open

Description

@colejohnson66

Using five or more attribute lists causes RoslynSourceTextGuardException:

MirrorSharp.Advanced.EarlyAccess.RoslynSourceTextGuardException: Exceeded limit on consecutive [].
   at SharpLab.Server.MirrorSharp.Guards.RoslynSourceTextGuard.ValidatingSourceTextWriter.ValidateBrackets(Char char, Char openBracket, Char closeBracket, Int32& nestingLevel, Int32[] adjacentPairCounts, Boolean allowTopLevelAdjacentPairs) in D:\a\SharpLab\SharpLab\source\Server\MirrorSharp\Guards\RoslynSourceTextGuard.cs:line 67
   at Microsoft.CodeAnalysis.Text.SourceText.Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken)
   at SharpLab.Server.MirrorSharp.Guards.RoslynSourceTextGuard.ValidateSourceText(SourceText sourceText) in D:\a\SharpLab\SharpLab\source\Server\MirrorSharp\Guards\RoslynSourceTextGuard.cs:line 18
   at MirrorSharp.Internal.Handlers.RequestInfoTipHandler.ExecuteForRoslynAsync(Int32 cursorPosition, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken)
   at MirrorSharp.Internal.Connection.ReceiveAndProcessInternalAsync(CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\source\#external\mirrorsharp-codemirror-6-preview\Common\Internal\Connection.cs:line 96
   at MirrorSharp.Internal.Connection.ReceiveAndProcessAsync(CancellationToken cancellationToken) in D:\a\SharpLab\SharpLab\source\#external\mirrorsharp-codemirror-6-preview\Common\Internal\Connection.cs:line 54

This appears to be the same as #1222.

Reproduction Code

https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIAYACAZQAtsoAHAGW2ADoASgFcAdhgCW+GAG4aNYgGYGZBgGEANnlw0A3jQYGGAbQBS4jAHEYImFHFgAFBgCeHGBABmDgBLZ1HgEoAgF19Q1NzKxs7Rxc3TwcPdQhsDCDQ6kNjM0trW3snV3cvABMIIWB1GHSwgwjc6IK44ocSmDBJPxrM8Jyo/NiihPExbqzFZRQGAFkYDBYIEoAeABUAPgcA2oY9HoMAXxp9oA==

using System;
using SharpLab.Runtime;

public class Class
{
    [JitGeneric(typeof(Half))]
    [JitGeneric(typeof(float))]
    [JitGeneric(typeof(double))]
    [JitGeneric(typeof(decimal))]
    [JitGeneric(typeof(int))]
    public void Method<T>()
    {
    }
}

Activity

  1. OwnageIsMagic commented on Aug 21, 2024

    @OwnageIsMagic

    use

    [JitGeneric(typeof(Half)), JitGeneric(typeof(float)), JitGeneric(typeof(double))]
  2. colejohnson66 commented on Aug 21, 2024

    @colejohnson66
    Author

    That is what I ended up doing when I found #1222. I’m not necessarily saying the limit should be increased, but the error message is extremely cryptic, and could be improved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions