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

DacFx doesn't work on .NET 6 #33

Closed
jmezach opened this issue Sep 18, 2021 · 16 comments
Closed

DacFx doesn't work on .NET 6 #33

jmezach opened this issue Sep 18, 2021 · 16 comments
Assignees
Labels
bug Something isn't working fixed-pending-release Fix in upcoming release

Comments

@jmezach
Copy link

jmezach commented Sep 18, 2021

  • SqlPackage or DacFx Version: 150.5164.1
  • .NET Framework (Windows-only) or .NET Core: .NET 6
  • Environment (local platform and source/target platforms): macOS, Linux

Hi there, I'm the maintainer of MSBuild.Sdk.SqlProj and we've been working on upgrading that project to make it compatible with .NET 6. Unfortunately we've ran into an issue in DACFX where it seems that it is depending on Strong-name signing which seems to be no longer supported on .NET 6. We are seeing the following stack trace:

System.PlatformNotSupportedException: Strong-name signing is not supported on this platform.
     at System.Reflection.AssemblyName.get_KeyPair()
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.ExtensionAssemblies.CreateAssemblyName(String partialName, AssemblyName templateName)
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.ExtensionAssemblies.CreateAssemblyLoadName(String partialName, Nullable`1 specificVersion, Nullable`1 isLazy)
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.ExtensionAssemblies.GetNames(HashSet`1& allNames)
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.LoadTypes()
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager..ctor(String databaseSchemaProviderType)
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager.<>c__DisplayClass20_0.<SetLazyExtensionManager>b__0()
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
     at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.get_Value()
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionManager.GetExtensionManager(String dsp)
     at Microsoft.Data.Tools.Schema.Sql.SchemaModel.ModelBuildingUtils.CreateEmptyModel(Type dspType, Action`1 ctorSetter)
     at Microsoft.Data.Tools.Schema.Sql.SchemaModel.ModelBuildingUtils.CreateEmptyModel(SqlPlatforms platform, Action`1 ctorSetter)
     at Microsoft.SqlServer.Dac.Model.SqlSchemaModelCreator.CreateEmptyModel(SqlServerVersion modelTargetVersion, TSqlModelOptions modelCreationOptions)
     at Microsoft.SqlServer.Dac.Model.TSqlModel..ctor(SqlServerVersion modelTargetVersion, TSqlModelOptions modelCreationOptions)

Steps to Reproduce:

  1. Create a new Console app on .NET 6 (dotnet new console)
  2. Instantiate a new TSqlModel using the constructor that takes a SqlServerVersion and TSqlModelOptions.
  3. Run the app and see the above exception

Did this occur in prior versions? If not - which version(s) did it work in?
It works fine on .NET 5.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

@KalleOlaviNiemitalo
Copy link

The AssemblyName.KeyPair implementation was replaced with throw statements in dotnet/runtime#50941, which was merged before v6.0.0-preview.5.21301.5.

@jmezach
Copy link
Author

jmezach commented Sep 18, 2021

I have also tried using the latest preview of DacFx, but that exhibits the same issue.

@dvomsaal
Copy link

I started the process of opening this exact issue last week and traded emails with Leila Lali llali@microsoft.com but you beat me to the punch. This is a critical issue for our project as we rely on code-based dacpac deployments. I can provide any additional details, but it's exactly what was reported - as soon as you try to get a script against NET 6 the strong-name exception is raised.

@kevin-david
Copy link

@dzsquared I'm wondering if anyone has mentioned this to you yet? My understanding is the final release of .NET 6 is about a month or so away, and I'm assuming having DacFx not working with that at release would be undesirable 🙂

@llali
Copy link
Member

llali commented Oct 13, 2021

@jmezach sorry about the delay. I have a fix for this and planning to include it in the next release of DacFx Nuget package.

@jmezach
Copy link
Author

jmezach commented Oct 14, 2021

@llali No problem, looking forward to it. If you want I could take a preview release for a spin to see if that solves our issue.

@llali llali added fixed-pending-release Fix in upcoming release and removed under-investigation labels Oct 19, 2021
@llali
Copy link
Member

llali commented Nov 4, 2021

the preview version of dacfx with this fix is now available in nuget.org.
https://www.nuget.org/packages/Microsoft.SqlServer.DacFx/160.5323.3-preview

@DavidWiseman
Copy link

The preview version resolved the issue for me. Thank you.

@jmezach
Copy link
Author

jmezach commented Nov 8, 2021

I can confirm the same.

Do have an estimate when DACFX 160 is going to ship?

@llali
Copy link
Member

llali commented Nov 9, 2021

Thanks for confirming the fix. We're planning to release by end of the year.

@zvrba
Copy link

zvrba commented Jan 20, 2022

I have just tried Microsoft.SqlServer.DacFX 160.5400.1-preview and it still fails with PNSE due to strong naming. (Exactly the same exception as in the OP).

@OskarKlintrot
Copy link

I tried to update from 160.5371.2-preview to 160.5400.1-preview to see if anything broke but it still works fine for me.

@zvrba
Copy link

zvrba commented Jan 20, 2022

Maybe an important detail: I'm deploying a net6.0 app to Azure AppService ("framework-dependent"), where it fails with PNSE. I have temporarily worked around it by disabling signing of the assembly which uses DacFX, but I'd rather not.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 13, 2022

@dzsquared could this be closed?

@llali llali closed this as completed Feb 14, 2022
@llali
Copy link
Member

llali commented Feb 23, 2022

this is fixed in stable release https://www.nuget.org/packages/Microsoft.SqlServer.DacFx/160.5400.1

@joyita4subs
Copy link

I am still getting this error after using 160.5400.1 or 160.6161.0. Any help on this is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-pending-release Fix in upcoming release
Projects
None yet
Development

No branches or pull requests