Skip to content

Commit

Permalink
Netcore 8. Not working with analyzers for now
Browse files Browse the repository at this point in the history
  • Loading branch information
mhelleborg committed Feb 26, 2024
1 parent 732dd6f commit b36bddd
Show file tree
Hide file tree
Showing 209 changed files with 310 additions and 304 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dotnet-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Setup dotCover
run: dotnet tool install JetBrains.dotCover.GlobalTool -g
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/Harness/BoundPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public BoundPort(int port, Action<int> free)
public int Port { get; }

public void Dispose() => _free(Port);
}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/BoundPorts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public void Dispose()
boundPort?.Dispose();
}
}
}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public static IDictionary<string, EmptyStruct> CreateExposedPorts(IEnumerable<in
=> containerPorts.ToDictionary(
binding => $"{binding}/tcp",
binding => new EmptyStruct());
}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/Harness.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/Harness/IRuntimeWithMongo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public interface IRuntimeWithMongo : IAsyncDisposable
Task Start();

Task Stop();
}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/OpenPortPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public BoundPort Claim(int port)
void Free(int i) => _usedPorts.Remove(i);


}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/RuntimeAndMongoContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public ValueTask DisposeAsync()
{
return new ValueTask(Task.WhenAll(_runtimeContainer.DisposeAsync().AsTask(), _mongoDbContainer.DisposeAsync().AsTask()));
}
}
}
2 changes: 1 addition & 1 deletion Benchmarks/Harness/RuntimeWithMongoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ public RuntimeDevelopmentContainer CreateDevelopment(IDockerClient client, strin
{
return new RuntimeDevelopmentContainer(client, tag, _portPool.Find(), _portPool.Find(), _portPool.Find(), _logger);
}
}
}
2 changes: 1 addition & 1 deletion Benchmarks/SDK/Categories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ namespace Dolittle.Benchmarks.SDK;
public static class Categories
{
public const string EventStore = "EventStore";
}
}
4 changes: 2 additions & 2 deletions Benchmarks/SDK/SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<PropertyGroup>
<Optimize>true</Optimize>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Dolittle.Benchmarks.SDK</RootNamespace>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/SDK/SummaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public static int ToExitCode(this IEnumerable<Summary> summaries)
? 1
: 0;
}
}
}
2 changes: 1 addition & 1 deletion Samples/ASP.NET/Customers/DishesEaten.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Customers;
[CopyProjectionToMongoDB("dishes_eaten")]
public class DishesEaten
{
public string[] Dishes { get; set; } = {};
public string[] Dishes { get; set; } = [];

[KeyFromEventSource]
public void On(DishEaten evt, ProjectionContext ctx)
Expand Down
2 changes: 1 addition & 1 deletion Samples/MongoDBProjections/MongoDBProjections.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Tutorials/Aggregates/Aggregates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Tutorials/EventHorizon/Consumer/Consumer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Tutorials/EventHorizon/Producer/Producer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Tutorials/GettingStarted/Kitchen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Tutorials/Projections/Projections.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Aggregates/Actors/AggregateClusterKindFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static class AggregateClusterKindFactory
public static ClusterKind CreateKind(IServiceProvider serviceProvider, Type aggregateRootType)
{
var createKind = typeof(AggregateClusterKindFactory<>).MakeGenericType(aggregateRootType).GetMethod(nameof(CreateKind));
return (ClusterKind)createKind!.Invoke(null, new object[] { serviceProvider })!;
return (ClusterKind)createKind!.Invoke(null, [serviceProvider])!;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Aggregates/AggregateOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public AggregateOf(IAggregates aggregates)
/// <inheritdoc />
public IAggregateRootOperations<TAggregateRoot> Get(EventSourceId eventSourceId)
=> _aggregates.Get<TAggregateRoot>(eventSourceId);
}
}
6 changes: 3 additions & 3 deletions Source/Aggregates/AggregateRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Dolittle.SDK.Aggregates;
/// </summary>
public abstract class AggregateRoot
{
readonly List<AppliedEvent> _appliedEvents = new();
readonly List<AppliedEvent> _appliedEvents = [];
EventSourceId? _eventSourceId;

/// <summary>
Expand Down Expand Up @@ -195,7 +195,7 @@ internal async Task RehydrateInternal(IAsyncEnumerable<CommittedAggregateEvents>
var eventContent = @event.Content;
if (onMethods.TryGetValue(eventContent.GetType(), out var handleMethod))
{
handleMethod.Invoke(this, new[] { eventContent });
handleMethod.Invoke(this, [eventContent]);
}
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ void InvokeOnMethod(object @event)
{
if (this.TryGetOnMethod(@event, out var handleMethod))
{
handleMethod.Invoke(this, new[] { @event });
handleMethod.Invoke(this, [@event]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Aggregates/AggregateRootIdCannotBeNull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public AggregateRootIdCannotBeNull()
: base($"The {nameof(AggregateRootId)} of an {nameof(AggregateRootType)} cannot be null")
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public AggregateRootTypeGenerationCannotBeNull()
: base($"The {nameof(Generation)} of an {nameof(AggregateRootType)} cannot be null")
{
}
}
}
2 changes: 1 addition & 1 deletion Source/Aggregates/Builders/IAggregates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ IAggregateRootOperations<TAggregateRoot> Get<TAggregateRoot>(EventSourceId event
/// <returns>The <see cref="IAggregateOf{TAggregate}"/> for the <typeparamref name="TAggregateRoot"/> <see cref="AggregateRoot"/> class.</returns>
IAggregateOf<TAggregateRoot> Of<TAggregateRoot>()
where TAggregateRoot : AggregateRoot;
}
}
2 changes: 1 addition & 1 deletion Source/Aggregates/IAggregateRootOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public interface IAggregateRootOperations<TAggregate>
/// <param name="cancellationToken">Token that can be used to cancel this operation.</param>
/// <returns>The <see cref="Task" /> representing the asynchronous operation.</returns>
Task Perform(Func<TAggregate, Task> method, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public InvalidAggregateRootConstructorSignature(Type aggregateRootType, string e
: base($"Wrong constructor for aggregate root of type {aggregateRootType} - {expectations}")
{
}
}
}
2 changes: 1 addition & 1 deletion Source/Aggregates/MissingAggregateRootAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public MissingAggregateRootAttribute(Type aggregateRootType)
: base($"Aggregate Root {aggregateRootType} is missing [AggregateRoot] attribute")
{
}
}
}
4 changes: 2 additions & 2 deletions Source/Analyzers/AggregateAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void CheckApplyInvocationsInOnMethods(SyntaxNodeAnalysisContext context,
context.ReportDiagnostic(Diagnostic.Create(
DescriptorRules.Aggregate.MutationsCannotProduceEvents,
applyInvocation.GetLocation(),
new[] { onMethod.ToDisplayString() }
[onMethod.ToDisplayString()]
));
}

Expand All @@ -189,7 +189,7 @@ static void CheckApplyInvocationsInOnMethods(SyntaxNodeAnalysisContext context,
context.ReportDiagnostic(Diagnostic.Create(
DescriptorRules.Aggregate.MutationsCannotProduceEvents,
invocation.GetLocation(),
new[] { onMethod.ToDisplayString() }
[onMethod.ToDisplayString()]
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Analyzers/Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
return Task.CompletedTask;
}


static async Task<Solution> GenerateIdentityAttribute(CodeFixContext context, Document document, string targetClass, string attributeClass,
CancellationToken cancellationToken)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Analyzers/DescriptorRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static class DescriptorRules
DiagnosticCategories.Sdk,
DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "Assign a unique identity in the attribute");
description: "Assign a unique identity in the attribute.");

internal static readonly DiagnosticDescriptor InvalidAccessibility =
new(
Expand Down
5 changes: 4 additions & 1 deletion Source/Analyzers/EventHandlerAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
Expand Down
2 changes: 1 addition & 1 deletion Source/Concepts/ConceptFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public static object CreateConceptInstance(Type type, object? value)
=> type
.GetConstructors()
.Single(c => c.GetParameters().Length > 0)
.Invoke(new[] {value});
.Invoke([value]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public MissingServiceProviderForTenant(TenantId tenant)
: base($"Tenant {tenant} has no configured service provider.")
{
}
}
}
2 changes: 1 addition & 1 deletion Source/EventHorizon/ConsentId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public record ConsentId(Guid Value) : ConceptAs<Guid>(Value)
/// <param name="consentId">The <see cref="string"/> representation.</param>
/// <returns>The converted <see cref="ConsentId"/>.</returns>
public static implicit operator ConsentId(string consentId) => new(Guid.Parse(consentId));
}
}
2 changes: 1 addition & 1 deletion Source/EventHorizon/EventSubscriptionRetryPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ namespace Dolittle.SDK.EventHorizon;
/// <param name="subscription">Subscription that we want to have a retry policy for.</param>
/// <param name="logger">Logger.</param>
/// <param name="methodToPerform">Method to perform.</param>
public delegate Task EventSubscriptionRetryPolicy(Subscription subscription, ILogger logger, Func<Task<bool>> methodToPerform);
public delegate Task EventSubscriptionRetryPolicy(Subscription subscription, ILogger logger, Func<Task<bool>> methodToPerform);
2 changes: 1 addition & 1 deletion Source/EventHorizon/IEventHorizons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public interface IEventHorizons
/// <param name="subscription">The <see cref="Subscription"/> to register.</param>
/// <returns>The <see cref="SubscribeResponse"/> from the Runtime indicating whether or not the subscription was successful.</returns>
Task<SubscribeResponse> Subscribe(Subscription subscription);
}
}
2 changes: 1 addition & 1 deletion Source/EventHorizon/SubscriptionBuilderForConsumerScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ public void BuildAndSubscribe(IEventHorizons eventHorizons, CancellationToken ca

eventHorizons.Subscribe(subscription);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ void ThrowIfProducerTenantIsNotDefined()
throw new SubscriptionDefinitionIncomplete("Producer Tenant", "Call FromProducerTenant()");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ void ThrowIfConsumerScopeIsNotDefined()
throw new SubscriptionDefinitionIncomplete("Scope", "Call ToScope() with a non-default scope");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ void ThrowIfProducerPartitionIsNotDefined()
throw new SubscriptionDefinitionIncomplete("Partition", "Call FromProducerPartition()");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ void ThrowIfProducerStreamIsNotDefined()
throw new SubscriptionDefinitionIncomplete("Stream", "Call FromProducerStream()");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public SubscriptionBuilderMethodAlreadyCalled(string method)
: base($"The method {method} can only be called once while building an Event Horizon Subscription.")
{
}
}
}
2 changes: 1 addition & 1 deletion Source/EventHorizon/SubscriptionCallbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public void OnError(Exception error)
void IObserver<SubscribeResponse>.OnCompleted()
{
}
}
}
2 changes: 1 addition & 1 deletion Source/EventHorizon/SubscriptionDefinitionIncomplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public SubscriptionDefinitionIncomplete(string missingInformation, string correc
: base($"Event Horizon Subscription definition is missing {missingInformation}. {correctingAction} before calling Build()")
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ public void BuildAndSubscribe(IEventHorizons eventHorizons, CancellationToken ca
builder.BuildAndSubscribe(eventHorizons, cancellationToken);
}
}
}
}
Loading

0 comments on commit b36bddd

Please sign in to comment.