question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tracking: avoid suppressing SYSLIB0001 in shipping sources

See original GitHub issue

There are a few cases in the sources where aspnet is comparing if (encoding == Encoding.UTF7) { /* do something */ }. Since this accesses the Encoding.UTF7 property getter, a warning is produced.

From https://github.com/dotnet/docs/issues/19274:

If you’re trying to compare an Encoding instance against Encoding.UTF7, consider instead performing a check against the well-known UTF-7 code page (65000). This has the dual advantage that it both avoids the warning and handles some edge cases (such as somebody having subclassed UTF7Encoding).

void DoSomething(Encoding enc)
{
    // don't perform the check this way; it produces a warning and misses some edge cases
    if (enc == Encoding.UTF7)
    {
        // encoding is UTF-7
    }

    // instead, perform the check this way
    if (enc != null && enc.CodePage == 65000)
    {
        // encoding is UTF-7
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
BrennanConroycommented, Feb 5, 2021
0reactions
msftbot[bot]commented, Jul 24, 2020

Thanks for contacting us. We’re moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Obsoletion of UTF-7 code paths within the framework · ...
UTF7 or UTF7Encoding , you can suppress the SYSLIB0001 warning in code or ... Tracking: avoid suppressing SYSLIB0001 in shipping sources ...
Read more >
SYSLIB0001 warning - .NET
To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning. C# Copy. // ......
Read more >
Breaking change: UTF-7 code paths are obsolete - .NET
Suppressing SYSLIB0001 only disables the Encoding.UTF7 and UTF7Encoding obsoletion warnings. It doesn't disable any other warnings or change the ...
Read more >
7124b168cc7e0c6a11120728ad...
dotnet nuget disable source ... How to: Prevent a Child Task from Attaching to its Parent Dataflow ... sudo apt-get install -y apt-transport-https...
Read more >
Net | PDF | Xml | Microsoft Visual Studio
How to suppress warnings ... How to: Prevent a Child Task from Attaching to its Parent ... NET Core 3.0 shipped in September...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found