Skip to content

find the nearest line, previously was always returning last#83

Merged
leculver merged 1 commit into
microsoft:masterfrom
adamsitnik:sourceLineNumber
Aug 9, 2017
Merged

find the nearest line, previously was always returning last#83
leculver merged 1 commit into
microsoft:masterfrom
adamsitnik:sourceLineNumber

Conversation

@adamsitnik
Copy link
Copy Markdown
Member

Hi!

I have been using part of the code from samples (found it in msos project) to display the disassembly code for BenchmarkDotNet and I have realized, that always the last line of source code was printed.

The bug fix was trivial: when you find smaller distance, set the current distance to it. So far the value of distance was always int.Max, so the value of if (dist < distance) was always true, so the loop was going to the end, and returning the last line.

@msftclas
Copy link
Copy Markdown

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@leculver leculver merged commit ed250d8 into microsoft:master Aug 9, 2017
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.

3 participants