Skip to content

Commit b490e60

Browse files
CopilotAndriySvyryd
andcommitted
Fix RuntimeNavigation casting issue in ToDebugString methods
Co-authored-by: AndriySvyryd <[email protected]>
1 parent e75fe03 commit b490e60

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/EFCore/Metadata/IReadOnlyComplexProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
9191
}
9292

9393
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
94-
&& ((AnnotatableBase)this).IsReadOnly)
94+
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
9595
{
9696
var indexes = ((IProperty)this).GetPropertyIndexes();
9797
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlyNavigation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
165165
}
166166

167167
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
168-
&& ((AnnotatableBase)this).IsReadOnly)
168+
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
169169
{
170170
var indexes = ((INavigation)this).GetPropertyIndexes();
171171
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlyProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
433433
}
434434

435435
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
436-
&& ((AnnotatableBase)this).IsReadOnly)
436+
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
437437
{
438438
var indexes = ((IProperty)this).GetPropertyIndexes();
439439
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlySkipNavigation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
9999
}
100100

101101
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
102-
&& ((AnnotatableBase)this).IsReadOnly)
102+
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
103103
{
104104
var indexes = ((ISkipNavigation)this).GetPropertyIndexes();
105105
builder.Append(' ').Append(indexes.Index);

0 commit comments

Comments
 (0)