modelsbuilder / ModelsBuilder.Original

The Community Models Builder for Umbraco
MIT License
114 stars 49 forks source link

Custom Tool Generation Failed - The Character set provided in ContentType is invalid #135

Closed PaddyMacBelfast closed 7 years ago

PaddyMacBelfast commented 7 years ago

Hi,

I'm working on my first Umbraco project along with ModelsBuilder.. The custom tool for generating models was working fine but I had to upgrade Umbraco from 7.4.2 to 7.4.3 but since do this the custom tool failed. The error message I'm getting is below. using Umbraco.ModelsBuilder 3.0.5

I'm not sure how to fix this problem - can some please give me a heads-up on the message below? Thanks.

UmbracoModelsBuilder: Starting v3.0.0.90 13/03/2017 12:20:50. UmbracoModelsBuilder: UmbracoModelsBuilder failed to generate code: AggregateException: One or more errors occurred. UmbracoModelsBuilder: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at Umbraco.ModelsBuilder.Api.ApiClient.EnsureSuccess(HttpResponseMessage result) at Umbraco.ModelsBuilder.Api.ApiClient.ValidateClientVersion() at Umbraco.ModelsBuilder.CustomTool.CustomTool.UmbracoModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg) UmbracoModelsBuilder: Inner: InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. UmbracoModelsBuilder: UmbracoModelsBuilder: Inner: ArgumentException: '"UTF-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name UmbracoModelsBuilder: at System.Globalization.EncodingTable.internalGetCodePageFromName(String name) at System.Globalization.EncodingTable.GetCodePageFromName(String name) at System.Text.Encoding.GetEncoding(String name) at System.Net.Http.HttpContent.<>c__DisplayClass13_0.<ReadAsStringAsync>b__0(Task task) UmbracoModelsBuilder: AggregateInner: InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set.

zpqrtbnk commented 7 years ago

Ouch that is a weird exception, apparently the ApiClient (in Visual Studio) failed to get a meaningful response from the site. I see the client runs 3.0.0, maybe it's worth upgrading to 3.0.5 as well (cannot remember right now the compatibility - in fact, the ValidateClientVersion call is supposed to check the compatibility, but fails) - also, can you ensure that the API library (Umbraco.ModelsBuilder.Api) dll has also been updated and is not stuck at 3.0.0 as well?

PaddyMacBelfast commented 7 years ago

Thanks for the quick reply zpqrtbnk

Spent another 2 days trying to debug this.. Really weird thing is it just started working without any changes. I'm assuming the client was cached at 3.0.0 even-though I done several clean and rebuilds.

All working now.. thanks for the pointers

zpqrtbnk commented 7 years ago

Fixed then. Cool.