microsoft / microsoft/DacFx

The dependency of DacPacs DacServices.Deploy() on Assembly.Location is erroneous when DLLs are embedded into EXE

Open
#401 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

Hi!

We use "DACExtensions" in a desktop WPF application and embed all our dependencies (DLLs) into the resulting executable by the means of [Costura.Fody](https://github.com/Fody/Costura).

We've stumbled across an issue with `Microsoft.SqlServer.DacFx.x86` package newer than "150.4384.2" due to it retrieves the `Assembly.Location` path and uses it to construct a directory path. The `Assembly.Location` property returns an empty string when the assembly is embedded into an EXE.

Needless to say, it leads to the following exception:
```c
ERROR System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at Microsoft.SqlServer.Dac.DacServices.GetDeploymentContributorLoadPaths(IPackageSource packageSource, DacDeployOptions options) in f:\B\16847\6200\Sources\Product\Source\DeploymentApi\DacServices.cs:line 884
at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action`3 reportPlanOperation, Boolean executePlan) in f:\B\16847\6200\Sources\Product\Source\DeploymentApi\DacServices.cs:line 809
at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable`1 cancellationToken) in f:\B\16847\6200\Sources\Product\Source\DeploymentApi\DacServices.cs:line 743
```

May such a uses case with embedded libraries be considered for this package?

There is a very similar issue already reported:
microsoft/DacFx#402 "Extensions discovery issue in DacPac's DacServices.Deploy()"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Microsoft.SqlServer.Dac.DacServices.Deploy and the GetDeploymentContributorLoadPaths call shown in the stack trace, then compare the embedded-assembly behavior described for Costura.Fody with the similar microsoft/DacFx#402 report. Done means DacServices.Deploy no longer fails with an illegal path when dependencies are embedded into a WPF executable.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.