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

ArgumentException in Charset.InitializeSupportedCharsets while initializing charset 'ks_c_5601-1987' [DNET215] #223

Closed
firebird-automations opened this issue Feb 24, 2009 · 4 comments

Comments

@firebird-automations
Copy link

Submitted by: Konstantin Dombrugov (abracadabra)

probably, it would be better to try\catch AgrumentException while executing default case in GetEncoding private method

@firebird-automations
Copy link
Author

Commented by: @cincuranet

It's because you're running on Mono, but the build isn't done with MONO directive. And BTW doing blind try-catch to solve problem isn't a good idea.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Author

Commented by: Konstantin Dombrugov (abracadabra)

1) this is not blind try-catch

according to MSDN
Encoding.GetEncoding(string)
exceptions:
ArgumentException
name is not a valid code page name.
-or-
The code page indicated by name is not supported by the underlying platform.

And I need only 3 encodings... not the whole list of supported encodings.

2) Sorry, but need to have TWO diffrent builds of the same assembly is a really bad idea. My software can work on Windows (.net 2.0) or Linux (Mono 2.*) on the same build.
I think, it's better to use runtime check instread of compilation directives.
public static Boolean IsRunningOnLinux()
{
var p = (int)Environment.OSVersion.Platform;
return (p == 4) || (p == 128);
}

    public static Boolean IsRunningOnMono\(\)
    \{
        return Type\.GetType\("Mono\.Runtime"\) \!= null;
    \}

@firebird-automations
Copy link
Author

Commented by: @cincuranet

We have to have Mono build, because some parts of code are not working there. The runtime check isn't enough, in some parts we need to know this during compile time. If you need to use it on Mono and on http://MS.NET, use MONO directive. It's compatible with http://MS.NET.

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