I have a breakpoint on the "return" line here:
[HttpGet]
[Route("api/Test/{id1}/{id2}")]
public NRBQEntity GetTestMessage(String id1, String id2)
{
return NRBQClient.GetTestMessage(id1, id2);
}
Although it does not crash the app, when I reach that point, I get,
"Exception:Thrown: "Culture is not supported." (System.Globalization.CultureNotFoundException) A System.Globalization.CultureNotFoundException was thrown: "Culture is not supported.""
Which culture is trying to be supported, why is it not supported, and what, if anything, should I do to support the culture?
Answer to sphanley:
Besides standing for "New Riders of the BarbeQue," it is a "skeleton" (for now) Entity that looks like this:
public class NRBQEntity
{
public NRBQEntity()
{
}
public String Value { get; set; }
}
Answer to AnotherUser:
This is not my code, so I'm just in the process of trying to grok it; it has been provided as a starting point for me to copy over/refactor an existing standalone project, incorporating it into "the" solution. That having been said, to answer your question, here are all the instances of "GetTestMessage()" in the solution:
[HttpGet]
[Route("api/Test/{id1}/{id2}")]
public NRBQEntity GetTestMessage(String id1, String id2)
{
return NRBQClient.GetTestMessage(id1, id2);
}
[HttpGet]
[Route("api/Test/{id1}/{id2}")]
public NRBQEntity GetTestMessage(String id1, String id2)
{
return 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);
}
return res.result;
}
...and this 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 culture is trying to be supported
Place a try / catch around the offending line and catch the exception. Place a break point inside the catch block and debug your code. Examine the thrown CultureNotFoundException's InvalidCultureName
property. This will tell you which Culture is trying be used but is not found on the system.
Why is it not supported
Windows has a built in set of Cultures (What cultures are supported by the CultureInfo class in .NET 3.5? and http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx). If the Culture listed in InvalidCultureName
is not on the list, it's not supported.
What, if anything, should I do to support the culture?
This depends on what InvalidCultureName
is. If you are legitimately trying to use a non-supported culture (for example, you have a multi lingual / multi regional site and want to support English for every culture) you may have legitimate need to create a new culture. For example, I worked on a site, http://www.oneill.com, where we wanted to have a French version of the Netherlands site (http://www.oneill.com/nl-fr). We had to create a new culture and install it on the web server using these instructions: http://msdn.microsoft.com/en-us/library/ms172469(v=vs.90).aspx
If you aren't doing any fancy culture stuff, there are some known issues with asp.net involving the framework erroneously creating CultureInfo
instances against based on directories that might not be present:
In that case, looks like the solution is to just turn off the Exception and ignore it.