Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.NotSupportedException with DeriveParameters and ASP.net [DNET358] #363

Closed
firebird-automations opened this issue Nov 29, 2010 · 9 comments

Comments

@firebird-automations
Copy link

Submitted by: Olivier M (olivierm)

When using DeriveParameters Method in http://ASP.net with the following line in the web.config :
"<globalization uiCulture="auto" culture="auto" />"
a System.NotSupportedException is raised :
"Culture 'xx' is a neutral culture and cannot be used for formatting and parsing".

I think this is due to using "CultureInfo.CurrentUICulture" instead of "CultureInfo.CurrentCulture" when formatting strings in DeriveParameters.

For example, http://Asp.net with globalization...="auto" sets CultureInfo.CurrentUICulture="fr" and CultureInfo.CurrentCulture="fr-FR".

@firebird-automations
Copy link
Author

Commented by: Olivier M (olivierm)

There is also one String.Format(CultureInfo.CurrentUICulture in FbSchema.BuildCommand.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

priority: Major [ 3 ] => Minor [ 4 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue relate to DNET539 [ DNET539 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue relate to DNET539 [ DNET539 ] =>

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Can you provide a stack trace. I can't replicate it. This piece works fine:

var culture = new CultureInfo\("fr"\);
"test"\.ToUpper\(culture\);

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Closed [ 6 ]

resolution: Cannot Reproduce [ 5 ]

@firebird-automations
Copy link
Author

Commented by: Olivier M (olivierm)

Hi!

Sorry for the late answer (i'm not using this address nowadays).
I was not able to reproduce the problem also with the last provider version on .net framework 4.5 because the behavior of the framewwork has changed :
If you create a console application in .net framework 4.5.1, and put the following lines, everything is ok :

		System\.Threading\.Thread\.CurrentThread\.CurrentUICulture = new CultureInfo\("fr"\);
		System\.Threading\.Thread\.CurrentThread\.CurrentCulture = new CultureInfo\("fr\-FR"\);
		Console\.WriteLine\(String\.Format\(CultureInfo\.CurrentUICulture,"\{0\}", DateTime\.Now\)\);

Now change the target framework for 3.5 => the exception System.NotSupportedException is raised.
I noticed also the behavior changed in http://asp.net : CurrentUICulture and CurrentCulture are set both automatically to "fr-FR".
So in my case, it's not a problem anymore. I suppose that if you want to be "strict", it's still preferable to use "String.Format(CultureInfo.CurrentCulture" (see :
http://stackoverflow.com/questions/6795891/fxcop-ca1305-currentculture-vs-currentuiculture)...

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Interesting. .NET 3.5 support in FirebirdClient has been dropped anyway, so I'll leave the ticket as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants