Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First-chance ArgumentOutOfRangeException in NuGetUtils.cs line

See original GitHub issue

When debugging a design-time build on the line above I see fullPath = System.Xml and dir.FullName = J:\s\src\Tools\BuildUtil. Calling substring with these arguments throws, obviously.

It is being caught in the catch block below, but still causes dozens of annoying first-chance exceptions.

Is there a check we could do to avoid the exception? Say, if the index is outside the string bounds, don’t attempt to call Substring.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

KirillOsenkovcommented, Feb 3, 2022

Looks good I think, except I’d name the variable fullNameLength: we try to avoid using underscores in identifiers, and use camelCase for locals and parameters, and avoid abbreviations.

Would you send a Pull Request with this change?

nguerreracommented, May 3, 2018

We should fix the TODO that even caused this approach to exist: #1091. I moved it to 2.1.4xx as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get line number of first-chance exception
I'm getting exceptions thrown from somewhere, but all I get from the compiler is "A first chance exception of type 'System.
Read more >
C# Exception Guide: ArgumentOutOfRangeException
The ArgumentOutOfRangeException exception is thrown when the argument passed to a method is not null and contains a value that is not within...
Read more >
ArgumentOutOfRangeException Class (System)
The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found