Skip to content

Commit b26b68a

Browse files
authored
Merge pull request #403 from DataObjects-NET/7.1-mutable-hashset-bug
Fix of race condition with TranslatorState.NonVisitableExpressions
2 parents 41e85c4 + 35e57b0 commit b26b68a

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

ChangeLog/7.1.3_dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[main] Addressed race condition issue with TranslatorState.NonVisitableExpressions

Orm/Xtensive.Orm/Orm/Linq/LocalCollectionKeyTypeExtractor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public static Type Extract(BinaryExpression expression)
2424
return key.EntityType.UnderlyingType;
2525
}
2626

27-
var expr = VisitBinaryExpession(expression);
27+
var expr = VisitBinaryExpression(expression);
2828
if (expr.Type.IsSubclassOf(WellKnownOrmTypes.Entity)) {
2929
return expr.Type;
3030
}
3131
throw new NotSupportedException(string.Format(Strings.ExCurrentTypeXIsNotSupported, expr.Type));
3232
}
3333

34-
private static Expression VisitBinaryExpession(BinaryExpression binaryExpression)
34+
private static Expression VisitBinaryExpression(BinaryExpression binaryExpression)
3535
{
3636
if (!(binaryExpression.Right is MemberExpression memberExpression)) {
3737
throw new InvalidOperationException(string.Format(Strings.ExCantConvertXToY, binaryExpression.Type, typeof(MemberExpression)));

Orm/Xtensive.Orm/Orm/Linq/Translator.Queryable.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ internal sealed partial class Translator : QueryableVisitor
3333
private readonly TranslatorContext context;
3434
private readonly bool tagsEnabled;
3535

36-
internal TranslatorState State { get; private set; } = TranslatorState.InitState;
36+
internal TranslatorState State { get; private set; } = new(TranslatorState.InitState) {
37+
NonVisitableExpressions = new()
38+
};
3739

3840
protected override Expression VisitConstant(ConstantExpression c)
3941
{

Orm/Xtensive.Orm/Orm/Linq/TranslatorState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public TranslatorScope(Translator translator)
7070

7171

7272
/// <summary>
73-
/// Expessions that were constructed during original expression translation
73+
/// Expressions that were constructed during original expression translation
7474
/// and aim to replace original parts so they are avoidable to visit by Linq translator.
7575
/// </summary>
7676
/// <remarks>

0 commit comments

Comments
 (0)