Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure: SuppressScope_False_CreatesNewScope #3569

Closed
aspnet-hello opened this issue Oct 1, 2018 · 9 comments
Closed

Test failure: SuppressScope_False_CreatesNewScope #3569

aspnet-hello opened this issue Oct 1, 2018 · 9 comments
Assignees
Labels
Done This issue has been fixed test-failure

Comments

@aspnet-hello
Copy link

This issue was made automatically. If there is a problem contact ryanbrandenburg.

This test failed with the following error:

System.NullReferenceException : Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Castle.DynamicProxy.ModuleScope.GetFromCache(CacheKey key)
   at Castle.DynamicProxy.Generators.BaseProxyGenerator.GetFromCache(CacheKey key)
   at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey, Func`3 factory)
   at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options)
   at Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
   at Castle.DynamicProxy.ProxyGenerator.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options)
   at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors)
   at Moq.Proxy.CastleProxyFactory.CreateProxy(Type mockType, ICallInterceptor interceptor, Type[] interfaces, Object[] arguments)
   at Moq.Mock`1.<InitializeInstance>b__20_0()
   at Moq.PexProtector.Invoke(Action action)
   at Moq.Mock`1.InitializeInstance()
   at Moq.Mock`1.OnGetObject()
   at Moq.Mock.GetObject()
   at Moq.Mock.get_Object()
   at Moq.Mock`1.get_Object()
   at Moq.Mocks.CreateMocks[T]()+MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at System.Linq.EnumerableExecutor`1.Execute()
   at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute[TElement](Expression expression)
   at System.Linq.Queryable.First[TSource](IQueryable`1 source)
   at Moq.Linq.MockQueryable`1.Execute[TResult](Expression expression)
   at System.Linq.Queryable.First[TSource](IQueryable`1 source)
   at Moq.Mock.Of[T]()
   at Microsoft.Extensions.DependencyInjection.HttpClientFactoryServiceCollectionExtensionsTest.<>c__DisplayClass29_0.<SuppressScope_False_CreatesNewScope>b__0(IServiceProvider s) in /_/test/Microsoft.Extensions.Http.Test/DependencyInjection/HttpClientFactoryServiceCollectionExtensionsTest.cs:line 786
   at Microsoft.Extensions.DependencyInjection.HttpClientBuilderExtensions.<>c__DisplayClass3_0.<AddHttpMessageHandler>b__1(HttpMessageHandlerBuilder b) in /_/src/Microsoft.Extensions.Http/DependencyInjection/HttpClientBuilderExtensions.cs:line 132
   at Microsoft.Extensions.Http.DefaultHttpClientFactory.<>c__DisplayClass17_0.<CreateHandlerEntry>g__Configure|0(HttpMessageHandlerBuilder b) in /_/src/Microsoft.Extensions.Http/DefaultHttpClientFactory.cs:line 194
   at Microsoft.Extensions.Http.LoggingHttpMessageHandlerBuilderFilter.<>c__DisplayClass2_0.<Configure>b__0(HttpMessageHandlerBuilder builder) in /_/src/Microsoft.Extensions.Http/Logging/LoggingHttpMessageHandlerBuilderFilter.cs:line 35
   at Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateHandlerEntry(String name) in /_/src/Microsoft.Extensions.Http/DefaultHttpClientFactory.cs:line 176
   at Microsoft.Extensions.Http.DefaultHttpClientFactory.<>c__DisplayClass14_0.<.ctor>b__1() in /_/src/Microsoft.Extensions.Http/DefaultHttpClientFactory.cs:line 106
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateHandler(String name) in /_/src/Microsoft.Extensions.Http/DefaultHttpClientFactory.cs:line 143
   at Microsoft.Extensions.Http.DefaultHttpClientFactory.CreateClient(String name) in /_/src/Microsoft.Extensions.Http/DefaultHttpClientFactory.cs:line 124
   at Microsoft.Extensions.DependencyInjection.HttpClientBuilderExtensions.<>c__DisplayClass9_0`1.<AddTypedClient>b__0(IServiceProvider s) in /_/src/Microsoft.Extensions.Http/DependencyInjection/HttpClientBuilderExtensions.cs:line 326
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.HttpClientFactoryServiceCollectionExtensionsTest.SuppressScope_False_CreatesNewScope() in /_/test/Microsoft.Extensions.Http.Test/DependencyInjection/HttpClientFactoryServ
...

Other tests within that build may have failed with a similar message, but they are not listed here. Check the link above for more info.

This test failed on 2.2.

CC @Eilon (because the bot doesn't know who else to pick)

@aspnet-hello
Copy link
Author

This comment was made automatically. If there is a problem contact ryanbrandenburg.

Please use this workflow to address this flaky test issue, including checking applicable checkboxes and filling in the applicable "TODO" entries:

  • Is this actually a flaky test?

    • No, this is a regular test failure, fix the test/product (TODO: Link to commit/PR)
    • Yes, proceed below...
  • Is this test failure caused by product code flakiness? (Either this product, or another product this test depends on.)

    • File a bug against the product (TODO: Link to other bug)
    • Is it possible to change the test to avoid the flakiness?
      • Yes? Go to the "Change the test!" section.
      • No?
        • Disable the test (TODO: Link to PR/commit)
        • Wait for other bug to be resolved
        • Wait for us to get build that has the fix
        • Re-enable our test (TODO: Link to PR/commit)
        • Close this bug
  • Is it that the test itself is flaky? This includes external transient problems (e.g. remote server problems, file system race condition, etc.)

    • Is there is a way to change our test to avoid this flakiness?
      • Yes? Change the test!
        • Change the test to avoid the flakiness, for example by using a different test strategy, or by adding retries w/ timeouts (TODO: Link to PR/commit)
        • Run the test 100 times locally as a sanity check.
        • Close this bug
      • No?
        • Is there any logging or extra information that we could add to make this more diagnosable when it happens again?
          • Yes?
            • Add the logging (TODO: Link to PR/commit)
          • No?
            • Delete the test because flaky tests are not useful (TODO: Link to PR/commit)

@Eilon
Copy link
Member

Eilon commented Oct 1, 2018

@dougbu / @rynowak - is this a dup of some test failure issue that we already had? This looks quite familiar to me.

@dougbu
Copy link
Member

dougbu commented Oct 1, 2018

@Eilon yes, this duplicates aspnet/Mvc#8157 and aspnet/Mvc#8186. The root cause is castleproject/Core#193.

Good news is the Castle.Core race condition occurs rarely. Bad news is their issue hasn't been touched since July.

@ryanbrandenburg could we have the bot ignore these rare failures until castleproject/Core#193 is fixed? Then we could close a number of related flaky test issues and track aspnet/Mvc#8157 or a new External issue (so that we don't lose track of castleproject/Core#193).

@Eilon
Copy link
Member

Eilon commented Oct 1, 2018

The bot doesn't ignore things, but it doesn't open new issues for a given repo as long as the issue is already open. Plus, we should keep them open for tracking purposes.

@rynowak
Copy link
Member

rynowak commented Oct 1, 2018

Digging into this a little more, I'm not totally certain that this is the same issue. Have we opened an issue on them yet? I think we're seeing a failure mode that others aren't seeing because we're running tests on netcoreapp2.2 and netcoreapp3.0.

This code is invalid no matter what: https://github.com/castleproject/Core/blob/master/src/Castle.Core/Core/Internal/SynchronizedDictionary.cs#L125 A dictionary in .NET is not thread safe for concurrent readers + a single writer.

@rynowak
Copy link
Member

rynowak commented Oct 2, 2018

Opened castleproject/Core#410

@rynowak
Copy link
Member

rynowak commented Oct 2, 2018

castleproject/Core#410 (comment) FYI

So there's a newer version of Moq we could be using, and the author thinks hes fixed the issue.

@dougbu
Copy link
Member

dougbu commented Oct 3, 2018

So, create a feature branch that updates dependencies.props in Universe to Mock the latest, build it on the CI machine -- repeatedly, and see if anything breaks in the first 100 (pick a number) or so test runs?

rynowak added a commit to aspnet/Universe that referenced this issue Oct 9, 2018
This is the latest version of Moq, should have a fix for
dotnet/aspnetcore#3569
rynowak added a commit to aspnet/Universe that referenced this issue Oct 9, 2018
This is the latest version of Moq, should have a fix for
dotnet/aspnetcore#3569
@rynowak
Copy link
Member

rynowak commented Oct 12, 2018

This should be fixed by the Moq update

@rynowak rynowak closed this as completed Oct 12, 2018
@dougbu dougbu added the Done This issue has been fixed label Feb 1, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Done This issue has been fixed test-failure
Projects
None yet
Development

No branches or pull requests

4 participants