Skip to content

Commit f496bbd

Browse files
bordingandreasohlundkentdr
authored
Prepare repo for .NET 8 (#6810)
* Update project files * Remove ifdefs * Update Analyzer to use latest 17.7 package * Fix obsolete errors * Fix error * Add workaround for testhost packaging error * Bump major version * Remove v8 obsoletes * Move v9 obsoletes * Update to .NET 8 dependencies * Update Microsoft.NET.Test.Sdk * Update workflows * Remove init.ps1 * Remove references to obsolete stuff * Use new di registration API * Remove all usages of old DI registration API * Remove asserts for now obsoleted address access methods * IMessageCreator is no longer available in DI * Add todo * Add todo about TransactionManager.ImplicitDistributedTransactions * Make sure IMessageCreator is registered * Go back to IMessageCreator since that is what's being tested * Revert test * Properly register installers * Register interfaces * Approve DI changes * Revert auto property change in DataBusProperty * Remove obsolete call to InstanceSpecificQueue * Add windows guard to dtc tests * Clean up MessageDrivenSubscriptions comment and remove reference * Remove unused UnitOfWork stuff * Remove unneeded tests * Clean up AddAuditData references * Extract interface registrations to helper * Fix registration bug * Fix feature dependency * Make relevant container tests use new helper * Complete obsoletion of notifications * Fix ordering of tx scope * Update approval files for acceptance tests * Remove exception test with obsolete constructor requirements * Restore NonDurableMessage header value * Update PreObsoleteAttribute usage * Clean up TransportDefinition.ToTransportAddress * Tweak Notifications obsoletes * Rename internal class to fix test * Update approval files * Remove binding redirect stuff from AssemblyScanner error messages * Update PreObsolete issue link * Update PreObsoleteAttribute XML comment * Get rid of AddWithInterfaces --------- Co-authored-by: Andreas Öhlund <[email protected]> Co-authored-by: kentdr <[email protected]>
1 parent 76c1280 commit f496bbd

File tree

116 files changed

+572
-5187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+572
-5187
lines changed

.github/workflows/ci.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
strategy:
1616
matrix:
1717
include:
18-
- os: windows-2019
18+
- os: windows-2022
1919
name: Windows
20-
- os: ubuntu-20.04
20+
- os: ubuntu-22.04
2121
name: Linux
2222
fail-fast: false
2323
steps:
@@ -28,9 +28,8 @@ jobs:
2828
- name: Setup .NET SDK
2929
uses: actions/[email protected]
3030
with:
31-
dotnet-version: |
32-
7.0.x
33-
6.0.x
31+
dotnet-version: 8.0.x
32+
dotnet-quality: 'preview'
3433
- name: Build
3534
run: dotnet build src --configuration Release
3635
- name: Upload packages

.github/workflows/release.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
DOTNET_NOLOGO: true
99
jobs:
1010
release:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Checkout
1414
uses: actions/[email protected]
@@ -17,7 +17,8 @@ jobs:
1717
- name: Setup .NET SDK
1818
uses: actions/[email protected]
1919
with:
20-
dotnet-version: 7.0.x
20+
dotnet-version: 8.0.x
21+
dotnet-quality: 'preview'
2122
- name: Build
2223
run: dotnet build src --configuration Release
2324
- name: Sign NuGet packages

src/Custom.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<PropertyGroup>
8-
<MinVerMinimumMajorMinor>8.1</MinVerMinimumMajorMinor>
8+
<MinVerMinimumMajorMinor>9.0</MinVerMinimumMajorMinor>
99
<MinVerAutoIncrement>minor</MinVerAutoIncrement>
1010
</PropertyGroup>
1111

src/NServiceBus.AcceptanceTesting/AcceptanceTestingPersistence/SubscriptionStorage/AcceptanceTestingSubscriptionPersistence.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class AcceptanceTestingSubscriptionPersistence : Feature
88
{
99
public AcceptanceTestingSubscriptionPersistence()
1010
{
11-
#pragma warning disable CS0618
12-
DependsOn<MessageDrivenSubscriptions>();
13-
#pragma warning restore CS0618
11+
DependsOn("NServiceBus.Features.MessageDrivenSubscriptions");
1412
}
1513

1614
protected internal override void Setup(FeatureConfigurationContext context)

src/NServiceBus.AcceptanceTesting/AcceptanceTestingTransport/AcceptanceTestingTransport.cs

+3-44
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System;
44
using System.Collections.Generic;
5-
using System.IO;
65
using System.Threading;
76
using System.Threading.Tasks;
87
using AcceptanceTesting;
@@ -27,34 +26,10 @@ public override async Task<TransportInfrastructure> Initialize(HostSettings host
2726
return infrastructure;
2827
}
2928

30-
[Obsolete("Obsolete marker to make the code compile", false)]
29+
[Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
3130
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
32-
public override string ToTransportAddress(QueueAddress address)
31+
public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
3332
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
34-
{
35-
var baseAddress = address.BaseAddress;
36-
ThrowForBadPath(baseAddress, "endpoint name");
37-
38-
var discriminator = address.Discriminator;
39-
40-
if (!string.IsNullOrEmpty(discriminator))
41-
{
42-
ThrowForBadPath(discriminator, "endpoint discriminator");
43-
44-
baseAddress += "-" + discriminator;
45-
}
46-
47-
var qualifier = address.Qualifier;
48-
49-
if (!string.IsNullOrEmpty(qualifier))
50-
{
51-
ThrowForBadPath(qualifier, "address qualifier");
52-
53-
baseAddress += "-" + qualifier;
54-
}
55-
56-
return baseAddress;
57-
}
5833

5934
public override IReadOnlyCollection<TransportTransactionMode> GetSupportedTransactionModes()
6035
{
@@ -67,6 +42,7 @@ public override IReadOnlyCollection<TransportTransactionMode> GetSupportedTransa
6742
}
6843

6944
string storageLocation;
45+
7046
public string StorageLocation
7147
{
7248
get => storageLocation;
@@ -77,22 +53,5 @@ public string StorageLocation
7753
storageLocation = value;
7854
}
7955
}
80-
81-
static void ThrowForBadPath(string value, string valueName)
82-
{
83-
var invalidPathChars = Path.GetInvalidPathChars();
84-
85-
if (string.IsNullOrEmpty(value))
86-
{
87-
return;
88-
}
89-
90-
if (value.IndexOfAny(invalidPathChars) < 0)
91-
{
92-
return;
93-
}
94-
95-
throw new Exception($"The value for '{valueName}' has illegal path characters. Provided value: {value}. Must not contain any of {string.Join(", ", invalidPathChars)}.");
96-
}
9756
}
9857
}

src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
4+
<TargetFramework>net8.0</TargetFramework>
55
<SignAssembly>true</SignAssembly>
66
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
77
<GenerateDocumentationFile>false</GenerateDocumentationFile>
8-
<LangVersion>10.0</LangVersion>
98
</PropertyGroup>
109

1110
<ItemGroup>
1211
<ProjectReference Include="..\NServiceBus.Core\NServiceBus.Core.csproj" />
1312
</ItemGroup>
1413

15-
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
16-
<Reference Include="System.Transactions" />
17-
</ItemGroup>
18-
1914
<ItemGroup>
2015
<PackageReference Include="NUnit" Version="[3.13.3, 4.0.0)" />
2116
<PackageReference Include="Particular.Packaging" Version="3.0.0" PrivateAssets="All" />

src/NServiceBus.AcceptanceTesting/Support/SimulatedException.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace NServiceBus.AcceptanceTesting
22
{
33
using System;
4-
using System.Runtime.Serialization;
54

65
/// <summary>
76
/// A dummy exception to be used in acceptance tests for easier differentiation from real exceptions.
@@ -19,9 +18,5 @@ public SimulatedException(string message) : base(message)
1918
public SimulatedException(string message, Exception innerException) : base(message, innerException)
2019
{
2120
}
22-
23-
protected SimulatedException(SerializationInfo info, StreamingContext context) : base(info, context)
24-
{
25-
}
2621
}
2722
}

src/NServiceBus.AcceptanceTests/ApprovalFiles/When_endpoint_is_warmed_up.Make_sure_things_are_in_DI.approved.txt

-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@ NServiceBus.Unicast.Subscriptions.MessageDrivenSubscriptions.ISubscriptionStorag
99
----------- Public registrations not used by Core -----------
1010
NServiceBus.CriticalError - Singleton
1111
NServiceBus.Hosting.HostInformation - Singleton
12-
NServiceBus.IHandleMessages`1[[NServiceBus.AcceptanceTests.Core.DependencyInjection.When_endpoint_is_warmed_up+SomeMessage, NServiceBus.AcceptanceTests, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null]] - Scoped
1312
NServiceBus.IMessageCreator - Singleton
1413
NServiceBus.MessageInterfaces.IMessageMapper - Singleton
15-
NServiceBus.Notifications - Singleton
1614
NServiceBus.Persistence.ISynchronizedStorageSession - Scoped
17-
NServiceBus.Pipeline.IBehavior - Transient
18-
NServiceBus.Pipeline.IBehavior`2[[NServiceBus.Pipeline.IIncomingLogicalMessageContext, NServiceBus.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c],[NServiceBus.Pipeline.IIncomingLogicalMessageContext, NServiceBus.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c]] - Transient
19-
NServiceBus.Pipeline.IBehavior`2[[NServiceBus.Pipeline.IIncomingPhysicalMessageContext, NServiceBus.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c],[NServiceBus.Pipeline.IIncomingPhysicalMessageContext, NServiceBus.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c]] - Transient
2015
NServiceBus.Pipeline.LogicalMessageFactory - Singleton
2116
NServiceBus.Settings.IReadOnlySettings - Singleton
2217
NServiceBus.Transport.ISubscriptionManager - Singleton

src/NServiceBus.AcceptanceTests/ApprovalFiles/When_pipelines_are_built.Should_preserve_order.approved.txt

+5-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@
5959
(IIncomingPhysicalMessageContext context3) => ProcessingStatisticsBehavior.Invoke(context3,
6060
(IIncomingPhysicalMessageContext context4) => MutateIncomingTransportMessageBehavior.Invoke(context4,
6161
(IIncomingPhysicalMessageContext context5) => SubscriptionReceiverBehavior.Invoke(context5,
62-
(IIncomingPhysicalMessageContext context6) => UnitOfWorkBehavior.Invoke(context6,
63-
(IIncomingPhysicalMessageContext context7) => DeserializeMessageConnector.Invoke(context7,
64-
(IIncomingLogicalMessageContext context8) => MutateIncomingMessageBehavior.Invoke(context8,
65-
(IIncomingLogicalMessageContext context9) => InferredMessageTypeEnricherBehavior.Invoke(context9,
66-
(IIncomingLogicalMessageContext context10) => LoadHandlersConnector.Invoke(context10,
67-
(IInvokeHandlerContext context11) => InvokeHandlerTerminator.Invoke(context11))
62+
(IIncomingPhysicalMessageContext context6) => DeserializeMessageConnector.Invoke(context6,
63+
(IIncomingLogicalMessageContext context7) => MutateIncomingMessageBehavior.Invoke(context7,
64+
(IIncomingLogicalMessageContext context8) => InferredMessageTypeEnricherBehavior.Invoke(context8,
65+
(IIncomingLogicalMessageContext context9) => LoadHandlersConnector.Invoke(context9,
66+
(IInvokeHandlerContext context10) => InvokeHandlerTerminator.Invoke(context10))
6867

6968
(IRecoverabilityContext context0) => CaptureRecoverabilityActionBehavior.Invoke(context0,
7069
(IRecoverabilityContext context1) => RecoverabilityRoutingConnector.Invoke(context1,

src/NServiceBus.AcceptanceTests/Core/FakeTransport/FakeTransport.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ public override Task<TransportInfrastructure> Initialize(HostSettings hostSettin
3030
return Task.FromResult<TransportInfrastructure>(infrastructure);
3131
}
3232

33-
[Obsolete("Obsolete marker to make the code compile", false)]
33+
[Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
3434
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
35-
public override string ToTransportAddress(QueueAddress address)
35+
public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
3636
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
37-
{
38-
return new LearningTransport().ToTransportAddress(address);
39-
}
4037

4138
public override IReadOnlyCollection<TransportTransactionMode> GetSupportedTransactionModes()
4239
{

src/NServiceBus.AcceptanceTests/Core/FakeTransport/ProcessingOptimizations/When_using_concurrency_limit.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,10 @@ public override Task<TransportInfrastructure> Initialize(HostSettings hostSettin
9292
return Task.FromResult<TransportInfrastructure>(new FakeTransportInfrastructure(receivers));
9393
}
9494

95-
[Obsolete("Obsolete marker to make the code compile", false)]
95+
[Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
9696
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
97-
public override string ToTransportAddress(QueueAddress address)
97+
public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
9898
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
99-
{
100-
return address.ToString();
101-
}
10299

103100
public override IReadOnlyCollection<TransportTransactionMode> GetSupportedTransactionModes()
104101
{

src/NServiceBus.AcceptanceTests/Core/Routing/When_replying_with_pre_created_interface.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ public interface IMyReply : IMessage
9292
{
9393
}
9494
}
95-
}
95+
}

src/NServiceBus.AcceptanceTests/Core/Routing/When_routing_interface_message.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,10 @@ public Endpoint()
3636

3737
public class StartMessageHandler : IHandleMessages<StartMessage>
3838
{
39-
public StartMessageHandler(IMessageCreator messageCreator)
40-
{
41-
this.messageCreator = messageCreator;
42-
}
43-
4439
public Task Handle(StartMessage message, IMessageHandlerContext context)
4540
{
46-
var interfaceMessage = messageCreator.CreateInstance<IMyMessage>();
47-
return context.Send(interfaceMessage);
41+
return context.Send<IMyMessage>(_ => { });
4842
}
49-
50-
IMessageCreator messageCreator;
5143
}
5244

5345
public class MyMessageHandler : IHandleMessages<IMyMessage>

src/NServiceBus.AcceptanceTests/Core/Routing/When_using_discriminator.cs

-56
This file was deleted.

src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started.cs

-20
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace NServiceBus.AcceptanceTests.Core.TransportSeam
22
{
3-
using System;
43
using System.Linq;
54
using System.Threading;
65
using System.Threading.Tasks;
76
using AcceptanceTesting;
87
using EndpointTemplates;
98
using Features;
10-
using NServiceBus.Configuration.AdvancedExtensibility;
119
using NServiceBus.Transport;
1210
using NUnit.Framework;
1311

@@ -25,9 +23,7 @@ public async Task Should_provide_access_to_addresses_and_address_resolution()
2523

2624
Assert.AreEqual("SomeAddress", context.ResolvedAddress);
2725
Assert.AreEqual(endpointName, context.ReceiveAddresses.MainReceiveAddress);
28-
Assert.AreEqual(context.LocalAddress, context.ReceiveAddresses.MainReceiveAddress);
2926
Assert.AreEqual(endpointName + "-MyInstance", context.ReceiveAddresses.InstanceReceiveAddress);
30-
Assert.AreEqual(context.InstanceSpecificQueue, context.ReceiveAddresses.InstanceReceiveAddress);
3127
Assert.AreEqual("MySatellite", context.ReceiveAddresses.SatelliteReceiveAddresses.Single());
3228
Assert.AreEqual(endpointName, context.LocalQueueAddress.ToString());
3329
Assert.AreEqual(endpointName + "-MyInstance", context.InstanceSpecificQueueAddress.ToString());
@@ -37,8 +33,6 @@ class Context : ScenarioContext
3733
{
3834
public string ResolvedAddress { get; set; }
3935
public ReceiveAddresses ReceiveAddresses { get; set; }
40-
public string LocalAddress { get; set; }
41-
public string InstanceSpecificQueue { get; set; }
4236
public QueueAddress LocalQueueAddress { get; set; }
4337
public QueueAddress InstanceSpecificQueueAddress { get; set; }
4438
}
@@ -49,13 +43,6 @@ public Endpoint()
4943
{
5044
EndpointSetup<DefaultServer>(c =>
5145
{
52-
#pragma warning disable IDE0079
53-
#pragma warning disable CS0618
54-
Assert.Throws<InvalidOperationException>(() => c.GetSettings().LocalAddress(), "Should throw since the endpoint isn't configured yet");
55-
Assert.Throws<InvalidOperationException>(() => c.GetSettings().InstanceSpecificQueue(), "Should throw since the endpoint isn't configured yet");
56-
#pragma warning restore CS0618
57-
#pragma warning restore IDE0079
58-
5946
c.EnableFeature<FeatureAccessingAddressing>();
6047
c.MakeInstanceUniquelyAddressable("MyInstance");
6148
});
@@ -67,13 +54,6 @@ protected override void Setup(FeatureConfigurationContext context)
6754
{
6855
var testContext = (Context)context.Settings.Get<ScenarioContext>();
6956

70-
#pragma warning disable IDE0079
71-
#pragma warning disable CS0618
72-
testContext.LocalAddress = context.Settings.LocalAddress();
73-
testContext.InstanceSpecificQueue = context.Settings.InstanceSpecificQueue();
74-
#pragma warning restore CS0618
75-
#pragma warning restore IDE0079
76-
7757
testContext.LocalQueueAddress = context.LocalQueueAddress();
7858
testContext.InstanceSpecificQueueAddress = context.InstanceSpecificQueueAddress();
7959

0 commit comments

Comments
 (0)