Microsoft.Data.SqlClient.SqlException : The identifier that starts with '***' is too long. Maximum length is 128.
D-Inventor opened this issue · 0 comments
D-Inventor commented
I seem to be running into an issue while using the Snapshot functionality of your package. I'm using this in combination with Umbraco 10 and I'm creating a snapshot after Umbraco is installed in the database, so I can return to a fresh install after each test.
The snapshot throws this exception on our buildserver. The identifier includes a very long path, too long it seems. The functionality works just fine on my local machine though.
Can you give me any advice on how to proceed? I couldn't find any configurations that allow me to modify this identifier, so I'm not sure what to do.
Here's the stacktrace, in case you need it:
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at ThrowawayDb.ThrowawayDatabase.CreateSnapshot()
at ThrowawayDb.SnapshotScope..ctor(ThrowawayDatabase db)
at ThrowawayDb.ThrowawayDatabaseExtensions.CreateSnapshotScope(ThrowawayDatabase this)
at UrlTracker.IntegrationTests.IntegrationTestBase.Setup() in C:\[myuserfolder]\UrlTracker.IntegrationTests\IntegrationTestBase.cs:line 33
at UrlTracker.IntegrationTests.Redirecting.RedirectTestBase.Setup() in C:\[myuserfolder]\UrlTracker.IntegrationTests\Redirecting\RedirectTestBase.cs:line 32
And here's how I use it in code:
public class IntegrationTestBase
{
protected ThrowawayDatabase Database { get; private set; }
public SnapshotScope SnapshotScope { get; private set; }
protected UrlTrackerWebApplicationFactory WebsiteFactory { get; private set; }
protected AsyncServiceScope Scope { get; private set; }
protected IServiceProvider ServiceProvider => Scope.ServiceProvider;
[OneTimeSetUp]
public virtual void OneTimeSetup()
{
Database = ThrowawayDatabase.FromLocalInstance(@"(LocalDb)\MSSQLLocalDB");
// Install Umbraco on the temporary database
using var factory = new UrlTrackerWebApplicationFactory(Database);
var client = factory.CreateClient();
var policy = HttpPolicyExtensions.HandleTransientHttpError().RetryAsync(3);
policy.ExecuteAsync(() => client.GetAsync("/")).Wait();
}
[SetUp]
public virtual void Setup()
{
// create database snapshot to return to after each test
SnapshotScope = Database.CreateSnapshotScope();
WebsiteFactory = new UrlTrackerWebApplicationFactory(Database);
Scope = WebsiteFactory.Services.GetRequiredService<IServiceScopeFactory>().CreateAsyncScope();
}
[TearDown]
public virtual void TearDown()
{
Scope.Dispose();
WebsiteFactory.Dispose();
SnapshotScope.Dispose();
}
[OneTimeTearDown]
public virtual void OneTimeTeardown()
{
Database.Dispose();
}
}
Any advice is appreciated