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

Host can't be null excpetion on 2nd run #323

Open
rlandfair opened this issue Jan 8, 2025 · 0 comments
Open

Host can't be null excpetion on 2nd run #323

rlandfair opened this issue Jan 8, 2025 · 0 comments

Comments

@rlandfair
Copy link

I am having an issue where everything runs smoothly on the first run and then running afterwards creates a 'Host can't be null' exception. Is there something I need to clear out to run multiple deploys during the same 'session'.?

Here is the exception I get in Visual Studio in my C# project.

System.ArgumentException: 'Host can't be null'

This exception was originally thrown at this call stack:
Npgsql.NpgsqlConnectionStringBuilder.PostProcessAndValidate() in NpgsqlConnectionStringBuilder.cs
Npgsql.NpgsqlConnection.SetupDataSource() in NpgsqlConnection.cs
Npgsql.NpgsqlConnection.ConnectionString.set(string) in NpgsqlConnection.cs
Npgsql.NpgsqlConnection.NpgsqlConnection(string) in NpgsqlConnection.cs
Scytec.DBManagement.DCI.PostgreSQL.Yuniql.YuniqlSqlDataService.CreateMasterConnection() in YuniqlSqlDataService.cs
Yuniql.Core.MetadataService.IsDatabaseExists(int?) in MetadataService.cs
Yuniql.Core.MigrationService.Run(string, string, bool?, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, string>>, bool?, string, string, string, int?, int?, string, string, string, bool?, string, bool) in MigrationService.cs
Yuniql.Core.MigrationService.Run() in MigrationService.cs
Scytec.DBManagement.DCI.PostgreSQL.Yuniql.YuniqlDeployer.Deploy(System.Data.IDbConnection) in YuniqlDeployer.cs
Scytec.DBManagement.Client.ViewModel.MainWindowViewModel.deployDCIDatabase.AnonymousMethod__0() in MainWindowViewModel.cs
...
[Call Stack Truncated]

Here is my code.
public bool Deploy(IDbConnection? p_cnx)
{
ArgumentNullException.ThrowIfNull(p_cnx);

m_logger.Notify("Deploy starting...");

var configuration = Configuration.Instance;

configuration.Platform = "postgresql";
configuration.Workspace = Path.Combine(Environment.CurrentDirectory, "PostgreSQL\\Yuniql");
configuration.ConnectionString = p_cnx.ConnectionString;
configuration.IsDebug = true;
configuration.IsAutoCreateDatabase = true;


var migrationServiceFactory = new MigrationServiceFactory(m_traceService);
var migrationService = migrationServiceFactory.Create(new YuniqlSqlDataService(m_traceService),
    new YuniqlSqlBulkImportService(m_traceService));

migrationService.Run();

m_logger.Notify("Deploy done!");

return true;

}

Any help is appreciated.

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

No branches or pull requests

1 participant