/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/Test/CodeFixes/ErrorCases/CodeFixExceptionInGetFixAllProvider.cs
32 строки
1 KB
Cyrus Najmabadi
use collection expression
20 дек 2024, 08:13
20 дек 2024, 08:13
96255aa
Код
Авторство
О чём код?
// 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.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; namespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeFixes.ErrorCases; public class ExceptionInGetFixAllProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds { get { return [CodeFixServiceTests.MockFixer.Id]; } } public sealed override FixAllProvider GetFixAllProvider() => throw new Exception($"Exception thrown in GetFixAllProvider of {nameof(ExceptionInGetFixAllProvider)}"); public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { #pragma warning disable RS0005 // Do not use generic CodeAction.Create to create CodeAction context.RegisterCodeFix(CodeAction.Create("Do Nothing", token => Task.FromResult(context.Document)), context.Diagnostics[0]); #pragma warning restore RS0005 // Do not use generic CodeAction.Create to create CodeAction return Task.FromResult(true); } }