DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

Not actionable extension related errors in DacServices.Deploy()

Open Pikhulya opened this issue 4 years ago • 0 comments

I have .net core 3.1 application (targeting win-x64, also tried win10-x64 with the same results) referencing netstadard 2.0 Microsoft.SqlServer.DACFx 150.4826.1 which fails with not actionable exception:

Microsoft.SqlServer.Dac.DacServicesException
  HResult=0x80131500
  Message=An error occurred during deployment plan generation. Deployment cannot continue.
Error 72002: The extension type Microsoft.SqlServer.Dac.Deployment.Internal.InternalDeploymentPlanExecutor could not be instantiated.
Error 72002: The extension type Microsoft.SqlServer.Dac.Deployment.Internal.InternalDeploymentPlanModifier could not be instantiated.

  Source=Microsoft.SqlServer.Dac
  StackTrace:
   at Microsoft.SqlServer.Dac.DacServices.CreateController(SqlDeployment deploymentEngine, ErrorManager errorManager)
   at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass16_1.<CreatePlanInitializationOperation>b__1()
   at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action)
   at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass16_0.<CreatePlanInitializationOperation>b__0(Object operation, CancellationToken token)
   at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action`3 reportPlanOperation, Boolean executePlan)
   at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable`1 cancellationToken)
   at Microsoft.Dynamics365.Commerce.Tools.DacValidator.DacServicesFacade.DeployPackage(String connectionString, String databaseName, DacPackage package, DacDeployOptions deployOptions, Boolean ignoreCustomVersioning, Nullable`1 cancellationToken, ILogger logger) in H:\Repos\Tools\src\Tools\Database\DacValidator\DacServicesFacade.cs:line 224

Not actionable - because there are no any details explaining why those types could not be loaded. The exception is thrown here:

image

And I was only able to figure out the details by attaching a debugger and disabling "Just My Code": image

The original valuable exception indeed is provided to the method CreateInvalidTypeException but it is simply used there in Exception's base constructor and is not used anywhere for the above error reporting making real life investigation without debugger very difficult.

Can you please leverage the original exception so it is available in the final exception's message? Please also scan the code for all other similar occurrences and fix them as well.

By the way, it seems like DacFx library is relying on MEF1 rather than on MEF2 which works in net core 3.1, are there plans to update the MEF in DacFx?

Pikhulya avatar Aug 19 '20 08:08 Pikhulya