This is part of the NServiceBus Upgrade Guide from Version 5 to 6, which also includes the following individual upgrade guides for specific components:
Feature Details
- Assembly Scanning Changes in NServiceBus Version 6
- No Async Suffix
- Dependency Injection Changes in NServiceBus Version 6
- Deprecated TransportMessage in NServiceBus Version 6
- Endpoint API changes in NServiceBus Version 6
- Extension Seam Changes in NServiceBus Version 6
- Migrate handlers and sagas to Version 6
- Header API changes in NServiceBus Version 6
- Messaging Changes in NServiceBus Version 6
- Moving away from IBus in Version 6
- Recoverability Changes in Version 6
- Serialization Changes in NServiceBus Version 6
- Subscription Changes in NServiceBus Version 6
- Transaction Configuration Changes in NServiceBus Version 6
Transports
- Azure Service Bus Transport (Legacy) Upgrade Version 6 to 7
- RabbitMQ Transport Upgrade Version 3 to 4
- SQL Server Transport Upgrade Version 2 to 3
- SQL Server Transport Upgrade - Supporting Unicode in Headers
Persistence
- Upgrade from NServiceBus Azure Version 6
- NHibernate Persistence Upgrade Version 6 to 7
- NHibernate Persistence - Resolving incorrect timeout table indexes
- RavenDB Persistence Upgrade from 3 to 4
Hosting
Other
- Moving to the DataBus AzureBlobStorage Package
- Azure Cloud Services Host Upgrade Version 6 to 7
- NServiceBus.Azure package deprecated
- Gateway Upgrade Version 1 to 2
- NServiceBus Testing Upgrade Version 5 to 6
- Callback Changes in NServiceBus Version 6
- Migrating the distributor to use sender-side distribution
- Tool and Helper Changes in NServiceBus Version 6
This document explains how to patch a system using the SQL Server transport to allow message headers to contain characters not supported by the current SQL Server collation. The issue may cause data loss when these characters are used in header names or values.
Compatibility
This issue has been resolved in the following patch versions of the SQL Server transport as defined in the NServiceBus support policy:
Any of the supported affected minor versions (3.1.x, 3.0.x, or 2.2.x) should be updated to the latest patch release. Older (unsupported) affected versions should be updated to a supported minor (2.1.x or 2.0.x) or major version (1.x).
Upgrade steps
To upgrade an existing endpoint:
- Update to the latest patch release
- Deploy the new version
- Check endpoint startup logs for a warning message
- Follow the queue table schema upgrade procedure
Check at startup
The SQL Server transport detects incorrect definition of the Headers
column and logs a warning:
Table [dbo].[SampleEndpoint] stores headers in a non Unicode-compatible column (varchar).
This may lead to data loss when sending non-ASCII characters in headers. SQL Server transport versions 3.1 and newer can take advantage of the
nvarchar
column type for headers. Please change the column type in the database.
If this log event is written to the log file, the following guidance describes how to upgrade the queue table schema.
Queue table schema upgrade
The incorrect Headers
column definition on existing queue tables needs to be updated manually using the following SQL statement for every queue table managed by a given endpoint:
This procedure does not require any downtime, and it can be executed when affected endpoints are processing messages.
Run this script on a testing or staging environment first to verify that it works as expected.
declare @queueTableName nvarchar(max) = N'...'
declare @sql nvarchar(max) = N'alter table ' + @queueTableName + N' alter column Headers nvarchar(max) not null';
exec sp_executesql @sql;