2014-12-08 2 views
0

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; } 
    } 
} 
+0

NServiceBus의 어떤 특정 버전을 사용하고 있습니까? –

+0

3.3.8을 사용하여 5.1.2 –

+0

으로 이동하면 맞춤 직렬 변환기를 등록하면 http://docs.particular.net/nservicebus/how-to-register-a-custom-serializer가 해제됩니다. – Simon

답변

0

당신이 메시지를 직렬화하고 와이어를 통해 보내, 당신은 탈 수 있습니다 직렬화 된 데이터를 전송하는 다른 끝에서 직렬화됩니다. DeepClone 방법으로 보내지는 무엇입니까? 당신이 명령에서 그 방법을 벗겨야한다고 말하고 싶습니다.

+0

딥 복사 방법이 직렬화되지 않았습니다 (우리는 사용자 정의 JSON 멸균기를 사용하고 있습니다). NSB가 인터페이스를 기반으로 전송하도록 허용함으로써 도움이 될 수있는 곳에서는 설정되어있는 맞춤 직렬화를 존중하지 않습니다 (솔직히 말해서 내가 할 수있는 방법이 전혀 없음). 그러나 이것이 NSB 3.3.8에서 작동 했었고 이제는 NSB 5.1.2로 옮겨 가고 있습니다. 따라서 MessageMapper의 내용이 변경되었다고 가정합니다. 우리는 현재 메시지에서 인터페이스의 메소드를 구현하는 모든 클래스를 제거하려고합니다. –

+0

도메인 객체가 메시지 (아마도 좋지 않음)로 유출되었으므로이 문제는 우리가 스스로 만든 문제로 간주 될 수 있습니다. 아무런 문서도 보지 못했기 때문에 업그레이드에 예상되는 문제가 아니 었습니다. 그것에 대해 (또는 메시지 클래스에서이 제한을 자세히 설명합니다). –

+0

당신과 동의하십시오. 명령은 대부분 데이터의 유효성을 확인해야하지만 다른 책임은 수행하지 않아야합니다. –