Exception when starting endpoint


(AK) #1

When running Host I am facing this exception

2019-03-21 12:24:52,076 FATAL NServiceBus.GenericHost - Exception when starting endpoint.
System.Exception: Can only generate a concrete implementation for ‘IMainframeHandler’ because the interface contains methods. Ensure interface messages do not contain methods.
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.GenerateImplementationFor(Type interfaceType)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InnerInitialize(Type t)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t)
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable1 types) at NServiceBus.SerializationFeature.Setup(FeatureConfigurationContext context) at NServiceBus.Features.FeatureActivator.ActivateFeature(FeatureInfo featureInfo, List1 featuresToActivate, IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing, ReceiveConfiguration receiveConfiguration)
at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing, ReceiveConfiguration receiveConfiguration)
at NServiceBus.InitializableEndpoint.d__1.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NServiceBus.GenericHost.d__1.MoveNext() in C:\BuildAgent\work\3fdd02ec65f005b\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 47
2019-03-21 12:24:52,200 FATAL NServiceBus.Hosting.Windows.WindowsHost - Start failure
System.Exception: Can only generate a concrete implementation for ‘IMainframeHandler’ because the interface contains methods. Ensure interface messages do not contain methods.
at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.GenerateImplementationFor(Type interfaceType)


(Brandon Ording) #2

It appears that you are using your IMainframeHandler interface as a message. When you do this, the interface must not have any methods, which is what the “Ensure interface messages do not contain methods” portion of the error message is telling you.

BTW, it does look like the first sentence of the error message has a typo. Instead of “Can only” it should say “Cannot”. I’ve opened PR to fix this: https://github.com/Particular/NServiceBus/pull/5346


(AK) #3

Issue resolved. Thank you!