Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle null ref exceptions in managed parser #1606

Merged
merged 2 commits into from
Jul 28, 2022
Merged

Conversation

alanrenmsft
Copy link
Contributor

This PR fixes: microsoft/azuredatastudio#20119
The root cause of the issue is #1605, I am not familiar with this area to fix the root cause, so I opened an issue for it.

but meanwhile, we can unblock the user by properly handle the null reference exception.

@alanrenmsft alanrenmsft changed the title handle null ref exceptions handle null ref exceptions in managed parser Jul 27, 2022
Copy link
Contributor

@Charles-Gagnon Charles-Gagnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add tests for this while you're at it.

@@ -229,7 +229,7 @@ private static List<int> GetOffsets(string content, IList<BatchInfo> batchInfos)
}

// get number of characters in the last line
int endColumn = prevLine.ToCharArray().Length;
int endColumn = prevLine == null ? 0 : prevLine.ToCharArray().Length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment explaining what the situation would be where this would be null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated comment

@alanrenmsft alanrenmsft merged commit bfa40e8 into main Jul 28, 2022
@alanrenmsft alanrenmsft deleted the alanren/sqlcmd-mode branch July 28, 2022 01:35
nofield pushed a commit that referenced this pull request Jul 28, 2022
* handle null ref exceptions

* add comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLCMD in TSQL not working in ADS
2 participants