Code Monkey home page Code Monkey logo

Comments (3)

sujitmahapatra avatar sujitmahapatra commented on June 14, 2024

The issue you're encountering where VSTHRD103 doesn't trigger when accessed using the null-conditional operator (?.) might be a limitation of the current version of the Microsoft.VisualStudio.Threading.Analyzers library. To work around this issue, you can follow these steps:

  1. Manually Check for Null:

    Instead of relying solely on the null-conditional operator, manually check if the result of SomethingAsync() is null before accessing the Result property. This way, you can ensure that VSTHRD103 is triggered:

    public async Task DoAsync()
    {
        var a = SomethingAsync().Result; // Triggers VSTHRD103
        var result = SomethingAsync();
        if (result != null)
        {
            var b = result.Result; // Triggers VSTHRD103
        }
    }

    By manually checking for null, you make sure that the analyzer recognizes the potential issue with accessing Result in a non-async context.

  2. Check for Updates:

    Keep an eye on updates to the Microsoft.VisualStudio.Threading.Analyzers library. The behavior you described might be a bug that is fixed in a later version of the library. Check for updates and upgrade to a newer version if it becomes available.

  3. Report the Issue:

    If you believe this is a genuine bug in the analyzer and it's not fixed in the latest version, consider reporting the issue to the Visual Studio team on their GitHub repository. Provide a clear description of the problem and any relevant code examples to help them understand and address the issue.

    Here is the link to the GitHub repository where you can report issues: https://github.com/microsoft/vs-threading

    Reporting the issue directly to the maintainers can help ensure that it gets the necessary attention and is addressed in a future release of the library.

from vs-threading.

AArnott avatar AArnott commented on June 14, 2024

Thanks for the report @bjornhellander.

@sujitmahapatra I can't fault what you say. I'm guessing though that it's AI-generated text (and as I guessed, that's an interest of yours from your github profile). The text seems both customized yet boilerplate like AI would have generated. Advising that the issue be reported as a github issue when that is exactly what you're responding to feels... a bit AI like.
Am I right?

from vs-threading.

sujitmahapatra avatar sujitmahapatra commented on June 14, 2024

from vs-threading.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.