| Bug #89595 | Unhandled Exception, only on Linux os | ||
|---|---|---|---|
| Submitted: | 9 Feb 2018 0:43 | Modified: | 10 Aug 2022 18:40 |
| Reporter: | qining luo | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 8.0.10-rc | OS: | Ubuntu (16.04LTS) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | exception, initializer, MySql.Data, MySqlConnection, ReplicationManager, ubuntu | ||
[9 Feb 2018 0:44]
qining luo
Screenshot,Exception on ubuntu.
Attachment: Image 1.png (image/png, text), 166.54 KiB.
[13 Feb 2018 6:12]
Chiranjeevi Battula
Hello qining, Thank you for the bug report. Verified based on internal discussion with dev's. Thanks, Chiranjeevi.
[25 Jul 2018 15:39]
Daniel Valdez
Posted by developer: Cannot reproduce the bug. Tried with various scenarios and none of them show the error message.
[25 Mar 2019 6:39]
MySQL Verification Team
Bug #94759 marked as duplicate of this one
[29 Sep 2021 9:40]
Anton Yakovlev
My reason for this issue was incompatibility between MySql.Data.dll and .Net framework version. Once I found latest version of MySql.Data.dll for .NET 5 (in my particular case), this issue gone. Prior to change dll I gave a try to various suggestions within and without config file, with no luck. Also incompatibiliy between dll and execution environment could cause various exceptions similar to this.
[2 Dec 2021 8:02]
Whikiey Yan
This error ALWAYS occures on Windows, Linux.(.net core 1~3, .net 5, .net 6) Once we publish a project which ref to MySql.Data, generate a single file, this error occures.
[2 Dec 2021 14:18]
Daniel Valdez
Posted by developer: Hi Whikiey Yan, Can you please share how can we reproduce the issue, you can attach a sample project if you like.
[10 Aug 2022 18:40]
Daniel Valdez
Bug not reproducible.

Description: ATTENTION! Execption only happened on Linux os, please test on Linux os. OS : Ubuntu 16.04 LTS Dotnet SDK : 2.1.4 MySql.Data : 8.0.10-rc MySql : 5.7.21-0ubuntu0.16.04.1 Unhandled Exception: System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring(Int32 startIndex, Int32 length) at System.Uri.CreateHostStringHelper(String str, UInt16 idx, UInt16 end, Flags& flags, String& scopeId) at System.Uri.CreateHostString() at System.Uri.EnsureHostString(Boolean allowDnsOptimization) at System.Uri.GetComponentsHelper(UriComponents uriComponents, UriFormat uriFormat) at System.Uri.ToString() at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(String exePath) at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig) at System.Configuration.ClientConfigurationHost.get_ConfigPaths() at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at MySql.Data.MySqlClient.MySqlConfiguration..cctor() --- End of inner exception stack trace --- at MySql.Data.MySqlClient.MySqlConfiguration.get_Settings() at MySql.Data.MySqlClient.Replication.ReplicationManager..cctor() --- End of inner exception stack trace --- at MySql.Data.MySqlClient.Replication.ReplicationManager.IsReplicationGroup(String groupName) at MySql.Data.MySqlClient.MySqlConnection.Open() at mysqltest1.Program.Main(String[] args) in /home/lqn/test/mysqltest1/Program.cs:line 24 How to repeat: Test code: using System; using MySql.Data.MySqlClient; namespace mysqltest1 { class Program { static void Main(string[] args) { MySqlConnectionStringBuilder b = new MySqlConnectionStringBuilder(); b.Server = "localhost"; b.Port = 3306; b.Database = "testdb"; b.UserID = "root"; b.Password = "123456"; b.CharacterSet = "utf8"; var connstr = b.ToString(); MySqlConnection conn = new MySqlConnection(connstr); conn.Open(); conn.Close(); } } } dotnet run