我在创建我的巴士时遇到问题。当我从传递给 With() 函数(“MyAssembly.LetterProcessor”)的集合中删除最后一个程序集时,它不会在本节中中断,尽管它稍后会中断。错误消息只是“对象引用未设置为对象的实例”。没有内在的例外。
我正在使用 NSB 3.2.0.0。
NServiceBus.SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
var assemblies = new List<Assembly> { Assembly.Load("NServiceBus"), Assembly.Load("NServiceBus.Core"), Assembly.Load("MyAssembly.LetterProcessor") };
var cfg = NServiceBus.Configure.With(assemblies);
cfg = cfg.DefineEndpointName("MyAssembly.letterprocessor");
cfg = cfg.DefaultBuilder();
cfg = cfg.DefiningMessagesAs(t => t.Namespace != null &&
(
t.Namespace.Equals("MyAssembly.LetterProcessor.NSB.BatchSaga")
|| t.Namespace.Equals("MyAssembly.LetterProcessor.NSB.FileSaga")
)
);
cfg = cfg.MessageForwardingInCaseOfFault();
cfg = cfg.Log4Net();
cfg = cfg.StructureMapBuilder();
cfg = cfg.XmlSerializer();
cfg = cfg.MsmqTransport();
cfg = cfg.IsTransactional(true);
cfg = cfg.IsolationLevel(System.Transactions.IsolationLevel.Serializable);
cfg = cfg.Sagas();
cfg = cfg.NHibernateSagaPersister();
var cfgu = cfg.UnicastBus();
cfgu = cfgu.LoadMessageHandlers();
var sb = cfgu.CreateBus(); // <-- breaks here.
var bus = sb.Start();
...和堆栈跟踪:
at System.Reflection.Emit.CustomAttributeBuilder.EmitValue(BinaryWriter writer, Type type, Object value)
at System.Reflection.Emit.CustomAttributeBuilder.InitCustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] propertyValues, FieldInfo[] namedFields, Object[] fieldValues)
at System.Reflection.Emit.CustomAttributeBuilder..ctor(ConstructorInfo con, Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] propertyValues)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.BuildCustomAttribute(Object customAttribute)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.AddCustomAttributeToProperty(Object customAttribute, PropertyBuilder propBuilder)
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.InitType(Type t, ModuleBuilder moduleBuilder)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable`1 types)
at NServiceBus.Serializers.XML.Config.MessageTypesInitializer.Run()
at NServiceBus.Configure.<Initialize>b__d(IWantToRunWhenConfigurationIsComplete o)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at NServiceBus.Configure.Initialize()
at NServiceBus.Configure.CreateBus()
at MyAssembly.LetterProcessor.Service.Tests.Tests.EndpointInit() in C:\svn\MyAssembly\LetterProcessor\trunk\src\MyAssembly.LetterProcessor.Service.Tests\Tests.cs:line 72>