0
我在創建總線時遇到問題。當我從傳遞給With()函數的集合中刪除最後一個程序集(「MyAssembly.LetterProcessor」)時,它在本節中不會中斷,儘管它稍後會中斷。該錯誤消息僅爲「未將對象引用設置爲對象的實例」。沒有內在的例外。創建NServiceBus總線時出現「對象引用未設置」錯誤
我在使用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>
撥號您的端點DEBUG的日誌記錄級別,以便您可以看到哪些消息類型,它正在對當它炸燬了。 –
你有任何消息的[obsolete]屬性(或任何其他屬性)嗎? https://github.com/NServiceBus/NServiceBus/issues/353 –