Uploaded image for project: 'Visual Studio'
  1. Visual Studio
  2. VS-114

A lambda expression for sorting makes MongoDB.Analyzer not work as expected

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: None
    • None
    • Dotnet Drivers

      Summary

      MongoDB.Analyzer doesn't show ... annotation when the source file contains the following code:

      Func<IFindFluent<User, User>, IOrderedFindFluent<User, User>> sort = x => x.SortBy(u => u.Address);

      The version of MongoDB.Analyzer is 1.3.0.

      How to Reproduce

      Adding the following code in BuildersSample.cs in MongoDB.Analyzer.Samples.sln:

      public void Test()
      {
          Func<IFindFluent<Movie, Movie>, IOrderedFindFluent<Movie, Movie>> sort = x => x.SortBy(x => x.Score);
      }

      Additional Background

      The following error was logged by MongoDB.Analyzer:

      Compilation failed with: (65,38): error CS0103: The name 'x' does not exist in the current context

            Assignee:
            ravi.raghavan@mongodb.com Ravi Raghavan (Inactive)
            Reporter:
            alanliu90@gmail.com AlanLiu90 N/A
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: