i attempt to migrate bot framework composer dot net 3.1 project to dot net 6
upon testing i hit Internet Service Error, any insight would be appreciated.
ArgumentNullException: Value cannot be null. (Parameter 'adaptiveDialogId')
Microsoft.Bot.Builder.Dialogs.Adaptive.AdaptiveDialogBot..ctor(string adaptiveDialogId, string languageGeneratorId, ResourceExplorer resourceExplorer, ConversationState conversationState, UserState userState, SkillConversationIdFactoryBase skillConversationIdFactoryBase, LanguagePolicy languagePolicy, BotFrameworkAuthentication botFrameworkAuthentication, IBotTelemetryClient telemetryClient, IEnumerable scopes, IEnumerable pathResolvers, IEnumerable dialogs, ILogger logger)
Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.ConfigurationAdaptiveDialogBot..ctor(IConfiguration configuration, ResourceExplorer resourceExplorer, ConversationState conversationState, UserState userState, SkillConversationIdFactoryBase skillConversationIdFactoryBase, LanguagePolicy languagePolicy, BotFrameworkAuthentication botFrameworkAuthentication, IBotTelemetryClient telemetryClient, IEnumerable scopes, IEnumerable pathResolvers, IEnumerable dialogs, ILogger logger)
System.RuntimeMethodHandle.InvokeMethod(object target, ref Span arguments, Signature sig, bool constructor, bool wrapExceptions)
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<TArgument, TResult>.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<TArgument, TResult>.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)
System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired)
lambda_method8(Closure , IServiceProvider , object[] )
Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider+<>c__DisplayClass7_0.b__0(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider+<>c__DisplayClass6_0.g__CreateController|0(ControllerContext controllerContext)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Thanks AP01 for dropping your knowledge
Unfortunately, the adaptiveDialogId is embedded in library Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime in which I cannot debug
however, inspired by your advice
I modify the build target not from scratch, but simply upgrade the dot net target straight from 3.1 to 6
as it turns out the problems caused by nullable validation in the Project File, this causes dot net 3.1 libraries not working
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64</Platforms>
**<Nullable>enable</Nullable>**
...
</PropertyGroup>
Related
I am trying to query an Oracle database from .NET7.
I used database first approach to generate my model context. When querying, I get the following exception:
InvalidCastException: Specified cast is not valid.
Oracle.ManagedDataAccess.Client.OracleDataReader.GetInt16(int i)...
That's my (truncated) object class, and the property causing the exception (when I comment the property, select query is working):
public partial class Car
{
public string? Owner { get; set; }
[...]
}
Database looks like this:
CREATE TABLE "Car"
( "Owner" VARCHAR2(6 BYTE)
[...]
Generated context:
modelBuilder.Entity<Car>(entity =>
{
entity.Property(e => e.Owner)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("Owner")
[...]
}
Packages:
Oracle.EntityFrameworkCore 7.21.8
Microsoft.EntityFrameworkCore.Design 7.0.1
What's the problem? Is it because the column is nullable? I have no idea.
EDIT:
Seems like the problem is the stored data. Some rows must be corrupted / not like the column definition.
EDIT2:
That's the LINQ query:
return await _context.Cars.Take(10).ToListAsync();
Stacktrace:
System.InvalidCastException: Specified cast is not valid.
at Oracle.ManagedDataAccess.Client.OracleDataReader.GetInt16(Int32 i)
at lambda_method19(Closure, QueryContext, DbDataReader, ResultContext, SingleQueryResultCoordinator)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at CarService.Controllers.CarController.GetCars(Int32 plate) in C:\GIT\webservices\car-service-dotnet\CarService\Controllers\CarController.cs:line 45
at lambda_method5(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
When trying to execute the following ASP.NET Core code:
public class Foo
{
public long A { get; set; }
public string B { get; set; }
}
[HttpGet]
[Route("Foos")]
public ActionResult<IEnumerable<IGrouping<long, Foo>>> Foos()
{
var foos = new List<Foo> { new Foo { A = 1, B = "Foo" }, new Foo { A = 2, B = "Bar" }, new Foo { A = 2, B = "Baz" } };
return new ActionResult<IEnumerable<IGrouping<long, Foo>>>(foos.GroupBy(f => f.A));
}
I get:
System.InvalidCastException: Unable to cast object of type 'Foo' to type 'System.Int64'.
at System.Text.Json.JsonPropertyInfoNotNullable`4.OnWriteEnumerable(WriteStackFrame& current, Utf8JsonWriter writer)
at System.Text.Json.JsonPropertyInfo.WriteEnumerable(WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.JsonSerializer.HandleEnumerable(JsonClassInfo elementClassInfo, JsonSerializerOptions options, Utf8JsonWriter writer, WriteStack& state)
at System.Text.Json.JsonSerializer.Write(Utf8JsonWriter writer, Int32 originalWriterDepth, Int32 flushThreshold, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteAsyncCore(Stream utf8Json, Object value, Type inputType, JsonSerializerOptions options, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Why does it seem to be trying to serialize an object to an int64? How can I successfully return the result of a GroupBy from a web API endpoint?
New System.Text.Json serializer cannot serialize IEnumerable<IGrouping<long, Foo>>.
Solution
I would recommend switching to old Json.Net serializer in your ASP.Net Core project. I've tested it and it works fine with Json.Net.
See this article for information about switching to Json.Net.
It will be something as easy as that:
services.AddMvc()
.AddNewtonsoftJson();
When I scaffold this Oracle DB (database -first) and it generates me all models, contexts, FK relations ect. But it gives me an error in the context when I start Querying.
(simple things as select * from (any Table))
The follow error comes up.
System.InvalidOperationException
HResult=0x80131509
Message=The properties 'Address.AddressId', 'Address.AddressItemId'
are configured to use 'Identity' value generator and are mapped to the
same table '[DBName].ADDRESS'. Only one column per table can be
configured as 'Identity'. Call 'ValueGeneratedNever' for properties
that should not use 'Identity'.
Source=Oracle.EntityFrameworkCore
StackTrace:
at
Oracle.EntityFrameworkCore.Internal.OracleModelValidator.ValidateSharedColumnsCompatibility(IReadOnlyList`1
mappedTypes, String tableName)
at
Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelValidator.ValidateSharedTableCompatibility(IModel
model)
at
Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelValidator.Validate(IModel
model)
at
Oracle.EntityFrameworkCore.Internal.OracleModelValidator.Validate(IModel
model)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ValidatingConvention.Apply(InternalModelBuilder
modelBuilder)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnModelBuilt(InternalModelBuilder
modelBuilder)
at
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnModelBuilt(InternalModelBuilder
modelBuilder)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Model.Validate()
at Microsoft.EntityFrameworkCore.ModelBuilder.FinalizeModel()
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext
context, IConventionSetBuilder conventionSetBuilder, IModelValidator
validator)
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.b__1()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper
executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at
Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext
context, IConventionSetBuilder conventionSetBuilder, IModelValidator
validator)
at
Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at
Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at
Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.b__7_2(IServiceProvider
p)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
factoryCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
constructorCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
scopedCallSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
callSite, TArgument argument)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite
callSite, ServiceProviderEngineScope scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope
scope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type
serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type
serviceType)
at
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider
provider, Type serviceType)
at
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider
provider)
at
Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at
Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at
Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_Model()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityType()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.CheckState()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityQueryable()
at
Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at OracleConsoleApp.Program.Main(String[] args) in
C:\GitPlayGround\OracleConsoleApp\OracleConsoleApp\Program.cs:line 47
I need to use the FK connections in this complex structure.
I have no experience with Oracle, nor with Oracle.EntityFrameworkCore (2.2.6, application core 2.2)
Can anyone advise me what to do, Can't find a clue to start to solve this.
After a deep research, my colleague came with the solution.
In Oracle generated value's work different. With the database first it sets the data annotation ValueGeneratedOnAdd();.
This is not a working model and context.
So selective deleting this ValueGeneratedOnAdd() will result in a working result and solves the problem.
I have recently upgraded my project from dotnet core v.1.0.0 to v.1.0.4. I am using the same code in each of the Startup.cs files. V.1.0.0 works fine, .4 does not. Visual Studio 2017.
System.ArgumentNullException occurred
HResult=0x80004003
Message=Value cannot be null.
Source=<Cannot evaluate the exception source>
StackTrace:
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 sqlServerOptionsAction)
at ApostilleDNCv2.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder options) in c:\users\kenn.kinnaird\documents\visual studio 2017\Projects\ApostilleDNCv2\ApostilleDNCv2\Startup.cs:line 34
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.DbContextOptionsFactory[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at Microsoft.AspNetCore.Mvc.Internal.TypeActivatorCache.CreateInstance[TInstance](IServiceProvider serviceProvider, Type implementationType)
at Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(ControllerContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
My code (both version):
Startup.cs-
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("ApostillesTest")));
services.AddMvc();
services.AddDistributedMemoryCache();
services.AddScoped<ICountryRepository, CountryRepository>();
appsettings.json-
"ConnectionStrings": {
"ApostillesTest": "Server=TESTSQLCORP;Database=Apostilles;Trusted_Connection=True;Persist Security Info=True",
"DefaultConnection": "Server=TESTSQLCORP;Database=Apostilles;Trusted_Connection=True"
}
I have looked at other solutions here; none have helped.
Any help will be appreciated.
I'm hosting a Web API in IIS (7.5) as an Application under "Default Web Site", and am using several of the Enrichers from Serilog.Extras.Web (I'll be upgrading soon to the SerilogWeb.Classic package). I noticed in my logs that ApplicationLifecycleModule.LogRequest() was being called twice for each request, and I'm trying to understand why.
What I noticed is that ApplicationLifecycleModule.Init() is being called twice, thus registering two event handlers.
The first callstack:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(System.IntPtr appContext, System.Web.HttpContext context, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplication.InitSpecial(System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers, System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.InitializeApplication(System.IntPtr appContext)
[AppDomain Transition]
And the second:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.InitModulesCommon()
System.Web.dll!System.Web.HttpApplication.InitInternal(System.Web.HttpContext context, System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplicationFactory.GetNormalApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
Am I doing something wrong? Or is this a bug in the ApplicationLifecycleModule?