/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/VisualStudio/IntegrationTest/Harness/XUnitShared/Threading/WpfTestSharedData.cs
38 строк
2 KB
David Barbet
Shorten file paths to prevent long path issues opening the slnx
10 дек 2025, 22:44
10 дек 2025, 22:44
7830fcf
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Xunit.Threading { using System; using System.Collections.Generic; using System.Threading; [Serializable] #pragma warning disable CA1001 // Types that own disposable fields should be disposable public sealed class WpfTestSharedData #pragma warning restore CA1001 // Types that own disposable fields should be disposable { internal static readonly WpfTestSharedData Instance = new WpfTestSharedData(); /// <summary> /// The name of a <see cref="Semaphore"/> used to ensure that only a single /// <see cref="IdeFactAttribute"/>-attributed test runs at once. This requirement must be made because, /// currently, <see cref="IdeTestCase"/>'s logic sets various static state before a method runs. If two tests /// run interleaved on the same scheduler (i.e. if one yields with an await) then all bets are off. /// </summary> internal static readonly Guid TestSerializationGateName = Guid.NewGuid(); #pragma warning disable CA2235 // Mark all non-serializable fields private readonly Semaphore _testSerializationGate = new Semaphore(1, 1, TestSerializationGateName.ToString("N")); #pragma warning restore CA2235 // Mark all non-serializable fields private WpfTestSharedData() { } public Semaphore TestSerializationGate => _testSerializationGate; public Exception? Exception { get; set; } } }