Skip to content

EMA C#: OmmDate object modified during the for-each iteration #291

Closed as not planned
@y-intercept2018

Description

@y-intercept2018

Real-Time: For Real-Time SDK C#, looks like the OmmDate object will be modified during the for-each iteration. This strange behavior does not happen to all RICs, for example, it does not happen on RIC /0005.HK, it does happen on RIC /HCEIX4 .

public void OnRefreshMsg(RefreshMsg refreshMsg, IOmmConsumerEvent consumerEvent)
{
    OmmDate? date = null;
    foreach (var field in refreshMsg.Payload().FieldList())
    {
        if (field.Code == Data.DataCode.BLANK)
            continue;
        switch (field.FieldId){
            case 16:
                date = field.OmmDateValue();
                Console.WriteLine($"date (in-place): {date}");
                break;
        }

    }
    Console.WriteLine($"date (after-foreach): {date}");
}

This function is used to extract one specific field with fieldId == 16 (i.e., TRADE_DATE) into my date object. The output I get is this:

date (in-place): 29 OCT 2024
date (after-foreach): (blank data) 

This issue was also discussed on a LSEG forum here and it seems to be a bug.

My environment:
DotNet 6.0 with LSEG.Ema.Core 3.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions