troubleshooting Question

CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]- NullReferenceException on 1st Run from VS 2008??

Avatar of OddiC
OddiC asked on
ASPC#ASP.NET
2 Comments1 Solution1129 ViewsLast Modified:
I am experiencing a strange, repeatable error.... Every time I first run my project from Visual Studio (ONLY THE FIRST TIME!!!), I get a null reference exception when trying to assign the Request.UserLanguages[0] value to the Thread CurrentCulture..

But everything works fine (it can find the reference), on all subsequent tries (until I shut down VS 2008, open back up, and run it for another first time- then the error comes back (only for the first run though..)).

Does anyone know why I would be experiencing this odd behavior? I want to make sure there is nothing in my code amiss.

Thanks!!
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros