NSB v3에서 NSB v5로 프로젝트를 업그레이드 중이며 MessageMapper에 문제가 있습니다.메시지 매퍼가 솔루션을 nServiceBus 5로 업데이트 한 후 TypeLoadException을 던졌습니다.
Method 'DeepCopy' in type 'Benefex.Core.Interfaces.DTO.IUserContext__impl' from assembly 'Benefex.Commands.Operations.Batches__impl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
스택 추적은 다음과 같습니다 :
at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateType()
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.CreateTypeFrom(Type t, ModuleBuilder moduleBuilder)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.GenerateImplementationFor(Type interfaceType, ModuleBuilder moduleBuilder)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t, ModuleBuilder moduleBuilder)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t, ModuleBuilder moduleBuilder)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable`1 types)
at NServiceBus.Serializers.XML.Config.MessageTypesInitializer.Run(Configure config)
at NServiceBus.Configure.Initialize()
at NServiceBus.Bus.Create(BusConfiguration configuration)
at Benefex.Core.Processor.ProcessorConfiguration.Customize(BusConfiguration configuration) in c:\TFS\Benefex\Work Streams\SignIn\Benefex.Core.Processor\ProcessorConfiguration.cs:line 33
at Benefex.P1Processor.MessageEndpoint.Customize(BusConfiguration configuration) in c:\TFS\Benefex\Work Streams\SignIn\P1Processor\Server.cs:line 12
at NServiceBus.GenericHost.PerformConfiguration(Action`1 moreConfiguration)
at NServiceBus.GenericHost.Start()
at NServiceBus.Hosting.Windows.WindowsHost.Start()
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClasse.<Main>b__6(WindowsHost service)
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj)
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service)
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc)
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter)
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NServiceBus.Hosting.Windows.Program.Main(String[] args)
IUserContent 인터페이스는 구현이 NSB 3 잘 작동 수업은 지금 예외는 NSB (5)와
을 입력로드 예외를 던지고있다 예외에 명시된 메소드를 구현하는 클래스 UserContext. IUserContext는 다른 프로젝트에서 정의되며 해당 구현은 다른 별도의 프로젝트에 있습니다. 우리가 미래에 이들을 바꿀 가능성은 있지만, NSB 5를 지금 변경하지 않고 작업하고 싶습니다.
우리는 XML 직렬화 (대신 사용자 정의 JSON)를 사용하지 않지만 XML 직렬화 프로세스의 일부인 것처럼 보이지만 메시지 매퍼를 무시하는 방법을 찾지 못했습니다. -
편집 내가 같은 오류가 던지는 작은 테스트 프로젝트 얻을 관리했습니다 :
using NServiceBus.Features;
using NServiceBus.Persistence;
using Raven.Client.Document;
using NServiceBus;
namespace ServiceBus
{
public class EndpointConfig : IConfigureThisEndpoint
{
public void Customize(BusConfiguration configuration)
{
var documentStore = new DocumentStore
{
ConnectionStringName = "NServiceBus.Persistence"
};
configuration.AssembliesToScan(AllAssemblies.Except("ABCpdf9-32.dll"));
configuration.EndpointName("testqueue");
configuration.DisableFeature<AutoSubscribe>();
configuration.DisableFeature<SecondLevelRetries>();
configuration.UsePersistence<RavenDBPersistence>()
.SetDefaultDocumentStore(documentStore);
var conventionsBuilder = configuration.Conventions();
conventionsBuilder.DefiningCommandsAs(t => t.Namespace != null &&
!t.IsInterface &&
t.Name.EndsWith("Command"));
conventionsBuilder.DefiningMessagesAs(t => t.Namespace != null &&
!t.IsInterface &&
t.Name.EndsWith("Notification"));
Bus.Create(configuration);
}
}
public interface IDeepCopy<T>
{
T DeepCopy();
}
public class TestCommand
{
public IUserContext UserContext { get; set; }
public string Description { get; set; }
public int Id { get; set; }
}
public interface IUserContext : IDeepCopy<IUserContext>
{
int Id { get; set; }
string Description { get; set; }
}
public class UserContext : IUserContext
{
public IUserContext DeepCopy()
{
return new UserContext
{
Id = Id,
Description = Description
};
}
public int Id { get; set; }
public string Description { get; set; }
}
}
NServiceBus의 어떤 특정 버전을 사용하고 있습니까? –
3.3.8을 사용하여 5.1.2 –
으로 이동하면 맞춤 직렬 변환기를 등록하면 http://docs.particular.net/nservicebus/how-to-register-a-custom-serializer가 해제됩니다. – Simon