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: 2 additions & 0 deletions src/AspectCore.SourceGenerator/AnalyzerReleases.Shipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
19 changes: 19 additions & 0 deletions src/AspectCore.SourceGenerator/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
ACSG001 | AspectCore.SourceGenerator | Warning | Open generic type is not supported for proxy generation.
ACSG002 | AspectCore.SourceGenerator | Warning | Nested type is not supported for proxy generation.
ACSG003 | AspectCore.SourceGenerator | Warning | Event member is not supported for proxy generation.
ACSG004 | AspectCore.SourceGenerator | Warning | Open generic method is not supported for proxy generation.
ACSG005 | AspectCore.SourceGenerator | Error | Cannot generate a proxy for a sealed type.
ACSG006 | AspectCore.SourceGenerator | Error | Type is not accessible to the source generator.
ACSG007 | AspectCore.SourceGenerator | Error | Type has no accessible constructor for a class proxy.
ACSG008 | AspectCore.SourceGenerator | Error | Cannot generate a proxy for a ref struct type.
ACSG009 | AspectCore.SourceGenerator | Warning | byref-like params parameter is not supported for proxy generation.
ACSG010 | AspectCore.SourceGenerator | Warning | byref-like parameter is not supported for proxy generation.
ACSG011 | AspectCore.SourceGenerator | Warning | byref-like return value is not supported for proxy generation.
ACSG0101 | AspectCore.SourceGenerator | Warning | Open generic method falls back to reflection for NativeAOT.
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@
<None Include="..\..\LICENSE" Pack="false" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="AnalyzerReleases.Shipped.md" />
<AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
</ItemGroup>

</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void Issue331_ResolveFromServiceResolver_AfterExtraRegistration_StillRetu
#region Issue #271: Singleton concurrent construction returns same instance

[Fact]
public void Issue271_Singleton_ConcurrentResolution_ReturnsSameInstance()
public async Task Issue271_Singleton_ConcurrentResolution_ReturnsSameInstance()
{
// Arrange: a singleton service with a slow constructor
var context = new ServiceContext();
Expand Down Expand Up @@ -126,7 +126,7 @@ public void Issue271_Singleton_ConcurrentResolution_ReturnsSameInstance()
results[index] = resolver.Resolve(typeof(ISlowSingletonService));
});
}
Task.WaitAll(tasks);
await Task.WhenAll(tasks);

// Assert: all threads should get the same instance
var firstResult = results[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
private static IInvocation InvokeAdapterAndCapture(
AspectContext context,
AspectDelegate next,
Action<IInvocation> extraAction = null)

Check warning on line 102 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 102 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 102 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.
{
IInvocation captured = null!;
var castleInterceptor = new InlineInterceptor(inv =>
Expand Down Expand Up @@ -226,7 +226,7 @@

var inv = InvokeAdapterAndCapture(context, next);

Assert.Equal("Add", inv.MethodInvocationTarget.Name);

Check warning on line 229 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 229 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 229 in tests/AspectCore.Extensions.CastleCompat.Tests/AspectContextInvocationAdapterTests.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Dereference of a possibly null reference.
}

[Fact]
Expand All @@ -242,7 +242,7 @@
}

[Fact]
public void ReturnValue_Get_Returns_Context_ReturnValue()
public async Task ReturnValue_Get_Returns_Context_ReturnValue()
{
var context = CreateRealAspectContext(out _);
// The context has ReturnValue=30 from the backing invocation
Expand All @@ -255,13 +255,13 @@
// Don't proceed - just read ReturnValue
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);

Assert.Equal(30, captured.ReturnValue);
}

[Fact]
public void ReturnValue_Set_Updates_Context_ReturnValue()
public async Task ReturnValue_Set_Updates_Context_ReturnValue()
{
var context = CreateRealAspectContext(out _);
AspectDelegate next = ctx => Task.CompletedTask;
Expand All @@ -273,7 +273,7 @@
inv.ReturnValue = 99;
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);

Assert.Equal(99, context.ReturnValue);
}
Expand Down Expand Up @@ -387,7 +387,7 @@
}

[Fact]
public void Proceed_Called_Twice_Throws_InvalidOperationException()
public async Task Proceed_Called_Twice_Throws_InvalidOperationException()
{
var context = CreateRealAspectContext(out _);
AspectDelegate next = ctx => Task.CompletedTask;
Expand All @@ -398,11 +398,11 @@
Assert.Throws<InvalidOperationException>(() => inv.Proceed());
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);
}

[Fact]
public void Proceed_Synchronous_Faulted_Task_Propagates_Exception()
public async Task Proceed_Synchronous_Faulted_Task_Propagates_Exception()
{
var context = CreateRealAspectContext(out _);
AspectDelegate next = _ => Task.FromException(new InvalidOperationException("test error"));
Expand All @@ -412,7 +412,7 @@
Assert.Throws<InvalidOperationException>(() => inv.Proceed());
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);
}

[Fact]
Expand Down Expand Up @@ -456,7 +456,7 @@
// ── CaptureProceedInfo Tests ────────────────────────────────────────

[Fact]
public void CaptureProceedInfo_Invoke_Calls_Proceed()
public async Task CaptureProceedInfo_Invoke_Calls_Proceed()
{
var context = CreateRealAspectContext(out _);
var nextCalled = false;
Expand All @@ -472,13 +472,13 @@
info.Invoke();
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);

Assert.True(nextCalled);
}

[Fact]
public void CaptureProceedInfo_Double_Invoke_Throws()
public async Task CaptureProceedInfo_Double_Invoke_Throws()
{
var context = CreateRealAspectContext(out _);
AspectDelegate next = ctx => Task.CompletedTask;
Expand All @@ -490,7 +490,7 @@
Assert.Throws<InvalidOperationException>(() => info.Invoke());
});
var adapter = new CastleInterceptorAdapter(castleInterceptor);
adapter.Invoke(context, next).GetAwaiter().GetResult();
await adapter.Invoke(context, next);
}

// ── CastleInterceptorAdapter Constructor Tests ──────────────────────
Expand Down
Loading