c# - Why do I get, "Culture is not supported" and What, if Anything, Should I Do about it? -



c# - Why do I get, "Culture is not supported" and What, if Anything, Should I Do about it? -

i have breakpoint on "return" line here:

[httpget] [route("api/test/{id1}/{id2}")] public nrbqentity gettestmessage(string id1, string id2) { homecoming nrbqclient.gettestmessage(id1, id2); }

although not crash app, when reach point, get,

"exception:thrown: "culture not supported." (system.globalization.culturenotfoundexception) system.globalization.culturenotfoundexception thrown: "culture not supported.""

which civilization trying supported, why not supported, , what, if anything, should back upwards culture?

update

answer sphanley:

besides standing "new riders of barbeque," "skeleton" (for now) entity looks this:

public class nrbqentity { public nrbqentity() { } public string value { get; set; } } update 2

answer anotheruser:

this not code, i'm in process of trying grok it; has been provided starting point me re-create over/refactor existing standalone project, incorporating "the" solution. having been said, reply question, here instances of "gettestmessage()" in solution:

[httpget] [route("api/test/{id1}/{id2}")] public nrbqentity gettestmessage(string id1, string id2) { homecoming nrbqclient.gettestmessage(id1, id2); } [httpget] [route("api/test/{id1}/{id2}")] public nrbqentity gettestmessage(string id1, string id2) { homecoming nrbqservice.getnrbqentity(id1, id2); } public interface inrbqclient { nrbqentity gettestmessage(string id1, string id2); } public nrbqentity gettestmessage(string id1, string id2) { var res = restapiclient.get<nrbqentity>(null , new uri(nrbqclientsettings.nrbqapi) , string.format("api/test/{0}/{1}" , id1 , id2) ); if (res.status != requestresultstatus.success) { throw new exception(res.message); } homecoming res.result; }

...and test:

[testfixture, category(drbcommon.unittests.categories.integrationtest)] public class nrbqclientintegrationtests { [test] public void testnrbqinterface() { var nrbqclient = ioc.container.resolve<inrbqclient>(); var s = nrbqclient.gettestmessage("get", "sorty"); assert.greater(s.value.length, 0); } }

which civilization trying supported

place seek / grab around offending line , grab exception. place break point within grab block , debug code. examine thrown culturenotfoundexception's invalidculturename property. tell civilization trying used not found on system.

why not supported

windows has built in set of cultures (what cultures supported cultureinfo class in .net 3.5? , http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx). if civilization listed in invalidculturename not on list, it's not supported.

what, if anything, should back upwards culture?

this depends on invalidculturename is. if legitimately trying utilize non-supported civilization (for example, have multi lingual / multi regional site , want back upwards english language every culture) may have legitimate need create new culture. example, worked on site, http://www.oneill.com, wanted have french version of netherlands site (http://www.oneill.com/nl-fr). had create new civilization , install on web server using these instructions: http://msdn.microsoft.com/en-us/library/ms172469(v=vs.90).aspx

if aren't doing fancy civilization stuff, there known issues asp.net involving framework erroneously creating cultureinfo instances against based on directories might not present:

http://edd.stefancamilleri.com/2013/11/25/asp-net-mvc-always-throws-a-system-globalization-culturenotfoundexception/ .net 4.0 - culturenotfoundexception

in case, looks solution turn off exception , ignore it.

c# asp.net-web-api globalization cultureinfo culture

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -