diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5be8e74de..93e48a8f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: echo "Create extra databases" sqlcmd -Q "CREATE DATABASE nservicebus1" sqlcmd -Q "CREATE DATABASE nservicebus2" + sqlcmd -Q "CREATE DATABASE [n service.bus&#]" echo "Create additional schemas" sqlcmd -Q "CREATE SCHEMA receiver AUTHORIZATION db_owner" -d "nservicebus" diff --git a/src/NServiceBus.Transport.SqlServer.AcceptanceTests/MultiCatalog/When_catalog_with_special_characters_configured_for_endpoint.cs b/src/NServiceBus.Transport.SqlServer.AcceptanceTests/MultiCatalog/When_catalog_with_special_characters_configured_for_endpoint.cs new file mode 100644 index 000000000..e4c20b415 --- /dev/null +++ b/src/NServiceBus.Transport.SqlServer.AcceptanceTests/MultiCatalog/When_catalog_with_special_characters_configured_for_endpoint.cs @@ -0,0 +1,54 @@ +namespace NServiceBus.Transport.SqlServer.AcceptanceTests.MultiCatalog +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using NUnit.Framework; + + public class When_catalog_with_special_characters_configured_for_endpoint : MultiCatalogAcceptanceTest + { + static string EndpointConnectionString => WithCustomCatalog(GetDefaultConnectionString(), "n service.bus&#"); + + [Test] + public async Task Should_be_able_to_send_messages_to_the_endpoint() + { + await Scenario.Define() + .WithEndpoint(c => c.When(s => s.SendLocal(new Message()))) + .Done(c => c.MessageReceived) + .Run(); + + Assert.Pass(); + } + + public class AnEndpoint : EndpointConfigurationBuilder + { + public AnEndpoint() => + EndpointSetup(new CustomizedServer(EndpointConnectionString), (_, __) => { }); + + class Handler : IHandleMessages + { + public Handler(Context scenarioContext) + { + ScenarioContext = scenarioContext; + } + + public Task Handle(Message message, IMessageHandlerContext context) + { + ScenarioContext.MessageReceived = true; + + return Task.FromResult(0); + } + + Context ScenarioContext; + } + } + + public class Message : ICommand + { + } + + class Context : ScenarioContext + { + public bool MessageReceived { get; set; } + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs b/src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs index c574cd360..c68e38752 100644 --- a/src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs +++ b/src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs @@ -50,7 +50,7 @@ THEN DATEADD(ms, @TimeToBeReceivedMs, GETUTCDATE()) END, public static string CheckIfTableHasRecoverableText { get; set; } = @" SELECT COUNT(*) -FROM {0}.sys.columns c +FROM [{0}].sys.columns c WHERE c.object_id = OBJECT_ID(N'{1}') AND c.name = 'Recoverable'";