XE7 and more With weirdness
100% reproducable fail: Access violation at address 00B5464D in module ‘MyApp.exe’. Read of address 00000040.
Fails:
tpLot := Tp.Add;
with tpLot do
begin
LotId := Lot.Id; // <–BANG
LotNo := Lot.LotNumber;
ExpiryDate := Lot.ExpireDate;
ProducedDate := Lot.ProducedStartTime;
ArticleId := ArtSum.ArticleId;
ArticleNo := ArtSum.ArticleNumber;
OriginalArticleId := ArtSum.ArticleId;
Quantity := NumDPacks * ArtSum.BaseUnitsPerKPack;
NetWeight := Quantity * ArtSum.NetWeightPrBaseUnit;
GrossWeight := NetWeight +
(ArtSum.TaraWeightPrFPack * Quantity);
LotLockState := Lot.LockStateCode;
end;
Works:
tpLot := Tp.Add;
tpLot.LotId := Lot.Id;
tpLot.LotNo := Lot.LotNumber;
tpLot.ExpiryDate := Lot.ExpireDate;
tpLot.ProducedDate := Lot.ProducedStartTime;
tpLot.ArticleId := ArtSum.ArticleId;
tpLot.ArticleNo := ArtSum.ArticleNumber;
tpLot.OriginalArticleId := ArtSum.ArticleId;
tpLot.Quantity := NumDPacks * ArtSum.BaseUnitsPerKPack;
tpLot.NetWeight := tpLot.Quantity * ArtSum.NetWeightPrBaseUnit;
tpLot.GrossWeight := tpLot.NetWeight + (ArtSum.TaraWeightPrFPack * tpLot.Quantity);
tpLot.LotLockState := Lot.LockStateCode;
Lot and ArtSum are properly initated and readable (inspected in debugger), so I assume it is the assignment that fails.
The problem is, I cannot reproduce in a mini-example.
If I wasn’t set at eradicating all with statements before, I surely am now.
#sigh
You must be logged in to post a comment.