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

Length cannot be less than zero exception #42

Open
pver opened this issue Feb 18, 2015 · 6 comments
Open

Length cannot be less than zero exception #42

pver opened this issue Feb 18, 2015 · 6 comments
Assignees

Comments

@pver
Copy link
Contributor

pver commented Feb 18, 2015

Found this one in the Q&A on the visual studio gallery:
https://visualstudiogallery.msdn.microsoft.com/6950a046-8919-4935-8542-c6f37956f688

An exception occured: Length cannot be less than zero. Parameter name: length. Please refer to output window for more details.
I can't find the extra details it is talking about: nothing is shown in any of OpenCover's panes, or in the normal VisualStudio output pane.
...
I did some more troubleshooting and this is being caused by a specific test that looks like this:
[TestCase(false, TestName = "FirstTestCase")]
[TestCase(true, TestName = "SecondTestCase")]
public void TestSomething(bool input) {
...
}
Perhaps OpenCover UI is being confused by these tests being renamed by the TestName parameter to the TestCase attribute?

I did a quick test and can confirm this makes the plugin fail. The spinner ('Please wait while we collect coverage results') stays visible and a popup is shown:
image

@pver
Copy link
Contributor Author

pver commented Feb 18, 2015

Extra info logged in the OpenCover.UI output window:

Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at OpenCover.UI.Processors.NUnitTestExecutor.ReadTestCase(XElement ts)
at OpenCover.UI.Processors.NUnitTestExecutor.b__1(XElement ts)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.<UnionIterator>d__881.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__142.MoveNext()
at System.Linq.Lookup2.CreateForJoin(IEnumerable1 source, Func2 keySelector, IEqualityComparer1 comparer)
at System.Linq.Enumerable.d__614.MoveNext() at OpenCover.UI.Processors.NUnitTestExecutor.UpdateTestMethodsExecution(IEnumerable1 tests)
at OpenCover.UI.Commands.ExecuteSelectedTestsCommand.b__1()

@pver
Copy link
Contributor Author

pver commented Feb 18, 2015

@sawilde I'll take care of this one: I found the root cause for the problem and have an approach to fix it

@sawilde
Copy link
Contributor

sawilde commented Feb 18, 2015

feel free to assign tickets to yourself :)

@pver
Copy link
Contributor Author

pver commented Feb 19, 2015

Thanks for assigning :)
I couldn't find the assign functionality myself, I think it's because assigning also requires write access to the repository?

@sawilde
Copy link
Contributor

sawilde commented Feb 19, 2015

Ahh - I didn't know that, learning more about github things everyday.

I did wonder about write access but I want devs to work on their own forks and submit pull requests before I do so - I only do very minor changes on the main repo i.e. readme.md files etc

@ashes999
Copy link

Looks the same as #125 . Is there any progress on this? I'm getting an identical stack dump today.

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

No branches or pull requests

3 participants