Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-3054

DependencyInjection tests fail due to Moq with .NET 5.0 and 6.0

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.2.5
    • 3.3.0
    • None
    • None
    • 1
    • SDK16: SDK 3.3 + Spring Txns

    Description

       Couchbase.Extensions.DependencyInjection.UnitTests.Internal.ClusterProviderTests.GetCluster_FirstCall_ReturnsNewCluster
         Source: ClusterProviderTests.cs line 52
         Duration: 68 ms

        Message: 
      System.ArgumentException : Cannot set up ClusterProvider.CreateClusterAsync because it is not accessible to the proxy generator used by Moq:
      Can not create proxy for method System.Threading.Tasks.Task`1[Couchbase.ICluster] CreateClusterAsync(Couchbase.ClusterOptions) because it or its declaring type is not accessible. Make it public, or internal and mark your assembly with [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] attribute, because assembly Couchbase.Extensions.DependencyInjection is not strong-named.

        Stack Trace: 
      Guard.IsVisibleToProxyFactory(MethodInfo method) line 115
      ExpressionExtensions.<Split>g__Split|5_0(Expression e, Expression& r, MethodExpectation& p, Boolean assignment, Boolean allowNonOverridableLastProperty) line 219
      ExpressionExtensions.Split(LambdaExpression expression, Boolean allowNonOverridableLastProperty) line 149
      Mock.SetupRecursive[TSetup](Mock mock, LambdaExpression expression, Func`4 setupLast, Boolean allowNonOverridableLastProperty) line 643
      Mock.Setup(Mock mock, LambdaExpression expression, Condition condition) line 498
      ProtectedMock`1.InternalSetup[TResult](String methodName, Type[] genericTypeArguments, Boolean exactParameterMatch, Object[] args) line 102
      ProtectedMock`1.Setup[TResult](String methodName, Object[] args) line 68
      ClusterProviderTests.GetCluster_FirstCall_ReturnsNewCluster() line 67
      — End of stack trace from previous location —

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          It looks like the root cause of this is https://github.com/castleproject/Core/issues/601, which was merged 14 days ago.  That, in turn, will take a little while to be included in Moq.

          richard.ponton Richard Ponton added a comment - It looks like the root cause of this is https://github.com/castleproject/Core/issues/601, which was merged 14 days ago.  That, in turn, will take a little while to be included in Moq.

          Punting until next release since this is test-only and may be fixed at the root cause in external libraries.

          richard.ponton Richard Ponton added a comment - Punting until next release since this is test-only and may be fixed at the root cause in external libraries.

          People

            richard.ponton Richard Ponton
            richard.ponton Richard Ponton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty