程序集中的重复类型名称(使用NSubstitute)

时间:2018-03-15 15:14:49

标签: c# linq exception nsubstitute castle-dynamicproxy

从今天早上开始,我们的CI构建由于令人惊讶而导致失败" System.ArgumentException:程序集中的重复类型名称。"我们的测试执行期间的异常。

(注意:我们的测试项目是使用对NUnit(3.9.0.0)和NSubstitute(3.1.0.0)的引用在.NET(4.6)中构建的。

到目前为止,我们已经步入mscorlib(ModuleBuilder类型)并发现Castle.DynamicProxy正在动态生成一个程序集来托管其存根/伪造/命名:DynamicProxyGenAssembly2。似乎我们有一个名为" Castle.Proxies.IEnumerator`1Proxy_13"的类型的多个引用。

我们真的不明白这里发生了什么。我们感谢任何有关如何理解和找到解决方案的建议。

堆栈跟踪示例:-----------------

at System.Reflection.Emit.ModuleBuilder.CheckTypeNameConflict(String strTypeName,Type enclosingType) 在System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName,TypeBuilder enclosingType) 在System.Reflection.Emit.TypeBuilder.Init(String fullname,TypeAttributes attr,Type parent,Type [] interfaces,ModuleBuilder module,PackingSize iPackingSize,Int32 iTypeSize,TypeBuilder enclosingType) 在System.Reflection.Emit.ModuleBuilder.DefineTypeNoLock(String name,TypeAttributes attr,Type parent,Type [] interfaces,PackingSize packingSize,Int32 typesize) 在System.Reflection.Emit.ModuleBuilder.DefineType(String name,TypeAttributes attr) 在Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope,String name,Type baseType,IEnumerable 1 interfaces, TypeAttributes flags, Boolean forceUnsigned) at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, IEnumerable 1个接口) 在Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter(String typeName,Type parentType,IEnumerable 1 interfaces) at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.Init(String typeName, ClassEmitter& emitter, Type proxyTargetType, FieldReference& interceptorsField, IEnumerable 1 interface) 在Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator.GenerateType(String typeName,Type proxyTargetType,Type [] interfaces,INamingScope namingScope) 在Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator。&lt;&gt; c__DisplayClass6_0.b__0(String n,INamingScope s) 在Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey,Func 3 factory) at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, IInterceptor[] interceptors) at NSubstitute.Proxies.CastleDynamicProxy.CastleDynamicProxyFactory.GenerateProxy(ICallRouter callRouter, Type typeToProxy, Type[] additionalInterfaces, Object[] constructorArguments) at NSubstitute.Core.SubstituteFactory.Create(Type[] typesToProxy, Object[] constructorArguments, SubstituteConfig config) at NSubstitute.Routing.Handlers.ReturnAutoValue.<>c__DisplayClass6_0.<ReturnValueUsingProvider>b__0(IAutoValueProvider provider) at NSubstitute.Routing.Handlers.ReturnAutoValue.Handle(ICall call) at System.Linq.Enumerable.WhereSelectArrayIterator 2.MoveNext() 在System.Linq.Enumerable.FirstOrDefault [TSource](IEnumerable 1 source, Func 2谓词) 在NSubstitute.Routing.Route.Handle(ICall电话) 在NSubstitute.Proxies.CastleDynamicProxy.CastleForwardingInterceptor.Intercept(IInvocation invocation) 在Castle.DynamicProxy.AbstractInvocation.Proceed() 在Castle.Proxies.IEnumerable 1Proxy_16.GetEnumerator() at System.Linq.Buffer 1..ctor(IEnumerable 1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable 1来源) 在Caraibes.Infrastructure.AggregateCreationAuditTrail.BuildCacheFromEventStore(AggregateType aggregateType)中的E:\ Builds \ TheFuture01_work \ 366 \ s \ Caraibes \ Caraibes.Infrastructure \ AggregateCreationAuditTrail.cs:第45行 at Caraibes.Infrastructure.AggregateCreationAuditTrail.HasAlreadyBeenCreated(AggregateType aggregateType,Int32 lightTradeId)在E:\ Builds \ TheFuture01_work \ 366 \ s \ Caraibes \ Caraibes.Infrastructure \ AggregateCreationAuditTrail.cs:第31行 位于E:\ Builds \ TheFuture01_work \ 366 \ s \ Caraibes \ Caraibes.Tests \ Domain \ EventSourcing \ AggregateCreationAuditTrailShould.cs中的Caraibes.Tests.Domain.EventSourcing.AggregateCreationAuditTrailShould.Only_call_EventStore_when_previous_request_did_not_contained_the_requested_identifier(AggregateType aggregateType):第74行 附件(0)

0 个答案:

没有答案