Humanizr / Humanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities
Other
8.69k stars 964 forks source link

DateHumanize_MultipleMonthsAgo #879

Closed imclint21 closed 9 months ago

imclint21 commented 5 years ago

Hi,

I get this error:

Nov 10 00:07:15 hypeproxy hypeproxy[15951]: System.ArgumentException: The resource object with key 'DateHumanize_MultipleMonthsAgo' was not found
Nov 10 00:07:15 hypeproxy hypeproxy[15951]: Parameter name: resourceKey
Nov 10 00:07:15 hypeproxy hypeproxy[15951]:    at Humanizer.Localisation.Formatters.DefaultFormatter.Format(String resourceKey, Int32 number, Boolean toWords) in d:\a\1\s\src\Humanizer\Localisation\Formatters\DefaultFormatter.cs:line 118
Nov 10 00:07:15 hypeproxy hypeproxy[15951]:    at Humanizer.DateTimeHumanizeStrategy.DateTimeHumanizeAlgorithms.DefaultHumanize(DateTime input, DateTime comparisonBase, CultureInfo culture) in d:\a\1\s\src\Humanizer\DateTimeHumanizeStrategy\DateTimeHumanizeAlgorithms.cs:line 171
Nov 10 00:07:15 hypeproxy hypeproxy[15951]:    at Humanizer.DateTimeHumanizeStrategy.DefaultDateTimeHumanizeStrategy.Humanize(DateTime input, DateTime comparisonBase, CultureInfo culture) in d:\a\1\s\src\Humanizer\DateTimeHumanizeStrategy\DefaultDateTimeHumanizeStrategy.cs:line 16
Nov 10 00:07:15 hypeproxy hypeproxy[15951]:    at Humanizer.DateHumanizeExtensions.Humanize(DateTime input, Boolean utcDate, Nullable`1 dateToCompareAgainst, CultureInfo culture) in d:\a\1\s\src\Humanizer\DateHumanizeExtensions.cs:line 24
AKTheKnight commented 5 years ago

That's odd, they're here: https://github.com/Humanizr/Humanizer/blob/93b66cd11156bd06a4585703e407f1239119a04d/src/Humanizer/Properties/Resources.resx#L147-L149

Lemme see if I can repro this somehow. Do you have an example of what causes the error?

Thanks

imclint21 commented 5 years ago

Hey,

I will try tomorrow to found you the trace of the error, honestly, I don't know what is it, it seems to appear from the culture of one of our customers!

AKTheKnight commented 5 years ago

Hi,

If you're able to find out which culture they're using, I suspect we find we don't have the translation for that specific resource. From there we can look at the best way of getting it.

imclint21 commented 5 years ago

Yes yes, tonight it's not possible because I don't have my computer but tomorrow I will normally retrieve Sentry.io logs and it will be good!

imclint21 commented 5 years ago

Hi @AKTheKnight

This is the report of the error: https://sentry.io/share/issue/a93f6d4135494d99a3fdad69f847265b/

System.ArgumentException: The resource object with key 'DateHumanize_MultipleMonthsAgo' was not found
Parameter name: resourceKey
  File "d:\a\1\s\src\Humanizer\Localisation\Formatters\DefaultFormatter.cs", line 118, col 17, in Format
    System.String Format(System.String, Int32, Boolean)
  File "d:\a\1\s\src\Humanizer\DateTimeHumanizeStrategy\DateTimeHumanizeAlgorithms.cs", line 171, col 17, in DefaultHumanize
    System.String DefaultHumanize(System.DateTime, System.DateTime, System.Globalization.CultureInfo)
  File "d:\a\1\s\src\Humanizer\DateTimeHumanizeStrategy\DefaultDateTimeHumanizeStrategy.cs", line 16, col 13, in Humanize
    System.String Humanize(System.DateTime, System.DateTime, System.Globalization.CultureInfo)
  File "d:\a\1\s\src\Humanizer\DateHumanizeExtensions.cs", line 24, col 13, in Humanize
    System.String Humanize(System.DateTime, Boolean, System.Nullable`1[System.DateTime], System.Globalization.CultureInfo)
  File "d:\a\1\s\HypeProxy\Areas\Dashboard\Views\Home\Index.cshtml", line 313, col 1, in ExecuteAsync
    Void MoveNext()
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Razor.RazorView", in RenderPageCoreAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Razor.RazorView", in RenderPageAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "System.Runtime.CompilerServices.TaskAwaiter`1", in GetResult
  Module "Microsoft.AspNetCore.Mvc.Razor.RazorView", in RenderAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", in ExecuteAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", in ExecuteAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor", in ExecuteAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.ViewResult", in ExecuteResultAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in InvokeResultAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeNextResultFilterAsync>d__28`2", in MoveNext
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in Rethrow
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in ResultNext
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in InvokeResultFilters
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in InvokeNextResourceFilter
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in Rethrow
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in Next
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in InvokeFilterPipelineAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker", in InvokeAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Builder.RouterMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Builder.Extensions.MapMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "WebMarkupMin.AspNetCore2.WebMarkupMinMiddleware", in ProcessAsync
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "WebMarkupMin.AspNetCore2.WebMarkupMinMiddlewareBase", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Authentication.AuthenticationMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Session.SessionMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "Microsoft.AspNetCore.Session.SessionMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware", in Invoke
  Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  Module "Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware", in Invoke
skyapps-co commented 4 years ago

I got 2 reports of this error for the Czech language.

System.ArgumentException: The resource object with key 'DateHumanize_MultipleMonthsAgo' was not found
Parameter name: resourceKey
    at Humanizer.Localisation.Formatters.DefaultFormatter.Format (System.String resourceKey, System.Int32 number, System.Boolean toWords) [0x0002c] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at Humanizer.Localisation.Formatters.DefaultFormatter.GetResourceForDate (Humanizer.Localisation.TimeUnit unit, Humanizer.Localisation.Tense timeUnitTense, System.Int32 count) [0x0000d] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at Humanizer.Localisation.Formatters.DefaultFormatter.DateHumanize (Humanizer.Localisation.TimeUnit timeUnit, Humanizer.Localisation.Tense timeUnitTense, System.Int32 unit) [0x00000] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at Humanizer.DateTimeHumanizeStrategy.DateTimeHumanizeAlgorithms.DefaultHumanize (System.DateTime input, System.DateTime comparisonBase, System.Globalization.CultureInfo culture) [0x001de] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at Humanizer.DateTimeHumanizeStrategy.DefaultDateTimeHumanizeStrategy.Humanize (System.DateTime input, System.DateTime comparisonBase, System.Globalization.CultureInfo culture) [0x00000] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at Humanizer.DateHumanizeExtensions.Humanize (System.DateTime input, System.Boolean utcDate, System.Nullable``1[T] dateToCompareAgainst, System.Globalization.CultureInfo culture) [0x0002a] in <031dbcf93fbb4be5a5e4066e6737a085>:0
    at OrbiterApp.Models.MemberDetails.get_LastVisitedYouDateRel () [0x0001a] in <884f0d14cef3402a8d4ecf5b09f7caf7>:0
BieleckiLtd commented 3 years ago

Same with the Polish lang

DefaultFormatter.Format (String resourceKey, Int32 number, Boolean toWords)
/_/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs, line 130
System.ArgumentException: The resource object with key 'DateHumanize_MultipleMinutesAgo' was not found (Parameter 'resourceKey')
eth0izzle commented 1 year ago

Did anyone find a fix / workaround for this?

hazzik commented 9 months ago

Duplicate of #690