Support forum for ASP.NET Zero (https://aspnetzero.com/).
By statuscast
#31992 Does anyone else experience a large number of exceptions during startup in AppNameCoreModule.cs:
Code: Select allline 109: IocManager.Resolve<ChatUserStateWatcher>().Initialize();

Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
System.ArgumentException: 'Null is not a valid constant value for this type.'


I'm trying to debug the MVC app startup time and just happened to notice this.. probably not related but figured it would be worth reporting.
By statuscast
#31996 Here's the stack trace. Unfortunately I had to use the Call Stack window, as the stack trace listed in the exception is showing only

System.ArgumentException
HResult=0x80070057
Message=Null is not a valid constant value for this type.
Source=System.Private.CoreLib
StackTrace:
at System.Reflection.Emit.TypeBuilder.SetConstantValue(ModuleBuilder module, Int32 tk, Type destType, Object value)

Here's the full Call Stack Window:
Code: Select allSystem.Private.CoreLib.dll!System.Reflection.Emit.TypeBuilder.SetConstantValue(System.Reflection.Emit.ModuleBuilder module, int tk, System.Type destType, object value)
Castle.Core.dll!Castle.DynamicProxy.Generators.Emitters.MethodEmitter.CopyDefaultValueConstant(System.Reflection.ParameterInfo from, System.Reflection.Emit.ParameterBuilder to)
Castle.Core.dll!Castle.DynamicProxy.Generators.Emitters.MethodEmitter.DefineParameters(System.Reflection.ParameterInfo[] parameters)
Castle.Core.dll!Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.CreateCallbackMethod(Castle.DynamicProxy.Generators.Emitters.ClassEmitter emitter, System.Reflection.MethodInfo methodInfo, System.Reflection.MethodInfo methodOnTarget)
Castle.Core.dll!Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.BuildInvocationType(Castle.DynamicProxy.Generators.MetaMethod method, Castle.DynamicProxy.Generators.Emitters.ClassEmitter class, Castle.DynamicProxy.ProxyGenerationOptions options)
Castle.Core.dll!Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.GetMethodGenerator(Castle.DynamicProxy.Generators.MetaMethod method, Castle.DynamicProxy.Generators.Emitters.ClassEmitter class, Castle.DynamicProxy.ProxyGenerationOptions options, Castle.DynamicProxy.Contributors.OverrideMethodDelegate overrideMethod)
Castle.Core.dll!Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementMethod(Castle.DynamicProxy.Generators.MetaMethod method, Castle.DynamicProxy.Generators.Emitters.ClassEmitter class, Castle.DynamicProxy.ProxyGenerationOptions options, Castle.DynamicProxy.Contributors.OverrideMethodDelegate overrideMethod)
Castle.Core.dll!Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(Castle.DynamicProxy.Generators.Emitters.ClassEmitter class, Castle.DynamicProxy.ProxyGenerationOptions options)
Castle.Core.dll!Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(string name, System.Type[] interfaces, Castle.DynamicProxy.Generators.INamingScope namingScope)
Castle.Core.dll!Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(Castle.DynamicProxy.Generators.CacheKey cacheKey, System.Func<string, Castle.DynamicProxy.Generators.INamingScope, System.Type> factory)
Castle.Core.dll!Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type classToProxy, System.Type[] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options, object[] constructorArguments, Castle.DynamicProxy.IInterceptor[] interceptors)
Castle.Windsor.dll!Castle.Windsor.Proxy.DefaultProxyFactory.Create(Castle.MicroKernel.IKernel kernel, object target, Castle.Core.ComponentModel model, Castle.MicroKernel.Context.CreationContext context, object[] constructorArguments)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(Castle.MicroKernel.Context.CreationContext context, Castle.Core.ConstructorCandidate constructor, object[] arguments)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(Castle.MicroKernel.Context.CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.dll!Castle.Windsor.MsDependencyInjection.MsScopedLifestyleManager.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy) Line 26
   at D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\MsScopedLifestyleManager.cs(26)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(Castle.MicroKernel.Context.CreationContext context, bool requiresDecommission, bool instanceRequired, out Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.Resolve(Castle.MicroKernel.Context.CreationContext context, bool instanceRequired)
Castle.Windsor.dll!Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(Castle.Core.ConstructorCandidate constructor, Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(Castle.MicroKernel.Context.CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.dll!Castle.Windsor.MsDependencyInjection.MsScopedLifestyleManager.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy) Line 26
   at D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\MsScopedLifestyleManager.cs(26)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(Castle.MicroKernel.Context.CreationContext context, bool requiresDecommission, bool instanceRequired, out Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.Resolve(Castle.MicroKernel.Context.CreationContext context, bool instanceRequired)
Castle.Windsor.dll!Castle.MicroKernel.DefaultKernel.ResolveComponent(Castle.MicroKernel.IHandler handler, System.Type service, System.Collections.IDictionary additionalArguments, Castle.MicroKernel.IReleasePolicy policy)
Castle.Windsor.dll!Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(System.Type service, System.Collections.IDictionary arguments, Castle.MicroKernel.IReleasePolicy policy)
Castle.Windsor.MsDependencyInjection.dll!Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(System.Type serviceType, bool isOptional) Line 55
   at D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\ScopedWindsorServiceProvider.cs(55)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.FactoryMethodActivator<object>.Instantiate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(Castle.MicroKernel.Context.CreationContext context, bool trackedExternally)
Castle.Windsor.MsDependencyInjection.dll!Castle.Windsor.MsDependencyInjection.MsScopedLifestyleManager.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy) Line 26
   at D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\MsScopedLifestyleManager.cs(26)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(Castle.MicroKernel.Context.CreationContext context, bool requiresDecommission, bool instanceRequired, out Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.Resolve(Castle.MicroKernel.Context.CreationContext context, bool instanceRequired)
Castle.Windsor.dll!Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(Castle.Core.ConstructorCandidate constructor, Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(Castle.MicroKernel.Context.CreationContext context, bool trackedExternally)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(Castle.MicroKernel.Context.CreationContext context, bool requiresDecommission, bool instanceRequired, out Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.Resolve(Castle.MicroKernel.Context.CreationContext context, bool instanceRequired)
Castle.Windsor.dll!Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(Castle.Core.ConstructorCandidate constructor, Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(Castle.MicroKernel.Context.CreationContext context)
Castle.Windsor.dll!Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(Castle.MicroKernel.Context.CreationContext context, bool trackedExternally)
Castle.Windsor.dll!Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(Castle.MicroKernel.Context.CreationContext context, bool requiresDecommission, bool instanceRequired, out Castle.MicroKernel.Burden burden)
Castle.Windsor.dll!Castle.MicroKernel.Handlers.DefaultHandler.Resolve(Castle.MicroKernel.Context.CreationContext context, bool instanceRequired)
Castle.Windsor.dll!Castle.MicroKernel.DefaultKernel.ResolveComponent(Castle.MicroKernel.IHandler handler, System.Type service, System.Collections.IDictionary additionalArguments, Castle.MicroKernel.IReleasePolicy policy)
Castle.Windsor.dll!Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(System.Type service, System.Collections.IDictionary arguments, Castle.MicroKernel.IReleasePolicy policy)
Castle.Windsor.dll!Castle.Windsor.WindsorContainer.Resolve<StatusCast.Friendships.ChatUserStateWatcher>()
StatusCast.Core.dll!StatusCast.StatusCastCoreModule.PostInitialize() Line 109
   at C:\src\statuscast\server.v3\src\StatusCast.Core\StatusCastCoreModule.cs(109)
System.Private.CoreLib.dll!System.Collections.Generic.List<Abp.Modules.AbpModuleInfo>.ForEach(System.Action<Abp.Modules.AbpModuleInfo> action)
Abp.dll!Abp.AbpBootstrapper.Initialize() Line 155
   at D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs(155)
Abp.AspNetCore.dll!Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(Microsoft.AspNetCore.Builder.IApplicationBuilder app) Line 67
   at D:\Github\aspnetboilerplate\src\Abp.AspNetCore\AspNetCore\AbpApplicationBuilderExtensions.cs(67)
Abp.AspNetCore.dll!Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.Action<Abp.AspNetCore.AbpApplicationBuilderOptions> optionsAction) Line 38
   at D:\Github\aspnetboilerplate\src\Abp.AspNetCore\AspNetCore\AbpApplicationBuilderExtensions.cs(38)
StatusCast.Web.Mvc.dll!StatusCast.Web.Startup.Startup.Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) Line 171
   at C:\src\statuscast\server.v3\src\StatusCast.Web.Mvc\Startup\Startup.cs(171)
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(object instance, Microsoft.AspNetCore.Builder.IApplicationBuilder builder)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder app)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(System.Threading.CancellationToken cancellationToken)
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26>(ref Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26 stateMachine)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(System.Threading.CancellationToken cancellationToken)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token, string shutdownMessage)
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5>(ref Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5 stateMachine)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token, string shutdownMessage)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token)
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4>(ref Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4 stateMachine)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token)
Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(Microsoft.AspNetCore.Hosting.IWebHost host)
StatusCast.Web.Mvc.dll!StatusCast.Web.Startup.Program.Main(string[] args) Line 10
   at C:\src\statuscast\server.v3\src\StatusCast.Web.Mvc\Startup\Program.cs(10)
By statuscast
#32003
Code: Select allpublic override void PostInitialize()
        {
            IocManager.RegisterIfNot<IChatCommunicator, NullChatCommunicator>();

            var x = IocManager.Resolve<ChatUserStateWatcher>();
            x.Initialize();
            IocManager.Resolve<AppTimes>().StartupTime = Clock.Now;
        }


It's happening on the .Resolve<ChatUserStateWatcher>()
The app just rushes right past it, so it's not a "problem" per se. Just doesn't look right.