We are using one of the DataFlow blocks (BufferBlock<T>
in System.Threading.Tasks.Dataflow
) from a library that our service uses, and since adding that type, we have been getting the following exception in our base AppHost:
[NullReferenceException: Object reference not set to an instance of an object.]
Gene.Services.AppHosts.AppHostBase..cctor() in c:\Projects\github\mindkin\gene\src\Services.AppHosts.Common\AppHostBase.cs:13
[TypeInitializationException: The type initializer for 'Gene.Services.AppHosts.AppHostBase' threw an exception.]
Gene.Services.AppHosts.AppHostBase..ctor(String serviceName, Assembly[] assembliesWithServices) in c:\Projects\github\mindkin\gene\src\Services.AppHosts.Common\AppHostBase.cs:37
Crib.Services.AppHostBase..ctor() in c:\Projects\github\mindkin\crib\src\Services\AppHost.gen.cs:45
Crib.Services.AppHost..ctor() +43
Crib.Services.Global.Application_Start(Object sender, EventArgs e) in c:\Projects\github\mindkin\crib\src\Services\Global.asax.cs:24
[HttpException (0x80004005): The type initializer for 'Gene.Services.AppHosts.AppHostBase' threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343
[HttpException (0x80004005): The type initializer for 'Gene.Services.AppHosts.AppHostBase' threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716
The offending line of code simply calls the ctor of ServiceStack.AppHostBase
with our list of discovery assemblies (containing our services and DTO’s), as it always has.
Since we added code that uses BufferBlock<T>
to one of our other libraries (not in the list of discovery assemblies), but added the TPL nuget to the service project, we get this exception. (Service project directly references the library assembly and the System.Threading.Tasks.Dataflow
Assembly)
Does anyone know why we would get this exception now?
p.s. I stress, if we comment out the use of the BufferBlock<T>
type in our library, everything works fine again. This is not a setup problem of our service that we have seen yet.