Skip to content

Commit 6a28b52

Browse files
authored
Merge pull request #244 from DataObjects-NET/datetimeoffset-accessor-on-x86-issue
DateTimeOffsetAccessor.GetSize() returns the same size on both x86 and x64 architectures
2 parents 4b38d6f + 6ca4f63 commit 6a28b52

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ChangeLog/6.0.10_dev.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
[main] Fixed certain cases of NRE happened on Domain build due to views in extracted schema
1+
[main] Fixed certain cases of NRE happened on Domain build due to views in extracted schema
2+
[main] Fixed NotSupportedException appeared on x86 architecture when DateTimeOffset is used in entites

Orm/Xtensive.Orm/Tuples/Packed/PackedFieldAccessor.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,11 @@ protected override void Encode(DateTimeOffset value, long[] values, int offset)
578578

579579
private static unsafe int GetSize()
580580
{
581-
return sizeof(DateTimeOffset);
581+
// Depending on architecture, x86 or x64, the size of DateTimeOffset is either 12 or 16 respectively.
582+
// Due to the fact that Rank calculation algorithm expects sizes to be equal to one of the power of two
583+
// it returns wrong rank value for size 12 (bitsize = 96) which causes wrong choice of Encode/Decode methods.
584+
// Setting it to 16 helps to solve Rank problem.
585+
return sizeof(long) * 2;
582586
}
583587

584588
public DateTimeOffsetFieldAccessor()

0 commit comments

Comments
 (0)