microsoft / microsoft/sqlmanagementobjects

SqlScriptPublishModel fires ScriptItemsCollected event with duplicate URNs

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

When using SqlScriptPublishModel.SelectedObjects to provide URNs of objects to script, the application may have constructed the URN manually with user input.
During scripting, the URNs used to populate progress events are generated by SMO based on server and database queries. As a result the Server[@Name='myserver'] component of the output URN may be of a different case than that of the input URN, causing some internal dictionary lookups based on URN keys to fail. Applications will see this in the ScriptItemsCollected event where the ScriptItemsArgs.Urns collection may have multiple instances of the URN, differing only by the case of the server name component.

We found this in a sql tools service test case failure when the server name case in the local settings json file mismatches the server's self-reported name.

Contributor guide

No contributing guide indexed for this repository

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 SqlScriptPublishModel.SelectedObjects and the ScriptItemsCollected event, then reproduce the failure using the SqlScriptPublishModelTests.cs test case linked in the issue. Done means the ScriptItemsArgs.Urns collection does not contain case-only duplicate URNs when the server name casing differs.

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
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.