Giter Site home page Giter Site logo

Comments (8)

clairernovotny avatar clairernovotny commented on August 16, 2024

That's really strange...I'm not sure where the bug is here. Looking at that method, it appears that a new TaskCompletionSource is created exactly once and then the handler method is executed on the threadpool once. The SetResult method is called once in the finally block.

It looks like we need to know what their version of TaskCompletionSource is doing on line 322.

from devices.xunit.

clairernovotny avatar clairernovotny commented on August 16, 2024

It's probably this line: https://github.com/mono/referencesource/blob/mono/mscorlib/system/threading/Tasks/TaskCompletionSource.cs#L322

from devices.xunit.

clairernovotny avatar clairernovotny commented on August 16, 2024

One theory: it's hitting SetException is called prior to SetResult and is thus not allowed.... do you see any first chance exceptions logged that might indicate this?

from devices.xunit.

bradwilson avatar bradwilson commented on August 16, 2024

Yep, that line should be TrySetResult instead of SetResult, because the latter conflicts with the SetException call in the catch block.

from devices.xunit.

kentcb avatar kentcb commented on August 16, 2024

I've got break on all exceptions turned on, and this exception is the first one to show up :/

Thanks for making the fix @onovotny . Any idea when you'll be releasing to NuGet?

from devices.xunit.

kentcb avatar kentcb commented on August 16, 2024

OK, I found the underlying problem. I had a theory with many test cases, but one of them was repeated. For example:

[Theory]
[InlineData("a")]
[InlineData("b")]
[InlineData("c")]
[InlineData("d")]
[InlineData("a")]  // oops
[InlineData("e")]
public void theory(string input)
{
}

This was triggering an exception which VS+Xamarin was refusing to show me yesterday:

        $exception.StackTrace   "  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/throwhelper.cs:74 \n  at System.Collections.Generic.Dictionary`2[System.String,Xunit.Runners.TestCaseViewModel].Insert (System.String key, Xunit.Runners.TestCaseViewModel value, Boolean add) [0x0008e] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:329 \n  at System.Collections.Generic.Dictionary`2[System.String,Xunit.Runners.TestCaseViewModel].Add (System.String key, Xunit.Runners.TestCaseViewModel value) [0x00000] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:185 \n  at System.Linq.Enumerable.ToDictionary[<>f__AnonymousType0`2,String,TestCaseViewModel] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x0002f] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2924 \n  at System.Linq.Enumerable.ToDictionary[<>f__AnonymousType0`2,String,TestCaseViewModel] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector) [0x00000] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:2911 \n  at Xunit.Runners.DeviceRunner.RunTestsInAssembly (System.Collections.Generic.List`1 toDispose, Xunit.Runners.AssemblyRunInfo runInfo) [0x00043] in C:\\BuildAgent\\work\\a3e04f08310ca743\\src\\xunit.runner.viewmodels\\DeviceRunner.cs:276 \n  at Xunit.Runners.DeviceRunner+<>c__DisplayClass17_1.<RunTests>b__4 (Xunit.Runners.AssemblyRunInfo runInfo) [0x00000] in C:\\BuildAgent\\work\\a3e04f08310ca743\\src\\xunit.runner.viewmodels\\DeviceRunner.cs:243 \n  at Xunit.Runners.Extensions.ForEach[AssemblyRunInfo] (IEnumerable`1 This, System.Action`1 action) [0x00010] in C:\\BuildAgent\\work\\a3e04f08310ca743\\src\\xunit.runner.viewmodels\\Utilities\\Extensions.cs:14 \n  at Xunit.Runners.DeviceRunner+<>c__DisplayClass17_0.<RunTests>b__0 () [0x0009e] in C:\\BuildAgent\\work\\a3e04f08310ca743\\src\\xunit.runner.viewmodels\\DeviceRunner.cs:242 "    string

This was in turn triggering the SetException call and then subsequently the SetResult call, which triggered the original exception I mentioned.

Since I've had these tests working successfully in previous xUnit + devices incarnations, it is presumably a change of behavior. Is that right, @bradwilson ?

from devices.xunit.

clairernovotny avatar clairernovotny commented on August 16, 2024

I just published 1.2.2 with this fix. It was supposed to be 1.2.1 but I mistyped the push from MyGet :(

from devices.xunit.

kentcb avatar kentcb commented on August 16, 2024

@onovotny thanks!

from devices.xunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.