Executing this part of method I got exception in client, exception is:
Cannot roll back s0. No transaction or savepoint of that name was found.
Examining the debugger I have found:
using (VersionValidator.Attach(versionSet))
{
using (var transaction = Transaction.Open(TransactionOpenMode.New))
{
var item = Query.Single<T>(id);
using (var ir = Validation.Disable())
{
foreach (var keyValuePair in CleanUpValues(values))
{
item[keyValuePair.Key] = keyValuePair.Value;
}
ir.Complete();
}
Validation.Enforce();
...
ValidateComments(item);
...
transaction.Complete();
}
}
The first exception occurs in
item[keyValuePair.Key] = keyValuePair.Value;
System.Reflection.TargetInvocationException was unhandled by user code
Message=Exception has been thrown by the target of an invocation.
InnerException: Xtensive.Storage.VersionConflictException
Message=Version of entity with key 'GridSetting, (dc60186a-8f74-442a-a2b7-f363d5de0eef)' differs from the expected one.
Later this debugger jumps to Disposing of transaction scope
and there is my exception:
Cannot roll back s0. No transaction or savepoint of that name was found.
I was trying to reproduce this in isolated project, but without any success.
One more question is why this version mistmach occurs:
ValidateComments may throw exception, and as far as I understand transaction should be rolled back and version should not change, but it has changed.
Could you indicate possible causes of this problem to create this in isolated project?
asked
Sep 07 '10 at 04:59
pil0t
207●57●57●63
futher debugging show that changing
var item = Query.Single<T>(id);
to
var item = Query.All<T>().Where(a=>a.Id == id).Single();
fix the issue.
Possible there are no transaction open when I use
Query.Single<T>(id)
(chached item?) but on disposing try to rollback ?Do you use
SessionOptions.AutoShortenTransactions
option?Btw, there is definitely some bug. I'm just trying to figure out of it is already fixed in our development branch, or not.
Yes, I use SessionOptions.AutoShortenTransactions option
Try to turn off
AutoShortenTransactions
option - quite likely the problem will be fixed. Its support in current branch (v4.3) is buggy; we significantly refactored it in v4.4 branch (that's in development now), so further it should work as expected.Did this help?
The issue is suspended, please see the comments.