ElmahCore icon indicating copy to clipboard operation
ElmahCore copied to clipboard

ElamahCore giving exception System.ArgumentNullException: 'Value cannot be null. Parameter name: path1'

Open itbeam opened this issue 6 years ago • 4 comments

Please Help. If i write this piece of code that you suggest yesterday, I could not hit my API (it is giving 500 Internal Server Error) and if i move app.UseElmah() at the end then it works fine but giving the exception.

app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseAuthentication(); app.UseElmah(); //moved app.UseHttpsRedirection(); app.UseMvc();

Now i'm only logging error to the files services.AddElmah<XmlFileErrorLog>(options => { options.LogPath = "~/logs"; });

Please see attached image:

Screenshot_30

itbeam avatar Apr 04 '19 11:04 itbeam

I need more exceptions details.

ElmahCore avatar Apr 04 '19 16:04 ElmahCore

Same problem here. Sorry for the french stack trace.

System.ArgumentNullException: La valeur ne peut pas être null. Nom du paramètre : path1 à System.IO.Path.Combine(String path1, String path2) à ElmahCore.XmlFileErrorLog..ctor(IOptions`1 options, IHostingEnvironment hostingEnvironment) --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) à Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) à Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) à Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) à Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) à Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) à ElmahCore.Mvc.BuilderHelper.<>c.<<UseElmah>b__0_0>d.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à IdentityServer4.Hosting.IdentityServerMiddleware.<Invoke>d__3.MoveNext() dans C:\local\identity\server4\IdentityServer4\src\IdentityServer4\src\Hosting\IdentityServerMiddleware.cs:ligne 72 --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.<Invoke>d__4.MoveNext() dans C:\local\identity\server4\IdentityServer4\src\IdentityServer4\src\Hosting\MtlsTokenEndpointMiddleware.cs:ligne 60 --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à IdentityServer4.Hosting.BaseUrlMiddleware.<Invoke>d__3.MoveNext() dans C:\local\identity\server4\IdentityServer4\src\IdentityServer4\src\Hosting\BaseUrlMiddleware.cs:ligne 36 --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()

malylemire1 avatar May 13 '19 17:05 malylemire1

Just found why it happens. It's when the wwwroot does not exists.

malylemire1 avatar May 13 '19 17:05 malylemire1

It seems that this is only a problem with paths that begin with "~/"

Relative paths, such as "./log" or "../log", do not throw the error.

bjsafdie avatar May 22 '19 12:05 bjsafdie