2

So I'm currently running a Blazor .NET Core server side App on Azure App Services in a linux based config, the below is my environment

System info
System up time: 5.05:06:19.3920000
OS version: Unix 4.15.0.112
64 bit system: True
64 bit process: True
Processor count: 1
Short instance id: bdcba9
CLR version: 4.0.30319.42000
System directory:
Current working directory: /opt/Kudu
IIS command line: /opt/Kudu/Kudu.Services.Web.dll

It was all running fine yesterday but as of today when I made a minor change to some text and did a re-publish. And suddenly I am now getting a HTTP 500 error with this in the kudu log stream. You can see it crashing when trying to get a cultureinfo with what I presume is an incorrect parameter (GetMethodFromHandle perhaps) Locally its all running fine with no issues and hitting no exceptions even with it set to hit everything/all exception types. There is also nowhere in my app I set CultureInfo or play around with Locale.

2020-09-12T12:07:40.245382681Z: [INFO]  [41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
2020-09-12T12:07:40.245431982Z: [INFO]        An unhandled exception has occurred while executing the request.
2020-09-12T12:07:40.247771813Z: [INFO]  System.Globalization.CultureNotFoundException: Culture is not supported. (Parameter 'name')
2020-09-12T12:07:40.247802114Z: [INFO]  ethodFromHandle is an invalid culture identifier.
2020-09-12T12:07:40.247876715Z: [INFO]     at System.Globalization.CultureInfo.GetCultureInfo(String name)
2020-09-12T12:07:40.247892415Z: [INFO]     at System.Reflection.RuntimeAssembly.GetLocale()
2020-09-12T12:07:40.247937615Z: [INFO]     at System.Reflection.RuntimeAssembly.GetName(Boolean copiedName)
2020-09-12T12:07:40.247952516Z: [INFO]     at Microsoft.AspNetCore.Mvc.ViewFeatures.ServerComponentSerializer.CreateSerializedServerComponent(ServerComponentInvocationSequence invocationId, Type rootComponent, ParameterView parameters)
2020-09-12T12:07:40.247999016Z: [INFO]     at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.NonPrerenderedServerComponent(HttpContext context, ServerComponentInvocationSequence invocationId, Type type, ParameterView parametersCollection)
2020-09-12T12:07:40.248015117Z: [INFO]     at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.RenderComponentAsync(ViewContext viewContext, Type componentType, RenderMode renderMode, Object parameters)
2020-09-12T12:07:40.248055617Z: [INFO]     at Microsoft.AspNetCore.Mvc.TagHelpers.ComponentTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
2020-09-12T12:07:40.248079317Z: [INFO]     at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
2020-09-12T12:07:40.248117818Z: [INFO]     at BHub.Pages.Pages__Host.<ExecuteAsync>b__15_1() in D:\Sites\BHub\BHub\Pages\_Host.cshtml:line 29
2020-09-12T12:07:40.249937843Z: [INFO]     at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
2020-09-12T12:07:40.249974943Z: [INFO]     at BHub.Pages.Pages__Host.ExecuteAsync() in D:\Sites\BHub\BHub\Pages\_Host.cshtml:line 5
2020-09-12T12:07:40.250014644Z: [INFO]     at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
2020-09-12T12:07:40.267442179Z: [INFO]     at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
2020-09-12T12:07:40.267524481Z: [INFO]     at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
2020-09-12T12:07:40.267669083Z: [INFO]     at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
2020-09-12T12:07:40.267711783Z: [INFO]     at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
2020-09-12T12:07:40.267807784Z: [INFO]     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)

I am not quite sure what's causing this and wondering if anyone else has had anything similar or could shed some light. I understand it gets the culture from the OS but there's been no changes on my end and it was working previously. I'm not sure what I can try as locally it's fine, I'm sort of leaning towards a problem in a Azure App/Linux config but.. hmph

benjay_uk
  • 107
  • 2
  • 8
  • So where/how do you set a culture? Is it in your code (setting up Loacaliztion perhaps)? – H H Sep 12 '20 at 12:18
  • I don't set any cultures or use locale anywhere in my code. I presume the code is just trying to get it from the OS – benjay_uk Sep 12 '20 at 12:19
  • Yes, it gets it from the OS (or CLR). But why, and which culture? What language(s) do you have in your Browser? – H H Sep 12 '20 at 12:21
  • My browser (chrome) is in English, UK. I'm unsure what region my linux server is on azure, should be en-gb or en-us but I guess that's something I'll check if I can? – benjay_uk Sep 12 '20 at 12:26
  • I'm not sure about Linux, I have ran into something similar with regional cultures on Windows, not everything was installed. – H H Sep 12 '20 at 12:27
  • With the stack trace showing it's trying to pass a method's name in the culture name parameter, looks definitely fishy to me. – benjay_uk Sep 12 '20 at 12:31
  • Yes, but there is an M missing, is that a typo on your side? And can you post line 5 from _Host.cshtml, probably the TagHelpers. – H H Sep 12 '20 at 12:34
  • Sure, `@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers`. And yes, that is pasted directly from the log so looks like its been truncated somehow – benjay_uk Sep 12 '20 at 12:38
  • You may have stumbled on a bug. First make sure everything is uptodate, RuntimeAssembly.GetLocale() dives into an unmanaged DLL. So clear out your folders and do a re-deploy. – H H Sep 12 '20 at 13:15
  • CLR version: 4.0 seem a bit odd, but I don't know what you should see. Do you deploy as self-contained? – H H Sep 12 '20 at 13:17
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/221380/discussion-between-benjay-uk-and-henk-holterman). – benjay_uk Sep 12 '20 at 14:56
  • No, I don't do chat. And nobody ever reads that. – H H Sep 12 '20 at 15:01
  • I deploy as framework-dependent although I've tried deploying as self-contained to no avail. Same issue. – benjay_uk Sep 12 '20 at 15:04
  • I think you should report this one on GitHub. Make sure to mention the version(s). – H H Sep 12 '20 at 15:11
  • Ok, thanks for your time & help. Much appreciated. – benjay_uk Sep 12 '20 at 15:15
  • https://stackoverflow.com/questions/24332304/why-do-i-get-culture-is-not-supported-and-what-if-anything-should-i-do-abou – Amit Kumar Singh Sep 12 '20 at 16:25

1 Answers1

2

I wouldn't necessarily call this a solution but I basically noticed that when I was deploying it wasn't restarting the web server after pushing the files like it should do. I removed and re-added this app to the deployment list to get it to start doing this again and voila. It now restarts after deployment and seems to work again.

Updating file (bhublive\System.Runtime.Caching.dll).
Updating file (bhublive\web.config).
Publish Succeeded.
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
Waiting for Web App to be ready...
Restarting the Web App...
Successfully restarted Web App.
Web App is ready.
benjay_uk
  • 107
  • 2
  • 8