Skip to content

Commit b4e737b

Browse files
committed
Support C# 11 again
Which doesn't have the 'ref readonly parameter' feature
1 parent 9dcbb52 commit b4e737b

5 files changed

Lines changed: 94 additions & 1 deletion

File tree

Main/CodeGeneration/DisposeUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ internal static class {{ClassName}}
313313
var awaitDisposalSourceReference = _referenceGenerator.Generate("awaitDisposalSource");
314314
code.AppendLine(
315315
$$"""
316-
internal static void {{_releaseDisposeAsyncName}}(ref int {{disposedReference}}, ref readonly int {{resolutionCounterReference}}, {{_wellKnownTypes.TaskCompletionSourceOfInt.FullName()}} {{awaitDisposalSourceReference}})
316+
internal static void {{_releaseDisposeAsyncName}}(ref int {{disposedReference}}, ref int {{resolutionCounterReference}}, {{_wellKnownTypes.TaskCompletionSourceOfInt.FullName()}} {{awaitDisposalSourceReference}})
317317
{
318318
if ({{disposedReference}} == 0 || {{resolutionCounterReference}} > 0)
319319
return;

MrMeeseeks.DIE.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestInternalsVisibleToChild
2626
EndProject
2727
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.NetStandard", "Test.NetStandard\Test.NetStandard.csproj", "{8DE05FB0-986F-402B-AE88-9B10D0EEA666}"
2828
EndProject
29+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.LowerLanguageVersion", "Test.LowerLanguageVersion\Test.LowerLanguageVersion.csproj", "{52CBDD79-E7C6-4511-8393-EA25758E51DF}"
30+
EndProject
2931
Global
3032
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3133
Debug|Any CPU = Debug|Any CPU
@@ -60,6 +62,10 @@ Global
6062
{8DE05FB0-986F-402B-AE88-9B10D0EEA666}.Debug|Any CPU.Build.0 = Debug|Any CPU
6163
{8DE05FB0-986F-402B-AE88-9B10D0EEA666}.Release|Any CPU.ActiveCfg = Release|Any CPU
6264
{8DE05FB0-986F-402B-AE88-9B10D0EEA666}.Release|Any CPU.Build.0 = Release|Any CPU
65+
{52CBDD79-E7C6-4511-8393-EA25758E51DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66+
{52CBDD79-E7C6-4511-8393-EA25758E51DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
67+
{52CBDD79-E7C6-4511-8393-EA25758E51DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
68+
{52CBDD79-E7C6-4511-8393-EA25758E51DF}.Release|Any CPU.Build.0 = Release|Any CPU
6369
EndGlobalSection
6470
GlobalSection(SolutionProperties) = preSolution
6571
HideSolutionNode = FALSE
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using MrMeeseeks.DIE.Configuration.Attributes;
2+
using MrMeeseeks.DIE.UserUtility;
3+
4+
[assembly:ContainerInstanceAbstractionAggregation(typeof(IContainerInstance))]
5+
[assembly:TransientScopeInstanceAbstractionAggregation(typeof(ITransientScopeInstance))]
6+
[assembly:ScopeInstanceAbstractionAggregation(typeof(IScopeInstance))]
7+
[assembly:TransientScopeRootAbstractionAggregation(typeof(ITransientScopeRoot))]
8+
[assembly:ScopeRootAbstractionAggregation(typeof(IScopeRoot))]
9+
[assembly:TransientAbstractionAggregation(typeof(ITransient))]
10+
[assembly:SyncTransientAbstractionAggregation(typeof(ISyncTransient))]
11+
[assembly:AsyncTransientAbstractionAggregation(typeof(IAsyncTransient))]
12+
[assembly:DecoratorAbstractionAggregation(typeof(IDecorator<>))]
13+
[assembly:CompositeAbstractionAggregation(typeof(IComposite<>))]
14+
[assembly:Initializer(typeof(IInitializer), nameof(IInitializer.Initialize))]
15+
[assembly:Initializer(typeof(ITaskInitializer), nameof(ITaskInitializer.InitializeAsync))]
16+
[assembly:Initializer(typeof(IValueTaskInitializer), nameof(IValueTaskInitializer.InitializeAsync))]
17+
18+
[assembly:InjectionKeyMapping(typeof(InjectionKeyAttribute))]
19+
[assembly:DecorationOrdinalMapping(typeof(DecorationOrdinalAttribute))]
20+
21+
[assembly:AllImplementationsAggregation]
22+
23+
[assembly:ErrorDescriptionInsteadOfBuildFailure]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<LangVersion>11</LangVersion>
7+
8+
<IsPackable>false</IsPackable>
9+
<IsTestProject>true</IsTestProject>
10+
<OutputType>Library</OutputType>
11+
12+
<RootNamespace>MrMeeseeks.DIE.Test.LowerLanguageVersion</RootNamespace>
13+
<AssemblyName>MrMeeseeks.DIE.Test.LowerLanguageVersion</AssemblyName>
14+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
15+
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
16+
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
21+
<PackageReference Include="MrMeeseeks.DIE.UserUtility" Version="3.0.1" />
22+
<PackageReference Include="xunit" Version="2.7.0" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\Main\Main.csproj" OutputItemType="Analyzer" PrivateAssets="all"/>
27+
</ItemGroup>
28+
29+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using MrMeeseeks.DIE.Configuration.Attributes;
2+
using MrMeeseeks.DIE.UserUtility;
3+
using Xunit;
4+
5+
// ReSharper disable once CheckNamespace
6+
namespace MrMeeseeks.DIE.Test.NetStandard.Vanilla
7+
{
8+
internal class Dependency {}
9+
10+
internal class Parent : IScopeRoot
11+
{
12+
internal Parent(
13+
Dependency dependency)
14+
{
15+
16+
}
17+
}
18+
19+
[CreateFunction(typeof(Parent), "Create")]
20+
internal sealed partial class Container
21+
{
22+
[CustomScopeForRootTypes(typeof(Parent))]
23+
private sealed partial class DIE_Scope_Parent{}
24+
}
25+
26+
public class Tests
27+
{
28+
[Fact]
29+
public void Test()
30+
{
31+
//using var container = Container.DIE_CreateContainer();
32+
//var instance = container.Create();
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)