snowflakedb / snowflake-connector-net

Snowflake Connector for .NET
Apache License 2.0
180 stars 138 forks source link

SNOW-1814669: Publishing as SingleFile breaks the Snowflake connector #1062

Open hasnik opened 3 days ago

hasnik commented 3 days ago
  1. What version of .NET driver are you using? 4.2.0

  2. What operating system and processor architecture are you using? Windows 11 23H2 (build 22631.4460) x86_64

  3. What version of .NET framework are you using? net9.0

  4. What did you do? Run the app published with dotnet publish --configuration Release --runtime win-x64 --self-contained true -p:PublishSingleFile=true

  5. What did you expect to see? The app is working the same way as if it is published with dotnet publish --configuration Release --runtime win-x64 --self-contained true

  6. What is the actual result?

    The path is empty. (Parameter 'path')
    at System.IO.Path.GetFullPath(String path)
    at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
    at Snowflake.Data.Core.Tools.Diagnostics.AppendAssemblyInfo(StringBuilder info, Assembly assembly, String assemblyTag)
    at Snowflake.Data.Core.Tools.Diagnostics.GetDiagnosticInfo()
    at Snowflake.Data.Core.Tools.Diagnostics.LogDiagnostics()
    at Snowflake.Data.Client.SnowflakeDbConnectionPool.SetConnectionPoolVersion(ConnectionPoolType requestedPoolType, Boolean force)
    at Snowflake.Data.Client.SnowflakeDbConnectionPool.get_ConnectionManager()
    at Snowflake.Data.Client.SnowflakeDbConnectionPool.GetSessionAsync(String connectionString, SecureString password, CancellationToken cancellationToken)
    at Snowflake.Data.Client.SnowflakeDbConnection.OpenAsync(CancellationToken cancellationToken)
  7. Problem description Snowflake.Data relies on the fact that it is able to locate an assembly and if the app is packaged as a single file it is unable to do so. Is there a way I can pass required information to Snowflake.Data so that it will work when published as a single file?

sfc-gh-dszmolka commented 2 days ago

hello - i'm not sure we intended to support single-file deployment. Let me research on this a bit.

edit: per initial analysis it looks like this is a bug, without workarounds for the moment. We'll look into it.

hasnik commented 2 days ago

Hi! Sure thing, take your time. If your research concludes that you do not intend to support single-file deployment I believe it's a good idea to communicate it explicitly in the documentation.

sfc-gh-dszmolka commented 2 days ago

Team started to look into this, and there's already a PR https://github.com/snowflakedb/snowflake-connector-net/pull/1063 with a fix