Skip to content

'Attempt to read protected memory' re: PR #150 #151

@SteveWilkes

Description

@SteveWilkes

Hi!

I've added a failing test to the issues project in PR #150 where a fast-compiled Func is throwing 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt'.

The compiled lambda is:

dsosToPpssData =>
{
    var publicPropertyStruct_String = dsosToPpssData.Target;
    string valueKey;
    object value;
    publicPropertyStruct_String.Value = ((valueKey = dsosToPpssData.Source.Keys.FirstOrDefault(key => key.MatchesKey("Value"))) != null)
        ? ((value = dsosToPpssData.Source[valueKey]) != null) ? value.ToString() : null
        : null;

    return publicPropertyStruct_String;
}

The error is not thrown if I use the FirstOrDefault() overload that doesn't take a lambda. I note your source states nested lambdas are not supported, but it is a simple one and TryEmitNestedLambda is there, so I figured you might want to take a look :)

Cheers,

Steve

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions