/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/TestUtilities/TestExtensionErrorHandler.cs
36 строк
1 KB
Jason Malinowski
Remove workarounds for bugs that have been fixed
31 май 2025, 03:58
31 май 2025, 03:58
670cd85
Код
Авторство
О чём код?
// 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. #nullable disable using System; using System.Collections.Immutable; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.UnitTests; [Export(typeof(IExtensionErrorHandler))] [Export(typeof(ITestErrorHandler))] internal sealed class TestExtensionErrorHandler : IExtensionErrorHandler, ITestErrorHandler { public ImmutableList<Exception> Exceptions { get; private set; } = []; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public TestExtensionErrorHandler() { } public void HandleError(object sender, Exception exception) { // This exception is unexpected and as such we want the containing test case to // fail. Unfortuntately throwing an exception here is not going to help because // the editor is going to catch and swallow it. Store it here and wait for the // containing workspace to notice it and throw. Exceptions = Exceptions.Add(exception); } }