You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem can be seen here, is LogInformation intended instead of using LogError(exception, ..) ? I guess it was not updated because dbup-mysql moved to Microsoft logging style, in my case it's problematic because: I can't handle this exception, I have to create own implementation of logger and check if format argument is a Database not found on server with connection string in settings, instead I want to fail my app by handling this exception (for example re-throwing the exception) and outputting more information about what happened.
Relevant log output
2024-07-28 21:15:02 Database not found on server with connection string in settings: Unable to connect to any of the specified MySQL hosts.
2024-07-28 21:15:02 Unhandled exception. MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
2024-07-28 21:15:02 ---> System.Net.Sockets.SocketException (111): Connection refused
2024-07-28 21:15:02 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
2024-07-28 21:15:02 at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
2024-07-28 21:15:02 at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
2024-07-28 21:15:02 --- End of stack trace from previous location ---
2024-07-28 21:15:02 at System.Net.Sockets.TcpClient.CompleteConnectAsync(Task task)
2024-07-28 21:15:02 at MySql.Data.MySqlClient.NativeDriver.<>c.<OpenAsync>b__38_0(Exception ex)
2024-07-28 21:15:02 at System.AggregateException.Handle(Func`2 predicate)2024-07-28 21:15:02 at MySql.Data.MySqlClient.NativeDriver.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.Driver.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.Driver.CreateAsync(MySqlConnectionStringBuilder settings, Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.Driver.CreateAsync(MySqlConnectionStringBuilder settings, Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnectionAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlPool.GetPooledConnectionAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlPool.TryToGetDriverAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlPool.GetConnectionAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)2024-07-28 21:15:02 at MySql.Data.MySqlClient.MySqlConnection.Open()2024-07-28 21:15:02 at MySqlExtensions.MySqlDatabase(SupportedDatabasesForEnsureDatabase supported, String connectionString, IUpgradeLog logger, Int32 timeout, String collation) in /_/src/dbup-mysql/MySqlExtensions.cs:line 1722024-07-28 21:15:02 at MySqlExtensions.MySqlDatabase(SupportedDatabasesForEnsureDatabase supported, String connectionString) in /_/src/dbup-mysql/MySqlExtensions.cs:line 982024-07-28 21:15:02 at UnturnedGuardAPI.App.Configurations.DependencyInjection.PrepareDatabases(IConfiguration configuration) in /src/src/UnturnedGuardAPI.App/Configurations/DependencyInjection.cs:line 282024-07-28 21:15:02 at Program.<Main>$(String[] args)in /src/src/UnturnedGuardAPI.App/Program.cs:line 52024-07-28 21:15:02 at Program.<Main>(String[] args)
The text was updated successfully, but these errors were encountered:
I think we should throw an exception here. I'm not that familiar with MySQL.
Is there any case we get to that point and everything is ok except for the database not existing? The DatabaseExists code looks like it should work without exception. When does it throw an exception?
I think we should throw an exception here. I'm not that familiar with MySQL.
Yep, I do agree about that. 👍
Is there any case we get to that point and everything is ok except for the database not existing? The DatabaseExists code looks like it should work without exception. When does it throw an exception?
It throws an exception if it can't connect to the database
Is there an existing issue for this?
Library Version
6.0.1-beta.41
What happened?
The problem can be seen here, is LogInformation intended instead of using LogError(exception, ..) ? I guess it was not updated because dbup-mysql moved to Microsoft logging style, in my case it's problematic because: I can't handle this exception, I have to create own implementation of logger and check if
format
argument is aDatabase not found on server with connection string in settings
, instead I want to fail my app by handling this exception (for example re-throwing the exception) and outputting more information about what happened.Relevant log output
The text was updated successfully, but these errors were encountered: