First-chance ArgumentOutOfRangeException in NuGetUtils.cs line
See original GitHub issueWhen 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:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?
We should fix the TODO that even caused this approach to exist: #1091. I moved it to 2.1.4xx as well.