Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<GlobalPackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.15.0" />
<GlobalPackageReference Include="Roslynator.CodeFixes" Version="4.15.0" />
<GlobalPackageReference Include="Roslynator.Refactorings" Version="4.15.0" />
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774" />
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.30.0.144632" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.6.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ bool useLegacyReferences

await codeFix.RegisterCodeFixesAsync(fixContext).ConfigureAwait(false);

var operations = await registeredAction!.GetOperationsAsync(CancellationToken.None).ConfigureAwait(false);
if (registeredAction is null)
{
throw new InvalidOperationException("No code fix action was registered.");
}

var operations = await registeredAction.GetOperationsAsync(CancellationToken.None).ConfigureAwait(false);
var applyChanges = operations.OfType<ApplyChangesOperation>().Single();
var newDocument = applyChanges.ChangedSolution.GetDocument(document.Id)!;
var newRoot = await newDocument.GetSyntaxRootAsync().ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public async Task ThrowIf_WithType_WhenConditionIsFalse_DoesNotThrow()
[Test]
public async Task ThrowIf_WithNullInstance_WhenConditionIsTrue_ThrowsObjectDisposedException()
{
object? instance = null;
object instance = null!;

void Act() => ObjectDisposedException.ThrowIf(true, instance!);
void Act() => ObjectDisposedException.ThrowIf(true, instance);

var exception = Assert.Throws<ObjectDisposedException>(Act);
_ = await Assert.That(exception.ObjectName).IsEqualTo(string.Empty);
Expand All @@ -60,9 +60,9 @@ public async Task ThrowIf_WithNullInstance_WhenConditionIsTrue_ThrowsObjectDispo
[Test]
public async Task ThrowIf_WithNullType_WhenConditionIsTrue_ThrowsObjectDisposedException()
{
Type? type = null;
Type type = null!;

void Act() => ObjectDisposedException.ThrowIf(true, type!);
void Act() => ObjectDisposedException.ThrowIf(true, type);

var exception = Assert.Throws<ObjectDisposedException>(Act);
_ = await Assert.That(exception.ObjectName).IsEqualTo(string.Empty);
Expand Down