diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 69d3599f6c..9bd190fe0e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,9 +15,9 @@ jobs:
strategy:
matrix:
include:
- - os: windows-2019
+ - os: windows-2022
name: Windows
- - os: ubuntu-20.04
+ - os: ubuntu-22.04
name: Linux
fail-fast: false
steps:
@@ -28,9 +28,8 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3.2.0
with:
- dotnet-version: |
- 7.0.x
- 6.0.x
+ dotnet-version: 8.0.x
+ dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 36e9e0d43e..91fbb9b291 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -8,7 +8,7 @@ env:
DOTNET_NOLOGO: true
jobs:
release:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
@@ -17,7 +17,8 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3.2.0
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
+ dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
diff --git a/src/Custom.Build.props b/src/Custom.Build.props
index 3b8624d348..ee5ed47084 100644
--- a/src/Custom.Build.props
+++ b/src/Custom.Build.props
@@ -5,7 +5,7 @@
- 8.1
+ 9.0minor
diff --git a/src/NServiceBus.AcceptanceTesting/AcceptanceTestingPersistence/SubscriptionStorage/AcceptanceTestingSubscriptionPersistence.cs b/src/NServiceBus.AcceptanceTesting/AcceptanceTestingPersistence/SubscriptionStorage/AcceptanceTestingSubscriptionPersistence.cs
index 98f62167dc..1dbc0f08b7 100644
--- a/src/NServiceBus.AcceptanceTesting/AcceptanceTestingPersistence/SubscriptionStorage/AcceptanceTestingSubscriptionPersistence.cs
+++ b/src/NServiceBus.AcceptanceTesting/AcceptanceTestingPersistence/SubscriptionStorage/AcceptanceTestingSubscriptionPersistence.cs
@@ -8,9 +8,7 @@ class AcceptanceTestingSubscriptionPersistence : Feature
{
public AcceptanceTestingSubscriptionPersistence()
{
-#pragma warning disable CS0618
- DependsOn();
-#pragma warning restore CS0618
+ DependsOn("NServiceBus.Features.MessageDrivenSubscriptions");
}
protected internal override void Setup(FeatureConfigurationContext context)
diff --git a/src/NServiceBus.AcceptanceTesting/AcceptanceTestingTransport/AcceptanceTestingTransport.cs b/src/NServiceBus.AcceptanceTesting/AcceptanceTestingTransport/AcceptanceTestingTransport.cs
index 2eb6e96aa3..be27ce1957 100644
--- a/src/NServiceBus.AcceptanceTesting/AcceptanceTestingTransport/AcceptanceTestingTransport.cs
+++ b/src/NServiceBus.AcceptanceTesting/AcceptanceTestingTransport/AcceptanceTestingTransport.cs
@@ -2,7 +2,6 @@
{
using System;
using System.Collections.Generic;
- using System.IO;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
@@ -27,34 +26,10 @@ public override async Task Initialize(HostSettings host
return infrastructure;
}
- [Obsolete("Obsolete marker to make the code compile", false)]
+ [Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
- public override string ToTransportAddress(QueueAddress address)
+ public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
- {
- var baseAddress = address.BaseAddress;
- ThrowForBadPath(baseAddress, "endpoint name");
-
- var discriminator = address.Discriminator;
-
- if (!string.IsNullOrEmpty(discriminator))
- {
- ThrowForBadPath(discriminator, "endpoint discriminator");
-
- baseAddress += "-" + discriminator;
- }
-
- var qualifier = address.Qualifier;
-
- if (!string.IsNullOrEmpty(qualifier))
- {
- ThrowForBadPath(qualifier, "address qualifier");
-
- baseAddress += "-" + qualifier;
- }
-
- return baseAddress;
- }
public override IReadOnlyCollection GetSupportedTransactionModes()
{
@@ -67,6 +42,7 @@ public override IReadOnlyCollection GetSupportedTransa
}
string storageLocation;
+
public string StorageLocation
{
get => storageLocation;
@@ -77,22 +53,5 @@ public string StorageLocation
storageLocation = value;
}
}
-
- static void ThrowForBadPath(string value, string valueName)
- {
- var invalidPathChars = Path.GetInvalidPathChars();
-
- if (string.IsNullOrEmpty(value))
- {
- return;
- }
-
- if (value.IndexOfAny(invalidPathChars) < 0)
- {
- return;
- }
-
- throw new Exception($"The value for '{valueName}' has illegal path characters. Provided value: {value}. Must not contain any of {string.Join(", ", invalidPathChars)}.");
- }
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj b/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj
index 14efed28d7..fd6f2bd397 100644
--- a/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj
+++ b/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj
@@ -1,21 +1,16 @@
- net472;net6.0
+ net8.0true..\NServiceBus.snkfalse
- 10.0
-
-
-
-
diff --git a/src/NServiceBus.AcceptanceTesting/Support/SimulatedException.cs b/src/NServiceBus.AcceptanceTesting/Support/SimulatedException.cs
index 7bc3a75258..e18efdde3f 100644
--- a/src/NServiceBus.AcceptanceTesting/Support/SimulatedException.cs
+++ b/src/NServiceBus.AcceptanceTesting/Support/SimulatedException.cs
@@ -1,7 +1,6 @@
namespace NServiceBus.AcceptanceTesting
{
using System;
- using System.Runtime.Serialization;
///
/// 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)
public SimulatedException(string message, Exception innerException) : base(message, innerException)
{
}
-
- protected SimulatedException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_endpoint_is_warmed_up.Make_sure_things_are_in_DI.approved.txt b/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_endpoint_is_warmed_up.Make_sure_things_are_in_DI.approved.txt
index d4b38dfeb7..f46eb014c9 100644
--- a/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_endpoint_is_warmed_up.Make_sure_things_are_in_DI.approved.txt
+++ b/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_endpoint_is_warmed_up.Make_sure_things_are_in_DI.approved.txt
@@ -9,14 +9,9 @@ NServiceBus.Unicast.Subscriptions.MessageDrivenSubscriptions.ISubscriptionStorag
----------- Public registrations not used by Core -----------
NServiceBus.CriticalError - Singleton
NServiceBus.Hosting.HostInformation - Singleton
-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
NServiceBus.IMessageCreator - Singleton
NServiceBus.MessageInterfaces.IMessageMapper - Singleton
-NServiceBus.Notifications - Singleton
NServiceBus.Persistence.ISynchronizedStorageSession - Scoped
-NServiceBus.Pipeline.IBehavior - Transient
-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
-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
NServiceBus.Pipeline.LogicalMessageFactory - Singleton
NServiceBus.Settings.IReadOnlySettings - Singleton
NServiceBus.Transport.ISubscriptionManager - Singleton
diff --git a/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_pipelines_are_built.Should_preserve_order.approved.txt b/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_pipelines_are_built.Should_preserve_order.approved.txt
index 66cb425418..81ad9dedf9 100644
--- a/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_pipelines_are_built.Should_preserve_order.approved.txt
+++ b/src/NServiceBus.AcceptanceTests/ApprovalFiles/When_pipelines_are_built.Should_preserve_order.approved.txt
@@ -59,12 +59,11 @@
(IIncomingPhysicalMessageContext context3) => ProcessingStatisticsBehavior.Invoke(context3,
(IIncomingPhysicalMessageContext context4) => MutateIncomingTransportMessageBehavior.Invoke(context4,
(IIncomingPhysicalMessageContext context5) => SubscriptionReceiverBehavior.Invoke(context5,
- (IIncomingPhysicalMessageContext context6) => UnitOfWorkBehavior.Invoke(context6,
- (IIncomingPhysicalMessageContext context7) => DeserializeMessageConnector.Invoke(context7,
- (IIncomingLogicalMessageContext context8) => MutateIncomingMessageBehavior.Invoke(context8,
- (IIncomingLogicalMessageContext context9) => InferredMessageTypeEnricherBehavior.Invoke(context9,
- (IIncomingLogicalMessageContext context10) => LoadHandlersConnector.Invoke(context10,
- (IInvokeHandlerContext context11) => InvokeHandlerTerminator.Invoke(context11))
+ (IIncomingPhysicalMessageContext context6) => DeserializeMessageConnector.Invoke(context6,
+ (IIncomingLogicalMessageContext context7) => MutateIncomingMessageBehavior.Invoke(context7,
+ (IIncomingLogicalMessageContext context8) => InferredMessageTypeEnricherBehavior.Invoke(context8,
+ (IIncomingLogicalMessageContext context9) => LoadHandlersConnector.Invoke(context9,
+ (IInvokeHandlerContext context10) => InvokeHandlerTerminator.Invoke(context10))
(IRecoverabilityContext context0) => CaptureRecoverabilityActionBehavior.Invoke(context0,
(IRecoverabilityContext context1) => RecoverabilityRoutingConnector.Invoke(context1,
diff --git a/src/NServiceBus.AcceptanceTests/Core/FakeTransport/FakeTransport.cs b/src/NServiceBus.AcceptanceTests/Core/FakeTransport/FakeTransport.cs
index 6019a6b82d..a2cf4bad74 100644
--- a/src/NServiceBus.AcceptanceTests/Core/FakeTransport/FakeTransport.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/FakeTransport/FakeTransport.cs
@@ -30,13 +30,10 @@ public override Task Initialize(HostSettings hostSettin
return Task.FromResult(infrastructure);
}
- [Obsolete("Obsolete marker to make the code compile", false)]
+ [Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
- public override string ToTransportAddress(QueueAddress address)
+ public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
- {
- return new LearningTransport().ToTransportAddress(address);
- }
public override IReadOnlyCollection GetSupportedTransactionModes()
{
diff --git a/src/NServiceBus.AcceptanceTests/Core/FakeTransport/ProcessingOptimizations/When_using_concurrency_limit.cs b/src/NServiceBus.AcceptanceTests/Core/FakeTransport/ProcessingOptimizations/When_using_concurrency_limit.cs
index 8c678a3ce4..0acc1e4a24 100644
--- a/src/NServiceBus.AcceptanceTests/Core/FakeTransport/ProcessingOptimizations/When_using_concurrency_limit.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/FakeTransport/ProcessingOptimizations/When_using_concurrency_limit.cs
@@ -92,13 +92,10 @@ public override Task Initialize(HostSettings hostSettin
return Task.FromResult(new FakeTransportInfrastructure(receivers));
}
- [Obsolete("Obsolete marker to make the code compile", false)]
+ [Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
- public override string ToTransportAddress(QueueAddress address)
+ public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
- {
- return address.ToString();
- }
public override IReadOnlyCollection GetSupportedTransactionModes()
{
diff --git a/src/NServiceBus.AcceptanceTests/Core/Routing/When_replying_with_pre_created_interface.cs b/src/NServiceBus.AcceptanceTests/Core/Routing/When_replying_with_pre_created_interface.cs
index 6597d936af..06ef5f4442 100644
--- a/src/NServiceBus.AcceptanceTests/Core/Routing/When_replying_with_pre_created_interface.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/Routing/When_replying_with_pre_created_interface.cs
@@ -92,4 +92,4 @@ public interface IMyReply : IMessage
{
}
}
-}
+}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/Core/Routing/When_routing_interface_message.cs b/src/NServiceBus.AcceptanceTests/Core/Routing/When_routing_interface_message.cs
index c00fed2550..c979bf2ce4 100644
--- a/src/NServiceBus.AcceptanceTests/Core/Routing/When_routing_interface_message.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/Routing/When_routing_interface_message.cs
@@ -36,18 +36,10 @@ public Endpoint()
public class StartMessageHandler : IHandleMessages
{
- public StartMessageHandler(IMessageCreator messageCreator)
- {
- this.messageCreator = messageCreator;
- }
-
public Task Handle(StartMessage message, IMessageHandlerContext context)
{
- var interfaceMessage = messageCreator.CreateInstance();
- return context.Send(interfaceMessage);
+ return context.Send(_ => { });
}
-
- IMessageCreator messageCreator;
}
public class MyMessageHandler : IHandleMessages
diff --git a/src/NServiceBus.AcceptanceTests/Core/Routing/When_using_discriminator.cs b/src/NServiceBus.AcceptanceTests/Core/Routing/When_using_discriminator.cs
deleted file mode 100644
index b048d51a1e..0000000000
--- a/src/NServiceBus.AcceptanceTests/Core/Routing/When_using_discriminator.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// This test can be removed when the InstanceSpecificQueue() extension is being fully obsoleted
-#pragma warning disable IDE0079 // Remove unnecessary suppression
-#pragma warning disable CS0618
-namespace NServiceBus.AcceptanceTests.Routing
-{
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using EndpointTemplates;
- using Features;
- using NUnit.Framework;
-
- [TestFixture]
- class When_using_discriminator : NServiceBusAcceptanceTest
- {
- const string instanceDiscriminator = "instance-42";
-
- [Test]
- public async Task Should_be_able_to_read_instance_specific_queue_name_using_extension_method()
- {
- var context = await Scenario.Define()
- .WithEndpoint()
- .Done(c => c.EndpointsStarted)
- .Run();
-
- StringAssert.EndsWith(instanceDiscriminator, context.InstanceDescriminatorFromSettingsExtensions);
- }
-
- class Context : ScenarioContext
- {
- public string InstanceDescriminatorFromSettingsExtensions { get; set; }
- }
-
- class UniquelyAddressableEndpoint : EndpointConfigurationBuilder
- {
- public UniquelyAddressableEndpoint()
- {
- EndpointSetup(c => c.MakeInstanceUniquelyAddressable(instanceDiscriminator));
- }
-
- public class SpyFeature : Feature
- {
- public SpyFeature()
- {
- EnableByDefault();
- }
-
- protected override void Setup(FeatureConfigurationContext context)
- {
- context.Settings.Get().InstanceDescriminatorFromSettingsExtensions = context.Settings.InstanceSpecificQueue();
- }
- }
- }
- }
-}
-#pragma warning restore CS0618
-#pragma warning restore IDE0079 // Remove unnecessary suppression
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started.cs b/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started.cs
index ec548b5640..e6f8d2c08e 100644
--- a/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started.cs
@@ -1,13 +1,11 @@
namespace NServiceBus.AcceptanceTests.Core.TransportSeam
{
- using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using EndpointTemplates;
using Features;
- using NServiceBus.Configuration.AdvancedExtensibility;
using NServiceBus.Transport;
using NUnit.Framework;
@@ -25,9 +23,7 @@ public async Task Should_provide_access_to_addresses_and_address_resolution()
Assert.AreEqual("SomeAddress", context.ResolvedAddress);
Assert.AreEqual(endpointName, context.ReceiveAddresses.MainReceiveAddress);
- Assert.AreEqual(context.LocalAddress, context.ReceiveAddresses.MainReceiveAddress);
Assert.AreEqual(endpointName + "-MyInstance", context.ReceiveAddresses.InstanceReceiveAddress);
- Assert.AreEqual(context.InstanceSpecificQueue, context.ReceiveAddresses.InstanceReceiveAddress);
Assert.AreEqual("MySatellite", context.ReceiveAddresses.SatelliteReceiveAddresses.Single());
Assert.AreEqual(endpointName, context.LocalQueueAddress.ToString());
Assert.AreEqual(endpointName + "-MyInstance", context.InstanceSpecificQueueAddress.ToString());
@@ -37,8 +33,6 @@ class Context : ScenarioContext
{
public string ResolvedAddress { get; set; }
public ReceiveAddresses ReceiveAddresses { get; set; }
- public string LocalAddress { get; set; }
- public string InstanceSpecificQueue { get; set; }
public QueueAddress LocalQueueAddress { get; set; }
public QueueAddress InstanceSpecificQueueAddress { get; set; }
}
@@ -49,13 +43,6 @@ public Endpoint()
{
EndpointSetup(c =>
{
-#pragma warning disable IDE0079
-#pragma warning disable CS0618
- Assert.Throws(() => c.GetSettings().LocalAddress(), "Should throw since the endpoint isn't configured yet");
- Assert.Throws(() => c.GetSettings().InstanceSpecificQueue(), "Should throw since the endpoint isn't configured yet");
-#pragma warning restore CS0618
-#pragma warning restore IDE0079
-
c.EnableFeature();
c.MakeInstanceUniquelyAddressable("MyInstance");
});
@@ -67,13 +54,6 @@ protected override void Setup(FeatureConfigurationContext context)
{
var testContext = (Context)context.Settings.Get();
-#pragma warning disable IDE0079
-#pragma warning disable CS0618
- testContext.LocalAddress = context.Settings.LocalAddress();
- testContext.InstanceSpecificQueue = context.Settings.InstanceSpecificQueue();
-#pragma warning restore CS0618
-#pragma warning restore IDE0079
-
testContext.LocalQueueAddress = context.LocalQueueAddress();
testContext.InstanceSpecificQueueAddress = context.InstanceSpecificQueueAddress();
diff --git a/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started_send_only.cs b/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started_send_only.cs
index 276bc7298f..09bc410301 100644
--- a/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started_send_only.cs
+++ b/src/NServiceBus.AcceptanceTests/Core/TransportSeam/When_transport_is_started_send_only.cs
@@ -44,13 +44,6 @@ protected override void Setup(FeatureConfigurationContext context)
{
var testContext = (Context)context.Settings.Get();
-#pragma warning disable IDE0079
-#pragma warning disable CS0618
- Assert.Throws(() => context.Settings.LocalAddress(), "Should throw since the endpoint is send only");
- Assert.Throws(() => context.Settings.InstanceSpecificQueue(), "Should throw since the endpoint is send only");
-#pragma warning restore CS0618
-#pragma warning restore IDE0079
-
Assert.Throws(() => context.LocalQueueAddress(), "Should throw since the endpoint is send only");
Assert.Throws(() => context.InstanceSpecificQueueAddress(), "Should throw since the endpoint is send only");
diff --git a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_failed_message.cs b/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_failed_message.cs
deleted file mode 100644
index 7c63f93726..0000000000
--- a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_failed_message.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma warning disable CS0618
-namespace NServiceBus.AcceptanceTests.UnitOfWork
-{
- using System;
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using EndpointTemplates;
- using Microsoft.Extensions.DependencyInjection;
- using NServiceBus.UnitOfWork;
- using NUnit.Framework;
-
- public class When_using_custom_unit_of_work_with_failed_message : NServiceBusAcceptanceTest
- {
- [Test]
- public async Task Should_execute_uow_and_provide_exception_details()
- {
- var context = await Scenario.Define()
- .WithEndpoint(g =>
- {
- g.DoNotFailOnErrorMessages();
- g.When(b => b.SendLocal(new MyMessage()));
- })
- .Done(c => c.BeginCalled && c.EndCalled)
- .Run();
-
- Assert.True(context.BeginCalled, "Unit of work should have been executed");
- Assert.True(context.EndCalled, "Unit of work should have been executed");
- Assert.That(context.EndException, Is.InstanceOf().And.Message.Contain("Something went wrong"), "Exception was not provided but should have been");
- }
-
- public class Context : ScenarioContext
- {
- public bool Done { get; set; }
- public bool BeginCalled { get; set; }
- public bool EndCalled { get; set; }
- public Exception EndException { get; set; }
- }
-
- public class EndpointWithCustomUnitOfWork : EndpointConfigurationBuilder
- {
- public EndpointWithCustomUnitOfWork()
- {
- EndpointSetup((c, r) =>
- {
- c.RegisterComponents(services => services.AddSingleton());
- });
- }
-
- class CustomUnitOfWork : IManageUnitsOfWork
- {
- public CustomUnitOfWork(Context testContext)
- {
- this.testContext = testContext;
- }
-
- public Task Begin()
- {
- testContext.BeginCalled = true;
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- testContext.EndCalled = true;
- testContext.EndException = ex;
- return Task.CompletedTask;
- }
-
- Context testContext;
- }
-
- class MyMessageHandler : IHandleMessages
- {
- public Task Handle(MyMessage message, IMessageHandlerContext context)
- {
- throw new SimulatedException("Something went wrong");
- }
- }
- }
-
- public class MyMessage : IMessage
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_successful_message.cs b/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_successful_message.cs
deleted file mode 100644
index 683a682bbb..0000000000
--- a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_successful_message.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-#pragma warning disable CS0618
-namespace NServiceBus.AcceptanceTests.UnitOfWork
-{
- using System;
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using EndpointTemplates;
- using Microsoft.Extensions.DependencyInjection;
- using NServiceBus.UnitOfWork;
- using NUnit.Framework;
-
- public class When_using_custom_unit_of_work_with_successful_message : NServiceBusAcceptanceTest
- {
- [Test]
- public async Task Should_execute_uow()
- {
- var context = await Scenario.Define()
- .WithEndpoint(g => g.When(b => b.SendLocal(new MyMessage())))
- .Done(c => c.BeginCalled && c.EndCalled)
- .Run();
-
- Assert.True(context.BeginCalled, "Unit of work should have been executed");
- Assert.True(context.EndCalled, "Unit of work should have been executed");
- Assert.IsNull(context.EndException, "Exception was provided to unit of work but should not have been");
- }
-
- public class Context : ScenarioContext
- {
- public bool Done { get; set; }
- public bool BeginCalled { get; set; }
- public bool EndCalled { get; set; }
- public Exception EndException { get; set; }
- }
-
- public class EndpointWithCustomUnitOfWork : EndpointConfigurationBuilder
- {
- public EndpointWithCustomUnitOfWork()
- {
- EndpointSetup((c, r) =>
- {
- c.RegisterComponents(services => services.AddSingleton());
- });
- }
-
- class CustomUnitOfWork : IManageUnitsOfWork
- {
- public CustomUnitOfWork(Context testContext)
- {
- this.testContext = testContext;
- }
-
- public Task Begin()
- {
- testContext.BeginCalled = true;
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- testContext.EndCalled = true;
- testContext.EndException = ex;
- return Task.CompletedTask;
- }
-
- Context testContext;
- }
-
- class MyMessageHandler : IHandleMessages
- {
- public MyMessageHandler(Context testContext)
- {
- this.testContext = testContext;
- }
-
- public Task Handle(MyMessage message, IMessageHandlerContext context)
- {
- testContext.Done = true;
-
- return Task.CompletedTask;
- }
-
- Context testContext;
- }
- }
-
- public class MyMessage : IMessage
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_wrap_handlers_in_scope.cs b/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_wrap_handlers_in_scope.cs
deleted file mode 100644
index c3398dcb26..0000000000
--- a/src/NServiceBus.AcceptanceTests/Core/UnitOfWork/When_using_custom_unit_of_work_with_wrap_handlers_in_scope.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-#pragma warning disable CS0618
-namespace NServiceBus.AcceptanceTests.UnitOfWork
-{
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Transactions;
- using AcceptanceTesting;
- using EndpointTemplates;
- using Microsoft.Extensions.DependencyInjection;
- using NServiceBus.UnitOfWork;
- using NUnit.Framework;
-
- public class When_using_custom_unit_of_work_with_wrap_handlers_in_scope : NServiceBusAcceptanceTest
- {
- [Test]
- public async Task Should_fail()
- {
- var context = await Scenario.Define()
- .WithEndpoint(g =>
- {
- g.DoNotFailOnErrorMessages();
- g.When(b => b.SendLocal(new MyMessage()));
- })
- .Done(c => c.FailedMessages.Any())
- .Run();
-
- Assert.False(context.ShouldNeverBeCalled, "Unit of work should have been executed");
- }
-
- public class Context : ScenarioContext
- {
- public bool Done { get; set; }
- public bool ShouldNeverBeCalled { get; set; }
- }
-
- public class EndpointWithCustomUnitOfWork : EndpointConfigurationBuilder
- {
- public EndpointWithCustomUnitOfWork()
- {
- EndpointSetup((c, r) =>
- {
- c.UnitOfWork().WrapHandlersInATransactionScope();
-
- c.RegisterComponents(services => services.AddSingleton());
- });
- }
-
- class CustomUnitOfWork : IManageUnitsOfWork
- {
- TransactionScope transactionScope;
- public Task Begin()
- {
- // this only works because we are not using the async state machine
- transactionScope = new TransactionScope(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled);
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- transactionScope.Complete();
- return Task.CompletedTask;
- }
- }
-
- class MyMessageHandler : IHandleMessages
- {
- Context testContext;
-
- public MyMessageHandler(Context testContext)
- {
- this.testContext = testContext;
- }
-
- public Task Handle(MyMessage message, IMessageHandlerContext context)
- {
- testContext.ShouldNeverBeCalled = true;
- return Task.CompletedTask;
- }
- }
- }
-
- public class MyMessage : IMessage
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj
index c98fd74a71..886d8e051c 100644
--- a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj
+++ b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj
@@ -1,8 +1,7 @@
- net472;net6.0;net7.0
- 10.0
+ net8.0
@@ -10,13 +9,9 @@
-
-
-
-
-
+
@@ -34,4 +29,10 @@
+
+
+
+
+
+
diff --git a/src/NServiceBus.AcceptanceTests/NServiceBusAcceptanceTest.cs b/src/NServiceBus.AcceptanceTests/NServiceBusAcceptanceTest.cs
index d71f55e82c..d1c5d02501 100644
--- a/src/NServiceBus.AcceptanceTests/NServiceBusAcceptanceTest.cs
+++ b/src/NServiceBus.AcceptanceTests/NServiceBusAcceptanceTest.cs
@@ -18,11 +18,6 @@ public abstract partial class NServiceBusAcceptanceTest
[SetUp]
public void SetUp()
{
-#if NETFRAMEWORK
- // Hack: prevents SerializationException ... Type 'x' in assembly 'y' is not marked as serializable.
- // https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-deserialization-of-objects-across-app-domains
- System.Configuration.ConfigurationManager.GetSection("X");
-#endif
Conventions.EndpointNamingConvention = t =>
{
var classAndEndpoint = t.FullName.Split('.').Last();
diff --git a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_additional_deserializers.cs b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_additional_deserializers.cs
index 4e1204ca98..3ac570b15b 100644
--- a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_additional_deserializers.cs
+++ b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_additional_deserializers.cs
@@ -84,7 +84,6 @@ public Task Handle(MyRequest request, IMessageHandlerContext context)
}
}
- [Serializable]
public class MyRequest : IMessage
{
}
diff --git a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_custom_serializer.cs b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_custom_serializer.cs
index dd4abe0409..5ff97184b1 100644
--- a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_custom_serializer.cs
+++ b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_custom_serializer.cs
@@ -63,7 +63,6 @@ public Task Handle(MyRequest request, IMessageHandlerContext context)
}
}
- [Serializable]
public class MyRequest : IMessage
{
}
diff --git a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_deserializers_with_settings.cs b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_deserializers_with_settings.cs
index 5f8b4ecd9c..4098b4c229 100644
--- a/src/NServiceBus.AcceptanceTests/Serialization/When_registering_deserializers_with_settings.cs
+++ b/src/NServiceBus.AcceptanceTests/Serialization/When_registering_deserializers_with_settings.cs
@@ -76,7 +76,6 @@ public Task Handle(MyRequest request, IMessageHandlerContext context)
}
}
- [Serializable]
public class MyRequest : IMessage
{
}
diff --git a/src/NServiceBus.AcceptanceTests/Tx/When_receiving_with_dtc_enabled.cs b/src/NServiceBus.AcceptanceTests/Tx/When_receiving_with_dtc_enabled.cs
index c02c5a0d15..6c84a749f5 100644
--- a/src/NServiceBus.AcceptanceTests/Tx/When_receiving_with_dtc_enabled.cs
+++ b/src/NServiceBus.AcceptanceTests/Tx/When_receiving_with_dtc_enabled.cs
@@ -1,5 +1,7 @@
namespace NServiceBus.AcceptanceTests.Tx
{
+ using System;
+ using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Transactions;
using AcceptanceTesting;
@@ -21,19 +23,28 @@ public async Task Should_enlist_the_receive_in_the_dtc_tx()
Assert.False(context.CanEnlistPromotable, "There should exists a DTC tx");
}
-#if NETFRAMEWORK
+
[Test]
public void Basic_assumptions_promotable_should_fail_if_durable_already_exists()
{
- using (var tx = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
+
+ if (OperatingSystem.IsWindows())
{
- Transaction.Current.EnlistDurable(FakePromotableResourceManager.ResourceManagerId, new FakePromotableResourceManager(), EnlistmentOptions.None);
- Assert.False(Transaction.Current.EnlistPromotableSinglePhase(new FakePromotableResourceManager()));
+ // This test only work on Windows
+ TransactionManager.ImplicitDistributedTransactions = true;
+ using (var tx = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
+ {
+ Transaction.Current.EnlistDurable(FakePromotableResourceManager.ResourceManagerId, new FakePromotableResourceManager(), EnlistmentOptions.None);
+ Assert.False(Transaction.Current.EnlistPromotableSinglePhase(new FakePromotableResourceManager()));
- tx.Complete();
+ tx.Complete();
+ }
+ }
+ else
+ {
+ Assert.Ignore("Ignoring this test because it requires Windows");
}
}
-#endif
[Test]
public void Basic_assumptions_second_promotable_should_fail()
diff --git a/src/NServiceBus.ContainerTests/NServiceBus.ContainerTests.csproj b/src/NServiceBus.ContainerTests/NServiceBus.ContainerTests.csproj
index 013f736532..19ba103b47 100644
--- a/src/NServiceBus.ContainerTests/NServiceBus.ContainerTests.csproj
+++ b/src/NServiceBus.ContainerTests/NServiceBus.ContainerTests.csproj
@@ -1,7 +1,7 @@
- net472;net6.0;net7.0
+ net8.0true..\NServiceBusTests.snk
@@ -12,9 +12,9 @@
-
+
-
\ No newline at end of file
+
diff --git a/src/NServiceBus.ContainerTests/When_building_components.cs b/src/NServiceBus.ContainerTests/When_building_components.cs
index 3dfb314278..c63793fcc6 100644
--- a/src/NServiceBus.ContainerTests/When_building_components.cs
+++ b/src/NServiceBus.ContainerTests/When_building_components.cs
@@ -1,9 +1,7 @@
-#pragma warning disable CS0618
namespace NServiceBus.ContainerTests
{
using System;
using Microsoft.Extensions.DependencyInjection;
- using NServiceBus;
using NUnit.Framework;
public class When_building_components
@@ -19,49 +17,49 @@ public void Singleton_components_should_yield_the_same_instance()
}
[Test]
- public void Singlecall_components_should_yield_unique_instances()
+ public void Transient_components_should_yield_unique_instances()
{
var serviceCollection = new ServiceCollection();
InitializeServices(serviceCollection);
var serviceProvider = serviceCollection.BuildServiceProvider();
- Assert.AreNotEqual(serviceProvider.GetService(), serviceProvider.GetService());
+ Assert.AreNotEqual(serviceProvider.GetService(), serviceProvider.GetService());
}
[Test]
- public void UoW_components_should_yield_the_same_instance()
+ public void Scoped_components_should_yield_the_same_instance()
{
var serviceCollection = new ServiceCollection();
InitializeServices(serviceCollection);
var serviceProvider = serviceCollection.BuildServiceProvider();
- var instance1 = serviceProvider.GetService(typeof(InstancePerUoWComponent));
- var instance2 = serviceProvider.GetService(typeof(InstancePerUoWComponent));
+ var instance1 = serviceProvider.GetService(typeof(ScopedComponent));
+ var instance2 = serviceProvider.GetService(typeof(ScopedComponent));
Assert.AreSame(instance1, instance2);
}
[Test]
- public void Lambda_uow_components_should_yield_the_same_instance()
+ public void Lambda_scoped_components_should_yield_the_same_instance()
{
var serviceCollection = new ServiceCollection();
InitializeServices(serviceCollection);
var serviceProvider = serviceCollection.BuildServiceProvider();
- var instance1 = serviceProvider.GetService(typeof(LambdaComponentUoW));
- var instance2 = serviceProvider.GetService(typeof(LambdaComponentUoW));
+ var instance1 = serviceProvider.GetService(typeof(ScopedLambdaComponent));
+ var instance2 = serviceProvider.GetService(typeof(ScopedLambdaComponent));
Assert.AreSame(instance1, instance2);
}
[Test]
- public void Lambda_singlecall_components_should_yield_unique_instances()
+ public void Lambda_transient_components_should_yield_unique_instances()
{
var serviceCollection = new ServiceCollection();
InitializeServices(serviceCollection);
var serviceProvider = serviceCollection.BuildServiceProvider();
- Assert.AreNotEqual(serviceProvider.GetService(typeof(SingleCallLambdaComponent)), serviceProvider.GetService(typeof(SingleCallLambdaComponent)));
+ Assert.AreNotEqual(serviceProvider.GetService(typeof(TransientLambdaComponent)), serviceProvider.GetService(typeof(TransientLambdaComponent)));
}
[Test]
@@ -102,13 +100,13 @@ public void Resolving_recursive_types_does_not_stack_overflow()
void InitializeServices(IServiceCollection serviceCollection)
{
- serviceCollection.ConfigureComponent(typeof(SingletonComponent), DependencyLifecycle.SingleInstance);
- serviceCollection.ConfigureComponent(typeof(SinglecallComponent), DependencyLifecycle.InstancePerCall);
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
- serviceCollection.ConfigureComponent(() => new SingletonLambdaComponent(), DependencyLifecycle.SingleInstance);
- serviceCollection.ConfigureComponent(() => new SingleCallLambdaComponent(), DependencyLifecycle.InstancePerCall);
- serviceCollection.ConfigureComponent(() => new LambdaComponentUoW(), DependencyLifecycle.InstancePerUnitOfWork);
- serviceCollection.ConfigureComponent(() => new RecursiveComponent(), DependencyLifecycle.SingleInstance);
+ serviceCollection.AddSingleton(typeof(SingletonComponent));
+ serviceCollection.AddTransient(typeof(TransientComponent));
+ serviceCollection.AddScoped(typeof(ScopedComponent));
+ serviceCollection.AddSingleton(_ => new SingletonLambdaComponent());
+ serviceCollection.AddTransient(_ => new TransientLambdaComponent());
+ serviceCollection.AddScoped(_ => new ScopedLambdaComponent());
+ serviceCollection.AddSingleton(_ => new RecursiveComponent());
}
public class RecursiveComponent
@@ -129,7 +127,7 @@ public class SingletonComponentWithPropertyDependency : ISingletonComponentWithP
public SingletonComponent Dependency { get; set; }
}
- public class SinglecallComponent
+ public class TransientComponent
{
}
@@ -142,11 +140,11 @@ public class SingletonLambdaComponent
{
}
- public class LambdaComponentUoW
+ public class ScopedLambdaComponent
{
}
- public class SingleCallLambdaComponent
+ public class TransientLambdaComponent
{
}
}
@@ -182,5 +180,4 @@ public class ConstructorDependency
public class SetterDependency
{
}
-}
-#pragma warning restore CS0618
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/NServiceBus.ContainerTests/When_querying_for_registered_components.cs b/src/NServiceBus.ContainerTests/When_querying_for_registered_components.cs
index 617d2cc632..4ba8698846 100644
--- a/src/NServiceBus.ContainerTests/When_querying_for_registered_components.cs
+++ b/src/NServiceBus.ContainerTests/When_querying_for_registered_components.cs
@@ -1,8 +1,7 @@
-#pragma warning disable CS0618
namespace NServiceBus.ContainerTests
{
+ using System.Linq;
using Microsoft.Extensions.DependencyInjection;
- using NServiceBus;
using NUnit.Framework;
[TestFixture]
@@ -14,7 +13,7 @@ public void Existing_components_should_return_true()
var serviceCollection = new ServiceCollection();
InitializeBuilder(serviceCollection);
- Assert.True(serviceCollection.HasComponent(typeof(ExistingComponent)));
+ Assert.True(serviceCollection.Any(sd => sd.ServiceType == typeof(ExistingComponent)));
}
[Test]
@@ -23,7 +22,7 @@ public void Non_existing_components_should_return_false()
var serviceCollection = new ServiceCollection();
InitializeBuilder(serviceCollection);
- Assert.False(serviceCollection.HasComponent(typeof(NonExistingComponent)));
+ Assert.False(serviceCollection.Any(sd => sd.ServiceType == typeof(NonExistingComponent)));
}
[Test]
@@ -32,13 +31,13 @@ public void Builders_should_not_determine_existence_by_building_components()
var serviceCollection = new ServiceCollection();
InitializeBuilder(serviceCollection);
- Assert.True(serviceCollection.HasComponent(typeof(ExistingComponentWithUnsatisfiedDependency)));
+ Assert.True(serviceCollection.Any(sd => sd.ServiceType == typeof(ExistingComponentWithUnsatisfiedDependency)));
}
void InitializeBuilder(IServiceCollection c)
{
- c.ConfigureComponent(typeof(ExistingComponent), DependencyLifecycle.InstancePerCall);
- c.ConfigureComponent(typeof(ExistingComponentWithUnsatisfiedDependency), DependencyLifecycle.InstancePerCall);
+ c.AddTransient(typeof(ExistingComponent));
+ c.AddTransient(typeof(ExistingComponentWithUnsatisfiedDependency));
}
public class NonExistingComponent
@@ -57,5 +56,4 @@ public ExistingComponentWithUnsatisfiedDependency(NonExistingComponent dependenc
}
}
}
-}
-#pragma warning restore CS0618
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/NServiceBus.ContainerTests/When_registering_components.cs b/src/NServiceBus.ContainerTests/When_registering_components.cs
index adc67a4f3c..fec99164e5 100644
--- a/src/NServiceBus.ContainerTests/When_registering_components.cs
+++ b/src/NServiceBus.ContainerTests/When_registering_components.cs
@@ -1,4 +1,3 @@
-#pragma warning disable CS0618
namespace NServiceBus.ContainerTests
{
using System;
@@ -6,7 +5,6 @@ namespace NServiceBus.ContainerTests
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
- using NServiceBus;
using NUnit.Framework;
@@ -16,8 +14,8 @@ public class When_registering_components
public void Multiple_registrations_of_the_same_component_should_be_allowed()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(DuplicateClass), DependencyLifecycle.InstancePerCall);
- serviceCollection.ConfigureComponent(typeof(DuplicateClass), DependencyLifecycle.InstancePerCall);
+ serviceCollection.AddTransient(typeof(DuplicateClass));
+ serviceCollection.AddTransient(typeof(DuplicateClass));
var serviceProvider = serviceCollection.BuildServiceProvider();
Assert.AreEqual(2, serviceProvider.GetServices(typeof(DuplicateClass)).Count());
@@ -27,8 +25,8 @@ public void Multiple_registrations_of_the_same_component_should_be_allowed()
public void Should_support_lambdas_that_uses_other_components_registered_later()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(s => ((StaticFactory)s.GetService(typeof(StaticFactory))).Create(), DependencyLifecycle.InstancePerCall);
- serviceCollection.ConfigureComponent(() => new StaticFactory(), DependencyLifecycle.SingleInstance);
+ serviceCollection.AddTransient(s => ((StaticFactory)s.GetService(typeof(StaticFactory))).Create());
+ serviceCollection.AddSingleton(_ => new StaticFactory());
var serviceProvider = serviceCollection.BuildServiceProvider();
Assert.NotNull(serviceProvider.GetService(typeof(ComponentCreatedByFactory)));
@@ -65,7 +63,7 @@ public void Registering_the_same_singleton_for_different_interfaces_should_be_su
var singleton = new SingletonThatImplementsToInterfaces();
serviceCollection.AddSingleton(typeof(ISingleton1), singleton);
serviceCollection.AddSingleton(typeof(ISingleton2), singleton);
- serviceCollection.ConfigureComponent(typeof(ComponentThatDependsOnMultiSingletons), DependencyLifecycle.InstancePerCall);
+ serviceCollection.AddTransient(typeof(ComponentThatDependsOnMultiSingletons));
var serviceProvider = serviceCollection.BuildServiceProvider();
var dependency = (ComponentThatDependsOnMultiSingletons)serviceProvider.GetService(typeof(ComponentThatDependsOnMultiSingletons));
@@ -77,62 +75,6 @@ public void Registering_the_same_singleton_for_different_interfaces_should_be_su
Assert.AreEqual(serviceProvider.GetService(typeof(ISingleton2)), singleton);
}
- [Test]
- public void Concrete_classes_should_get_the_same_lifecycle_as_their_interfaces()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(SingletonComponent), DependencyLifecycle.SingleInstance);
-
- var serviceProvider = serviceCollection.BuildServiceProvider();
- Assert.AreSame(serviceProvider.GetService(typeof(SingletonComponent)), serviceProvider.GetService(typeof(ISingletonComponent)));
- }
-
- [Test]
- public void All_implemented_interfaces_should_be_registered()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(ComponentWithMultipleInterfaces),
- DependencyLifecycle.InstancePerCall);
- Assert.True(serviceCollection.HasComponent(typeof(ISomeInterface)));
- Assert.True(serviceCollection.HasComponent(typeof(ISomeOtherInterface)));
- Assert.True(serviceCollection.HasComponent(typeof(IYetAnotherInterface)));
-
- var serviceProvider = serviceCollection.BuildServiceProvider();
- Assert.AreEqual(1, serviceProvider.GetServices(typeof(IYetAnotherInterface)).Count());
- }
-
- [Test]
- public void All_implemented_interfaces_should_be_registered_for_func()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(() => new ComponentWithMultipleInterfaces(), DependencyLifecycle.InstancePerCall);
- Assert.True(serviceCollection.HasComponent(typeof(ISomeInterface)));
- Assert.True(serviceCollection.HasComponent(typeof(ISomeOtherInterface)));
- Assert.True(serviceCollection.HasComponent(typeof(IYetAnotherInterface)));
-
- var serviceProvider = serviceCollection.BuildServiceProvider();
-
- Assert.AreEqual(1, serviceProvider.GetServices(typeof(IYetAnotherInterface)).Count());
- }
-
- [Test]
- public void Multiple_implementations_should_be_supported()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(SomeClass), DependencyLifecycle.InstancePerUnitOfWork);
- serviceCollection.ConfigureComponent(typeof(SomeOtherClass), DependencyLifecycle.InstancePerUnitOfWork);
-
- var serviceProvider = serviceCollection.BuildServiceProvider();
- Assert.NotNull(serviceProvider.GetService(typeof(SomeClass)));
- Assert.AreEqual(2, serviceProvider.GetServices(typeof(ISomeInterface)).Count());
-
- using (var scope = serviceProvider.CreateScope())
- {
- Assert.NotNull(scope.ServiceProvider.GetService(typeof(SomeClass)));
- Assert.AreEqual(2, scope.ServiceProvider.GetServices(typeof(ISomeInterface)).Count());
- }
- }
-
[Test]
public void Given_lookupType_should_be_used_as_service_in_the_registration_when_RegisterSingleton()
{
@@ -148,28 +90,6 @@ public void Given_lookupType_should_be_used_as_service_in_the_registration_when_
Assert.AreEqual(expected, scope.ServiceProvider.GetService(typeof(SomeClass)));
}
}
-
- [Test]
- public void Generic_interfaces_should_be_registered()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(ComponentWithGenericInterface),
- DependencyLifecycle.InstancePerCall);
-
- Assert.True(serviceCollection.HasComponent(typeof(ISomeGenericInterface)));
- }
-
- [Test]
- [Ignore("Not sure that we should enforce this")]
- public void System_interfaces_should_not_be_auto_registered()
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(ComponentWithSystemInterface),
- DependencyLifecycle.InstancePerCall);
-
- Assert.False(serviceCollection.HasComponent(typeof(IGrouping)));
- Assert.False(serviceCollection.HasComponent(typeof(IDisposable)));
- }
}
@@ -269,5 +189,4 @@ public enum SomeEnum
{
X
}
-}
-#pragma warning restore CS0618
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/NServiceBus.ContainerTests/When_using_nested_containers.cs b/src/NServiceBus.ContainerTests/When_using_nested_containers.cs
index 2886382099..10c65fdc44 100644
--- a/src/NServiceBus.ContainerTests/When_using_nested_containers.cs
+++ b/src/NServiceBus.ContainerTests/When_using_nested_containers.cs
@@ -1,4 +1,3 @@
-#pragma warning disable CS0618
namespace NServiceBus.ContainerTests
{
using System;
@@ -8,108 +7,108 @@ namespace NServiceBus.ContainerTests
public class When_using_nested_containers
{
[Test]
- public void Instance_per_uow__components_should_be_disposed_when_the_child_container_is_disposed()
+ public void Scoped__components_should_be_disposed_when_the_child_container_is_disposed()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ScopedComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
using (var scope = serviceProvider.CreateScope())
{
- scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
+ scope.ServiceProvider.GetService(typeof(ScopedComponent));
}
- Assert.True(InstancePerUoWComponent.DisposeCalled);
+ Assert.True(ScopedComponent.DisposeCalled);
}
[Test]
- public void Instance_per_uow_components_should_yield_different_instances_between_parent_and_child_containers()
+ public void Scoped_components_should_yield_different_instances_between_parent_and_child_containers()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ScopedComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
- var parentInstance = serviceProvider.GetService(typeof(InstancePerUoWComponent));
+ var parentInstance = serviceProvider.GetService(typeof(ScopedComponent));
using (var scope = serviceProvider.CreateScope())
{
- var childInstance = scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
+ var childInstance = scope.ServiceProvider.GetService(typeof(ScopedComponent));
Assert.AreNotSame(parentInstance, childInstance);
}
}
[Test]
- public void Instance_per_uow_components_should_yield_different_instances_between_different_instances_of_child_containers()
+ public void Scoped_components_should_yield_different_instances_between_different_instances_of_child_containers()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ScopedComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
object instance1;
using (var scope = serviceProvider.CreateScope())
{
- instance1 = scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
+ instance1 = scope.ServiceProvider.GetService(typeof(ScopedComponent));
}
object instance2;
using (var scope = serviceProvider.CreateScope())
{
- instance2 = scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
+ instance2 = scope.ServiceProvider.GetService(typeof(ScopedComponent));
}
Assert.AreNotSame(instance1, instance2);
}
[Test]
- public void Instance_per_call_components_should_not_be_shared_across_child_containers()
+ public void Transient_components_should_not_be_shared_across_child_containers()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerCallComponent), DependencyLifecycle.InstancePerCall);
+ serviceCollection.AddTransient(typeof(TransientComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
object instance1;
using (var scope = serviceProvider.CreateScope())
{
- instance1 = scope.ServiceProvider.GetService(typeof(InstancePerCallComponent));
+ instance1 = scope.ServiceProvider.GetService(typeof(TransientComponent));
}
object instance2;
using (var scope = serviceProvider.CreateScope())
{
- instance2 = scope.ServiceProvider.GetService(typeof(InstancePerCallComponent));
+ instance2 = scope.ServiceProvider.GetService(typeof(TransientComponent));
}
Assert.AreNotSame(instance1, instance2);
}
[Test]
- public void UoW_components_in_the_parent_container_should_be_singletons_in_the_same_child_container()
+ public void Scoped_components_in_the_parent_container_should_be_singletons_in_the_same_child_container()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ScopedComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
using (var scope = serviceProvider.CreateScope())
{
- var instance1 = scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
- var instance2 = scope.ServiceProvider.GetService(typeof(InstancePerUoWComponent));
+ var instance1 = scope.ServiceProvider.GetService(typeof(ScopedComponent));
+ var instance2 = scope.ServiceProvider.GetService(typeof(ScopedComponent));
Assert.AreSame(instance1, instance2, "UoW's should be singleton in child container");
}
}
[Test]
- public void UoW_components_built_on_root_container_should_be_singletons_even_with_child_builder_present()
+ public void Scoped_components_built_on_root_container_should_be_singletons_even_with_child_builder_present()
{
var serviceCollection = new ServiceCollection();
- serviceCollection.ConfigureComponent(typeof(InstancePerUoWComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ScopedComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
using (serviceProvider.CreateScope())
{
}
- var instance1 = serviceProvider.GetService(typeof(InstancePerUoWComponent));
- var instance2 = serviceProvider.GetService(typeof(InstancePerUoWComponent));
+ var instance1 = serviceProvider.GetService(typeof(ScopedComponent));
+ var instance2 = serviceProvider.GetService(typeof(ScopedComponent));
Assert.AreSame(instance1, instance2, "UoW's should be singletons in the root container");
}
@@ -119,7 +118,7 @@ public void Should_not_dispose_singletons_when_container_goes_out_of_scope()
var serviceCollection = new ServiceCollection();
var singletonInMainContainer = new SingletonComponent();
serviceCollection.AddSingleton(typeof(ISingletonComponent), singletonInMainContainer);
- serviceCollection.ConfigureComponent(typeof(ComponentThatDependsOfSingleton), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(ComponentThatDependsOfSingleton));
var serviceProvider = serviceCollection.BuildServiceProvider();
using (var scope = serviceProvider.CreateScope())
@@ -130,13 +129,13 @@ public void Should_not_dispose_singletons_when_container_goes_out_of_scope()
}
[Test]
- public void Should_dispose_all_non_percall_IDisposable_components_in_child_container()
+ public void Should_dispose_all_non_singleton_IDisposable_components_in_child_container()
{
var serviceCollection = new ServiceCollection();
DisposableComponent.DisposeCalled = false;
AnotherDisposableComponent.DisposeCalled = false;
serviceCollection.AddSingleton(typeof(AnotherDisposableComponent), new AnotherDisposableComponent());
- serviceCollection.ConfigureComponent(typeof(DisposableComponent), DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(typeof(DisposableComponent));
var serviceProvider = serviceCollection.BuildServiceProvider();
@@ -175,14 +174,14 @@ class ComponentThatDependsOfSingleton
}
}
- public class InstancePerCallComponent : IDisposable
+ public class TransientComponent : IDisposable
{
public void Dispose()
{
}
}
- public class InstancePerUoWComponent : IDisposable
+ public class ScopedComponent : IDisposable
{
public void Dispose()
{
@@ -223,5 +222,4 @@ public void Dispose()
DisposeCalled = true;
}
}
-}
-#pragma warning restore CS0618
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/NServiceBus.Core.Analyzer.Tests.Common/ForwardCancellationToken/ForwardCancellationTokenTests.cs b/src/NServiceBus.Core.Analyzer.Tests.Common/ForwardCancellationToken/ForwardCancellationTokenTests.cs
index 886b18715d..ddaf3bf669 100644
--- a/src/NServiceBus.Core.Analyzer.Tests.Common/ForwardCancellationToken/ForwardCancellationTokenTests.cs
+++ b/src/NServiceBus.Core.Analyzer.Tests.Common/ForwardCancellationToken/ForwardCancellationTokenTests.cs
@@ -512,8 +512,6 @@ Task Test(string s, int i, DateTime d, CancellationToken token = default)
public class TestMessage : ICommand {}
");
-#if NET // IAsyncEnumerable requires package Microsoft.Bcl.AsyncInterfaces on .NET Framework
-
[TestCase("AsyncEnumerator(context.CancellationToken)")]
[TestCase("AsyncEnumerator(CancellationToken.None)")]
[TestCase("AsyncEnumerator(default(CancellationToken))")]
@@ -551,7 +549,6 @@ static async IAsyncEnumerable AsyncEnumerator([EnumeratorCancellation] Canc
}
public class TestMessage : ICommand {}
");
-#endif
}
public class ForwardCancellationTokenTestsCSharp9 : ForwardCancellationTokenTestsCSharp8
diff --git a/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs b/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs
index b98dffcce2..9a2aefb604 100644
--- a/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs
+++ b/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs
@@ -108,11 +108,9 @@ static AnalyzerTestFixture()
MetadataReference.CreateFromFile(typeof(object).GetTypeInfo().Assembly.Location),
MetadataReference.CreateFromFile(typeof(Enumerable).GetTypeInfo().Assembly.Location),
MetadataReference.CreateFromFile(typeof(System.Linq.Expressions.Expression).GetTypeInfo().Assembly.Location),
-#if NET
MetadataReference.CreateFromFile(Assembly.Load("System.Runtime").Location),
MetadataReference.CreateFromFile(Assembly.Load("System.Console").Location),
MetadataReference.CreateFromFile(Assembly.Load("System.Private.CoreLib").Location),
-#endif
MetadataReference.CreateFromFile(typeof(EndpointConfiguration).GetTypeInfo().Assembly.Location),
MetadataReference.CreateFromFile(typeof(IUniformSession).GetTypeInfo().Assembly.Location));
}
diff --git a/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/.editorconfig b/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/.editorconfig
deleted file mode 100644
index e8504d15cf..0000000000
--- a/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/.editorconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-[*.cs]
-
-# Justification: Test project
-dotnet_diagnostic.CA2007.severity = none
-
-# Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken
-dotnet_diagnostic.NSB0002.severity = suggestion
-
-# Justification: Tests don't support cancellation
-dotnet_diagnostic.PS0018.severity = suggestion
-
-# bug in analyzer when multi-targetting
-dotnet_diagnostic.IDE0063.severity = none # Use simple 'using' statement
diff --git a/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/NServiceBus.Core.Analyzer.Tests.Roslyn3.csproj b/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/NServiceBus.Core.Analyzer.Tests.Roslyn3.csproj
deleted file mode 100644
index 5cb8407ecb..0000000000
--- a/src/NServiceBus.Core.Analyzer.Tests.Roslyn3/NServiceBus.Core.Analyzer.Tests.Roslyn3.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- net472;net6.0;net7.0
- $(DefineConstants);ROSLYN3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/NServiceBus.Core.Analyzer.Tests.Roslyn4/NServiceBus.Core.Analyzer.Tests.Roslyn4.csproj b/src/NServiceBus.Core.Analyzer.Tests.Roslyn4/NServiceBus.Core.Analyzer.Tests.Roslyn4.csproj
index 8ab8fa05f1..2d931b5c74 100644
--- a/src/NServiceBus.Core.Analyzer.Tests.Roslyn4/NServiceBus.Core.Analyzer.Tests.Roslyn4.csproj
+++ b/src/NServiceBus.Core.Analyzer.Tests.Roslyn4/NServiceBus.Core.Analyzer.Tests.Roslyn4.csproj
@@ -1,7 +1,7 @@
- net472;net6.0;net7.0
+ net8.0$(DefineConstants);ROSLYN4
@@ -11,12 +11,12 @@
-
+
-
+
diff --git a/src/NServiceBus.Core.Analyzer/AwaitOrCaptureTasksAnalyzer.cs b/src/NServiceBus.Core.Analyzer/AwaitOrCaptureTasksAnalyzer.cs
index 0c07459bdd..8cd2b0b208 100644
--- a/src/NServiceBus.Core.Analyzer/AwaitOrCaptureTasksAnalyzer.cs
+++ b/src/NServiceBus.Core.Analyzer/AwaitOrCaptureTasksAnalyzer.cs
@@ -51,7 +51,7 @@ static void Analyze(SyntaxNodeAnalysisContext context)
}
static bool CouldBeMethodRequiringAwait(SyntaxToken syntaxToken) =>
- syntaxToken.Kind() == SyntaxKind.IdentifierToken && methodNames.Contains(syntaxToken.Text);
+ syntaxToken.IsKind(SyntaxKind.IdentifierToken) && methodNames.Contains(syntaxToken.Text);
static bool IsMethodRequiringAwait(ExpressionSyntax call, SyntaxNodeAnalysisContext context) =>
context.SemanticModel.GetSymbolInfo(call, context.CancellationToken).Symbol is IMethodSymbol methodSymbol &&
diff --git a/src/NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.csproj b/src/NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.csproj
index d5c045afe2..3ed71f9321 100644
--- a/src/NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.csproj
+++ b/src/NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.csproj
@@ -6,12 +6,13 @@
..\NServiceBus.snkfalsefalse
+ true
-
+
diff --git a/src/NServiceBus.Core.Analyzer/Sagas/RewriteConfigureHowToFindSagaFixer.cs b/src/NServiceBus.Core.Analyzer/Sagas/RewriteConfigureHowToFindSagaFixer.cs
index dc1da0c1b0..879fe78959 100644
--- a/src/NServiceBus.Core.Analyzer/Sagas/RewriteConfigureHowToFindSagaFixer.cs
+++ b/src/NServiceBus.Core.Analyzer/Sagas/RewriteConfigureHowToFindSagaFixer.cs
@@ -26,7 +26,7 @@ public class RewriteConfigureHowToFindSagaFixer : CodeFixProvider
public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
- static readonly string NewLine = System.Environment.NewLine;
+ static readonly string NewLine = "\r\n"; //System.Environment.NewLine;
public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
diff --git a/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs b/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs
index d3b0755388..d1e26cda57 100644
--- a/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs
+++ b/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs
@@ -1,5 +1,4 @@
-#if NET6_0_OR_GREATER
-namespace NServiceBus.Core.Tests.API
+namespace NServiceBus.Core.Tests.API
{
using System;
using System.Collections.Generic;
@@ -10,13 +9,10 @@ namespace NServiceBus.Core.Tests.API
using NUnit.Framework;
using Particular.Approvals;
-
-
[TestFixture]
public class NullableAnnotations
{
- // Only available with net6.0+, implementation for net472 not worth it
- NullabilityInfoContext nullContext = new NullabilityInfoContext();
+ readonly NullabilityInfoContext nullContext = new();
[Test]
public void ApproveNullableTypes()
@@ -100,4 +96,3 @@ bool HasNonAnnotatedMember(Type type)
}
}
}
-#endif
\ No newline at end of file
diff --git a/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt b/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
index 12bd14ee08..4a6cd6e26d 100644
--- a/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
+++ b/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt
@@ -49,25 +49,12 @@ namespace NServiceBus
public static void DoNotEnforceBestPractices(this NServiceBus.Pipeline.IUnsubscribeContext context) { }
public static bool IgnoredBestPractices(this NServiceBus.Extensibility.ExtendableOptions options) { }
}
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. Will be removed " +
- "in version 9.0.0.", true)]
- public static class ConfigurationTimeoutExtensions
- {
- [System.Obsolete("The timeout manager has been removed. See the upgrade guide for more details. The" +
- " member currently throws a NotImplementedException. Will be removed in version 9" +
- ".0.0.", true)]
- public static void TimeToWaitBeforeTriggeringCriticalErrorOnTimeoutOutages(this NServiceBus.EndpointConfiguration config, System.TimeSpan timeToWait) { }
- }
public static class ConfigureAudit
{
public static void AuditProcessedMessagesTo(this NServiceBus.EndpointConfiguration config, string auditQueue, System.TimeSpan? timeToBeReceived = default) { }
}
public static class ConfigureCriticalErrorAction
{
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void DefineCriticalErrorAction(this NServiceBus.EndpointConfiguration endpointConfiguration, System.Func onCriticalError) { }
public static void DefineCriticalErrorAction(this NServiceBus.EndpointConfiguration endpointConfiguration, System.Func onCriticalError) { }
}
public static class ConfigureError
@@ -78,12 +65,6 @@ namespace NServiceBus
{
public static NServiceBus.DataBus.DataBusExtensions BasePath(this NServiceBus.DataBus.DataBusExtensions config, string basePath) { }
}
- [System.Obsolete("Will be removed in version 9.0.0.", true)]
- public static class ConfigureForwarding
- {
- [System.Obsolete(@"Message forwarding is no longer supported natively by NServiceBus. For auditing messages, use endpointConfiguration.AuditProcessedMessagesTo(address). If true message forwarding capabilities are needed, use a custom pipeline behavior, an example of which can be found in the documentation. The member currently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void ForwardReceivedMessagesTo(this NServiceBus.EndpointConfiguration config, string address) { }
- }
public static class ConfigureLicenseExtensions
{
public static void License(this NServiceBus.EndpointConfiguration config, string licenseText) { }
@@ -93,31 +74,14 @@ namespace NServiceBus
{
public static void PurgeOnStartup(this NServiceBus.EndpointConfiguration config, bool value) { }
}
- [System.Obsolete("Transport infrastructure setup control is not based on the installer configuratio" +
- "n. Will be removed in version 9.0.0.", true)]
- public static class ConfigureQueueCreation
- {
- [System.Obsolete("Transport infrastructure setup control is not based on the installer configuratio" +
- "n. The member currently throws a NotImplementedException. Will be removed in ver" +
- "sion 9.0.0.", true)]
- public static bool CreateQueues(this NServiceBus.Settings.ReadOnlySettings settings) { }
- [System.Obsolete("Transport infrastructure setup control is not based on the installer configuratio" +
- "n. The member currently throws a NotImplementedException. Will be removed in ver" +
- "sion 9.0.0.", true)]
- public static void DoNotCreateQueues(this NServiceBus.EndpointConfiguration config) { }
- }
public static class ConnectorContextExtensions
{
- [System.Obsolete(@"Use `CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, TimeSpan? timeToBeReceived, IIncomingPhysicalMessageContext sourceContext)` instead. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use `CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, TimeSpan? timeToBeReceived, IIncomingPhysicalMessageContext sourceContext)` instead. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static NServiceBus.Pipeline.IAuditContext CreateAuditContext(this NServiceBus.Pipeline.ForkConnector forkConnector, NServiceBus.Transport.OutgoingMessage message, string auditAddress, NServiceBus.Pipeline.IIncomingPhysicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IAuditContext CreateAuditContext(this NServiceBus.Pipeline.ForkConnector forkConnector, NServiceBus.Transport.OutgoingMessage message, string auditAddress, System.TimeSpan? timeToBeReceived, NServiceBus.Pipeline.IIncomingPhysicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IBatchDispatchContext CreateBatchDispatchContext(this NServiceBus.Pipeline.StageForkConnector stageForkConnector, System.Collections.Generic.IReadOnlyCollection transportOperations, NServiceBus.Pipeline.IIncomingPhysicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IDispatchContext CreateDispatchContext(this NServiceBus.Pipeline.StageConnector stageConnector, System.Collections.Generic.IReadOnlyCollection transportOperations, NServiceBus.Pipeline.IBatchDispatchContext sourceContext) { }
public static NServiceBus.Pipeline.IDispatchContext CreateDispatchContext(this NServiceBus.Pipeline.StageConnector stageConnector, System.Collections.Generic.IReadOnlyCollection transportOperations, NServiceBus.Pipeline.IRoutingContext sourceContext) { }
- [System.Obsolete("Message forwarding is no longer supported, but can be implemented as a custom pip" +
- "eline behavior. The member currently throws a NotImplementedException. Will be r" +
- "emoved in version 9.0.0.", true)]
- public static NServiceBus.Pipeline.IForwardingContext CreateForwardingContext(this NServiceBus.Pipeline.ForkConnector forwardingContext, NServiceBus.Transport.OutgoingMessage message, string forwardingAddress, NServiceBus.Pipeline.IIncomingPhysicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IIncomingLogicalMessageContext CreateIncomingLogicalMessageContext(this NServiceBus.Pipeline.StageConnector stageConnector, NServiceBus.Pipeline.LogicalMessage logicalMessage, NServiceBus.Pipeline.IIncomingPhysicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IIncomingPhysicalMessageContext CreateIncomingPhysicalMessageContext(this NServiceBus.Pipeline.StageConnector stageConnector, NServiceBus.Transport.IncomingMessage incomingMessage, NServiceBus.Pipeline.ITransportReceiveContext sourceContext) { }
public static NServiceBus.Pipeline.IIncomingPhysicalMessageContext CreateIncomingPhysicalMessageContext(this NServiceBus.Pipeline.StageForkConnector stageForkConnector, NServiceBus.Transport.IncomingMessage incomingMessage, NServiceBus.Pipeline.ITransportReceiveContext sourceContext) { }
@@ -128,7 +92,6 @@ namespace NServiceBus
public static NServiceBus.Pipeline.IOutgoingPhysicalMessageContext CreateOutgoingPhysicalMessageContext(this NServiceBus.Pipeline.StageConnector stageConnector, System.ReadOnlyMemory messageBody, System.Collections.Generic.IReadOnlyCollection routingStrategies, NServiceBus.Pipeline.IOutgoingLogicalMessageContext sourceContext) { }
public static NServiceBus.Pipeline.IRoutingContext CreateRoutingContext(this NServiceBus.Pipeline.ForkConnector forkConnector, NServiceBus.Transport.OutgoingMessage outgoingMessage, string localAddress, NServiceBus.Pipeline.ITransportReceiveContext sourceContext) { }
public static NServiceBus.Pipeline.IRoutingContext CreateRoutingContext(this NServiceBus.Pipeline.StageConnector stageConnector, NServiceBus.Transport.OutgoingMessage outgoingMessage, NServiceBus.Routing.RoutingStrategy routingStrategy, NServiceBus.Pipeline.IAuditContext sourceContext) { }
- public static NServiceBus.Pipeline.IRoutingContext CreateRoutingContext(this NServiceBus.Pipeline.StageConnector stageConnector, NServiceBus.Transport.OutgoingMessage outgoingMessage, NServiceBus.Routing.RoutingStrategy routingStrategy, NServiceBus.Pipeline.IForwardingContext sourceContext) { }
public static NServiceBus.Pipeline.IRoutingContext CreateRoutingContext(this NServiceBus.Pipeline.StageConnector stageConnector, NServiceBus.Transport.OutgoingMessage outgoingMessage, System.Collections.Generic.IReadOnlyCollection routingStrategies, NServiceBus.Pipeline.IOutgoingPhysicalMessageContext sourceContext) { }
}
public abstract class ContainSagaData : NServiceBus.IContainSagaData
@@ -186,24 +149,17 @@ namespace NServiceBus
}
public class CriticalError
{
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public CriticalError(System.Func onCriticalErrorAction) { }
public CriticalError(System.Func onCriticalErrorAction) { }
public virtual void Raise(string errorMessage, System.Exception exception, System.Threading.CancellationToken cancellationToken = default) { }
}
public class CriticalErrorContext : NServiceBus.ICriticalErrorContext
{
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public CriticalErrorContext(System.Func stop, string error, System.Exception exception) { }
public CriticalErrorContext(System.Func stop, string error, System.Exception exception) { }
public string Error { get; }
public System.Exception Exception { get; }
public System.Func Stop { get; }
}
- [System.Serializable]
- public class DataBusProperty : NServiceBus.IDataBusProperty, System.Runtime.Serialization.ISerializable
+ public class DataBusProperty : NServiceBus.IDataBusProperty
where T : class
{
public DataBusProperty() { }
@@ -217,22 +173,6 @@ namespace NServiceBus
public object GetValue() { }
public void SetValue(object valueToSet) { }
}
- [System.Obsolete("Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for " +
- "more details. Use `NServiceBus.DateTimeOffsetExtensions` instead. Will be remove" +
- "d in version 9.0.0.", true)]
- public static class DateTimeExtensions
- {
- [System.Obsolete("Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for " +
- "more details. Use `NServiceBus.DateTimeOffsetHelper.ToDateTimeOffset` instead. T" +
- "he member currently throws a NotImplementedException. Will be removed in version" +
- " 9.0.0.", true)]
- public static System.DateTime ToUtcDateTime(string wireFormattedString) { }
- [System.Obsolete("Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for " +
- "more details. Use `NServiceBus.DateTimeOffsetHelper.ToWireFormattedString` inste" +
- "ad. The member currently throws a NotImplementedException. Will be removed in ve" +
- "rsion 9.0.0.", true)]
- public static string ToWireFormattedString(System.DateTime dateTime) { }
- }
public static class DateTimeOffsetHelper
{
public static System.DateTimeOffset ToDateTimeOffset(string wireFormattedString) { }
@@ -258,9 +198,6 @@ namespace NServiceBus
public class DelayedRetriesSettings : NServiceBus.Configuration.AdvancedExtensibility.ExposeSettings
{
public NServiceBus.DelayedRetriesSettings NumberOfRetries(int numberOfRetries) { }
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.DelayedRetriesSettings OnMessageBeingRetried(System.Func notificationCallback) { }
public NServiceBus.DelayedRetriesSettings OnMessageBeingRetried(System.Func notificationCallback) { }
public NServiceBus.DelayedRetriesSettings TimeIncrease(System.TimeSpan timeIncrease) { }
}
@@ -280,9 +217,6 @@ namespace NServiceBus
public static class DiagnosticSettingsExtensions
{
public static void AddStartupDiagnosticsSection(this NServiceBus.Settings.IReadOnlySettings settings, string sectionName, object section) { }
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void CustomDiagnosticsWriter(this NServiceBus.EndpointConfiguration config, System.Func customDiagnosticsWriter) { }
public static void CustomDiagnosticsWriter(this NServiceBus.EndpointConfiguration config, System.Func customDiagnosticsWriter) { }
public static void SetDiagnosticsPath(this NServiceBus.EndpointConfiguration config, string path) { }
}
@@ -303,32 +237,6 @@ namespace NServiceBus
Send = 0,
Publish = 1,
}
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public static class DurableMessagesConfig
- {
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. The member currently throws a NotImple" +
- "mentedException. Will be removed in version 9.0.0.", true)]
- public static void DisableDurableMessages(this NServiceBus.EndpointConfiguration config) { }
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. The member currently throws a NotImple" +
- "mentedException. Will be removed in version 9.0.0.", true)]
- public static bool DurableMessagesEnabled(this NServiceBus.Settings.ReadOnlySettings settings) { }
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. The member currently throws a NotImple" +
- "mentedException. Will be removed in version 9.0.0.", true)]
- public static void EnableDurableMessages(this NServiceBus.EndpointConfiguration config) { }
- }
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public static class DurableMessagesConventionExtensions
- {
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. The member currently throws a NotImple" +
- "mentedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.ConventionsBuilder DefiningExpressMessagesAs(this NServiceBus.ConventionsBuilder builder, System.Func definesExpressMessageType) { }
- }
public static class Endpoint
{
public static System.Threading.Tasks.Task Create(NServiceBus.EndpointConfiguration configuration, System.Threading.CancellationToken cancellationToken = default) { }
@@ -337,24 +245,13 @@ namespace NServiceBus
public class EndpointConfiguration : NServiceBus.Configuration.AdvancedExtensibility.ExposeSettings
{
public EndpointConfiguration(string endpointName) { }
+ [System.Obsolete("Error notification events have been replaced with a Task-based API available on t" +
+ "he recoverability settings. Will be removed in version 10.0.0.", true)]
public NServiceBus.Notifications Notifications { get; }
public NServiceBus.Pipeline.PipelineSettings Pipeline { get; }
public NServiceBus.ConventionsBuilder Conventions() { }
public void RegisterComponents(System.Action registration) { }
public void SendOnly() { }
- [System.Obsolete("Use the externally managed container mode to integrate with third party dependenc" +
- "y injection containers. The member currently throws a NotImplementedException. W" +
- "ill be removed in version 9.0.0.", true)]
- public void UseContainer(NServiceBus.ObjectBuilder.Common.IContainer builder) { }
- [System.Obsolete("Use the externally managed container mode to integrate with third party dependenc" +
- "y injection containers. The member currently throws a NotImplementedException. W" +
- "ill be removed in version 9.0.0.", true)]
- public void UseContainer(System.Type definitionType) { }
- [System.Obsolete("Use the externally managed container mode to integrate with third party dependenc" +
- "y injection containers. The member currently throws a NotImplementedException. W" +
- "ill be removed in version 9.0.0.", true)]
- public void UseContainer(System.Action customizations = null)
- where T : NServiceBus.Container.ContainerDefinition, new () { }
public NServiceBus.RoutingSettings UseTransport(TTransport transportDefinition)
where TTransport : NServiceBus.Transport.TransportDefinition { }
}
@@ -381,13 +278,6 @@ namespace NServiceBus
public static string ErrorQueueAddress(this NServiceBus.Settings.IReadOnlySettings settings) { }
public static bool TryGetExplicitlyConfiguredErrorQueueAddress(this NServiceBus.Settings.IReadOnlySettings settings, out string errorQueue) { }
}
- [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.All)]
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public sealed class ExpressAttribute : System.Attribute
- {
- public ExpressAttribute() { }
- }
public class FailedConfig
{
public FailedConfig(string errorQueue, System.Collections.Generic.HashSet unrecoverableExceptionTypes) { }
@@ -420,8 +310,6 @@ namespace NServiceBus
public const string DiagnosticsTraceState = "tracestate";
public const string EnclosedMessageTypes = "NServiceBus.EnclosedMessageTypes";
public const string HasLicenseExpired = "$.diagnostics.license.expired";
- [System.Obsolete("Not intended for public usage. Will be removed in version 9.0.0.", true)]
- public const string HeaderName = "Header";
public const string HostDisplayName = "$.diagnostics.hostdisplayname";
public const string HostId = "$.diagnostics.hostid";
public const string HttpFrom = "NServiceBus.From";
@@ -432,8 +320,6 @@ namespace NServiceBus
public const string MessageId = "NServiceBus.MessageId";
public const string MessageIntent = "NServiceBus.MessageIntent";
public const string NServiceBusVersion = "NServiceBus.Version";
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
public const string NonDurableMessage = "NServiceBus.NonDurableMessage";
public const string OriginatingAddress = "NServiceBus.OriginatingAddress";
public const string OriginatingEndpoint = "NServiceBus.OriginatingEndpoint";
@@ -601,16 +487,13 @@ namespace NServiceBus
{
public static bool IsImmediateDispatchSet(this NServiceBus.Extensibility.ExtendableOptions options) { }
public static void RequireImmediateDispatch(this NServiceBus.Extensibility.ExtendableOptions options) { }
- [System.Obsolete("Use `IsImmediateDispatchSet` instead. Will be treated as an error from version 9." +
- "0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete("Use `IsImmediateDispatchSet` instead. The member currently throws a NotImplemente" +
+ "dException. Will be removed in version 10.0.0.", true)]
public static bool RequiredImmediateDispatch(this NServiceBus.Extensibility.ExtendableOptions options) { }
}
public class ImmediateRetriesSettings : NServiceBus.Configuration.AdvancedExtensibility.ExposeSettings
{
public void NumberOfRetries(int numberOfRetries) { }
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.ImmediateRetriesSettings OnMessageBeingRetried(System.Func notificationCallback) { }
public NServiceBus.ImmediateRetriesSettings OnMessageBeingRetried(System.Func notificationCallback) { }
}
public class ImmediateRetry : NServiceBus.RecoverabilityAction
@@ -619,60 +502,6 @@ namespace NServiceBus
public override NServiceBus.Transport.ErrorHandleResult ErrorHandleResult { get; }
public override System.Collections.Generic.IReadOnlyCollection GetRoutingContexts(NServiceBus.Pipeline.IRecoverabilityActionContext context) { }
}
- [System.Obsolete("Gateway persistence has been moved to the NServiceBus.Gateway dedicated package. " +
- "Will be removed in version 9.0.0.", true)]
- public static class InMemoryGatewayPersistenceConfigurationExtensions
- {
- [System.Obsolete("Gateway persistence has been moved to the NServiceBus.Gateway dedicated package. " +
- "The member currently throws a NotImplementedException. Will be removed in versio" +
- "n 9.0.0.", true)]
- public static void GatewayDeduplicationCacheSize(this NServiceBus.PersistenceExtensions persistenceExtensions, int maxSize) { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public class InMemoryOutboxPersistence
- {
- public InMemoryOutboxPersistence() { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public static class InMemoryOutboxSettingsExtensions
- {
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public static NServiceBus.Outbox.OutboxSettings TimeToKeepDeduplicationData(this NServiceBus.Outbox.OutboxSettings settings, System.TimeSpan time) { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public class InMemoryPersistence : NServiceBus.Persistence.PersistenceDefinition
- {
- public InMemoryPersistence() { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public class InMemorySagaPersistence
- {
- public InMemorySagaPersistence() { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public class InMemorySubscriptionPersistence
- {
- public InMemorySubscriptionPersistence() { }
- }
- [System.Obsolete("The InMemoryPersistence has been moved to a dedicated Nuget Package called NServi" +
- "ceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence. Will" +
- " be removed in version 9.0.0.", true)]
- public class InMemoryTimeoutPersistence
- {
- public InMemoryTimeoutPersistence() { }
- }
public static class InstallConfigExtensions
{
public static void EnableInstallers(this NServiceBus.EndpointConfiguration config, string username = null) { }
@@ -689,16 +518,14 @@ namespace NServiceBus
public string StorageDirectory { get; set; }
public override System.Collections.Generic.IReadOnlyCollection GetSupportedTransactionModes() { }
public override System.Threading.Tasks.Task Initialize(NServiceBus.Transport.HostSettings hostSettings, NServiceBus.Transport.ReceiveSettings[] receivers, string[] sendingAddresses, System.Threading.CancellationToken cancellationToken = default) { }
+ [System.Obsolete("Inject the ITransportAddressResolver type to access the address translation mecha" +
+ "nism at runtime. See the NServiceBus version 8 upgrade guide for further details" +
+ ". The member currently throws a NotImplementedException. Will be removed in vers" +
+ "ion 10.0.0.", true)]
public override string ToTransportAddress(NServiceBus.Transport.QueueAddress queueAddress) { }
}
public static class LearningTransportConfigurationExtensions
{
- [System.Obsolete("The learning transport does not support a connection string. The member currently" +
- " throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.TransportExtensions ConnectionString(this NServiceBus.TransportExtensions transport, System.Func connectionString) { }
- [System.Obsolete("The learning transport does not support a connection string. The member currently" +
- " throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.TransportExtensions ConnectionString(this NServiceBus.TransportExtensions transport, string connectionString) { }
public static void NoPayloadSizeRestriction(this NServiceBus.TransportExtensions transportExtensions) { }
public static void StorageDirectory(this NServiceBus.TransportExtensions transportExtensions, string path) { }
public static NServiceBus.TransportExtensions UseTransport(this NServiceBus.EndpointConfiguration config)
@@ -709,48 +536,19 @@ namespace NServiceBus
public static void ExecuteTheseHandlersFirst(this NServiceBus.EndpointConfiguration config, System.Collections.Generic.IEnumerable handlerTypes) { }
public static void ExecuteTheseHandlersFirst(this NServiceBus.EndpointConfiguration config, params System.Type[] handlerTypes) { }
}
- [System.Obsolete("Use `QueueAddress` instead. Will be removed in version 9.0.0.", true)]
- public struct LogicalAddress
- {
- [System.Obsolete("Use `QueueAddress` instead. The member currently throws a NotImplementedException" +
- ". Will be removed in version 9.0.0.", true)]
- public NServiceBus.Routing.EndpointInstance EndpointInstance { get; }
- [System.Obsolete("Use `QueueAddress.Qualifier` instead. The member currently throws a NotImplemente" +
- "dException. Will be removed in version 9.0.0.", true)]
- public string Qualifier { get; }
- [System.Obsolete("Directly construct a QueueAddress with the discriminator. The member currently th" +
- "rows a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.LogicalAddress CreateIndividualizedAddress(string discriminator) { }
- [System.Obsolete("Directly construct a QueueAddress with the qualifier. The member currently throws" +
- " a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.LogicalAddress CreateQualifiedAddress(string qualifier) { }
- [System.Obsolete("Directly construct a QueueAddress with the queueName as the BaseAddress. The memb" +
- "er currently throws a NotImplementedException. Will be removed in version 9.0.0." +
- "", true)]
- public static NServiceBus.LogicalAddress CreateLocalAddress(string queueName, System.Collections.Generic.IReadOnlyDictionary properties) { }
- [System.Obsolete("Directly construct a QueueAddress. The member currently throws a NotImplementedEx" +
- "ception. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.LogicalAddress CreateRemoteAddress(NServiceBus.Routing.EndpointInstance endpointInstance) { }
- }
public static class MessageCausationConfigurationExtensions
{
public static void CustomConversationIdStrategy(this NServiceBus.EndpointConfiguration endpointConfiguration, System.Func customStrategy) { }
}
- [System.Serializable]
public class MessageDeserializationException : System.Runtime.Serialization.SerializationException
{
public MessageDeserializationException(string message) { }
- protected MessageDeserializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MessageDeserializationException(string messageId, System.Exception innerException) { }
}
public static class MessageDrivenSubscriptionsConfigExtensions
{
public static void DisablePublishing(this NServiceBus.RoutingSettings routingSettings)
where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
- [System.Obsolete("Use `RoutingSettings.DisablePublishing` instead. The member currently throws a" +
- " NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void DisablePublishing(this NServiceBus.TransportExtensions transportExtensions)
- where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
public static void RegisterPublisher(this NServiceBus.RoutingSettings routingSettings, System.Reflection.Assembly assembly, string publisherEndpoint)
where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
public static void RegisterPublisher(this NServiceBus.RoutingSettings routingSettings, System.Type eventType, string publisherEndpoint)
@@ -759,10 +557,6 @@ namespace NServiceBus
where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
public static void SubscriptionAuthorizer(this NServiceBus.RoutingSettings routingSettings, System.Func authorizer)
where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
- [System.Obsolete("Use `RoutingSettings.SubscriptionAuthorizer` instead. The member currently thr" +
- "ows a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void SubscriptionAuthorizer(this NServiceBus.TransportExtensions transportExtensions, System.Func authorizer)
- where T : NServiceBus.Transport.TransportDefinition, NServiceBus.Routing.IMessageDrivenSubscriptionTransport { }
}
public static class MessageIdExtensions
{
@@ -777,8 +571,6 @@ namespace NServiceBus
Unsubscribe = 4,
Reply = 5,
}
- [System.Obsolete("Use `MessageIntent` instead. Will be removed in version 9.0.0.", true)]
- public enum MessageIntentEnum { }
public static class MessageProcessingContextExtensions
{
public static System.Threading.Tasks.Task Reply(this NServiceBus.IMessageProcessingContext context, object message) { }
@@ -819,16 +611,11 @@ namespace NServiceBus
public bool IsEventType(System.Type type) { }
public bool IsMessageType(System.Type type) { }
}
- [System.Obsolete("Non-durable delivery support has been moved to the transports that can support it" +
- ". See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public class NonDurableDelivery
- {
- public NonDurableDelivery() { }
- }
+ [System.Obsolete("Error notification events have been replaced with a Task-based API available on t" +
+ "he recoverability settings. Will be removed in version 10.0.0.", true)]
public class Notifications
{
public Notifications() { }
- public NServiceBus.Faults.ErrorsNotifications Errors { get; }
}
public delegate System.Threading.Tasks.Task OnSatelliteMessage(System.IServiceProvider serviceProvider, NServiceBus.Transport.MessageContext messageContext, System.Threading.CancellationToken cancellationToken = default);
public static class OpenTelemetryConfigurationExtensions
@@ -916,9 +703,6 @@ namespace NServiceBus
}
public static class ReceivePipelineConfigExtensions
{
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void OnReceivePipelineCompleted(this NServiceBus.Pipeline.PipelineSettings pipelineSettings, System.Func subscription) { }
public static void OnReceivePipelineCompleted(this NServiceBus.Pipeline.PipelineSettings pipelineSettings, System.Func subscription) { }
}
public static class ReceiveSettingsExtensions
@@ -969,9 +753,6 @@ namespace NServiceBus
public class RetryFailedSettings : NServiceBus.Configuration.AdvancedExtensibility.ExposeSettings
{
public NServiceBus.RetryFailedSettings HeaderCustomization(System.Action> customization) { }
- [System.Obsolete("Use the overload that accepts a delegate with a cancellation token. The member cu" +
- "rrently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.RetryFailedSettings OnMessageSentToErrorQueue(System.Func notificationCallback) { }
public NServiceBus.RetryFailedSettings OnMessageSentToErrorQueue(System.Func notificationCallback) { }
}
public static class RoutingFeatureSettingsExtensions
@@ -1011,12 +792,6 @@ namespace NServiceBus
public void RouteToEndpoint(System.Type messageType, string destination) { }
public void RouteToEndpoint(System.Reflection.Assembly assembly, string @namespace, string destination) { }
}
- public static class RoutingSettingsExtensions
- {
- [System.Obsolete("Use `TransportExtensions.Routing()` instead. The member currently throws a Not" +
- "ImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.RoutingSettings Routing(this NServiceBus.TransportExtensions config) { }
- }
public class RoutingSettings : NServiceBus.RoutingSettings
where T : NServiceBus.Transport.TransportDefinition
{
@@ -1056,16 +831,6 @@ namespace NServiceBus
{
public static NServiceBus.Sagas.SagaSettings Sagas(this NServiceBus.EndpointConfiguration config) { }
}
- [System.Obsolete("The built-in scheduler is no longer supported, see our upgrade guide for details " +
- "on how to migrate to plain .NET Timers. Will be removed in version 9.0.0.", true)]
- public static class ScheduleExtensions
- {
- public static System.Threading.Tasks.Task ScheduleEvery(this NServiceBus.IMessageSession session, System.TimeSpan timeSpan, System.Func task) { }
- public static System.Threading.Tasks.Task ScheduleEvery(this NServiceBus.IMessageSession session, System.TimeSpan timeSpan, string name, System.Func task) { }
- }
- [System.Obsolete("The built-in scheduler is no longer supported, see our upgrade guide for details " +
- "on how to migrate to plain .NET Timers. Will be removed in version 9.0.0.", true)]
- public class ScheduledTask { }
public class SendOptions : NServiceBus.Extensibility.ExtendableOptions
{
public SendOptions() { }
@@ -1095,30 +860,30 @@ namespace NServiceBus
}
[System.Obsolete("Use methods on IServiceCollection instead. Note that interfaces are not registere" +
"d implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. Wil" +
- "l be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ "l be removed in version 10.0.0.", true)]
public static class ServiceCollectionExtensions
{
- [System.Obsolete("Use `IServiceCollection.Add` instead. Will be treated as an error from version 9." +
- "0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete("Use `IServiceCollection.Add` instead. The member currently throws a NotImplemente" +
+ "dException. Will be removed in version 10.0.0.", true)]
public static void ConfigureComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type concreteComponent, NServiceBus.DependencyLifecycle dependencyLifecycle) { }
- [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static void ConfigureComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, NServiceBus.DependencyLifecycle dependencyLifecycle) { }
- [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static void ConfigureComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Func componentFactory, NServiceBus.DependencyLifecycle dependencyLifecycle) { }
- [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static void ConfigureComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Func componentFactory, NServiceBus.DependencyLifecycle dependencyLifecycle) { }
- [System.Obsolete("Use `IServiceCollection.GetEnumerator` instead. Will be treated as an error from " +
- "version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete("Use `IServiceCollection.GetEnumerator` instead. The member currently throws a Not" +
+ "ImplementedException. Will be removed in version 10.0.0.", true)]
public static bool HasComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type componentType) { }
- [System.Obsolete("Use `IServiceCollection.GetEnumerator` instead. Will be treated as an error from " +
- "version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete("Use `IServiceCollection.GetEnumerator` instead. The member currently throws a Not" +
+ "ImplementedException. Will be removed in version 10.0.0.", true)]
public static bool HasComponent(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection) { }
[System.Obsolete("Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollect" +
- "ion.AddTransient` or `IServiceCollection.AddScoped` instead. Will be treated as " +
- "an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ "ion.AddTransient` or `IServiceCollection.AddScoped` instead. The member currentl" +
+ "y throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static void RegisterSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Type lookupType, object instance) { }
- [System.Obsolete("Use `IServiceCollection.AddSingleton` instead. Will be treated as an error from v" +
- "ersion 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete("Use `IServiceCollection.AddSingleton` instead. The member currently throws a NotI" +
+ "mplementedException. Will be removed in version 10.0.0.", true)]
public static void RegisterSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, T instance) { }
}
public static class SettingsExtensions
@@ -1126,13 +891,10 @@ namespace NServiceBus
public static string EndpointName(this NServiceBus.Settings.IReadOnlySettings settings) { }
public static string EndpointQueueName(this NServiceBus.Settings.IReadOnlySettings settings) { }
public static System.Collections.Generic.IList GetAvailableTypes(this NServiceBus.Settings.IReadOnlySettings settings) { }
- [System.Obsolete(@"Use FeatureConfigurationContext.InstanceSpecificQueueAddress() to access the endpoint instance specific queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use FeatureConfigurationContext.InstanceSpecificQueueAddress() to access the endpoint instance specific queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static string InstanceSpecificQueue(this NServiceBus.Settings.IReadOnlySettings settings) { }
- [System.Obsolete(@"Use FeatureConfigurationContext.LocalQueueAddress() to access the endpoint queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"Use FeatureConfigurationContext.LocalQueueAddress() to access the endpoint queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details. The member currently throws a NotImplementedException. Will be removed in version 10.0.0.", true)]
public static string LocalAddress(this NServiceBus.Settings.IReadOnlySettings settings) { }
- [System.Obsolete("Use `SettingsExtensions.EndpointQueueName` instead. The member currently throws a" +
- " NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.LogicalAddress LogicalAddress(this NServiceBus.Settings.ReadOnlySettings settings) { }
}
public class StartupDiagnosticEntries
{
@@ -1152,16 +914,9 @@ namespace NServiceBus
public abstract class StorageType
{
public override string ToString() { }
- [System.Obsolete("Gateway persistence has been moved to the NServiceBus.Gateway dedicated package. " +
- "Will be removed in version 9.0.0.", true)]
- public sealed class GatewayDeduplication { }
public sealed class Outbox : NServiceBus.StorageType { }
public sealed class Sagas : NServiceBus.StorageType { }
public sealed class Subscriptions : NServiceBus.StorageType { }
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. Will be removed " +
- "in version 9.0.0.", true)]
- public sealed class Timeouts { }
}
public class SubscribeOptions : NServiceBus.Extensibility.ExtendableOptions
{
@@ -1202,58 +957,17 @@ namespace NServiceBus
{
public static NServiceBus.ConventionsBuilder DefiningTimeToBeReceivedAs(this NServiceBus.ConventionsBuilder builder, System.Func retrieveTimeToBeReceived) { }
}
- public class TimeoutManagerConfiguration { }
- [System.Obsolete("The timeout manager has been removed. See the upgrade guide for more details. Wil" +
- "l be removed in version 9.0.0.", true)]
- public static class TimeoutManagerConfigurationExtensions
- {
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. The member curre" +
- "ntly throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void LimitMessageProcessingConcurrencyTo(this NServiceBus.TimeoutManagerConfiguration timeoutManagerConfiguration, int maxConcurrency) { }
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. The member curre" +
- "ntly throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.TimeoutManagerConfiguration TimeoutManager(this NServiceBus.EndpointConfiguration endpointConfiguration) { }
- }
public class ToSagaExpression
where TSagaData : class, NServiceBus.IContainSagaData
{
public ToSagaExpression(NServiceBus.IConfigureHowToFindSagaWithMessage sagaMessageFindingConfiguration, System.Linq.Expressions.Expression> messageProperty) { }
public void ToSaga(System.Linq.Expressions.Expression> sagaEntityProperty) { }
}
- [System.Obsolete("Configure the transport via the TransportDefinition instance\'s properties. Will b" +
- "e removed in version 9.0.0.", true)]
- public class TransportExtensions
- {
- [System.Obsolete("Configure the transport via the TransportDefinition instance\'s properties. Will b" +
- "e removed in version 9.0.0.", true)]
- public TransportExtensions(NServiceBus.Settings.SettingsHolder settings) { }
- [System.Obsolete("Setting connection string at the endpoint level is no longer supported. Transport" +
- " specific configuration options should be used instead. The member currently thr" +
- "ows a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.TransportExtensions ConnectionString(System.Func connectionString) { }
- [System.Obsolete("Setting connection string at the endpoint level is no longer supported. Transport" +
- " specific configuration options should be used instead. The member currently thr" +
- "ows a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.TransportExtensions ConnectionString(string connectionString) { }
- [System.Obsolete(@"The ability to used named connection strings has been removed. Instead, load the connection string in your code and pass the value to TransportExtensions.ConnectionString(connectionString). Use `ConnectionString(connectionString)` instead. The member currently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.TransportExtensions ConnectionStringName(string name) { }
- [System.Obsolete("Use `TransportDefinition.TransportTransactionMode` instead. The member currently " +
- "throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public NServiceBus.TransportExtensions Transactions(NServiceBus.TransportTransactionMode transportTransactionMode) { }
- }
public class TransportExtensions
where T : NServiceBus.Transport.TransportDefinition
{
- [System.Obsolete(@"TransportExtensions does not use a SettingsHolder. Get an instance from endpointConfiguration.UseTransport(), or configure the transport directly via the TransportDefinition instance's properties. The member currently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public TransportExtensions(NServiceBus.Settings.SettingsHolder settings) { }
public TransportExtensions(T transport, NServiceBus.RoutingSettings routing) { }
public T Transport { get; }
- [System.Obsolete("Loading named connection strings is no longer supported. Use `ConnectionString(co" +
- "nnectionString)` instead. The member currently throws a NotImplementedException." +
- " Will be removed in version 9.0.0.", true)]
- public NServiceBus.TransportExtensions ConnectionStringName(string name) { }
public NServiceBus.RoutingSettings Routing() { }
public NServiceBus.TransportExtensions Transactions(NServiceBus.TransportTransactionMode transportTransactionMode) { }
}
@@ -1278,30 +992,13 @@ namespace NServiceBus
}
public static class UseDataBusExtensions
{
- [System.Obsolete("Specifying a serializer for data bus is mandatory. Use the overload that accepts " +
- "a data bus serializer type. The member currently throws a NotImplementedExceptio" +
- "n. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.DataBus.DataBusExtensions UseDataBus(this NServiceBus.EndpointConfiguration config, System.Type dataBusType) { }
public static NServiceBus.DataBus.DataBusExtensions UseDataBus(this NServiceBus.EndpointConfiguration config, System.Func dataBusFactory, NServiceBus.DataBus.IDataBusSerializer dataBusSerializer) { }
- [System.Obsolete("Specifying data bus serializer is mandatory. Use the overload that accepts a data" +
- " bus serializer type. The member currently throws a NotImplementedException. Wil" +
- "l be removed in version 9.0.0.", true)]
- public static NServiceBus.DataBus.DataBusExtensions UseDataBus(this NServiceBus.EndpointConfiguration config)
- where T : NServiceBus.DataBus.DataBusDefinition { }
public static NServiceBus.DataBus.DataBusExtensions UseDataBus(this NServiceBus.EndpointConfiguration config, NServiceBus.DataBus.IDataBusSerializer dataBusSerializer)
where TDataBusDefinition : NServiceBus.DataBus.DataBusDefinition, new () { }
public static NServiceBus.DataBus.DataBusExtensions UseDataBus(this NServiceBus.EndpointConfiguration config)
where TDataBusDefinition : NServiceBus.DataBus.DataBusDefinition, new ()
where TDataBusSerializer : NServiceBus.DataBus.IDataBusSerializer, new () { }
}
- [System.Obsolete("Use `EndpointConfiguration.UseTransport(TransportDefinition)` instead. Will be re" +
- "moved in version 9.0.0.", true)]
- public static class UseTransportExtensions
- {
- [System.Obsolete("Use `EndpointConfiguration.UseTransport(TransportDefinition)` instead. The member" +
- " currently throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static NServiceBus.TransportExtensions UseTransport(this NServiceBus.EndpointConfiguration endpointConfiguration, System.Type transportDefinitionType) { }
- }
public static class XmlSerializationExtensions
{
public static NServiceBus.Serialization.SerializationExtensions DontWrapRawXml(this NServiceBus.Serialization.SerializationExtensions config) { }
@@ -1354,20 +1051,6 @@ namespace NServiceBus.ConsistencyGuarantees
public static NServiceBus.TransportTransactionMode GetRequiredTransactionModeForReceives(this NServiceBus.Settings.IReadOnlySettings settings) { }
}
}
-namespace NServiceBus.Container
-{
- [System.Obsolete("The NServiceBus dependency injection container API has been deprecated. Use the e" +
- "xternally managed container mode to use custom containers. Will be removed in ve" +
- "rsion 9.0.0.", true)]
- public class ContainerCustomizations { }
- [System.Obsolete("The NServiceBus dependency injection container API has been deprecated. Use the e" +
- "xternally managed container mode to use custom containers. Will be removed in ve" +
- "rsion 9.0.0.", true)]
- public abstract class ContainerDefinition
- {
- protected ContainerDefinition() { }
- }
-}
namespace NServiceBus.DataBus
{
public abstract class DataBusDefinition
@@ -1413,45 +1096,6 @@ namespace NServiceBus.DelayedDelivery
public DoNotDeliverBefore(System.DateTimeOffset at) { }
public System.DateTimeOffset At { get; }
}
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. Will be removed " +
- "in version 9.0.0.", true)]
- public static class ExternalTimeoutManagerConfigurationExtensions
- {
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. The member curre" +
- "ntly throws a NotImplementedException. Will be removed in version 9.0.0.", true)]
- public static void UseExternalTimeoutManager(this NServiceBus.EndpointConfiguration endpointConfiguration, string externalTimeoutManagerAddress) { }
- }
-}
-namespace NServiceBus.DeliveryConstraints
-{
- [System.Obsolete("Use `DispatchProperties` instead. Will be removed in version 9.0.0.", true)]
- public abstract class DeliveryConstraint
- {
- [System.Obsolete("Will be removed in version 9.0.0.", true)]
- protected DeliveryConstraint() { }
- }
- public static class DeliveryConstraintContextExtensions
- {
- [System.Obsolete("Use `DispatchProperties` instead. The member currently throws a NotImplementedExc" +
- "eption. Will be removed in version 9.0.0.", true)]
- public static void AddDeliveryConstraint(this NServiceBus.Extensibility.ContextBag context, NServiceBus.DeliveryConstraints.DeliveryConstraint constraint) { }
- [System.Obsolete("Use `DispatchProperties` instead. The member currently throws a NotImplementedExc" +
- "eption. Will be removed in version 9.0.0.", true)]
- public static System.Collections.Generic.List GetDeliveryConstraints(this NServiceBus.Extensibility.ContextBag context) { }
- [System.Obsolete("Use `DispatchProperties` instead. The member currently throws a NotImplementedExc" +
- "eption. Will be removed in version 9.0.0.", true)]
- public static void RemoveDeliveryConstraint(this NServiceBus.Extensibility.ContextBag context, NServiceBus.DeliveryConstraints.DeliveryConstraint constraint) { }
- [System.Obsolete("Use `DispatchProperties` instead. The member currently throws a NotImplementedExc" +
- "eption. Will be removed in version 9.0.0.", true)]
- public static bool TryGetDeliveryConstraint(this NServiceBus.Extensibility.ContextBag context, out T constraint)
- where T : NServiceBus.DeliveryConstraints.DeliveryConstraint { }
- [System.Obsolete("Use `DispatchProperties` instead. The member currently throws a NotImplementedExc" +
- "eption. Will be removed in version 9.0.0.", true)]
- public static bool TryRemoveDeliveryConstraint(this NServiceBus.Extensibility.ContextBag context, out T constraint)
- where T : NServiceBus.DeliveryConstraints.DeliveryConstraint { }
- }
}
namespace NServiceBus.Extensibility
{
@@ -1493,8 +1137,6 @@ namespace NServiceBus.Extensibility
bool TryGet(out T result);
bool TryGet(string key, out T result);
}
- [System.Obsolete("Use `IReadOnlyContextBag` instead. Will be removed in version 9.0.0.", true)]
- public interface ReadOnlyContextBag { }
}
namespace NServiceBus.Faults
{
@@ -1507,25 +1149,6 @@ namespace NServiceBus.Faults
public string MessageId { get; }
public int RetryAttempt { get; }
}
- public class ErrorsNotifications
- {
- public ErrorsNotifications() { }
- [System.Obsolete("The .NET event based error notifications will be deprecated in favor of Task-base" +
- "d callbacks. Use endpointConfiguration.Recoverability().Delayed(settings => sett" +
- "ings.OnMessageBeingRetried(callback)) instead. Will be removed in version 9.0.0." +
- "", true)]
- public event System.EventHandler MessageHasBeenSentToDelayedRetries;
- [System.Obsolete("The .NET event based error notifications will be deprecated in favor of Task-base" +
- "d callbacks. Use endpointConfiguration.Recoverability().Immediate(settings => se" +
- "ttings.OnMessageBeingRetried(callback)) instead. Will be removed in version 9.0." +
- "0.", true)]
- public event System.EventHandler MessageHasFailedAnImmediateRetryAttempt;
- [System.Obsolete("The .NET event based error notifications will be deprecated in favor of Task-base" +
- "d callbacks. Use endpointConfiguration.Recoverability().Failed(settings => setti" +
- "ngs.OnMessageSentToErrorQueue(callback)) instead. Will be removed in version 9.0" +
- ".0.", true)]
- public event System.EventHandler MessageSentToErrorQueue;
- }
public class FailedMessage
{
public FailedMessage(string messageId, System.Collections.Generic.Dictionary headers, System.ReadOnlyMemory body, System.Exception exception, string errorQueue) { }
@@ -1587,8 +1210,8 @@ namespace NServiceBus.Features
}
public class FeatureConfigurationContext
{
- [System.Obsolete("Use `Services` instead. Will be treated as an error from version 9.0.0. Will be r" +
- "emoved in version 10.0.0.", false)]
+ [System.Obsolete("Use `Services` instead. The member currently throws a NotImplementedException. Wi" +
+ "ll be removed in version 10.0.0.", true)]
public Microsoft.Extensions.DependencyInjection.IServiceCollection Container { get; }
public NServiceBus.Pipeline.PipelineSettings Pipeline { get; }
public Microsoft.Extensions.DependencyInjection.IServiceCollection Services { get; }
@@ -1614,13 +1237,7 @@ namespace NServiceBus.Features
Active = 2,
Deactivated = 3,
}
- [System.Obsolete("Message forwarding is no longer supported, but can be implemented as a custom pip" +
- "eline behavior. Will be removed in version 9.0.0.", true)]
- public class ForwardReceivedMessages { }
- [System.Obsolete("Gateway persistence has been moved to the NServiceBus.Gateway dedicated package. " +
- "Will be removed in version 9.0.0.", true)]
- public class InMemoryGatewayPersistence { }
- [System.Obsolete(@"It's not recommended to disable the MessageDrivenSubscriptions feature and this option will be removed in future versions. Use 'TransportExtensions.DisablePublishing()' to avoid the need for a subscription storage if this endpoint does not publish events. Will be treated as an error from version 9.0.0. Will be removed in version 10.0.0.", false)]
+ [System.Obsolete(@"It's not recommended to disable the MessageDrivenSubscriptions feature and this option will be removed in future versions. Use 'TransportExtensions.DisablePublishing()' to avoid the need for a subscription storage if this endpoint does not publish events. Will be removed in version 10.0.0.", true)]
public class MessageDrivenSubscriptions : NServiceBus.Features.Feature
{
protected override void Setup(NServiceBus.Features.FeatureConfigurationContext context) { }
@@ -1637,12 +1254,6 @@ namespace NServiceBus.Features
{
protected override void Setup(NServiceBus.Features.FeatureConfigurationContext context) { }
}
- [System.Obsolete("The built-in scheduler is no longer supported, see our upgrade guide for details " +
- "on how to migrate to plain .NET Timers. Will be removed in version 9.0.0.", true)]
- public class Scheduler
- {
- public Scheduler() { }
- }
public static class SettingsExtensions
{
public static NServiceBus.Settings.SettingsHolder EnableFeatureByDefault(this NServiceBus.Settings.SettingsHolder settings, System.Type featureType) { }
@@ -1655,19 +1266,6 @@ namespace NServiceBus.Features
{
protected override void Setup(NServiceBus.Features.FeatureConfigurationContext context) { }
}
- [System.Obsolete("The timeout manager has been removed in favor of native delayed delivery support " +
- "provided by transports. See the upgrade guide for more details. Will be removed " +
- "in version 9.0.0.", true)]
- public class TimeoutManager { }
-}
-namespace NServiceBus.Gateway.Deduplication
-{
- [System.Obsolete("Gateway persistence has been moved to the NServiceBus.Gateway dedicated package. " +
- "Will be removed in version 9.0.0.", true)]
- public interface IDeduplicateMessages
- {
- System.Threading.Tasks.Task DeduplicateMessage(string clientId, System.DateTime timeReceived, NServiceBus.Extensibility.ContextBag context);
- }
}
namespace NServiceBus.Hosting.Helpers
{
@@ -1859,87 +1457,26 @@ namespace NServiceBus.MessageMutator
public static void RegisterMessageMutator(this NServiceBus.EndpointConfiguration endpointConfiguration, object messageMutator) { }
}
}
-namespace NServiceBus.ObjectBuilder.Common
-{
- [System.Obsolete("The NServiceBus dependency injection container API has been deprecated. Use the e" +
- "xternally managed container mode to use custom containers. Will be removed in ve" +
- "rsion 9.0.0.", true)]
- public interface IContainer : System.IDisposable { }
-}
namespace NServiceBus.ObjectBuilder
{
- [System.Obsolete("Use `IServiceProvider` instead. Will be removed in version 9.0.0.", true)]
- public interface IBuilder : System.IDisposable
- {
- [System.Obsolete("The Build method is not supported anymore. Use `GetService` instead. Will be remo" +
- "ved in version 9.0.0.", true)]
- object Build(System.Type typeToBuild);
- [System.Obsolete("The Build method is not supported anymore. Use `GetService` instead. Will be r" +
- "emoved in version 9.0.0.", true)]
- T Build();
- [System.Obsolete("The BuildAll method is not supported anymore. Use `GetServices` instead. Will be " +
- "removed in version 9.0.0.", true)]
- System.Collections.Generic.IEnumerable
diff --git a/src/NServiceBus.Core.Tests/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptionsConfigExtensionsTests.cs b/src/NServiceBus.Core.Tests/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptionsConfigExtensionsTests.cs
index e7901c5479..0758a6e45a 100644
--- a/src/NServiceBus.Core.Tests/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptionsConfigExtensionsTests.cs
+++ b/src/NServiceBus.Core.Tests/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptionsConfigExtensionsTests.cs
@@ -171,13 +171,10 @@ public override Task Initialize(HostSettings hostSettin
throw new NotImplementedException();
}
- [Obsolete("Obsolete marker to make the code compile", false)]
+ [Obsolete("This should be removed when TransportDefinition.ToTransportAddress is removed in v10.", true)]
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
- public override string ToTransportAddress(QueueAddress address)
+ public override string ToTransportAddress(QueueAddress address) => throw new NotImplementedException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
- {
- throw new NotImplementedException();
- }
public override IReadOnlyCollection GetSupportedTransactionModes()
{
diff --git a/src/NServiceBus.Core.Tests/Settings/SettingsExtensionsTests.cs b/src/NServiceBus.Core.Tests/Settings/SettingsExtensionsTests.cs
deleted file mode 100644
index fd739707f6..0000000000
--- a/src/NServiceBus.Core.Tests/Settings/SettingsExtensionsTests.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Core.TransportSeam
-{
- using System;
- using Configuration.AdvancedExtensibility;
- using NUnit.Framework;
-
- [TestFixture]
- public class SettingsExtensionsTests
- {
- [Test]
- public void Should_throw_if_receive_addresses_are_accessed_before_transport_configuration()
- {
- var endpointConfiguration = new EndpointConfiguration("MyEndpoint");
-
-#pragma warning disable IDE0079
-#pragma warning disable CS0618
- var localAddressEx = Assert.Throws(() => endpointConfiguration.GetSettings().LocalAddress(), "Should throw since the endpoint hasn't been fully configured yet");
- StringAssert.Contains("LocalAddress isn't available until the endpoint configuration is complete.", localAddressEx.Message);
-
- var instanceAddressEx = Assert.Throws(() => endpointConfiguration.GetSettings().InstanceSpecificQueue(), "Should throw since the endpoint hasn't been fully configured yet");
- StringAssert.Contains("Instance-specific receive address isn't available until the endpoint configuration is complete.", instanceAddressEx.Message);
-#pragma warning restore CS0618
-#pragma warning restore IDE0079
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.Core.Tests/UnitOfWork/UnitOfWorkBehaviorTests.cs b/src/NServiceBus.Core.Tests/UnitOfWork/UnitOfWorkBehaviorTests.cs
deleted file mode 100644
index 28d355cbea..0000000000
--- a/src/NServiceBus.Core.Tests/UnitOfWork/UnitOfWorkBehaviorTests.cs
+++ /dev/null
@@ -1,375 +0,0 @@
-#pragma warning disable CS0618
-namespace NServiceBus.Unicast.Tests
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading.Tasks;
- using Microsoft.Extensions.DependencyInjection;
- using NUnit.Framework;
- using Testing;
- using UnitOfWork;
-
- [TestFixture]
- [SuppressMessage("Code", "PS0018:A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext", Justification = "Obsolete")]
- public class UnitOfWorkBehaviorTests
- {
- [Test]
- public async Task Should_not_call_Begin_or_End_when_hasUnitsOfWork_is_false()
- {
- var services = new ServiceCollection();
-
- var behavior = new UnitOfWorkBehavior();
-
- await InvokeBehavior(services, behavior: behavior);
-
- var unitOfWork = new UnitOfWork();
- services.AddTransient(sp => unitOfWork);
-
- await InvokeBehavior(services, behavior: behavior);
-
- Assert.IsFalse(unitOfWork.BeginCalled);
- Assert.IsFalse(unitOfWork.EndCalled);
- }
-
- [Test]
- public void When_first_throw_second_is_cleaned_up()
- {
- var services = new ServiceCollection();
-
- var unitOfWorkThatThrowsFromEnd = new UnitOfWorkThatThrowsFromEnd();
- var unitOfWork = new UnitOfWork();
-
- services.AddTransient(sp => unitOfWorkThatThrowsFromEnd);
- services.AddTransient(sp => unitOfWork);
-
- //since it is a single exception then it will not be an AggregateException
- Assert.That(async () => await InvokeBehavior(services), Throws.InvalidOperationException);
- Assert.IsTrue(unitOfWorkThatThrowsFromEnd.BeginCalled);
- Assert.IsTrue(unitOfWorkThatThrowsFromEnd.EndCalled);
- Assert.IsTrue(unitOfWork.BeginCalled);
- Assert.IsTrue(unitOfWork.EndCalled);
- }
-
- [Test]
- public void Should_append_end_exception_to_rethrow()
- {
- var unitOfWork = new UnitOfWorkThatThrowsFromEnd();
-
- var services = new ServiceCollection();
- services.AddTransient(sp => unitOfWork);
-
- //since it is a single exception then it will not be an AggregateException
- Assert.That(async () => await InvokeBehavior(services), Throws.InvalidOperationException.And.SameAs(unitOfWork.ExceptionThrownFromEnd));
- }
-
- [Test]
- public void Should_not_invoke_end_if_begin_was_not_invoked()
- {
- var services = new ServiceCollection();
-
- var unitOfWorkThatThrowsFromBegin = new UnitOfWorkThatThrowsFromBegin();
- var unitOfWork = new UnitOfWork();
-
- services.AddTransient(sp => unitOfWorkThatThrowsFromBegin);
- services.AddTransient(sp => unitOfWork);
-
- //since it is a single exception then it will not be an AggregateException
- Assert.That(async () => await InvokeBehavior(services), Throws.InvalidOperationException);
- Assert.False(unitOfWork.EndCalled);
- }
-
- [Test]
- public void Should_pass_exceptions_to_the_uow_end()
- {
- var services = new ServiceCollection();
-
- var unitOfWork = new UnitOfWork();
-
- services.AddTransient(sp => unitOfWork);
-
- var ex = new Exception("Handler failed");
- //since it is a single exception then it will not be an AggregateException
- Assert.That(async () => await InvokeBehavior(services, ex), Throws.InstanceOf().And.SameAs(ex));
- Assert.AreSame(ex, unitOfWork.ExceptionPassedToEnd);
- }
-
- [Test]
- public async Task Should_invoke_ends_in_reverse_order_of_the_begins()
- {
- var services = new ServiceCollection();
-
- var order = new List();
- var firstUnitOfWork = new OrderAwareUnitOfWork("first", order);
- var secondUnitOfWork = new OrderAwareUnitOfWork("second", order);
-
- services.AddTransient(sp => firstUnitOfWork);
- services.AddTransient(sp => secondUnitOfWork);
-
- await InvokeBehavior(services);
-
- Assert.AreEqual("first", order[0]);
- Assert.AreEqual("second", order[1]);
- Assert.AreEqual("second", order[2]);
- Assert.AreEqual("first", order[3]);
- }
-
- [Test]
- public void Should_call_all_end_even_if_one_or_more_of_them_throws()
- {
- var services = new ServiceCollection();
-
- var unitOfWorkThatThrows = new UnitOfWorkThatThrowsFromEnd();
- var unitOfWork = new UnitOfWork();
-
- services.AddTransient(sp => unitOfWorkThatThrows);
- services.AddTransient(sp => unitOfWork);
-
- Assert.That(async () => await InvokeBehavior(services), Throws.InvalidOperationException);
- Assert.True(unitOfWork.EndCalled);
- }
-
- [Test]
- public void Should_invoke_ends_on_all_begins_that_was_called_even_when_begin_throws()
- {
- var services = new ServiceCollection();
-
- var normalUnitOfWork = new UnitOfWork();
- var unitOfWorkThatThrows = new UnitOfWorkThatThrowsFromBegin();
- var unitOfWorkThatIsNeverCalled = new UnitOfWork();
-
- services.AddTransient(sp => normalUnitOfWork);
- services.AddTransient(sp => unitOfWorkThatThrows);
- services.AddTransient(sp => unitOfWorkThatIsNeverCalled);
-
- Assert.That(async () => await InvokeBehavior(services), Throws.InvalidOperationException);
-
- Assert.True(normalUnitOfWork.EndCalled);
- Assert.True(unitOfWorkThatThrows.EndCalled);
- Assert.False(unitOfWorkThatIsNeverCalled.EndCalled);
- }
-
- [Test]
- public void Should_throw_friendly_exception_if_IManageUnitsOfWork_Begin_returns_null()
- {
- var services = new ServiceCollection();
-
- services.AddTransient(sp => new UnitOfWorkThatReturnsNullForBegin());
- Assert.That(async () => await InvokeBehavior(services),
- Throws.Exception.With.Message.EqualTo("Return a Task or mark the method as async."));
- }
-
- [Test]
- public void Should_throw_friendly_exception_if_IManageUnitsOfWork_End_returns_null()
- {
- var services = new ServiceCollection();
- services.AddSingleton(sp => new UnitOfWorkThatReturnsNullForEnd());
-
- Assert.That(async () => await InvokeBehavior(services),
- Throws.Exception.With.Message.EqualTo("Return a Task or mark the method as async."));
- }
-
- static Task InvokeBehavior(IServiceCollection services, Exception toThrow = null, UnitOfWorkBehavior behavior = null)
- {
- var runner = behavior ?? new UnitOfWorkBehavior();
-
- var context = new TestableIncomingPhysicalMessageContext
- {
- Services = services
- };
-
- return runner.Invoke(context, ctx =>
- {
- if (toThrow != null)
- {
- throw toThrow;
- }
-
- return Task.CompletedTask;
- });
- }
-
- class UnitOfWorkThatThrowsFromEnd : IManageUnitsOfWork
- {
- public bool BeginCalled;
- public bool EndCalled;
- public Exception ExceptionThrownFromEnd = new InvalidOperationException();
-
- public Task Begin()
- {
- BeginCalled = true;
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- EndCalled = true;
- throw ExceptionThrownFromEnd;
- }
- }
-
- class UnitOfWorkThatThrowsFromBegin : IManageUnitsOfWork
- {
- public bool EndCalled;
- public Exception ExceptionThrownFromEnd = new InvalidOperationException();
-
- public Task Begin()
- {
- throw ExceptionThrownFromEnd;
- }
-
- public Task End(Exception ex = null)
- {
- EndCalled = true;
- return Task.CompletedTask;
- }
- }
-
- class UnitOfWork : IManageUnitsOfWork
- {
- public bool BeginCalled;
- public bool EndCalled;
- public Exception ExceptionPassedToEnd;
-
- public Task Begin()
- {
- BeginCalled = true;
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- ExceptionPassedToEnd = ex;
- EndCalled = true;
- return Task.CompletedTask;
- }
- }
-
- class UnitOfWorkThatReturnsNullForBegin : IManageUnitsOfWork
- {
- public Task Begin()
- {
- return null;
- }
-
- public Task End(Exception ex = null)
- {
- return Task.CompletedTask;
- }
- }
-
- class UnitOfWorkThatReturnsNullForEnd : IManageUnitsOfWork
- {
- public Task Begin()
- {
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- return null;
- }
- }
-
- [Test]
- public async Task Verify_order()
- {
- var services = new ServiceCollection();
-
- var unitOfWork1 = new CountingUnitOfWork();
- var unitOfWork2 = new CountingUnitOfWork();
- var unitOfWork3 = new CountingUnitOfWork();
-
- services.AddTransient(sp => unitOfWork1);
- services.AddTransient(sp => unitOfWork2);
- services.AddTransient(sp => unitOfWork3);
-
- await InvokeBehavior(services);
-
- Assert.AreEqual(1, unitOfWork1.BeginCallIndex);
- Assert.AreEqual(2, unitOfWork2.BeginCallIndex);
- Assert.AreEqual(3, unitOfWork3.BeginCallIndex);
- Assert.AreEqual(3, unitOfWork1.EndCallIndex);
- Assert.AreEqual(2, unitOfWork2.EndCallIndex);
- Assert.AreEqual(1, unitOfWork3.EndCallIndex);
- }
-
- class CountingUnitOfWork : IManageUnitsOfWork
- {
- static int BeginCallCount;
- static int EndCallCount;
- public int EndCallIndex;
- public int BeginCallIndex;
-
- public Task Begin()
- {
- BeginCallCount++;
- BeginCallIndex = BeginCallCount;
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- EndCallCount++;
- EndCallIndex = EndCallCount;
- return Task.CompletedTask;
- }
- }
-
- [Test]
- public void Should_pass_exception_to_cleanup()
- {
- var services = new ServiceCollection();
-
- var unitOfWork = new CaptureExceptionPassedToEndUnitOfWork();
- var throwingUoW = new UnitOfWorkThatThrowsFromEnd();
-
- services.AddTransient(sp => unitOfWork);
- services.AddTransient(sp => throwingUoW);
-
- //since it is a single exception then it will not be an AggregateException
- Assert.That(async () => await InvokeBehavior(services), Throws.InstanceOf().And.SameAs(throwingUoW.ExceptionThrownFromEnd));
- Assert.AreSame(throwingUoW.ExceptionThrownFromEnd, unitOfWork.Exception);
- }
-
- class CaptureExceptionPassedToEndUnitOfWork : IManageUnitsOfWork
- {
- public Task Begin()
- {
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- Exception = ex;
- return Task.CompletedTask;
- }
-
- public Exception Exception;
- }
-
- class OrderAwareUnitOfWork : IManageUnitsOfWork
- {
- string name;
- List order;
-
- public OrderAwareUnitOfWork(string name, List order)
- {
- this.name = name;
- this.order = order;
- }
-
- public Task Begin()
- {
- order.Add(name);
- return Task.CompletedTask;
- }
-
- public Task End(Exception ex = null)
- {
- order.Add(name);
- return Task.CompletedTask;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/Audit/AuditContext.cs b/src/NServiceBus.Core/Audit/AuditContext.cs
index 3abd961ee7..2459160dd0 100644
--- a/src/NServiceBus.Core/Audit/AuditContext.cs
+++ b/src/NServiceBus.Core/Audit/AuditContext.cs
@@ -6,7 +6,7 @@ namespace NServiceBus
using Pipeline;
using Transport;
- class AuditContext : BehaviorContext, IAuditContext, IAuditActionContext
+ partial class AuditContext : BehaviorContext, IAuditContext, IAuditActionContext
{
public AuditContext(OutgoingMessage message, string auditAddress, TimeSpan? timeToBeReceived, IBehaviorContext parent)
: base(parent)
@@ -42,13 +42,6 @@ public AuditAction AuditAction
auditAction = value;
}
}
- public void AddAuditData(string key, string value)
- {
- Guard.ThrowIfNullOrEmpty(key);
- Guard.ThrowIfNullOrEmpty(value);
-
- AuditMetadata[key] = value;
- }
public IAuditActionContext PreventChanges()
{
diff --git a/src/NServiceBus.Core/Audit/IAuditContext.cs b/src/NServiceBus.Core/Audit/IAuditContext.cs
index 0758b2ec79..eee6b83e15 100644
--- a/src/NServiceBus.Core/Audit/IAuditContext.cs
+++ b/src/NServiceBus.Core/Audit/IAuditContext.cs
@@ -8,7 +8,7 @@
///
/// Provide context to behaviors on the audit pipeline.
///
- public interface IAuditContext : IBehaviorContext
+ public partial interface IAuditContext : IBehaviorContext
{
///
/// The message to be audited.
@@ -25,17 +25,6 @@ public interface IAuditContext : IBehaviorContext
///
TimeSpan? TimeToBeReceived { get; }
- ///
- /// Adds information about the current message that should be audited.
- ///
- /// The audit key.
- /// The value.
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(AuditMetadata),
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- void AddAuditData(string key, string value);
-
///
/// Metadata for the audited message.
///
diff --git a/src/NServiceBus.Core/DataBus/DataBus.cs b/src/NServiceBus.Core/DataBus/DataBus.cs
index 0356ba430d..ec19615c39 100644
--- a/src/NServiceBus.Core/DataBus/DataBus.cs
+++ b/src/NServiceBus.Core/DataBus/DataBus.cs
@@ -2,6 +2,7 @@ namespace NServiceBus.Features
{
using System;
using System.Collections.Generic;
+ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
@@ -29,7 +30,7 @@ static Type GetSelectedFeatureForDataBus(SettingsHolder settings)
///
protected internal override void Setup(FeatureConfigurationContext context)
{
- if (context.Services.HasComponent())
+ if (context.Services.Any(sd => sd.ServiceType == typeof(IDataBusSerializer)))
{
throw new Exception("Providing data bus serializer via dependency injection is no longer supported.");
}
diff --git a/src/NServiceBus.Core/DataBus/DataBusFileBased.cs b/src/NServiceBus.Core/DataBus/DataBusFileBased.cs
index 44c8f94526..9fb9de9152 100644
--- a/src/NServiceBus.Core/DataBus/DataBusFileBased.cs
+++ b/src/NServiceBus.Core/DataBus/DataBusFileBased.cs
@@ -22,7 +22,7 @@ protected internal override void Setup(FeatureConfigurationContext context)
}
var dataBus = new FileShareDataBusImplementation(basePath);
- context.Container.AddSingleton(typeof(IDataBus), dataBus);
+ context.Services.AddSingleton(typeof(IDataBus), dataBus);
}
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/DataBus/DataBusProperty.cs b/src/NServiceBus.Core/DataBus/DataBusProperty.cs
index 9a61886fea..1f3ca6329b 100644
--- a/src/NServiceBus.Core/DataBus/DataBusProperty.cs
+++ b/src/NServiceBus.Core/DataBus/DataBusProperty.cs
@@ -8,13 +8,12 @@
/// Default implementation for .
///
/// Type of data to store in .
- [Serializable]
- public class DataBusProperty : IDataBusProperty, ISerializable where T : class
+ public class DataBusProperty : IDataBusProperty where T : class
{
///
/// initializes a with no value set.
///
- public DataBusProperty() : this(null)
+ public DataBusProperty()
{
Type = typeof(T);
}
@@ -49,7 +48,9 @@ protected DataBusProperty(SerializationInfo info, StreamingContext context)
///
/// The value.
///
+#pragma warning disable IDE0032 // Use auto property - Value will be serialized into the message body if it is an auto property
public T Value => value;
+#pragma warning restore IDE0032 // Use auto property
///
/// The property .
@@ -99,6 +100,9 @@ public void GetObjectData(SerializationInfo info, StreamingContext context)
info.AddValue("HasValue", HasValue);
}
+#pragma warning disable IDE0032 // Use auto property - value will be serialized into the message body if it is an auto property
T value;
+#pragma warning restore IDE0032 // Use auto property
}
+
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/EndpointConfiguration.cs b/src/NServiceBus.Core/EndpointConfiguration.cs
index 756b67c62e..9919aa9ca3 100644
--- a/src/NServiceBus.Core/EndpointConfiguration.cs
+++ b/src/NServiceBus.Core/EndpointConfiguration.cs
@@ -39,17 +39,9 @@ public EndpointConfiguration(string endpointName)
Settings.Set(new ConsecutiveFailuresConfiguration());
Settings.Set(Pipeline = new PipelineSettings(Settings));
- Notifications = new Notifications();
- Settings.Set(Notifications);
-
ConventionsBuilder = new ConventionsBuilder(Settings);
}
- ///
- /// Access to the current endpoint .
- ///
- public Notifications Notifications { get; }
-
///
/// Access to the pipeline configuration.
///
diff --git a/src/NServiceBus.Core/EndpointCreator.cs b/src/NServiceBus.Core/EndpointCreator.cs
index 5bcd755f09..455abe9058 100644
--- a/src/NServiceBus.Core/EndpointCreator.cs
+++ b/src/NServiceBus.Core/EndpointCreator.cs
@@ -94,8 +94,6 @@ void Configure()
sendComponent = SendComponent.Initialize(pipelineSettings, hostingConfiguration, routingComponent, messageMapper);
- hostingConfiguration.Services.ConfigureComponent(b => settings.Get(), DependencyLifecycle.SingleInstance);
-
receiveComponent = ReceiveComponent.Configure(
receiveConfiguration,
settings.ErrorQueueAddress(),
diff --git a/src/NServiceBus.Core/Features/FeatureConfigurationContext.cs b/src/NServiceBus.Core/Features/FeatureConfigurationContext.cs
index 09deeca327..b10ee6a4bd 100644
--- a/src/NServiceBus.Core/Features/FeatureConfigurationContext.cs
+++ b/src/NServiceBus.Core/Features/FeatureConfigurationContext.cs
@@ -10,7 +10,7 @@
///
/// The context available to features when they are activated.
///
- public class FeatureConfigurationContext
+ public partial class FeatureConfigurationContext
{
internal FeatureConfigurationContext(
IReadOnlySettings settings,
@@ -33,15 +33,6 @@ internal FeatureConfigurationContext(
///
public IReadOnlySettings Settings { get; }
- ///
- /// Access to the container to allow for registrations.
- ///
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(Services),
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public IServiceCollection Container => Services;
-
///
/// Access to the to allow additional service registrations.
///
diff --git a/src/NServiceBus.Core/Headers.cs b/src/NServiceBus.Core/Headers.cs
index d7e1c57f27..1cb1e61655 100644
--- a/src/NServiceBus.Core/Headers.cs
+++ b/src/NServiceBus.Core/Headers.cs
@@ -217,6 +217,11 @@ public static partial class Headers
///
public const string MessageIntent = "NServiceBus.MessageIntent";
+ ///
+ /// Indicates that the message was sent as a non-durable message.
+ ///
+ public const string NonDurableMessage = "NServiceBus.NonDurableMessage";
+
///
/// The time to be received for this message when it was sent the first time.
/// When moved to error and audit this header will be preserved to the original TTBR
diff --git a/src/NServiceBus.Core/Hosting/Helpers/AssemblyScanner.cs b/src/NServiceBus.Core/Hosting/Helpers/AssemblyScanner.cs
index aafd0dde7d..fc704b154d 100644
--- a/src/NServiceBus.Core/Hosting/Helpers/AssemblyScanner.cs
+++ b/src/NServiceBus.Core/Hosting/Helpers/AssemblyScanner.cs
@@ -6,9 +6,7 @@ namespace NServiceBus.Hosting.Helpers
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
-#if NET
using System.Runtime.Loader;
-#endif
using System.Text;
using Logging;
@@ -170,12 +168,9 @@ bool TryLoadScannableAssembly(string assemblyPath, AssemblyScannerResults result
try
{
-#if NET
var context = AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly());
assembly = context.LoadFromAssemblyPath(assemblyPath);
-#else
- assembly = Assembly.LoadFrom(assemblyPath);
-#endif
+
return true;
}
catch (Exception ex) when (ex is BadImageFormatException or FileLoadException)
@@ -259,38 +254,24 @@ internal static string FormatReflectionTypeLoadException(string fileName, Reflec
return sb.ToString();
}
- var nsbAssemblyName = typeof(AssemblyScanner).Assembly.GetName();
- var nsbPublicKeyToken = BitConverter.ToString(nsbAssemblyName.GetPublicKeyToken()).Replace("-", string.Empty).ToLowerInvariant();
- var displayBindingRedirects = false;
var files = new List();
var sbFileLoadException = new StringBuilder();
var sbGenericException = new StringBuilder();
foreach (var ex in e.LoaderExceptions)
{
- var loadException = ex as FileLoadException;
-
- if (loadException?.FileName != null)
+ if (ex is FileLoadException loadException && loadException.FileName != null)
{
- var assemblyName = new AssemblyName(loadException.FileName);
- var assemblyPublicKeyToken = BitConverter.ToString(assemblyName.GetPublicKeyToken()).Replace("-", string.Empty).ToLowerInvariant();
- if (nsbAssemblyName.Name == assemblyName.Name &&
- nsbAssemblyName.CultureInfo.ToString() == assemblyName.CultureInfo.ToString() &&
- nsbPublicKeyToken == assemblyPublicKeyToken)
- {
- displayBindingRedirects = true;
- continue;
- }
-
if (!files.Contains(loadException.FileName))
{
files.Add(loadException.FileName);
sbFileLoadException.NewLine(loadException.FileName);
}
- continue;
}
-
- sbGenericException.NewLine(ex.ToString());
+ else
+ {
+ sbGenericException.NewLine(ex.ToString());
+ }
}
if (sbGenericException.Length > 0)
@@ -302,26 +283,8 @@ internal static string FormatReflectionTypeLoadException(string fileName, Reflec
if (sbFileLoadException.Length > 0)
{
sb.AppendLine();
- sb.NewLine("It looks like you may be missing binding redirects in the config file for the following assemblies:");
+ sb.NewLine("FileLoadExceptions:");
sb.Append(sbFileLoadException);
- sb.NewLine("For more information see http://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.100).aspx");
- }
-
- if (displayBindingRedirects)
- {
- sb.AppendLine();
- sb.NewLine("Try to add the following binding redirects to the config file:");
-
- const string bindingRedirects = @"
-
-
-
-
-
-
-";
-
- sb.NewLine(string.Format(bindingRedirects, nsbAssemblyName.Version.ToString(4)));
}
return sb.ToString();
@@ -437,10 +400,10 @@ bool ShouldScanDependencies(Assembly assembly)
return true;
}
- readonly AssemblyValidator assemblyValidator = new AssemblyValidator();
- internal List AssembliesToSkip = new List();
+ readonly AssemblyValidator assemblyValidator = new();
+ internal List AssembliesToSkip = new();
internal bool ScanNestedDirectories;
- internal List TypesToSkip = new List();
+ internal List TypesToSkip = new();
readonly Assembly assemblyToScan;
readonly string baseDirectoryToScan;
const string NServicebusCoreAssemblyName = "NServiceBus.Core";
diff --git a/src/NServiceBus.Core/Hosting/Helpers/AssemblyValidator.cs b/src/NServiceBus.Core/Hosting/Helpers/AssemblyValidator.cs
index 8baca0d701..ae028fd192 100644
--- a/src/NServiceBus.Core/Hosting/Helpers/AssemblyValidator.cs
+++ b/src/NServiceBus.Core/Hosting/Helpers/AssemblyValidator.cs
@@ -1,45 +1,13 @@
namespace NServiceBus
{
using System;
-#if NETFRAMEWORK
- using System.Reflection;
-#endif
-#if NET
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Security.Cryptography;
-#endif
class AssemblyValidator
{
-#if NETFRAMEWORK
- public void ValidateAssemblyFile(string assemblyPath, out bool shouldLoad, out string reason)
- {
- try
- {
- var token = AssemblyName.GetAssemblyName(assemblyPath).GetPublicKeyToken();
-
- if (IsRuntimeAssembly(token))
- {
- shouldLoad = false;
- reason = "File is a .NET runtime assembly.";
- return;
- }
- }
- catch (BadImageFormatException)
- {
- shouldLoad = false;
- reason = "File is not a .NET assembly.";
- return;
- }
-
- shouldLoad = true;
- reason = "File is a .NET assembly.";
- }
-#endif
-
-#if NET
public void ValidateAssemblyFile(string assemblyPath, out bool shouldLoad, out string reason)
{
using (var stream = File.OpenRead(assemblyPath))
@@ -96,7 +64,6 @@ static byte[] GetPublicKeyToken(byte[] publicKey)
return publicKeyToken;
}
}
-#endif
public static bool IsRuntimeAssembly(byte[] publicKeyToken)
{
diff --git a/src/NServiceBus.Core/Hosting/HostingComponent.cs b/src/NServiceBus.Core/Hosting/HostingComponent.cs
index a3f3ca3528..f5cafd1c07 100644
--- a/src/NServiceBus.Core/Hosting/HostingComponent.cs
+++ b/src/NServiceBus.Core/Hosting/HostingComponent.cs
@@ -17,12 +17,13 @@ partial class HostingComponent
public static HostingComponent Initialize(Configuration configuration)
{
var serviceCollection = configuration.Services;
- serviceCollection.ConfigureComponent(() => configuration.HostInformation, DependencyLifecycle.SingleInstance);
- serviceCollection.ConfigureComponent(() => configuration.CriticalError, DependencyLifecycle.SingleInstance);
+ serviceCollection.AddSingleton(_ => configuration.HostInformation);
+ serviceCollection.AddSingleton(_ => configuration.CriticalError);
foreach (var installerType in configuration.AvailableTypes.Where(t => IsINeedToInstallSomething(t)))
{
- serviceCollection.ConfigureComponent(installerType, DependencyLifecycle.InstancePerCall);
+ serviceCollection.AddTransient(installerType);
+ serviceCollection.AddTransient(sp => (INeedToInstallSomething)sp.GetRequiredService(installerType));
}
// Apply user registrations last, so that user overrides win.
diff --git a/src/NServiceBus.Core/IdGeneration/CombGuid.cs b/src/NServiceBus.Core/IdGeneration/CombGuid.cs
index 86ee77f1de..835b910e52 100644
--- a/src/NServiceBus.Core/IdGeneration/CombGuid.cs
+++ b/src/NServiceBus.Core/IdGeneration/CombGuid.cs
@@ -2,10 +2,6 @@ namespace NServiceBus
{
using System;
using System.Buffers.Binary;
-#if NETFRAMEWORK
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
-#endif
///
/// Generates a Guid using http://www.informit.com/articles/article.asp?p=25862
@@ -23,13 +19,9 @@ internal static Guid Generate(Guid inputGuid, DateTime inputNow)
{
var newGuid = inputGuid;
Span guidArray = stackalloc byte[16];
-#if NET
+
if (!newGuid.TryWriteBytes(guidArray))
-#else
- if (TryWriteBytes(newGuid, guidArray))
-#endif
{
-
guidArray = newGuid.ToByteArray();
}
@@ -66,121 +58,9 @@ internal static Guid Generate(Guid inputGuid, DateTime inputNow)
daysArray.Slice(daysArray.Length - 2).CopyTo(guidArray.Slice(10, 2));
milliSecondsArray.Slice(milliSecondsArray.Length - 4).CopyTo(guidArray.Slice(12, 4));
-#if NET
return new Guid(guidArray);
-#else
- if (!TryParseGuidBytes(guidArray, out Guid readGuid))
- {
- readGuid = new Guid(guidArray.ToArray());
- }
- return readGuid;
-#endif
- }
-
-#if NETFRAMEWORK
-
- static bool TryWriteBytes(Guid guid, Span buffer)
- {
- // Based on https://github.com/dotnet/runtime/blob/9129083c2fc6ef32479168f0555875b54aee4dfb/src/libraries/System.Private.CoreLib/src/System/Guid.cs#L836
-
- if (buffer.Length < 16)
- {
- return false;
- }
-
- if (BitConverter.IsLittleEndian)
- {
- MemoryMarshal.Write(buffer, ref guid);
- return true;
- }
-
- // slower path for BigEndian
- GuidData data = Unsafe.As(ref guid);
-
- buffer[15] = data.K; // hoist bounds checks
- BinaryPrimitives.WriteInt32LittleEndian(buffer, data.A);
- BinaryPrimitives.WriteInt16LittleEndian(buffer.Slice(4), data.B);
- BinaryPrimitives.WriteInt16LittleEndian(buffer.Slice(6), data.C);
- buffer[8] = data.D;
- buffer[9] = data.E;
- buffer[10] = data.F;
- buffer[11] = data.G;
- buffer[12] = data.H;
- buffer[13] = data.I;
- buffer[14] = data.J;
- return true;
}
- // This struct has the fields layed out to be GUID-like in order to read the GUID fields
- // to efficiently write them into memory without having to deal with endianness
- // Do not rename or reorder the fields.
- readonly struct GuidData
- {
- public readonly int A;
- public readonly short B;
- public readonly short C;
- public readonly byte D;
- public readonly byte E;
- public readonly byte F;
- public readonly byte G;
- public readonly byte H;
- public readonly byte I;
- public readonly byte J;
- public readonly byte K;
-
- // Creates a new GUID like struct initialized to the value represented by the
- // arguments. The bytes are specified like this to avoid endianness issues.
- public GuidData(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
- {
- A = a;
- B = b;
- C = c;
- D = d;
- E = e;
- F = f;
- G = g;
- H = h;
- I = i;
- J = j;
- K = k;
- }
- }
-
- static bool TryParseGuidBytes(ReadOnlySpan bytes, out Guid guid)
- {
- if (bytes.Length != GuidSizeInBytes)
- {
- guid = default;
- return false;
- }
-
- if (BitConverter.IsLittleEndian)
- {
- guid = MemoryMarshal.Read(bytes);
- return true;
- }
-
- // copied from https://github.com/dotnet/runtime/blob/9129083c2fc6ef32479168f0555875b54aee4dfb/src/libraries/System.Private.CoreLib/src/System/Guid.cs#L49
- // slower path for BigEndian:
- byte k = bytes[15]; // hoist bounds checks
- int a = BinaryPrimitives.ReadInt32LittleEndian(bytes);
- short b = BinaryPrimitives.ReadInt16LittleEndian(bytes.Slice(4));
- short c = BinaryPrimitives.ReadInt16LittleEndian(bytes.Slice(6));
- byte d = bytes[8];
- byte e = bytes[9];
- byte f = bytes[10];
- byte g = bytes[11];
- byte h = bytes[12];
- byte i = bytes[13];
- byte j = bytes[14];
-
- guid = new Guid(a, b, c, d, e, f, g, h, i, j, k);
- return true;
- }
-
- const int GuidSizeInBytes = 16;
-#endif
-
// Represents new DateTime(1900, 1, 1).Ticks, while this would be more readable having a const here instead of
// a static field the less readable version slightly improves the throughput
const long BaseDateTicks = 599266080000000000; // new DateTime(1900, 1, 1).Ticks
diff --git a/src/NServiceBus.Core/MessageDeserializationException.cs b/src/NServiceBus.Core/MessageDeserializationException.cs
index 0dbd74a730..6879908fe1 100644
--- a/src/NServiceBus.Core/MessageDeserializationException.cs
+++ b/src/NServiceBus.Core/MessageDeserializationException.cs
@@ -9,7 +9,6 @@
/// Wraps the that occurs when the contents of an is deserialized
/// to a list of s.
///
- [Serializable]
public class MessageDeserializationException : SerializationException
{
///
@@ -28,12 +27,5 @@ public MessageDeserializationException(string messageId, Exception innerExceptio
: base("An error occurred while attempting to extract logical messages from incoming physical message " + messageId, innerException)
{
}
-
- ///
- /// Initializes a new instance of .
- ///
- protected MessageDeserializationException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/ConcreteProxyCreator.cs b/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/ConcreteProxyCreator.cs
index 86ca2f0cc3..cd40dab16b 100644
--- a/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/ConcreteProxyCreator.cs
+++ b/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/ConcreteProxyCreator.cs
@@ -22,7 +22,7 @@ public ConcreteProxyCreator()
public Type CreateTypeFrom(Type type)
{
var typeBuilder = moduleBuilder.DefineType(type.FullName + SUFFIX,
- TypeAttributes.Serializable | TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed,
+ TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed,
typeof(object)
);
diff --git a/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/MessageMapper.cs b/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/MessageMapper.cs
index b5a73353bb..b83d7c2762 100644
--- a/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/MessageMapper.cs
+++ b/src/NServiceBus.Core/MessageInterfaces/MessageMapper/Reflection/MessageMapper.cs
@@ -6,7 +6,7 @@ namespace NServiceBus.MessageInterfaces.MessageMapper.Reflection
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
- using System.Runtime.Serialization;
+ using System.Runtime.CompilerServices;
///
/// Uses reflection to map between interfaces and their generated concrete implementations.
@@ -123,7 +123,7 @@ public object CreateInstance(Type t)
if (t.IsInterface || t.IsAbstract)
{
var mapped = GetMappedTypeFor(t);
- return FormatterServices.GetUninitializedObject(mapped);
+ return RuntimeHelpers.GetUninitializedObject(mapped);
}
if (typeToConstructor.TryGetValue(t.TypeHandle, out var ctor))
@@ -131,7 +131,7 @@ public object CreateInstance(Type t)
return ((ConstructorInfo)MethodBase.GetMethodFromHandle(ctor, t.TypeHandle)).Invoke(null);
}
- return FormatterServices.GetUninitializedObject(t);
+ return RuntimeHelpers.GetUninitializedObject(t);
}
void InitType(Type t)
diff --git a/src/NServiceBus.Core/NServiceBus.Core.csproj b/src/NServiceBus.Core/NServiceBus.Core.csproj
index da33480763..374a683a2d 100644
--- a/src/NServiceBus.Core/NServiceBus.Core.csproj
+++ b/src/NServiceBus.Core/NServiceBus.Core.csproj
@@ -1,40 +1,27 @@
- net472;net6.0
+ net8.0NServiceBustrue..\NServiceBus.snk
- 10.0
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
@@ -44,8 +31,6 @@
-
-
diff --git a/src/NServiceBus.Core/Notifications.cs b/src/NServiceBus.Core/Notifications.cs
deleted file mode 100644
index 4377489fc1..0000000000
--- a/src/NServiceBus.Core/Notifications.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-#nullable enable
-
-namespace NServiceBus
-{
- using Faults;
-
- ///
- /// Notifications.
- ///
- public class Notifications
- {
- ///
- /// Push-based error notifications.
- ///
- public ErrorsNotifications Errors { get; } = new ErrorsNotifications();
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/ObjectBuilder/ServiceCollectionExtensions.cs b/src/NServiceBus.Core/ObjectBuilder/ServiceCollectionExtensions.cs
deleted file mode 100644
index fba191aa17..0000000000
--- a/src/NServiceBus.Core/ObjectBuilder/ServiceCollectionExtensions.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-namespace NServiceBus
-{
- using System;
- using System.Linq;
- using Microsoft.Extensions.DependencyInjection;
- using ObjectBuilder;
-
- ///
- /// Contains extension methods for that were formerly provided by .
- ///
- [ObsoleteEx(
- Message = "Use methods on IServiceCollection instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static class ServiceCollectionExtensions
- {
- ///
- /// Configures the given type. Can be used to configure all kinds of properties.
- ///
- /// The to register the types in.
- /// The concrete implementation of the component.
- /// Defines lifecycle semantics for the given type.
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.Add",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void ConfigureComponent(this IServiceCollection serviceCollection, Type concreteComponent, DependencyLifecycle dependencyLifecycle)
- {
- var serviceLifeTime = MapLifeCycle(dependencyLifecycle);
- serviceCollection.Add(new ServiceDescriptor(concreteComponent, concreteComponent, serviceLifeTime));
- RegisterInterfaces(concreteComponent, serviceLifeTime, serviceCollection);
- }
-
- ///
- /// Configures the given type, allowing to fluently configure properties.
- ///
- /// The to register the types in.
- /// Defines lifecycle semantics for the given type.
- [ObsoleteEx(
- Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void ConfigureComponent(this IServiceCollection serviceCollection, DependencyLifecycle dependencyLifecycle)
- {
- serviceCollection.ConfigureComponent(typeof(T), dependencyLifecycle);
- }
-
- ///
- /// Configures the given type, allowing to fluently configure properties.
- ///
- /// Type to configure.
- /// The to register the types in.
- /// Factory method that returns the given type.
- /// Defines lifecycle semantics for the given type.
- [ObsoleteEx(
- Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void ConfigureComponent(this IServiceCollection serviceCollection, Func componentFactory, DependencyLifecycle dependencyLifecycle)
- {
- serviceCollection.ConfigureComponent(_ => componentFactory(), dependencyLifecycle);
- }
-
- ///
- /// Configures the given type, allowing to fluently configure properties.
- ///
- [ObsoleteEx(
- Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void ConfigureComponent(this IServiceCollection serviceCollection, Func componentFactory, DependencyLifecycle dependencyLifecycle)
- {
- var componentType = typeof(T);
- var serviceLifeTime = MapLifeCycle(dependencyLifecycle);
- serviceCollection.Add(new ServiceDescriptor(componentType, p => componentFactory(p), serviceLifeTime));
- RegisterInterfaces(componentType, serviceLifeTime, serviceCollection);
- }
-
- ///
- /// Registers the given instance as the singleton that will be returned
- /// for the given type.
- ///
- [ObsoleteEx(
- Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead.",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void RegisterSingleton(this IServiceCollection serviceCollection, Type lookupType, object instance)
- {
- serviceCollection.AddSingleton(lookupType, instance);
- }
-
- ///
- /// Registers the given instance as the singleton that will be returned
- /// for the given type.
- ///
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.AddSingleton",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static void RegisterSingleton(this IServiceCollection serviceCollection, T instance)
- {
- serviceCollection.RegisterSingleton(typeof(T), instance);
- }
-
- ///
- /// Indicates if a component of the given type has been configured.
- ///
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.GetEnumerator",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static bool HasComponent(this IServiceCollection serviceCollection)
- {
- return serviceCollection.HasComponent(typeof(T));
- }
-
- ///
- /// Indicates if a component of the given type has been configured.
- ///
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.GetEnumerator",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static bool HasComponent(this IServiceCollection serviceCollection, Type componentType)
- {
- return serviceCollection.Any(sd => sd.ServiceType == componentType);
- }
-
- static void RegisterInterfaces(Type component, ServiceLifetime lifetime, IServiceCollection serviceCollection)
- {
- var interfaces = component.GetInterfaces();
- foreach (var serviceType in interfaces)
- {
- // see https://andrewlock.net/how-to-register-a-service-with-multiple-interfaces-for-in-asp-net-core-di/
- serviceCollection.Add(new ServiceDescriptor(serviceType, sp => sp.GetService(component), lifetime));
- }
- }
-
- static ServiceLifetime MapLifeCycle(DependencyLifecycle dependencyLifecycle) => dependencyLifecycle switch
- {
- DependencyLifecycle.InstancePerCall => ServiceLifetime.Transient,
- DependencyLifecycle.SingleInstance => ServiceLifetime.Singleton,
- DependencyLifecycle.InstancePerUnitOfWork => ServiceLifetime.Scoped,
- _ => throw new NotSupportedException($"{dependencyLifecycle} is not supported.")
- };
- }
-}
diff --git a/src/NServiceBus.Core/ObjectBuilder/ServiceProviderExtensions.cs b/src/NServiceBus.Core/ObjectBuilder/ServiceProviderExtensions.cs
deleted file mode 100644
index c8544414cc..0000000000
--- a/src/NServiceBus.Core/ObjectBuilder/ServiceProviderExtensions.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-#pragma warning disable 1591
-
-namespace NServiceBus.ObjectBuilder
-{
- using System;
- using System.Collections.Generic;
- using Microsoft.Extensions.DependencyInjection;
-
- ///
- /// Contains extension methods for that were formerly provided by .
- ///
- public static class ServiceProviderExtensions
- {
- ///
- /// Returns an instantiation of the given type.
- ///
- /// The .
- /// The to build.
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceProvider.GetService",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static object Build(this IServiceProvider serviceProvider, Type typeToBuild) => serviceProvider.GetService(typeToBuild);
-
- ///
- /// Returns a child instance of the container to facilitate deterministic disposal
- /// of all resources built by the child container.
- ///
- /// The .
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceProvider.CreateScope",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static IServiceScope CreateChildBuilder(this IServiceProvider serviceProvider) => serviceProvider.CreateScope();
-
- ///
- /// Creates an instance of the given type, injecting it with all defined dependencies.
- ///
- /// The .
- /// Type to be resolved.
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceProvider.GetService",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static T Build(this IServiceProvider serviceProvider) => serviceProvider.GetService();
-
- ///
- /// For each type that is compatible with T, an instance is created with all dependencies injected, and yielded to the caller.
- ///
- /// The .
- /// Type to be resolved.
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceProvider.GetServices",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static IEnumerable BuildAll(this IServiceProvider serviceProvider) => serviceProvider.GetServices();
-
- ///
- /// For each type that is compatible with the given type, an instance is created with all dependencies injected.
- ///
- /// The .
- /// The to build.
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceProvider.GetServices",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static IEnumerable BuildAll(this IServiceProvider serviceProvider, Type typeToBuild) => serviceProvider.GetServices(typeToBuild);
-
- [ObsoleteEx(
- Message = "The Release method is not supported.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void Release(this IServiceProvider serviceProvider, object instance) => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "The BuildAndDispatch method is not supported anymore. Use `IServiceProvider.GetService(typeToBuild)` and call the action on the returned service.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void BuildAndDispatch(this IServiceProvider serviceProvider, Type typeToBuild, Action action) => throw new NotImplementedException();
- }
-}
-#pragma warning restore 1591
diff --git a/src/NServiceBus.Core/Pipeline/ConnectorContextExtensions.cs b/src/NServiceBus.Core/Pipeline/ConnectorContextExtensions.cs
index 205165f0b3..8bed4c1267 100644
--- a/src/NServiceBus.Core/Pipeline/ConnectorContextExtensions.cs
+++ b/src/NServiceBus.Core/Pipeline/ConnectorContextExtensions.cs
@@ -24,18 +24,6 @@ public static IRoutingContext CreateRoutingContext(this ForkConnector
- /// Creates a based on the current context.
- ///
- public static IRoutingContext CreateRoutingContext(this StageConnector stageConnector, OutgoingMessage outgoingMessage, RoutingStrategy routingStrategy, IForwardingContext sourceContext)
- {
- Guard.ThrowIfNull(outgoingMessage);
- Guard.ThrowIfNull(routingStrategy);
- Guard.ThrowIfNull(sourceContext);
-
- return new RoutingContext(outgoingMessage, routingStrategy, sourceContext);
- }
-
///
/// Creates a based on the current context.
///
@@ -215,18 +203,6 @@ public static IOutgoingPhysicalMessageContext CreateOutgoingPhysicalMessageConte
return new OutgoingPhysicalMessageContext(messageBody, routingStrategies, sourceContext);
}
- ///
- /// Creates a based on the current context.
- ///
- [ObsoleteEx(
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0",
- ReplacementTypeOrMember = "CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, TimeSpan? timeToBeReceived, IIncomingPhysicalMessageContext sourceContext)")]
- public static IAuditContext CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, IIncomingPhysicalMessageContext sourceContext)
- {
- return forkConnector.CreateAuditContext(message, auditAddress, null, sourceContext);
- }
-
///
/// Creates a based on the current context.
///
diff --git a/src/NServiceBus.Core/Pipeline/Outgoing/ImmediateDispatchOptionExtensions.cs b/src/NServiceBus.Core/Pipeline/Outgoing/ImmediateDispatchOptionExtensions.cs
index 331d66683c..e5c472709c 100644
--- a/src/NServiceBus.Core/Pipeline/Outgoing/ImmediateDispatchOptionExtensions.cs
+++ b/src/NServiceBus.Core/Pipeline/Outgoing/ImmediateDispatchOptionExtensions.cs
@@ -5,7 +5,7 @@ namespace NServiceBus
///
/// Provides ways to request immediate dispatch of messages.
///
- public static class ImmediateDispatchOptionExtensions
+ public static partial class ImmediateDispatchOptionExtensions
{
///
/// Requests that the message be dispatched to the transport immediately.
@@ -23,20 +23,6 @@ public static void RequireImmediateDispatch(this ExtendableOptions options)
});
}
- ///
- /// Returns whether immediate dispatch has been requested by or not.
- ///
- /// The options being extended.
- /// True if immediate dispatch was requested, False otherwise.
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(IsImmediateDispatchSet),
- RemoveInVersion = "10.0",
- TreatAsErrorFromVersion = "9.0")]
- public static bool RequiredImmediateDispatch(this ExtendableOptions options)
- {
- return IsImmediateDispatchSet(options);
- }
-
///
/// Returns whether immediate dispatch has been requested by or not.
///
diff --git a/src/NServiceBus.Core/Pipeline/PipelineCache.cs b/src/NServiceBus.Core/Pipeline/PipelineCache.cs
index 92ff888840..1afba61767 100644
--- a/src/NServiceBus.Core/Pipeline/PipelineCache.cs
+++ b/src/NServiceBus.Core/Pipeline/PipelineCache.cs
@@ -15,7 +15,6 @@ public PipelineCache(IServiceProvider rootBuilder, PipelineModifications pipelin
FromMainPipeline(rootBuilder);
FromMainPipeline(rootBuilder);
FromMainPipeline(rootBuilder);
- FromMainPipeline(rootBuilder);
}
public IPipeline Pipeline()
diff --git a/src/NServiceBus.Core/Pipeline/PipelineComponent.cs b/src/NServiceBus.Core/Pipeline/PipelineComponent.cs
index 5ac1c8901b..d519c227e8 100644
--- a/src/NServiceBus.Core/Pipeline/PipelineComponent.cs
+++ b/src/NServiceBus.Core/Pipeline/PipelineComponent.cs
@@ -1,6 +1,7 @@
namespace NServiceBus
{
using System;
+ using Microsoft.Extensions.DependencyInjection;
using Pipeline;
class PipelineComponent
@@ -16,7 +17,7 @@ public static PipelineComponent Initialize(PipelineSettings settings, HostingCom
foreach (var registeredBehavior in modifications.Replacements)
{
- hostingConfiguration.Services.ConfigureComponent(registeredBehavior.BehaviorType, DependencyLifecycle.InstancePerCall);
+ hostingConfiguration.Services.AddTransient(registeredBehavior.BehaviorType);
}
foreach (var step in modifications.Additions)
diff --git a/src/NServiceBus.Core/Pipeline/PipelineExecutionExtensions.cs b/src/NServiceBus.Core/Pipeline/PipelineExecutionExtensions.cs
index 240a44ebc7..f266497ce5 100644
--- a/src/NServiceBus.Core/Pipeline/PipelineExecutionExtensions.cs
+++ b/src/NServiceBus.Core/Pipeline/PipelineExecutionExtensions.cs
@@ -5,10 +5,8 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
-#if NET
- using System.Runtime.InteropServices;
-#endif
using System.Runtime.CompilerServices;
+ using System.Runtime.InteropServices;
using System.Threading.Tasks;
using FastExpressionCompiler;
using Pipeline;
@@ -71,20 +69,12 @@ static Delegate CreateBehaviorCallDelegate(MethodInfo methodInfo, ParameterExpre
return lambdaExpression.CompileFast();
}
-#if NET
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TBehavior GetBehavior(TContext context, int index)
where TContext : class, IBehaviorContext
where TBehavior : class, IBehavior
=> Unsafe.As(
Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(context.Extensions.Behaviors), index));
-#else
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static TBehavior GetBehavior(TContext context, int index)
- where TContext : class, IBehaviorContext
- where TBehavior : class, IBehavior
- => (TBehavior)context.Extensions.Behaviors[index];
-#endif
///
/// context{i} => return TaskEx.CompletedTask;
diff --git a/src/NServiceBus.Core/Pipeline/RegisterStep.cs b/src/NServiceBus.Core/Pipeline/RegisterStep.cs
index f90f0b61b9..9331adb916 100644
--- a/src/NServiceBus.Core/Pipeline/RegisterStep.cs
+++ b/src/NServiceBus.Core/Pipeline/RegisterStep.cs
@@ -48,14 +48,14 @@ protected RegisterStep(string stepId, Type behavior, string description, Func
public Type BehaviorType { get; private set; }
- internal void ApplyContainerRegistration(IServiceCollection container)
+ internal void ApplyContainerRegistration(IServiceCollection serviceCollection)
{
if (factoryMethod != null)
{
return;
}
- container.ConfigureComponent(BehaviorType, DependencyLifecycle.InstancePerCall);
+ serviceCollection.AddTransient(BehaviorType);
}
///
diff --git a/src/NServiceBus.Core/PreObsoleteAttribute.cs b/src/NServiceBus.Core/PreObsoleteAttribute.cs
index bfaf7d261a..f8e6ca84b9 100644
--- a/src/NServiceBus.Core/PreObsoleteAttribute.cs
+++ b/src/NServiceBus.Core/PreObsoleteAttribute.cs
@@ -3,14 +3,22 @@
using System;
///
- /// Meant for staging future obsoletes. Mimics the structure of .
+ /// Meant for staging future obsoletes.
///
+ [AttributeUsage(AttributeTargets.All)]
sealed class PreObsoleteAttribute : Attribute
{
- public string RemoveInVersion { get; set; }
- public string TreatAsErrorFromVersion { get; set; }
+ public PreObsoleteAttribute(string contextUrl)
+ {
+ ContextUrl = contextUrl;
+ }
+
+ public string ContextUrl { get; }
+
public string ReplacementTypeOrMember { get; set; }
+
public string Message { get; set; }
+
public string Note { get; set; }
}
}
diff --git a/src/NServiceBus.Core/Receiving/ReceiveComponent.cs b/src/NServiceBus.Core/Receiving/ReceiveComponent.cs
index 30cd8c9757..6199b34749 100644
--- a/src/NServiceBus.Core/Receiving/ReceiveComponent.cs
+++ b/src/NServiceBus.Core/Receiving/ReceiveComponent.cs
@@ -71,8 +71,6 @@ public static ReceiveComponent Configure(
return new LoadHandlersConnector(b.GetRequiredService());
}, "Gets all the handlers to invoke from the MessageHandler registry based on the message type.");
- pipelineSettings.Register("ExecuteUnitOfWork", new UnitOfWorkBehavior(), "Executes the UoW");
-
pipelineSettings.Register("InvokeHandlers", new InvokeHandlerTerminator(hostingConfiguration.ActivityFactory), "Calls the IHandleMessages.Handle(T)");
var handlerDiagnostics = new Dictionary>();
@@ -246,7 +244,7 @@ public Task Stop(CancellationToken cancellationToken = default)
return Task.WhenAll(receiverStopTasks);
}
- static void RegisterMessageHandlers(MessageHandlerRegistry handlerRegistry, List orderedTypes, IServiceCollection container, ICollection availableTypes)
+ static void RegisterMessageHandlers(MessageHandlerRegistry handlerRegistry, List orderedTypes, IServiceCollection serviceCollection, ICollection availableTypes)
{
var types = new List(availableTypes);
@@ -259,11 +257,12 @@ static void RegisterMessageHandlers(MessageHandlerRegistry handlerRegistry, List
foreach (var t in types.Where(IsMessageHandler))
{
- container.ConfigureComponent(t, DependencyLifecycle.InstancePerUnitOfWork);
+ serviceCollection.AddScoped(t);
+
handlerRegistry.RegisterHandler(t);
}
- container.AddSingleton(handlerRegistry);
+ serviceCollection.AddSingleton(handlerRegistry);
}
public static bool IsMessageHandler(Type type)
diff --git a/src/NServiceBus.Core/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptions.cs b/src/NServiceBus.Core/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptions.cs
index d81910c212..df9ee6b977 100644
--- a/src/NServiceBus.Core/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptions.cs
+++ b/src/NServiceBus.Core/Routing/MessageDrivenSubscriptions/MessageDrivenSubscriptions.cs
@@ -8,11 +8,11 @@ namespace NServiceBus.Features
///
/// Allows subscribers to register by sending a subscription message to this endpoint.
- /// ---
- /// The goal is to remove feature classes that implemented functionality far beyond what features are "supposed" to be.
- /// Many of those features have been moved into components instead. Now that this class is internal in V8 that
- /// refactoring can occur.
///
+
+ // The goal is to remove feature classes that implement functionality far beyond what features are "supposed" to be.
+ // Many of those features have been moved into components instead.
+ // The ObsoleteEx attribute is here so that when it's time to 'RemoveInVersion', the class should not be deleted, but made internal. Once it's internal, refactoring can occur.
[ObsoleteEx(
Message = "It's not recommended to disable the MessageDrivenSubscriptions feature and this option will be removed in future versions. Use 'TransportExtensions.DisablePublishing()' to avoid the need for a subscription storage if this endpoint does not publish events.",
RemoveInVersion = "10",
@@ -79,7 +79,7 @@ protected internal override void Setup(FeatureConfigurationContext context)
var authorizer = context.Settings.GetSubscriptionAuthorizer();
authorizer ??= _ => true;
- context.Container.AddSingleton(authorizer);
+ context.Services.AddSingleton(authorizer);
context.Pipeline.Register(typeof(SubscriptionReceiverBehavior), "Check for subscription messages and execute the requested behavior to subscribe or unsubscribe.");
}
else
@@ -90,7 +90,7 @@ protected internal override void Setup(FeatureConfigurationContext context)
var canReceive = !context.Settings.GetOrDefault("Endpoint.SendOnly");
if (canReceive)
{
- context.Container.AddSingleton(b =>
+ context.Services.AddSingleton(b =>
{
var transportAddressResolver = b.GetRequiredService();
return new SubscriptionRouter(
diff --git a/src/NServiceBus.Core/Routing/SubscriptionMigrationMode/SubscriptionMigrationMode.cs b/src/NServiceBus.Core/Routing/SubscriptionMigrationMode/SubscriptionMigrationMode.cs
index ce8aed88f8..76a2584b71 100644
--- a/src/NServiceBus.Core/Routing/SubscriptionMigrationMode/SubscriptionMigrationMode.cs
+++ b/src/NServiceBus.Core/Routing/SubscriptionMigrationMode/SubscriptionMigrationMode.cs
@@ -46,7 +46,7 @@ protected internal override void Setup(FeatureConfigurationContext context)
{
var endpointInstances = context.Routing.EndpointInstances;
- context.Container.AddSingleton(b =>
+ context.Services.AddSingleton(b =>
{
var transportAddressResolver = b.GetRequiredService();
return new SubscriptionRouter(
@@ -76,7 +76,7 @@ protected internal override void Setup(FeatureConfigurationContext context)
var authorizer = context.Settings.GetSubscriptionAuthorizer();
authorizer ??= _ => true;
- context.Container.AddSingleton(authorizer);
+ context.Services.AddSingleton(authorizer);
context.Pipeline.Register(typeof(SubscriptionReceiverBehavior), "Check for subscription messages and execute the requested behavior to subscribe or unsubscribe.");
}
else
diff --git a/src/NServiceBus.Core/Sagas/SagaMetadata.cs b/src/NServiceBus.Core/Sagas/SagaMetadata.cs
index f48032f085..8aaa3da63a 100644
--- a/src/NServiceBus.Core/Sagas/SagaMetadata.cs
+++ b/src/NServiceBus.Core/Sagas/SagaMetadata.cs
@@ -5,7 +5,7 @@ namespace NServiceBus.Sagas
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
- using System.Runtime.Serialization;
+ using System.Runtime.CompilerServices;
///
/// Contains metadata for known sagas.
@@ -167,7 +167,7 @@ public static SagaMetadata Create(Type sagaType, IEnumerable availableType
throw new Exception($"'{sagaType.Name}' saga type does not implement Saga");
}
- var saga = (Saga)FormatterServices.GetUninitializedObject(sagaType);
+ var saga = (Saga)RuntimeHelpers.GetUninitializedObject(sagaType);
var mapper = new SagaMapper();
saga.ConfigureHowToFindSaga(mapper);
diff --git a/src/NServiceBus.Core/Sagas/Sagas.cs b/src/NServiceBus.Core/Sagas/Sagas.cs
index b537adc502..4fd7667588 100644
--- a/src/NServiceBus.Core/Sagas/Sagas.cs
+++ b/src/NServiceBus.Core/Sagas/Sagas.cs
@@ -58,13 +58,13 @@ protected internal override void Setup(FeatureConfigurationContext context)
sagaMetaModel.VerifyIfEntitiesAreShared();
}
- RegisterCustomFindersInContainer(context.Container, sagaMetaModel);
+ RegisterCustomFindersInContainer(context.Services, sagaMetaModel);
foreach (var t in context.Settings.GetAvailableTypes())
{
if (IsSagaNotFoundHandler(t))
{
- context.Container.ConfigureComponent(t, DependencyLifecycle.InstancePerCall);
+ context.Services.AddTransient(typeof(IHandleSagaNotFound), t);
}
}
@@ -78,11 +78,11 @@ static void RegisterCustomFindersInContainer(IServiceCollection container, IEnum
{
foreach (var finder in sagaMetaModel.SelectMany(m => m.Finders))
{
- container.ConfigureComponent(finder.Type, DependencyLifecycle.InstancePerCall);
+ container.AddTransient(finder.Type);
if (finder.Properties.TryGetValue("custom-finder-clr-type", out var customFinderType))
{
- container.ConfigureComponent((Type)customFinderType, DependencyLifecycle.InstancePerCall);
+ container.AddTransient((Type)customFinderType);
}
}
}
diff --git a/src/NServiceBus.Core/Serialization/SerializationFeature.cs b/src/NServiceBus.Core/Serialization/SerializationFeature.cs
index 43bfc61401..3afcd7711f 100644
--- a/src/NServiceBus.Core/Serialization/SerializationFeature.cs
+++ b/src/NServiceBus.Core/Serialization/SerializationFeature.cs
@@ -6,6 +6,7 @@
using Features;
using Logging;
using MessageInterfaces;
+ using Microsoft.Extensions.DependencyInjection;
using Pipeline;
using Serialization;
using Settings;
@@ -55,9 +56,10 @@ protected internal sealed override void Setup(FeatureConfigurationContext contex
context.Pipeline.Register("DeserializeLogicalMessagesConnector", new DeserializeMessageConnector(resolver, logicalMessageFactory, messageMetadataRegistry, mapper, allowMessageTypeInference), "Deserializes the physical message body into logical messages");
context.Pipeline.Register("SerializeMessageConnector", new SerializeMessageConnector(defaultSerializer, messageMetadataRegistry), "Converts a logical message into a physical message");
- context.Container.ConfigureComponent(_ => mapper, DependencyLifecycle.SingleInstance);
- context.Container.ConfigureComponent(_ => messageMetadataRegistry, DependencyLifecycle.SingleInstance);
- context.Container.ConfigureComponent(_ => logicalMessageFactory, DependencyLifecycle.SingleInstance);
+ context.Services.AddSingleton(_ => mapper);
+ context.Services.AddSingleton(sp => sp.GetRequiredService());
+ context.Services.AddSingleton(_ => messageMetadataRegistry);
+ context.Services.AddSingleton(_ => logicalMessageFactory);
LogFoundMessages(messageMetadataRegistry.GetAllMessages());
diff --git a/src/NServiceBus.Core/Serializers/ReadOnlyStream.cs b/src/NServiceBus.Core/Serializers/ReadOnlyStream.cs
index c7f80ef675..966be0076d 100644
--- a/src/NServiceBus.Core/Serializers/ReadOnlyStream.cs
+++ b/src/NServiceBus.Core/Serializers/ReadOnlyStream.cs
@@ -34,7 +34,6 @@ public override int Read(byte[] buffer, int offset, int count)
return bytesToCopy;
}
-#if NET
public override int Read(Span buffer)
{
var bytesToCopy = Math.Min(memory.Length - position, buffer.Length);
@@ -49,7 +48,6 @@ public override int Read(Span buffer)
position += bytesToCopy;
return bytesToCopy;
}
-#endif
public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException();
diff --git a/src/NServiceBus.Core/SettingsExtensions.cs b/src/NServiceBus.Core/SettingsExtensions.cs
index 636298cd0c..419c8c87ee 100644
--- a/src/NServiceBus.Core/SettingsExtensions.cs
+++ b/src/NServiceBus.Core/SettingsExtensions.cs
@@ -3,7 +3,6 @@ namespace NServiceBus
using System;
using System.Collections.Generic;
using Settings;
- using Transport;
///
/// Provides extensions to the settings holder.
@@ -28,30 +27,6 @@ public static string EndpointName(this IReadOnlySettings settings)
return settings.Get("NServiceBus.Routing.EndpointName");
}
- ///
- /// Returns the transport specific address of the shared queue name of this endpoint.
- ///
- [ObsoleteEx(
- Message = "Use FeatureConfigurationContext.LocalQueueAddress() to access the endpoint queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details.",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static string LocalAddress(this IReadOnlySettings settings)
- {
- Guard.ThrowIfNull(settings);
-
- if (!settings.TryGet(out var receiveConfiguration))
- {
- throw new InvalidOperationException("LocalAddress isn't available until the endpoint configuration is complete.");
- }
-
- if (receiveConfiguration.IsSendOnlyEndpoint)
- {
- throw new InvalidOperationException("LocalAddress isn't available for send only endpoints.");
- }
-
- return settings.Get().ToTransportAddress(receiveConfiguration.LocalQueueAddress);
- }
-
///
/// Returns the shared queue name of this endpoint.
///
@@ -71,35 +46,5 @@ public static string EndpointQueueName(this IReadOnlySettings settings)
return receiveConfiguration.QueueNameBase;
}
-
- ///
- /// Returns the instance-specific queue name of this endpoint.
- ///
- [ObsoleteEx(
- Message = "Use FeatureConfigurationContext.InstanceSpecificQueueAddress() to access the endpoint instance specific queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details.",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public static string InstanceSpecificQueue(this IReadOnlySettings settings)
- {
- Guard.ThrowIfNull(settings);
-
- if (!settings.TryGet(out var receiveConfiguration))
- {
- throw new InvalidOperationException("Instance-specific receive address isn't available until the endpoint configuration is complete.");
- }
-
- if (receiveConfiguration.IsSendOnlyEndpoint)
- {
- throw new InvalidOperationException("Instance-specific receive address isn't available for send only endpoints.");
- }
-
- if (receiveConfiguration.InstanceSpecificQueueAddress == null)
- {
- return null;
- }
-
- return settings.Get().ToTransportAddress(receiveConfiguration.InstanceSpecificQueueAddress);
-
- }
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/Support/RuntimeEnvironment.cs b/src/NServiceBus.Core/Support/RuntimeEnvironment.cs
index 106757d3ba..0700644788 100644
--- a/src/NServiceBus.Core/Support/RuntimeEnvironment.cs
+++ b/src/NServiceBus.Core/Support/RuntimeEnvironment.cs
@@ -5,33 +5,22 @@
///
/// Abstracts the runtime environment.
///
- public static class RuntimeEnvironment
+ public static partial class RuntimeEnvironment
{
static RuntimeEnvironment()
{
- var machineName = Environment.MachineName;
-
- MachineNameAction = () => machineName;
+ MachineName = Environment.MachineName;
}
///
/// Returns the machine name where this endpoint is currently running.
///
- public static string MachineName => MachineNameAction();
-
+ public static string MachineName { get; private set; }
- ///
- /// Get the machine name, allows for overrides.
- ///
- [ObsoleteEx(
- ReplacementTypeOrMember = "HostInfoSettings.UsingHostName",
- TreatAsErrorFromVersion = "9.0",
- RemoveInVersion = "10.0")]
- public static Func MachineNameAction { get; set; }
internal static void SetMachineName(string machineName)
{
- MachineNameAction = () => machineName;
+ MachineName = machineName;
}
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/Transports/ErrorContext.cs b/src/NServiceBus.Core/Transports/ErrorContext.cs
index 5696340fe9..83844765cb 100644
--- a/src/NServiceBus.Core/Transports/ErrorContext.cs
+++ b/src/NServiceBus.Core/Transports/ErrorContext.cs
@@ -19,7 +19,7 @@ public class ErrorContext
/// Transaction (along with connection if applicable) used to receive the message.
/// Number of failed immediate processing attempts.
/// The receive address.
- /// A which can be used to extend the current object.
+ /// A which can be used to extend the current object.
public ErrorContext(Exception exception, Dictionary headers, string nativeMessageId, ReadOnlyMemory body, TransportTransaction transportTransaction, int immediateProcessingFailures, string receiveAddress, ContextBag context)
{
Guard.ThrowIfNull(exception);
diff --git a/src/NServiceBus.Core/Transports/Learning/AsyncFile.cs b/src/NServiceBus.Core/Transports/Learning/AsyncFile.cs
index 6b8e2a2b53..339dc47758 100644
--- a/src/NServiceBus.Core/Transports/Learning/AsyncFile.cs
+++ b/src/NServiceBus.Core/Transports/Learning/AsyncFile.cs
@@ -15,11 +15,7 @@ public static async Task WriteBytes(string filePath, ReadOnlyMemory bytes,
{
using (var stream = CreateWriteStream(filePath, FileMode.Create))
{
-#if NET
await stream.WriteAsync(bytes, cancellationToken).ConfigureAwait(false);
-#else
- await stream.WriteAsync(bytes.ToArray(), 0, bytes.Length, cancellationToken).ConfigureAwait(false);
-#endif
}
}
@@ -83,7 +79,7 @@ public static async Task ReadText(string filePath, CancellationToken can
// This line makes the parameter "required".
cancellationToken.ThrowIfCancellationRequested();
- var result = await stream.ReadToEndAsync().ConfigureAwait(false);
+ var result = await stream.ReadToEndAsync(cancellationToken).ConfigureAwait(false);
return result;
}
diff --git a/src/NServiceBus.Core/Transports/Learning/LearningTransport.cs b/src/NServiceBus.Core/Transports/Learning/LearningTransport.cs
index 0016cd017a..6e80d29749 100644
--- a/src/NServiceBus.Core/Transports/Learning/LearningTransport.cs
+++ b/src/NServiceBus.Core/Transports/Learning/LearningTransport.cs
@@ -8,7 +8,7 @@
///
/// A transport optimized for development and learning use. DO NOT use in production.
///
- public class LearningTransport : TransportDefinition
+ public partial class LearningTransport : TransportDefinition
{
///
/// Creates a new instance of a learning transport.
@@ -35,33 +35,6 @@ public override Task Initialize(HostSettings hostSettin
return Task.FromResult(learningTransportInfrastructure);
}
- ///
- public override string ToTransportAddress(QueueAddress queueAddress)
- {
- var address = queueAddress.BaseAddress;
- PathChecker.ThrowForBadPath(address, "endpoint name");
-
- var discriminator = queueAddress.Discriminator;
-
- if (!string.IsNullOrEmpty(discriminator))
- {
- PathChecker.ThrowForBadPath(discriminator, "endpoint discriminator");
-
- address += "-" + discriminator;
- }
-
- var qualifier = queueAddress.Qualifier;
-
- if (!string.IsNullOrEmpty(qualifier))
- {
- PathChecker.ThrowForBadPath(qualifier, "address qualifier");
-
- address += "-" + qualifier;
- }
-
- return address;
- }
-
///
public override IReadOnlyCollection GetSupportedTransactionModes()
{
diff --git a/src/NServiceBus.Core/Transports/Learning/LearningTransportConfigurationExtensions.cs b/src/NServiceBus.Core/Transports/Learning/LearningTransportConfigurationExtensions.cs
index 43b4e39312..8e4ea30188 100644
--- a/src/NServiceBus.Core/Transports/Learning/LearningTransportConfigurationExtensions.cs
+++ b/src/NServiceBus.Core/Transports/Learning/LearningTransportConfigurationExtensions.cs
@@ -1,43 +1,18 @@
namespace NServiceBus
{
- using System;
-
///
/// Configuration options for the learning transport.
///
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static class LearningTransportConfigurationExtensions
{
- ///
- /// Configures the transport to use the given func as the connection string.
- ///
- [ObsoleteEx(
- Message = "The learning transport does not support a connection string.",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public static TransportExtensions ConnectionString(this TransportExtensions transport, string connectionString)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Configures the transport to use the given func as the connection string.
- ///
- [ObsoleteEx(
- Message = "The learning transport does not support a connection string.",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public static TransportExtensions ConnectionString(this TransportExtensions transport, Func connectionString)
- {
- throw new NotImplementedException();
- }
-
///
/// Configures NServiceBus to use the given transport.
///
- [PreObsolete(
- RemoveInVersion = "10",
- TreatAsErrorFromVersion = "9",
- ReplacementTypeOrMember = "EndpointConfiguration.UseTransport(TransportDefinition)")]
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
+ ReplacementTypeOrMember = "EndpointConfiguration.UseTransport(TransportDefinition)",
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static TransportExtensions UseTransport(this EndpointConfiguration config)
where T : LearningTransport
{
@@ -53,10 +28,9 @@ public static TransportExtensions UseTransport(this Endpoi
///
/// Configures the location where message files are stored.
///
- [PreObsolete(
- RemoveInVersion = "10",
- TreatAsErrorFromVersion = "9",
- ReplacementTypeOrMember = "Use LearningTransport.StorageDirectory")]
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
+ ReplacementTypeOrMember = "Use LearningTransport.StorageDirectory",
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static void StorageDirectory(this TransportExtensions transportExtensions, string path)
{
transportExtensions.Transport.StorageDirectory = path;
@@ -65,10 +39,9 @@ public static void StorageDirectory(this TransportExtensions
///
/// Allows messages of any size to be sent.
///
- [PreObsolete(
- RemoveInVersion = "10",
- TreatAsErrorFromVersion = "9",
- ReplacementTypeOrMember = "Use LearningTransport.RestrictPayloadSize")]
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
+ ReplacementTypeOrMember = "Use LearningTransport.RestrictPayloadSize",
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public static void NoPayloadSizeRestriction(this TransportExtensions transportExtensions)
{
transportExtensions.Transport.RestrictPayloadSize = false;
diff --git a/src/NServiceBus.Core/Transports/TransportDefinition.cs b/src/NServiceBus.Core/Transports/TransportDefinition.cs
index 95a7f2ea5b..c4c0fa1d64 100644
--- a/src/NServiceBus.Core/Transports/TransportDefinition.cs
+++ b/src/NServiceBus.Core/Transports/TransportDefinition.cs
@@ -9,7 +9,7 @@ namespace NServiceBus.Transport
///
/// Defines a transport.
///
- public abstract class TransportDefinition
+ public abstract partial class TransportDefinition
{
TransportTransactionMode transportTransactionMode;
@@ -32,16 +32,6 @@ protected TransportDefinition(TransportTransactionMode defaultTransactionMode, b
///
public abstract Task Initialize(HostSettings hostSettings, ReceiveSettings[] receivers, string[] sendingAddresses, CancellationToken cancellationToken = default);
-
- ///
- /// Translates a object into a transport specific queue address-string.
- ///
- [ObsoleteEx(
- Message = "Inject the ITransportAddressResolver type to access the address translation mechanism at runtime. See the NServiceBus version 8 upgrade guide for further details.",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
- public abstract string ToTransportAddress(QueueAddress address);
-
///
/// Returns a list of all supported transaction modes of this transport.
///
diff --git a/src/NServiceBus.Core/Transports/TransportExtensions.cs b/src/NServiceBus.Core/Transports/TransportExtensions.cs
index 80c8e4c1dc..2bd211b8dd 100644
--- a/src/NServiceBus.Core/Transports/TransportExtensions.cs
+++ b/src/NServiceBus.Core/Transports/TransportExtensions.cs
@@ -1,17 +1,14 @@
namespace NServiceBus
{
- using System;
- using Settings;
using Transport;
///
/// This class provides implementers of transports with an extension mechanism for custom settings via extension methods.
///
/// The transport definition e.g. , etc.
- [PreObsolete(
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
Message = "Configure the transport via the TransportDefinition instance's properties",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public class TransportExtensions where T : TransportDefinition
{
///
@@ -30,47 +27,20 @@ public TransportExtensions(T transport, RoutingSettings routing)
this.routing = routing;
}
- ///
- /// Initializes a new instance of .
- ///
- [ObsoleteEx(
- Message = "TransportExtensions does not use a SettingsHolder. Get an instance from endpointConfiguration.UseTransport(), or configure the transport directly via the TransportDefinition instance's properties.",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions(SettingsHolder settings)
- {
- throw new NotImplementedException();
- }
-
///
/// Routing configuration.
///
- [PreObsolete(
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
ReplacementTypeOrMember = "Use EndpointConfiguration.UseTransport() to access routing settings",
- TreatAsErrorFromVersion = "9",
- RemoveInVersion = "10")]
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public RoutingSettings Routing() => routing;
- ///
- /// Configures the transport to use the connection string with the given name.
- ///
- [ObsoleteEx(
- Message = "Loading named connection strings is no longer supported",
- ReplacementTypeOrMember = "ConnectionString(connectionString)",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions ConnectionStringName(string name)
- {
- throw new NotImplementedException();
- }
-
///
/// Configures the transport to use a specific transaction mode.
///
- [PreObsolete(
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0",
- ReplacementTypeOrMember = "TransportDefinition.TransportTransactionMode")]
+ [PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
+ ReplacementTypeOrMember = "TransportDefinition.TransportTransactionMode",
+ Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
public TransportExtensions Transactions(TransportTransactionMode transportTransactionMode)
{
Transport.TransportTransactionMode = transportTransactionMode;
diff --git a/src/NServiceBus.Core/Transports/TransportSeam.cs b/src/NServiceBus.Core/Transports/TransportSeam.cs
index b4832d4103..0929a7ae17 100644
--- a/src/NServiceBus.Core/Transports/TransportSeam.cs
+++ b/src/NServiceBus.Core/Transports/TransportSeam.cs
@@ -51,8 +51,7 @@ public static TransportSeam Create(Settings transportSeamSettings, HostingCompon
var transportSeam = new TransportSeam(transportDefinition, settings, transportSeamSettings.QueueBindings);
- hostingConfiguration.Services.ConfigureComponent(() =>
- transportSeam.TransportInfrastructure.Dispatcher, DependencyLifecycle.SingleInstance);
+ hostingConfiguration.Services.AddSingleton(_ => transportSeam.TransportInfrastructure.Dispatcher);
hostingConfiguration.Services.AddSingleton(_ =>
new TransportAddressResolver(transportSeam.TransportInfrastructure));
diff --git a/src/NServiceBus.Core/Unicast/Queuing/QueueNotFoundException.cs b/src/NServiceBus.Core/Unicast/Queuing/QueueNotFoundException.cs
index 59f7040b02..f203a3b270 100644
--- a/src/NServiceBus.Core/Unicast/Queuing/QueueNotFoundException.cs
+++ b/src/NServiceBus.Core/Unicast/Queuing/QueueNotFoundException.cs
@@ -1,12 +1,10 @@
namespace NServiceBus.Unicast.Queuing
{
using System;
- using System.Runtime.Serialization;
///
/// Thrown when the queue could not be found.
///
- [Serializable]
public class QueueNotFoundException : Exception
{
///
@@ -24,27 +22,9 @@ public QueueNotFoundException(string queue, string message, Exception inner) : b
Queue = queue;
}
- ///
- /// Initializes a new instance of .
- ///
- protected QueueNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- Queue = info.GetString("Queue");
- }
-
///
/// The queue address.
///
public string Queue { get; set; }
-
- ///
- /// Gets the object data for serialization purposes.
- ///
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData(info, context);
-
- info.AddValue("Queue", Queue);
- }
}
}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/Unicast/RunningEndpointInstance.cs b/src/NServiceBus.Core/Unicast/RunningEndpointInstance.cs
index 010520c5ae..d332edb57a 100644
--- a/src/NServiceBus.Core/Unicast/RunningEndpointInstance.cs
+++ b/src/NServiceBus.Core/Unicast/RunningEndpointInstance.cs
@@ -77,11 +77,9 @@ public async Task Stop(CancellationToken cancellationToken = default)
finally
{
stopSemaphore.Release();
-#if NET
+
await tokenRegistration.DisposeAsync().ConfigureAwait(false);
-#else
- tokenRegistration.Dispose();
-#endif
+
stoppingTokenSource.Dispose();
}
}
diff --git a/src/NServiceBus.Core/UnitOfWork/IManageUnitsOfWork.cs b/src/NServiceBus.Core/UnitOfWork/IManageUnitsOfWork.cs
deleted file mode 100644
index cd2e7448a5..0000000000
--- a/src/NServiceBus.Core/UnitOfWork/IManageUnitsOfWork.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace NServiceBus.UnitOfWork
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading.Tasks;
-
- ///
- /// Interface used by NServiceBus to manage units of work as a part of the
- /// message processing pipeline.
- ///
- [ObsoleteEx(Message = "The unit of work pattern is more straightforward to implement in a pipeline behavior, where the using keyword and try/catch blocks can be used.", ReplacementTypeOrMember = "NServiceBus.Pipeline.Behavior", TreatAsErrorFromVersion = "9", RemoveInVersion = "10")]
- [SuppressMessage("Code", "PS0018:A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext", Justification = "Obsolete.")]
- public interface IManageUnitsOfWork
- {
- ///
- /// Called before all message handlers and modules.
- ///
- /// This exception will be thrown if null is returned. Return a Task or mark the method as async.
- Task Begin();
-
- ///
- /// Called after all message handlers and modules, if an error has occurred the exception will be passed.
- ///
- /// This exception will be thrown if null is returned. Return a Task or mark the method as async.
- Task End(Exception ex = null);
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/UnitOfWork/TransactionScopes/TransactionScopeUnitOfWorkBehavior.cs b/src/NServiceBus.Core/UnitOfWork/TransactionScopes/TransactionScopeUnitOfWorkBehavior.cs
index 8281aaba07..5a843ed5e1 100644
--- a/src/NServiceBus.Core/UnitOfWork/TransactionScopes/TransactionScopeUnitOfWorkBehavior.cs
+++ b/src/NServiceBus.Core/UnitOfWork/TransactionScopes/TransactionScopeUnitOfWorkBehavior.cs
@@ -36,7 +36,6 @@ public Registration(TransactionOptions transactionOptions) : base("HandlerTransa
"Makes sure that the handlers gets wrapped in a transaction scope",
b => new TransactionScopeUnitOfWorkBehavior(transactionOptions))
{
- InsertAfter("ExecuteUnitOfWork");
}
}
}
diff --git a/src/NServiceBus.Core/UnitOfWork/UnitOfWorkBehavior.cs b/src/NServiceBus.Core/UnitOfWork/UnitOfWorkBehavior.cs
deleted file mode 100644
index c8f564ed4e..0000000000
--- a/src/NServiceBus.Core/UnitOfWork/UnitOfWorkBehavior.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-namespace NServiceBus
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using System.Threading.Tasks;
- using Microsoft.Extensions.DependencyInjection;
- using Pipeline;
- using UnitOfWork;
-
- class UnitOfWorkBehavior : IBehavior
- {
- public Task Invoke(IIncomingPhysicalMessageContext context, Func next)
- {
- if (hasUnitsOfWork)
- {
- return InvokeUnitsOfWork(context, next);
- }
-
- return next(context);
- }
-
- async Task InvokeUnitsOfWork(IIncomingPhysicalMessageContext context, Func next)
- {
- var unitsOfWork = new Stack();
-
- try
- {
- var hasUow = false;
- foreach (var uow in context.Builder.GetServices())
- {
- hasUow = true;
- unitsOfWork.Push(uow);
- await uow.Begin()
- .ThrowIfNull()
- .ConfigureAwait(false);
- }
-
- hasUnitsOfWork = hasUow;
-
- await next(context).ConfigureAwait(false);
-
- while (unitsOfWork.Count > 0)
- {
- var popped = unitsOfWork.Pop();
- await popped.End()
- .ThrowIfNull()
- .ConfigureAwait(false);
- }
- }
- catch (MessageDeserializationException)
- {
- throw;
- }
- catch (Exception ex) when (!ex.IsCausedBy(context.CancellationToken))
- {
- var trailingExceptions = await AppendEndExceptions(unitsOfWork, ex, context.CancellationToken).ConfigureAwait(false);
- if (trailingExceptions.Any())
- {
- trailingExceptions.Insert(0, ex);
- throw new AggregateException(trailingExceptions);
- }
- throw;
- }
- }
-
- static async Task> AppendEndExceptions(Stack unitsOfWork, Exception initialException, CancellationToken cancellationToken)
- {
- var exceptionsToThrow = new List();
- while (unitsOfWork.Count > 0)
- {
- var uow = unitsOfWork.Pop();
- try
- {
- await uow.End(initialException)
- .ThrowIfNull()
- .ConfigureAwait(false);
- }
- catch (Exception endException)
- {
- exceptionsToThrow.Add(endException);
- }
- }
- return exceptionsToThrow;
- }
-
- volatile bool hasUnitsOfWork = true;
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.Core/init.ps1 b/src/NServiceBus.Core/init.ps1
deleted file mode 100644
index 3029acc3d2..0000000000
--- a/src/NServiceBus.Core/init.ps1
+++ /dev/null
@@ -1,67 +0,0 @@
-param($installPath, $toolsPath, $package, $project)
-
-$packageVersion = 'Unknown'
-$noticeEvent = 'noticeEvent'
-$jobName = 'analytics'
-
-# cleanup previous runs
-Get-Job | ? { $_.Name -eq $jobName } | Remove-Job -Force -ErrorAction SilentlyContinue
-
-if ($package) {
- $packageVersion = $package.Version
-}
-
-# Define script to run in background job
-$jobScriptBlock = {
- param($packageVersion, $noticeEvent)
-
- # Set Tracing on within the Job
- Set-PSDebug -Trace 2
-
- # Setup event forwarding to foreground
- Register-EngineEvent -SourceIdentifier $noticeEvent -Forward
-
- $nserviceBusKeyPath = 'HKCU:SOFTWARE\NServiceBus'
- $platformKeyPath = 'HKCU:SOFTWARE\ParticularSoftware'
-
- if ((Test-Path $nserviceBusKeyPath) -or (Test-Path $platformKeyPath)) {
- New-Event -SourceIdentifier $noticeEvent -Sender "analytics" -MessageData "existing"
- }
- else {
- New-Event -SourceIdentifier $noticeEvent -Sender "analytics" -MessageData "newuser"
-
- # Set Flag to bypass first time user feedback in Platform Installer
- New-Item -Path $platformKeyPath -Force | Out-Null
- Set-ItemProperty -Path $platformKeyPath -Name 'NuGetUser' -Value 'true' -Force
-
- # Post Version to particular.net
- $wc = New-Object System.Net.WebClient
- try {
- $url = 'https://api.particular.net/googleanalytics/reportfirsttimeinstall'
- $postData = New-Object System.Collections.Specialized.NameValueCollection
- $postData.Add("version", $packageversion)
- $wc.UseDefaultCredentials = $true
- $wc.UploadValues($url, "post", $postdata)
- }
- finally {
- # Dispose
- Remove-Variable -Name wc
- }
- }
-}
-
-$notice = @"
-Reporting first time usage and version information to www.particular.net.
-This call does not collect any personal information. For more details,
-see the License Agreement and the Privacy Policy available here: https://particular.net/licenseagreement.
-"@
-
-# Run JobScript
-$job = Start-Job -ScriptBlock $jobScriptBlock -Name $jobName -ArgumentList $packageVersion, $noticeEvent
-
-# Wait for show notice event
-$event = Wait-Event -SourceIdentifier $noticeEvent -Timeout 5
-Remove-Event -SourceIdentifier $noticeEvent -ErrorAction SilentlyContinue
-if ($event.MessageData -eq "newuser") {
- Write-Host $notice
-}
diff --git a/src/NServiceBus.Core/obsoletes-v8.cs b/src/NServiceBus.Core/obsoletes-v8.cs
deleted file mode 100644
index 77da39f6d7..0000000000
--- a/src/NServiceBus.Core/obsoletes-v8.cs
+++ /dev/null
@@ -1,1725 +0,0 @@
-#pragma warning disable 1591
-#pragma warning disable PS0013 // A Func used as a method parameter with a Task, ValueTask, or ValueTask return type argument should have at least one CancellationToken parameter type argument unless it has a parameter type argument implementing ICancellableContext
-#pragma warning disable PS0018 // A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext
-
-namespace NServiceBus.Gateway.Deduplication
-{
- using System;
- using System.Threading.Tasks;
- using Extensibility;
-
- [ObsoleteEx(
- Message = "Gateway persistence has been moved to the NServiceBus.Gateway dedicated package.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public interface IDeduplicateMessages
- {
- Task DeduplicateMessage(string clientId, DateTime timeReceived, ContextBag context);
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Container;
- using ObjectBuilder.Common;
- using Settings;
-
- public partial class EndpointConfiguration
- {
- [ObsoleteEx(
- Message = "Use the externally managed container mode to integrate with third party dependency injection containers.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public void UseContainer(Action customizations = null) where T : ContainerDefinition, new()
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Use the externally managed container mode to integrate with third party dependency injection containers.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public void UseContainer(Type definitionType)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Use the externally managed container mode to integrate with third party dependency injection containers.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public void UseContainer(IContainer builder)
- {
- throw new NotImplementedException();
- }
- }
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = "EndpointConfiguration.UseTransport(TransportDefinition)")]
- [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
- public static class UseTransportExtensions
- {
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = "EndpointConfiguration.UseTransport(TransportDefinition)")]
- [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
- public static TransportExtensions UseTransport(this EndpointConfiguration endpointConfiguration, Type transportDefinitionType)
- {
- throw new NotImplementedException();
- }
- }
-
- public static partial class Headers
- {
- [ObsoleteEx(
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0",
- Message = "Not intended for public usage.")]
- public const string HeaderName = "Header";
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public const string NonDurableMessage = "NServiceBus.NonDurableMessage";
- }
-
- [ObsoleteEx(
- Message = "Gateway persistence has been moved to the NServiceBus.Gateway dedicated package.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public static class InMemoryGatewayPersistenceConfigurationExtensions
- {
- [ObsoleteEx(
- Message = "Gateway persistence has been moved to the NServiceBus.Gateway dedicated package.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public static void GatewayDeduplicationCacheSize(this PersistenceExtensions persistenceExtensions, int maxSize)
- {
- throw new NotImplementedException();
- }
- }
-
- [ObsoleteEx(
- Message = "Transport infrastructure setup control is not based on the installer configuration.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public static class ConfigureQueueCreation
- {
- [ObsoleteEx(
- Message = "Transport infrastructure setup control is not based on the installer configuration.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public static void DoNotCreateQueues(this EndpointConfiguration config)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Transport infrastructure setup control is not based on the installer configuration.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public static bool CreateQueues(this ReadOnlySettings settings)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Container
-{
- [ObsoleteEx(
- Message = "The NServiceBus dependency injection container API has been deprecated. Use the externally managed container mode to use custom containers.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public abstract class ContainerDefinition
- {
- }
-
- [ObsoleteEx(
- Message = "The NServiceBus dependency injection container API has been deprecated. Use the externally managed container mode to use custom containers.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public class ContainerCustomizations
- {
- ContainerCustomizations()
- {
- // private ctor
- }
- }
-}
-
-namespace NServiceBus.ObjectBuilder
-{
- using System;
- using System.Collections.Generic;
- using Microsoft.Extensions.DependencyInjection;
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(IServiceProvider),
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0")]
- public interface IBuilder : IDisposable
- {
- [ObsoleteEx(Message = "The Build method is not supported anymore.", ReplacementTypeOrMember = nameof(IServiceProvider.GetService), TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- object Build(Type typeToBuild);
-
- [ObsoleteEx(Message = "The CreateChildBuilder method is not supported anymore.", ReplacementTypeOrMember = nameof(ServiceProviderServiceExtensions.CreateScope), TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- IBuilder CreateChildBuilder();
-
- [ObsoleteEx(Message = "The Build method is not supported anymore.", ReplacementTypeOrMember = nameof(ServiceProviderServiceExtensions.GetService), TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- T Build();
-
- [ObsoleteEx(Message = "The BuildAll method is not supported anymore.", ReplacementTypeOrMember = nameof(ServiceProviderServiceExtensions.GetServices), TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- IEnumerable BuildAll();
-
- [ObsoleteEx(Message = "The BuildAll method is not supported anymore.", ReplacementTypeOrMember = nameof(ServiceProviderServiceExtensions.GetServices), TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- IEnumerable BuildAll(Type typeToBuild);
-
- [ObsoleteEx(Message = "The Release method is not supported anymore.", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- void Release(object instance);
-
- [ObsoleteEx(Message = "The BuildAndDispatch method is not supported anymore.", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- void BuildAndDispatch(Type typeToBuild, Action action);
- }
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(IServiceCollection),
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public interface IConfigureComponents
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.ConfigureComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void ConfigureComponent(Type concreteComponent, DependencyLifecycle dependencyLifecycle);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.ConfigureComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void ConfigureComponent(DependencyLifecycle dependencyLifecycle);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.ConfigureComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void ConfigureComponent(Func componentFactory, DependencyLifecycle dependencyLifecycle);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.ConfigureComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void ConfigureComponent(Func componentFactory, DependencyLifecycle dependencyLifecycle);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.AddSingleton",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void RegisterSingleton(Type lookupType, object instance);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.AddSingleton",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- void RegisterSingleton(T instance);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.HasComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- bool HasComponent();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IServiceCollection.HasComponent",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- bool HasComponent(Type componentType);
- }
-}
-
-namespace NServiceBus.ObjectBuilder.Common
-{
- using System;
-
- [ObsoleteEx(
- Message = "The NServiceBus dependency injection container API has been deprecated. Use the externally managed container mode to use custom containers.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public interface IContainer : IDisposable
- {
- }
-}
-
-namespace NServiceBus.Features
-{
- using System;
-
- [ObsoleteEx(
- Message = "Gateway persistence has been moved to the NServiceBus.Gateway dedicated package.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public class InMemoryGatewayPersistence
- {
- internal InMemoryGatewayPersistence() => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- public abstract partial class StorageType
- {
- [ObsoleteEx(
- Message = "Gateway persistence has been moved to the NServiceBus.Gateway dedicated package.",
- RemoveInVersion = "9.0.0",
- TreatAsErrorFromVersion = "8.0.0")]
- public sealed class GatewayDeduplication
- {
- internal GatewayDeduplication() => throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Faults
-{
- using System;
-
- public class ErrorsNotifications
- {
-#pragma warning disable 67
-
- [ObsoleteEx(
- Message = "The .NET event based error notifications will be deprecated in favor of Task-based callbacks. Use endpointConfiguration.Recoverability().Failed(settings => settings.OnMessageSentToErrorQueue(callback)) instead.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public event EventHandler MessageSentToErrorQueue;
-
- [ObsoleteEx(
- Message = "The .NET event based error notifications will be deprecated in favor of Task-based callbacks. Use endpointConfiguration.Recoverability().Immediate(settings => settings.OnMessageBeingRetried(callback)) instead.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public event EventHandler MessageHasFailedAnImmediateRetryAttempt;
-
- [ObsoleteEx(
- Message = "The .NET event based error notifications will be deprecated in favor of Task-based callbacks. Use endpointConfiguration.Recoverability().Delayed(settings => settings.OnMessageBeingRetried(callback)) instead.",
- RemoveInVersion = "9.0",
- TreatAsErrorFromVersion = "8.0")]
- public event EventHandler MessageHasBeenSentToDelayedRetries;
-
-#pragma warning restore 67
- }
-}
-
-namespace NServiceBus.Settings
-{
- using System;
-
- public partial class SettingsHolder
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "Set(T value)",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public void Set(object value)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "SetDefault(T value)",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public void SetDefault(object value)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Settings;
-
- // NOTE: This class no longer is a base class of TransportExtensions, so all these items can be obsolete without affecting anything
-
- [ObsoleteEx(
- Message = "Configure the transport via the TransportDefinition instance's properties",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public class TransportExtensions
- {
- [ObsoleteEx(
- Message = "Configure the transport via the TransportDefinition instance's properties",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions(SettingsHolder settings)
- {
- }
-
- [ObsoleteEx(
- Message = "The ability to used named connection strings has been removed. Instead, load the connection string in your code and pass the value to TransportExtensions.ConnectionString(connectionString)",
- ReplacementTypeOrMember = "ConnectionString(connectionString)",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions ConnectionStringName(string name)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Setting connection string at the endpoint level is no longer supported. Transport specific configuration options should be used instead",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions ConnectionString(string connectionString)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Setting connection string at the endpoint level is no longer supported. Transport specific configuration options should be used instead",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public TransportExtensions ConnectionString(Func connectionString)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0",
- ReplacementTypeOrMember = "TransportDefinition.TransportTransactionMode")]
- public TransportExtensions Transactions(TransportTransactionMode transportTransactionMode)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- [ObsoleteEx(TreatAsErrorFromVersion = "8", RemoveInVersion = "9")]
- public static class ConfigureForwarding
- {
- [ObsoleteEx(
- Message = "Message forwarding is no longer supported natively by NServiceBus. For auditing messages, use endpointConfiguration.AuditProcessedMessagesTo(address). If true message forwarding capabilities are needed, use a custom pipeline behavior, an example of which can be found in the documentation.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void ForwardReceivedMessagesTo(this EndpointConfiguration config, string address)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Features
-{
- using System;
-
- [ObsoleteEx(
- Message = "Message forwarding is no longer supported, but can be implemented as a custom pipeline behavior.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class ForwardReceivedMessages
- {
- internal ForwardReceivedMessages() => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Pipeline
-{
- using System;
-
- [ObsoleteEx(
- Message = "Message forwarding is no longer supported, but can be implemented as a custom pipeline behavior.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IForwardingContext : IBehaviorContext
- {
- }
-
- public partial class PipelineSettings
- {
- [ObsoleteEx(
- Message = "Removing behaviors from the pipeline is discouraged, to disable a behavior replace the behavior by an empty one. Documentation: https://docs.particular.net/nservicebus/pipeline/manipulate-with-behaviors ",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public void Remove(string stepId)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Pipeline;
- using Transport;
-
- public static partial class ConnectorContextExtensions
- {
- [ObsoleteEx(
- Message = "Message forwarding is no longer supported, but can be implemented as a custom pipeline behavior.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static IForwardingContext CreateForwardingContext(this ForkConnector forwardingContext, OutgoingMessage message, string forwardingAddress, IIncomingPhysicalMessageContext sourceContext)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Unicast
-{
- using System;
-
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class BuilderExtensions
- {
- [ObsoleteEx(
- Message = "Replace usages of ForEach with a foreach loop",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void ForEach(this IServiceProvider builder, Action action)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- [ObsoleteEx(
- Message = "The built-in scheduler is no longer supported, see our upgrade guide for details on how to migrate to plain .NET Timers",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class ScheduledTask
- {
- internal ScheduledTask() => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
-
-
- [ObsoleteEx(
- Message = "The built-in scheduler is no longer supported, see our upgrade guide for details on how to migrate to plain .NET Timers",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class ScheduleExtensions
- {
- public static Task ScheduleEvery(this IMessageSession session, TimeSpan timeSpan, Func task)
- {
- throw new NotImplementedException();
- }
-
- public static Task ScheduleEvery(this IMessageSession session, TimeSpan timeSpan, string name, Func task)
- {
- throw new NotImplementedException();
-
- }
- }
-}
-
-namespace NServiceBus.Features
-{
- [ObsoleteEx(
- Message = "The built-in scheduler is no longer supported, see our upgrade guide for details on how to migrate to plain .NET Timers",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class Scheduler
- {
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Outbox;
- using Persistence;
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public class InMemoryPersistence : PersistenceDefinition
- {
- }
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public class InMemoryTimeoutPersistence
- {
- }
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public class InMemorySubscriptionPersistence
- {
- }
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public class InMemorySagaPersistence
- {
- }
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public static class InMemoryOutboxSettingsExtensions
- {
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public static OutboxSettings TimeToKeepDeduplicationData(this OutboxSettings settings, TimeSpan time)
- {
- throw new NotSupportedException();
- }
- }
-
- [ObsoleteEx(Message = "The InMemoryPersistence has been moved to a dedicated Nuget Package called NServiceBus.Persistence.NonDurable and has been renamed to NonDurablePersistence", TreatAsErrorFromVersion = "8.0.0", RemoveInVersion = "9.0.0")]
- public class InMemoryOutboxPersistence
- {
- }
-}
-
-namespace NServiceBus
-{
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class NonDurableDelivery
- {
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Settings;
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class DurableMessagesConfig
- {
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void EnableDurableMessages(this EndpointConfiguration config)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void DisableDurableMessages(this EndpointConfiguration config)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static bool DurableMessagesEnabled(this ReadOnlySettings settings)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class DurableMessagesConventionExtensions
- {
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static ConventionsBuilder DefiningExpressMessagesAs(this ConventionsBuilder builder, Func definesExpressMessageType)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- [ObsoleteEx(
- Message = "Non-durable delivery support has been moved to the transports that can support it. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
- public sealed class ExpressAttribute : Attribute
- {
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- [ObsoleteEx(
- Message = "Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for more details.",
- ReplacementTypeOrMember = "NServiceBus.DateTimeOffsetExtensions",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class DateTimeExtensions
- {
- [ObsoleteEx(
- Message = "Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for more details.",
- ReplacementTypeOrMember = "NServiceBus.DateTimeOffsetHelper.ToWireFormattedString",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static string ToWireFormattedString(DateTime dateTime)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "Public APIs no longer use DateTime but DateTimeOffset. See the upgrade guide for more details.",
- ReplacementTypeOrMember = "NServiceBus.DateTimeOffsetHelper.ToDateTimeOffset",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static DateTime ToUtcDateTime(string wireFormattedString)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- public abstract partial class StorageType
- {
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public sealed class Timeouts
- {
- internal Timeouts()
- {
- throw new NotImplementedException();
- }
- }
- }
-
- public class TimeoutManagerConfiguration
- {
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- internal TimeoutManagerConfiguration() => throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed. See the upgrade guide for more details",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class TimeoutManagerConfigurationExtensions
- {
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static TimeoutManagerConfiguration TimeoutManager(this EndpointConfiguration endpointConfiguration)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void LimitMessageProcessingConcurrencyTo(this TimeoutManagerConfiguration timeoutManagerConfiguration, int maxConcurrency)
- {
- throw new NotImplementedException();
- }
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class ConfigurationTimeoutExtensions
- {
- [ObsoleteEx(
- Message = "The timeout manager has been removed. See the upgrade guide for more details",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void TimeToWaitBeforeTriggeringCriticalErrorOnTimeoutOutages(this EndpointConfiguration config, TimeSpan timeToWait)
- {
- throw new NotImplementedException();
- }
- }
-
-}
-
-namespace NServiceBus.Features
-{
- using System;
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class TimeoutManager
- {
- internal TimeoutManager() => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Timeout.Core
-{
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using Extensibility;
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IPersistTimeouts
- {
- Task Add(TimeoutData timeout, ContextBag context);
-
- Task TryRemove(string timeoutId, ContextBag context);
-
- Task Peek(string timeoutId, ContextBag context);
-
- Task RemoveTimeoutBy(Guid sagaId, ContextBag context);
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IQueryTimeouts
- {
- Task GetNextChunk(DateTime startSlice);
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class TimeoutData
- {
- public string Id => throw new NotImplementedException();
-
- public string Destination => throw new NotImplementedException();
-
- public Guid SagaId => throw new NotImplementedException();
-
- public byte[] State => throw new NotImplementedException();
-
- public DateTime Time => throw new NotImplementedException();
-
- public string OwningTimeoutManager => throw new NotImplementedException();
-
- public Dictionary Headers => throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class TimeoutsChunk
- {
- public TimeoutsChunk(Timeout[] dueTimeouts, DateTime nextTimeToQuery)
- {
- throw new NotImplementedException();
- }
-
- public Timeout[] DueTimeouts => throw new NotImplementedException();
-
- public DateTime NextTimeToQuery => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public struct Timeout
- {
- public Timeout(string id, DateTime dueTime)
- {
- throw new NotImplementedException();
- }
-
- public string Id => throw new NotImplementedException();
-
- public DateTime DueTime => throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.DelayedDelivery
-{
- using System;
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static class ExternalTimeoutManagerConfigurationExtensions
- {
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void UseExternalTimeoutManager(this EndpointConfiguration endpointConfiguration, string externalTimeoutManagerAddress)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System.Threading.Tasks;
- using Pipeline;
-
- [ObsoleteEx(
- Message = "The timeout manager has been removed in favor of native delayed delivery support provided by transports. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface ICancelDeferredMessages
- {
- Task CancelDeferredMessages(string messageKey, IBehaviorContext context);
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System.Threading.Tasks;
- using Extensibility;
-
- [ObsoleteEx(
- Message = "The IDispatchMessages interface has been removed. See the upgrade guide for more details.",
- ReplacementTypeOrMember = nameof(IMessageDispatcher),
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IDispatchMessages
- {
- ///
- /// Dispatches the given operations to the transport.
- ///
- Task Dispatch(TransportOperations outgoingMessages, TransportTransaction transaction, ContextBag context);
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System.Threading.Tasks;
-
- [ObsoleteEx(
- Message = "Queue creation is done by TransportDefinition.Initialize",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface ICreateQueues
- {
- [ObsoleteEx(
- Message = "Queue creation is done by TransportDefinition.Initialize",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Task CreateQueueIfNecessary(QueueBindings queueBindings, string identity);
- }
-}
-
-namespace NServiceBus.Transport
-{
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(ReceiveSettings),
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class PushSettings
- {
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using System.Threading.Tasks;
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(IMessageReceiver),
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IPushMessages
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "IMessageReceiver.Initialize",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Task Init(Func onMessage,
- Func> onError,
- CriticalError criticalError,
- PushSettings settings);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IMessageReceiver.StartReceive",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- void Start(PushRuntimeSettings limitations);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "IMessageReceiver.StopReceive",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Task Stop();
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
-
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class OutboundRoutingPolicy
- {
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public OutboundRoutingPolicy(OutboundRoutingType sends, OutboundRoutingType publishes, OutboundRoutingType replies)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "This property is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public OutboundRoutingType Sends => throw new NotImplementedException();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "TransportDefinition.SupportsPublishSubscribe",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public OutboundRoutingType Publishes => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "This property is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public OutboundRoutingType Replies => throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- Message = "This enum is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public enum OutboundRoutingType
- {
- [ObsoleteEx(
- Message = "This enum is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Unicast,
- [ObsoleteEx(
- Message = "This enum is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Multicast
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using System.Threading.Tasks;
-
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class TransportSubscriptionInfrastructure
- {
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public TransportSubscriptionInfrastructure(Func subscriptionManagerFactory)
- {
- throw new NotImplementedException();
- }
- }
-
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public class TransportSendInfrastructure
- {
- [ObsoleteEx(
- Message = "This type is no longer necessary when implementing a transport",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public TransportSendInfrastructure(Func dispatcherFactory,
- Func> preStartupCheck)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "TransportInfrastructure.Dispatcher",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public Func DispatcherFactory => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "Pre-startup checks have been removed",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public Func> PreStartupCheck => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using System.Threading.Tasks;
- using Extensibility;
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(ISubscriptionManager),
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public interface IManageSubscriptions
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "ISubscriptionManager.SubscribeAll",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Task Subscribe(Type eventType, ContextBag context);
-
- [ObsoleteEx(
- ReplacementTypeOrMember = "ISubscriptionManager.Unsubscribe",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Task Unsubscribe(Type eventType, ContextBag context);
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Collections.Generic;
- using NServiceBus.Transport;
- using Routing;
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = nameof(QueueAddress))]
- public struct LogicalAddress
- {
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- Message = "Directly construct a QueueAddress.")]
- public static LogicalAddress CreateRemoteAddress(EndpointInstance endpointInstance)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- Message = "Directly construct a QueueAddress with the queueName as the BaseAddress.")]
- public static LogicalAddress CreateLocalAddress(string queueName, IReadOnlyDictionary properties)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- Message = "Directly construct a QueueAddress with the qualifier.")]
- public LogicalAddress CreateQualifiedAddress(string qualifier)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- Message = "Directly construct a QueueAddress with the discriminator.")]
- public LogicalAddress CreateIndividualizedAddress(string discriminator)
- {
- throw new NotImplementedException();
- }
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = "QueueAddress.Qualifier")]
- public string Qualifier => throw new NotImplementedException();
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = nameof(QueueAddress))]
- public EndpointInstance EndpointInstance => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Settings;
-
- public static partial class SettingsExtensions
- {
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8",
- ReplacementTypeOrMember = "SettingsExtensions.EndpointQueueName")]
- public static LogicalAddress LogicalAddress(this ReadOnlySettings settings)
- {
- throw new NotImplementedException();
- }
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using System.Collections.Generic;
-
- public partial class QueueBindings
- {
- [ObsoleteEx(
- Message = "Receiving addresses are automatically registered.",
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public IReadOnlyCollection ReceivingAddresses => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "Receiving addresses are automatically registered.",
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public void BindReceiving(string address) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.DeliveryConstraints
-{
- using System;
- using NServiceBus.Transport;
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public abstract class DeliveryConstraint
- {
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- protected DeliveryConstraint() { }
- }
-
- public static class DeliveryConstraintContextExtensions
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static void AddDeliveryConstraint(this Extensibility.ContextBag context, DeliveryConstraint constraint) => throw new NotImplementedException();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static System.Collections.Generic.List GetDeliveryConstraints(this Extensibility.ContextBag context) => throw new NotImplementedException();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static void RemoveDeliveryConstraint(this Extensibility.ContextBag context, DeliveryConstraint constraint) => throw new NotImplementedException();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static bool TryGetDeliveryConstraint(this Extensibility.ContextBag context, out T constraint)
- where T : DeliveryConstraint => throw new NotImplementedException();
-
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(DispatchProperties),
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static bool TryRemoveDeliveryConstraint(this Extensibility.ContextBag context, out T constraint)
- where T : DeliveryConstraint => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using Settings;
-
- public static class LogicalAddressExtensions
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "TransportDefinition.ToTransportAddress",
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static string GetTransportAddress(this ReadOnlySettings settings, LogicalAddress logicalAddress) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Pipeline
-{
- using System;
- using System.ComponentModel;
-
- ///
- /// Provides context for subscription requests.
- ///
- public partial interface ISubscribeContext
- {
- ///
- /// The type of the event.
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- [ObsoleteEx(
- ReplacementTypeOrMember = nameof(EventTypes),
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- Type EventType { get; }
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public class StartupCheckResult
- {
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public bool Succeeded => throw new NotImplementedException();
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public string ErrorMessage => throw new NotImplementedException();
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static StartupCheckResult Failed(string errorMessage) => throw new NotImplementedException();
-
- [ObsoleteEx(
- RemoveInVersion = "9",
- TreatAsErrorFromVersion = "8")]
- public static readonly StartupCheckResult Success = new StartupCheckResult();
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- ///
- /// Configuration extensions for routing.
- ///
- [PreObsolete(Note = "Current obsolete points to TransportExtensions replacement, in the future Replacement member should be EndpointConfiguration.UseTransport")]
- public static class RoutingSettingsExtensions
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "TransportExtensions.Routing()",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static RoutingSettings Routing(this TransportExtensions config) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using Pipeline;
- using Routing;
- using Transport;
-
- ///
- /// Provides extensions for configuring message driven subscriptions.
- ///
- public static partial class MessageDrivenSubscriptionsConfigExtensions
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "RoutingSettings.SubscriptionAuthorizer",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void SubscriptionAuthorizer(this TransportExtensions transportExtensions,
- Func authorizer)
- where T : TransportDefinition, IMessageDrivenSubscriptionTransport
- => throw new NotImplementedException();
- [ObsoleteEx(
- ReplacementTypeOrMember = "RoutingSettings.DisablePublishing",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void DisablePublishing(this TransportExtensions transportExtensions)
- where T : TransportDefinition, IMessageDrivenSubscriptionTransport
- => throw new NotImplementedException();
-
- }
-}
-
-namespace NServiceBus.Pipeline
-{
- public partial interface ITransportReceiveContext
- {
- ///
- /// Allows the pipeline to flag that it has been aborted and the receive operation should be rolled back.
- ///
- [ObsoleteEx(
- Message = "The AbortReceiveOperation method is no longer supported. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- void AbortReceiveOperation();
- }
-}
-
-namespace NServiceBus
-{
- using System;
-
- partial class TransportReceiveContext
- {
- [ObsoleteEx(
- Message = "The AbortReceiveOperation method is no longer supported. See the upgrade guide for more details.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public void AbortReceiveOperation() => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using NServiceBus.Extensibility;
-
- public partial class MessageContext
- {
- [ObsoleteEx(
- ReplacementTypeOrMember = "MessageContext(string, Dictionary, ReadonlyMemory, TransportTransaction, string, ContextBag)",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public MessageContext(string messageId, Dictionary headers, byte[] body, TransportTransaction transportTransaction, CancellationTokenSource receiveCancellationTokenSource, ContextBag context) => throw new NotImplementedException();
-
- [ObsoleteEx(TreatAsErrorFromVersion = "8", RemoveInVersion = "9")]
- public CancellationTokenSource ReceiveCancellationTokenSource => throw new NotImplementedException();
-
- [ObsoleteEx(ReplacementTypeOrMember = nameof(NativeMessageId), TreatAsErrorFromVersion = "8", RemoveInVersion = "9")]
- public string MessageId { get; }
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
-
- public partial class CriticalError
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public CriticalError(Func onCriticalErrorAction) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
-
- public partial class CriticalErrorContext : ICriticalErrorContext
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public CriticalErrorContext(Func stop, string error, Exception exception) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
- using Configuration.AdvancedExtensibility;
- using Faults;
-
- public partial class DelayedRetriesSettings : ExposeSettings
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public DelayedRetriesSettings OnMessageBeingRetried(Func notificationCallback) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
-
- public static partial class DiagnosticSettingsExtensions
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void CustomDiagnosticsWriter(this EndpointConfiguration config, Func customDiagnosticsWriter) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
- using Configuration.AdvancedExtensibility;
- using Faults;
-
- public partial class ImmediateRetriesSettings : ExposeSettings
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public ImmediateRetriesSettings OnMessageBeingRetried(Func notificationCallback) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
- using Pipeline;
-
- public static partial class ReceivePipelineConfigExtensions
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void OnReceivePipelineCompleted(this PipelineSettings pipelineSettings, Func subscription) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
- using Configuration.AdvancedExtensibility;
- using Faults;
-
- public partial class RetryFailedSettings : ExposeSettings
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public RetryFailedSettings OnMessageSentToErrorQueue(Func notificationCallback) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Transport
-{
- using System;
- using Settings;
-
- public partial class HostSettings
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public HostSettings(string name, string hostDisplayName, StartupDiagnosticEntries startupDiagnostic, Action criticalErrorAction, bool setupInfrastructure, ReadOnlySettings coreSettings = null) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus
-{
- using System;
- using System.Threading.Tasks;
-
- public static partial class ConfigureCriticalErrorAction
- {
- [ObsoleteEx(
- Message = "Use the overload that accepts a delegate with a cancellation token.",
- TreatAsErrorFromVersion = "8",
- RemoveInVersion = "9")]
- public static void DefineCriticalErrorAction(this EndpointConfiguration endpointConfiguration, Func onCriticalError) => throw new NotImplementedException();
- }
-}
-
-namespace NServiceBus.Unicast.Subscriptions.MessageDrivenSubscriptions
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0")]
- public interface IInitializableSubscriptionStorage : ISubscriptionStorage
- {
- void Init();
- }
-}
-
-namespace NServiceBus
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(MessageIntent))]
-#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
- public enum MessageIntentEnum { }
-#pragma warning restore CA1711 // Identifiers should not have incorrect suffix
-}
-
-namespace NServiceBus.Sagas
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = "ISagaFinder")]
-#pragma warning disable PS0024 // A non-interface type should not be prefixed with I
- public abstract class IFindSagas { }
-#pragma warning restore PS0024 // A non-interface type should not be prefixed with I
-}
-
-namespace NServiceBus.Extensibility
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(IReadOnlyContextBag))]
-#pragma warning disable IDE1006 // Naming Styles
- public interface ReadOnlyContextBag { }
-#pragma warning restore IDE1006 // Naming Styles
-}
-
-namespace NServiceBus.Persistence
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(ISynchronizedStorageSession))]
-#pragma warning disable IDE1006 // Naming Styles
- public interface SynchronizedStorageSession { }
-#pragma warning restore IDE1006 // Naming Styles
-}
-
-namespace NServiceBus.Persistence
-{
- using System.Threading;
- using System.Threading.Tasks;
- using Extensibility;
- using Outbox;
- using Transport;
-
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(ICompletableSynchronizedStorageSession))]
-#pragma warning disable IDE1006 // Naming Styles
- public interface CompletableSynchronizedStorageSession { }
-
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(ICompletableSynchronizedStorageSession))]
- public interface ISynchronizedStorageAdapter
- {
- Task TryAdapt(IOutboxTransaction transaction, ContextBag context, CancellationToken cancellationToken = default);
-
- Task TryAdapt(TransportTransaction transportTransaction, ContextBag context, CancellationToken cancellationToken = default);
- }
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(ICompletableSynchronizedStorageSession))]
- public interface ISynchronizedStorage
- {
- Task OpenSession(ContextBag contextBag, CancellationToken cancellationToken = default);
- }
-#pragma warning restore IDE1006 // Naming Styles
-}
-
-namespace NServiceBus.Outbox
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(IOutboxTransaction))]
-#pragma warning disable IDE1006 // Naming Styles
- public interface OutboxTransaction { }
-#pragma warning restore IDE1006 // Naming Styles
-}
-
-namespace NServiceBus.Settings
-{
- [ObsoleteEx(
- TreatAsErrorFromVersion = "8.0.0",
- RemoveInVersion = "9.0.0", ReplacementTypeOrMember = nameof(IReadOnlySettings))]
-#pragma warning disable IDE1006 // Naming Styles
- public interface ReadOnlySettings { }
-#pragma warning restore IDE1006 // Naming Styles
-}
-
-namespace NServiceBus
-{
- using System;
- using DataBus;
-
- public static partial class UseDataBusExtensions
- {
- [ObsoleteEx(
- Message = "Specifying data bus serializer is mandatory. Use the overload that accepts a data bus serializer type.",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public static DataBusExtensions UseDataBus(this EndpointConfiguration config) where T : DataBusDefinition => throw new NotImplementedException();
-
- [ObsoleteEx(
- Message = "Specifying a serializer for data bus is mandatory. Use the overload that accepts a data bus serializer type.",
- TreatAsErrorFromVersion = "8.0",
- RemoveInVersion = "9.0")]
- public static DataBusExtensions UseDataBus(this EndpointConfiguration config, Type dataBusType) => throw new NotImplementedException();
- }
-}
-#pragma warning restore 1591
diff --git a/src/NServiceBus.Core/obsoletes-v9.cs b/src/NServiceBus.Core/obsoletes-v9.cs
new file mode 100644
index 0000000000..4795a9f950
--- /dev/null
+++ b/src/NServiceBus.Core/obsoletes-v9.cs
@@ -0,0 +1,246 @@
+#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
+
+namespace NServiceBus
+{
+ using System;
+ using Microsoft.Extensions.DependencyInjection;
+ using NServiceBus.Extensibility;
+ using NServiceBus.Pipeline;
+ using NServiceBus.Settings;
+ using NServiceBus.Transport;
+
+ partial class AuditContext
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = nameof(AuditMetadata),
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public void AddAuditData(string key, string value) => throw new NotImplementedException();
+ }
+
+ public static partial class ConnectorContextExtensions
+ {
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0",
+ ReplacementTypeOrMember = "CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, TimeSpan? timeToBeReceived, IIncomingPhysicalMessageContext sourceContext)")]
+ public static IAuditContext CreateAuditContext(this ForkConnector forkConnector, OutgoingMessage message, string auditAddress, IIncomingPhysicalMessageContext sourceContext) => throw new NotImplementedException();
+ }
+
+ public partial class EndpointConfiguration
+ {
+
+ [ObsoleteEx(
+ Message = "Error notification events have been replaced with a Task-based API available on the recoverability settings.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public Notifications Notifications { get; }
+ }
+
+ public static partial class ImmediateDispatchOptionExtensions
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = nameof(IsImmediateDispatchSet),
+ RemoveInVersion = "10.0",
+ TreatAsErrorFromVersion = "9.0")]
+ public static bool RequiredImmediateDispatch(this ExtendableOptions options) => throw new NotImplementedException();
+ }
+ public partial class LearningTransport
+ {
+ [ObsoleteEx(
+ Message = "Inject the ITransportAddressResolver type to access the address translation mechanism at runtime. See the NServiceBus version 8 upgrade guide for further details.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public override string ToTransportAddress(QueueAddress queueAddress) => throw new NotImplementedException();
+ }
+
+ [ObsoleteEx(
+ Message = "Error notification events have been replaced with a Task-based API available on the recoverability settings.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public class Notifications { }
+
+ [ObsoleteEx(
+ Message = "Use methods on IServiceCollection instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static class ServiceCollectionExtensions
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceCollection.Add",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void ConfigureComponent(this IServiceCollection serviceCollection, Type concreteComponent, DependencyLifecycle dependencyLifecycle) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void ConfigureComponent(this IServiceCollection serviceCollection, DependencyLifecycle dependencyLifecycle) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void ConfigureComponent(this IServiceCollection serviceCollection, Func componentFactory, DependencyLifecycle dependencyLifecycle) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead. Note that interfaces are not registered implicitly. See the NServiceBus 7 to 8 upgrade guide for more information.",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void ConfigureComponent(this IServiceCollection serviceCollection, Func componentFactory, DependencyLifecycle dependencyLifecycle) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ Message = "Use `IServiceCollection.Add`, `IServiceCollection.AddSingleton`, `IServiceCollection.AddTransient` or `IServiceCollection.AddScoped` instead.",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void RegisterSingleton(this IServiceCollection serviceCollection, Type lookupType, object instance) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceCollection.AddSingleton",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static void RegisterSingleton(this IServiceCollection serviceCollection, T instance) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceCollection.GetEnumerator",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static bool HasComponent(this IServiceCollection serviceCollection) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceCollection.GetEnumerator",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static bool HasComponent(this IServiceCollection serviceCollection, Type componentType) => throw new NotImplementedException();
+ }
+
+ public static partial class SettingsExtensions
+ {
+ [ObsoleteEx(
+ Message = "Use FeatureConfigurationContext.LocalQueueAddress() to access the endpoint queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static string LocalAddress(this IReadOnlySettings settings) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ Message = "Use FeatureConfigurationContext.InstanceSpecificQueueAddress() to access the endpoint instance specific queue address. Inject the ReceiveAddresses class to access the endpoint's receiving transport addresses at runtime. See the NServiceBus version 8 upgrade guide for further details.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static string InstanceSpecificQueue(this IReadOnlySettings settings) => throw new NotImplementedException();
+ }
+}
+
+namespace NServiceBus.Features
+{
+ using System;
+ using Microsoft.Extensions.DependencyInjection;
+
+ public partial class FeatureConfigurationContext
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = nameof(Services),
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public IServiceCollection Container => throw new NotImplementedException();
+ }
+}
+
+namespace NServiceBus.ObjectBuilder
+{
+ using System;
+ using System.Collections.Generic;
+ using Microsoft.Extensions.DependencyInjection;
+
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static class ServiceProviderExtensions
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceProvider.GetService",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static object Build(this IServiceProvider serviceProvider, Type typeToBuild) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceProvider.CreateScope",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static IServiceScope CreateChildBuilder(this IServiceProvider serviceProvider) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceProvider.GetService",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static T Build(this IServiceProvider serviceProvider) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceProvider.GetServices",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static IEnumerable BuildAll(this IServiceProvider serviceProvider) => throw new NotImplementedException();
+
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "IServiceProvider.GetServices",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public static IEnumerable BuildAll(this IServiceProvider serviceProvider, Type typeToBuild) => throw new NotImplementedException();
+ }
+}
+
+namespace NServiceBus.Pipeline
+{
+ public partial interface IAuditContext : IBehaviorContext
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = nameof(AuditMetadata),
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ void AddAuditData(string key, string value);
+ }
+}
+
+namespace NServiceBus.Support
+{
+ using System;
+
+ public static partial class RuntimeEnvironment
+ {
+ [ObsoleteEx(
+ ReplacementTypeOrMember = "HostInfoSettings.UsingHostName",
+ TreatAsErrorFromVersion = "9.0",
+ RemoveInVersion = "10.0")]
+ public static Func MachineNameAction { get; set; }
+ }
+}
+
+namespace NServiceBus.Transport
+{
+ public abstract partial class TransportDefinition
+ {
+ [ObsoleteEx(
+ Message = "Inject the ITransportAddressResolver type to access the address translation mechanism at runtime. See the NServiceBus version 8 upgrade guide for further details.",
+ TreatAsErrorFromVersion = "9",
+ RemoveInVersion = "10")]
+ public abstract string ToTransportAddress(QueueAddress address);
+ }
+}
+
+namespace NServiceBus.UnitOfWork
+{
+ using System;
+ using System.Diagnostics.CodeAnalysis;
+ using System.Threading.Tasks;
+
+ [ObsoleteEx(Message = "The unit of work pattern is more straightforward to implement in a pipeline behavior, where the using keyword and try/catch blocks can be used.", ReplacementTypeOrMember = "NServiceBus.Pipeline.Behavior", TreatAsErrorFromVersion = "9", RemoveInVersion = "10")]
+ [SuppressMessage("Code", "PS0018:A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext", Justification = "Obsolete.")]
+ public interface IManageUnitsOfWork
+ {
+ Task Begin();
+
+ Task End(Exception ex = null);
+ }
+}
+
+#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
\ No newline at end of file
diff --git a/src/NServiceBus.Learning.AcceptanceTests/NServiceBus.Learning.AcceptanceTests.csproj b/src/NServiceBus.Learning.AcceptanceTests/NServiceBus.Learning.AcceptanceTests.csproj
index 37f5400c02..029e7a0ee1 100644
--- a/src/NServiceBus.Learning.AcceptanceTests/NServiceBus.Learning.AcceptanceTests.csproj
+++ b/src/NServiceBus.Learning.AcceptanceTests/NServiceBus.Learning.AcceptanceTests.csproj
@@ -1,8 +1,7 @@
- net472;net6.0;net7.0
- 10.0
+ net8.0
@@ -10,13 +9,9 @@
-
-
-
-
-
+
diff --git a/src/NServiceBus.PersistenceTests/NServiceBus.PersistenceTests.csproj b/src/NServiceBus.PersistenceTests/NServiceBus.PersistenceTests.csproj
index 45526519ea..238c31ad41 100644
--- a/src/NServiceBus.PersistenceTests/NServiceBus.PersistenceTests.csproj
+++ b/src/NServiceBus.PersistenceTests/NServiceBus.PersistenceTests.csproj
@@ -1,23 +1,18 @@
- net472;net6.0;net7.0
+ net8.0true..\NServiceBusTests.snk
- 10.0
-
-
-
-
-
+
@@ -37,4 +32,10 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
diff --git a/src/NServiceBus.PersistenceTests/RequiresExtensionsForPersistenceTestsConfiguration.cs b/src/NServiceBus.PersistenceTests/RequiresExtensionsForPersistenceTestsConfiguration.cs
index 0927c9bacc..c61d112377 100644
--- a/src/NServiceBus.PersistenceTests/RequiresExtensionsForPersistenceTestsConfiguration.cs
+++ b/src/NServiceBus.PersistenceTests/RequiresExtensionsForPersistenceTestsConfiguration.cs
@@ -10,10 +10,6 @@ public static void RequiresDtcSupport(this IPersistenceTestsConfiguration config
{
Assert.Ignore("Ignoring this test because it requires DTC transaction support from persister.");
}
-
-#if NET
- Assert.Ignore(".NET does not support distributed transactions.");
-#endif
}
public static void RequiresOutboxSupport(this IPersistenceTestsConfiguration configuration)
diff --git a/src/NServiceBus.PersistenceTests/Sagas/When_persisting_a_saga_with_record_type.cs b/src/NServiceBus.PersistenceTests/Sagas/When_persisting_a_saga_with_record_type.cs
index 61d7ad2148..f76260b85e 100644
--- a/src/NServiceBus.PersistenceTests/Sagas/When_persisting_a_saga_with_record_type.cs
+++ b/src/NServiceBus.PersistenceTests/Sagas/When_persisting_a_saga_with_record_type.cs
@@ -1,6 +1,5 @@
namespace NServiceBus.PersistenceTesting.Sagas
{
-#if NET
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -102,5 +101,4 @@ public When_persisting_a_saga_with_record_type(TestVariant param) : base(param)
}
}
-#endif
}
\ No newline at end of file
diff --git a/src/NServiceBus.Testing.Fakes/NServiceBus.Testing.Fakes.csproj b/src/NServiceBus.Testing.Fakes/NServiceBus.Testing.Fakes.csproj
index c154b6803e..5d8f06fb05 100644
--- a/src/NServiceBus.Testing.Fakes/NServiceBus.Testing.Fakes.csproj
+++ b/src/NServiceBus.Testing.Fakes/NServiceBus.Testing.Fakes.csproj
@@ -1,11 +1,10 @@
- net472;net6.0
+ net8.0NServiceBus.Testingtrue..\NServiceBusTests.snk
- 10.0
diff --git a/src/NServiceBus.Testing.Fakes/TestableAuditContext.cs b/src/NServiceBus.Testing.Fakes/TestableAuditContext.cs
index 04c93cedcd..5c07792b07 100644
--- a/src/NServiceBus.Testing.Fakes/TestableAuditContext.cs
+++ b/src/NServiceBus.Testing.Fakes/TestableAuditContext.cs
@@ -38,15 +38,8 @@ public partial class TestableAuditContext : TestableBehaviorContext, IAuditConte
IReadOnlyDictionary IAuditActionContext.AuditMetadata => AuditMetadata;
- ///
- /// Adds information about the current message that should be audited.
- ///
- /// The audit key.
- /// The value.
- public void AddAuditData(string key, string value)
- {
- AuditMetadata.Add(key, value);
- }
+ // This method is being removed from IAuditContext, so this stub method remains until the removal is done in v10
+ public void AddAuditData(string key, string value) => throw new NotImplementedException();
///
/// Locks the audit action for further changes.
diff --git a/src/NServiceBus.Testing.Fakes/obsoletes-v8.cs b/src/NServiceBus.Testing.Fakes/obsoletes-v8.cs
deleted file mode 100644
index 2e1df64214..0000000000
--- a/src/NServiceBus.Testing.Fakes/obsoletes-v8.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace NServiceBus.Testing
-{
- using System;
-
- public partial class TestableTransportReceiveContext// : TestableBehaviorContext, ITransportReceiveContext
- {
- [Obsolete("The AbortReceiveOperation method is no longer supported. See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public bool ReceiveOperationAborted { get; set; }
-
- [Obsolete("The AbortReceiveOperation method is no longer supported. See the upgrade guide for more details. Will be removed in version 9.0.0.", true)]
- public virtual void AbortReceiveOperation() => throw new NotImplementedException();
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.TransportTests/NServiceBus.TransportTests.csproj b/src/NServiceBus.TransportTests/NServiceBus.TransportTests.csproj
index b606fd4a01..7ea4c3f6b4 100644
--- a/src/NServiceBus.TransportTests/NServiceBus.TransportTests.csproj
+++ b/src/NServiceBus.TransportTests/NServiceBus.TransportTests.csproj
@@ -1,20 +1,16 @@
-
+
- net472;net6.0;net7.0
+ net8.0
-
-
-
-
-
+
@@ -32,4 +28,10 @@
+
+
+
+
+
+
diff --git a/src/NServiceBus.sln b/src/NServiceBus.sln
index 70332477f7..75edc3f3fb 100644
--- a/src/NServiceBus.sln
+++ b/src/NServiceBus.sln
@@ -30,8 +30,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Core.Analyzer", "NServiceBus.Core.Analyzer\NServiceBus.Core.Analyzer.csproj", "{A5C32904-ECEC-492B-8217-8BFB5CC1443C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Core.Analyzer.Tests.Roslyn3", "NServiceBus.Core.Analyzer.Tests.Roslyn3\NServiceBus.Core.Analyzer.Tests.Roslyn3.csproj", "{940AD1FA-E3D7-41FB-A832-2A84EF06C4DD}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzer", "Analyzer", "{6CF85707-290E-4FA1-8444-25D29B6A6BA8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.PersistenceTests", "NServiceBus.PersistenceTests\NServiceBus.PersistenceTests.csproj", "{157D1894-BAE7-45B2-9906-0445B38F3A97}"
@@ -78,10 +76,6 @@ Global
{A5C32904-ECEC-492B-8217-8BFB5CC1443C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5C32904-ECEC-492B-8217-8BFB5CC1443C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5C32904-ECEC-492B-8217-8BFB5CC1443C}.Release|Any CPU.Build.0 = Release|Any CPU
- {940AD1FA-E3D7-41FB-A832-2A84EF06C4DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {940AD1FA-E3D7-41FB-A832-2A84EF06C4DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {940AD1FA-E3D7-41FB-A832-2A84EF06C4DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {940AD1FA-E3D7-41FB-A832-2A84EF06C4DD}.Release|Any CPU.Build.0 = Release|Any CPU
{157D1894-BAE7-45B2-9906-0445B38F3A97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{157D1894-BAE7-45B2-9906-0445B38F3A97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{157D1894-BAE7-45B2-9906-0445B38F3A97}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -106,7 +100,6 @@ Global
{82BB433F-96BB-43D1-98E4-EEDE437D70AE} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}
{65578230-EF42-43A6-A943-624F2DF01E66} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}
{A5C32904-ECEC-492B-8217-8BFB5CC1443C} = {6CF85707-290E-4FA1-8444-25D29B6A6BA8}
- {940AD1FA-E3D7-41FB-A832-2A84EF06C4DD} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}
{157D1894-BAE7-45B2-9906-0445B38F3A97} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}
{360438BD-AEDE-48AC-BE75-FBB6BF2F004D} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}
{71330321-DA6D-4199-89C4-FB36F92E77C2} = {2904B75F-8F07-4C07-BABC-BC42533B3E75}