Skip to content

CS8103: combined length of user strings used by the program exceeds allowed limit #20224

Closed
@link05

Description

@link05

Describe the bug

I have 3 for each loop in cshtml that i wanted to nest all 3 loops inside single jquery tabs and i got this issue. *sorry i updated explanation but now the code looks unstructured here.

To Reproduce

initally:

<div>
@for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
@for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
@for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
</div>

after adding code for tabs:

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
  </ul>
  <div id="tabs-1">
   @for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
   @for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
   @for (int i = 0; Model.ManualData!= null && i < Model.ManualData.Count; i++){<div>...</div>}
  </div>
  <div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc.</p>
  </div>
  <div id="tabs-3">
    <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, </p>
  </div>
</div>

I ran the app. when the cshtml code was just 3 for loops(look above at initally) and then added jquery tabs and refreshed the page to see the change. It worked and the error CS8103 did not show up(which makes sense b.c. its a complier error). But when i build and tried to run again, it gave me this error.
Crazy thing is if i undo this(meaning went back to what the code was initally (look above) and clean and rebuild project) then it works. Its only when i try to restructure the 3 loops by nesting all 3 of them in single tab then it gives me this compile time error.

Got Exceptions? Include both the message and the stack trace
1>CSC : error CS8103: Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals.

Further technical details

  • Include the output of dotnet --info:
    Runtime Environment:
    OS Name: Windows
    OS Version: 10.0.17134
    OS Platform: Windows
    RID: win10-x64
    Base Path: C:\Program Files\dotnet\sdk\3.1.200\

.NET Core SDKs installed:
2.1.602 [C:\Program Files\dotnet\sdk]
3.1.200 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

  • VS 16.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions