Home>

Hello.
Thank you again this time.

We are developing form applications that run locally in VisualStudio.
I stored string literals of about 5,000,000 characters in two patterns in two string type variables, respectively.
An error occurs during compilation. (Refer to the lower error text)
Please tell me how to avoid errors or alternatives.

This 5,000,000 character string is what was originally stored as a csv file and made into one line using a script.

By design, external files should not be referenced, so
I think that it is necessary to put this character string in exe.

The reason why you cannot refer to the external file is that I want to keep the contents of the csv file confidential.

Although it is an alternative that I thought of, it is as follows.
①Use the database
② Have csv file with zippass and unzip inside exe when referring
③ Place DataGritView in the main form with visible = Flase and store the data in it

I think that it is a project that should be adopted ①, but unfortunately there are few man-hours and a new DB
There is no time to learn related knowledge.
In addition, even if (2) is adopted, there is a possibility that the temporarily decompressed file may be placed somewhere during decompression, so it is inferior as a secret function.

If possible, it is desirable to avoid this error without changing the program already made.

Error message
Error CS8103 The total length of user strings used in the program exceeds the allowed limit. Reduce the use of string literals.
Supplemental information (FW/tool version etc.)

Microsoft Visual Studio Community 2017
Version 15.7.3
VisualStudio.15.Release/15.7.3 + 27703.2026
Microsoft .NET Framework
Version 4.8.03761

In the following, it is written that "String Object is 2GB or about 1 billion characters" can be stored.
https://www.kinakomotitti.net/entry/2017/ 12/29/200615

In the following,
"I guess its a new compiler in VS2015, which restricts too much use of string literals."
"I think the new compiler in VS2015 is too restrictive to use string literals."
There is. Is there no help for the VS specification?
https://stackoverflow.com/questions/37193372/c-sharp-combined-length-of-user-strings-used-by-the-program-exceeds-allowed-limi/50522293

  • Answer # 1

      

    The reason why you cannot refer to the external file is that you want to keep the contents of the csv file confidential.

    In the first place, if you just write it as a string literal,it will be embedded in the executable file. The secret is whether it has an effect of comfort.