microsoft / microsoft/DacFx

Extensions discovery issue in DacPac's DacServices.Deploy()

Open
#402 1 comment 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

Due to specifics of our application we load the assembly Microsoft.SqlServer.Dac.dll, as well as all other it relies on, by leveraging the method[ Assembly.Load(byte[])](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.load?view=netcore-3.1#System_Reflection_Assembly_Load_System_Byte___). Then, once we call DacServices.Deploy(), it fails with the below ArgumentException:

![image](https://user-images.githubusercontent.com/11545082/90590291-09433e80-e195-11ea-861c-f11eae5ba589.png)

because its implementation:
![image](https://user-images.githubusercontent.com/11545082/90590331-224bef80-e195-11ea-99f6-3ad3cbb8cfcf.png)

is not ready to handle the contract of [Assembly.Location](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.location?view=netcore-3.1) saying: "_... If the assembly is loaded from a byte array, such as when using the Load(Byte[]) method overload, the value returned is an empty string ("") ..._"

So, the above ArgumentException is because Path.GetDirectoryName was supplied an empty string. The code should verify the property Assembly.Location for an empty string prior trying to use it.

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 by inspecting the DacServices.Deploy() extension-discovery implementation shown in the issue and reproduce the failure with assemblies loaded through Assembly.Load(byte[]). Done means deployment no longer throws when Assembly.Location is empty; the issue does not name a source file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.