microsoft / microsoft/DacFx

Microsoft.Build.Sql project build emits duplicate error reference

Open
#773 7 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

- Microsoft.Build.Sql version: 2.1.0
- .net core & windows platforms

**Steps to Reproduce:**

1. Install msbuild templates
2. Create new blank project (dotnet new sqlproj)
3. Add test file `aa.sql` (with an error), such as:

```
create table aa
(x int, y int)
go

create proc zz
as
begin
select z from aa
end
```

4. Build with `dotnet build`

Expected output:
`aa.sql(10,11): Build error SQL71501: Procedure: [dbo].[zz] has an unresolved reference to object [dbo].[aa].[z].`

Actual output:
`aa.sql(10,11,10,11): Build error SQL71501: Procedure: [dbo].[zz] has an unresolved reference to object [dbo].[aa].[z].`

The error line and column are repeated. This leads to issues in VS Code for example when clicking on the output. It cannot locate the error position.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by creating a blank project with `dotnet new sqlproj`, adding the shown `aa.sql`, and running `dotnet build`. Trace how the SQL project build reports SQL71501 diagnostics; done means the output reports the error location once as `aa.sql(10,11)` and remains usable for navigation in VS Code.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
build-system, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.