Inline lambda attached to Action<T> event causes MMP failure during deploy (“Wrong type in blob: 1d”)

Hi,

I found a reproducible issue in TinyCLR related to events using Action<T> and inline lambda handlers.

Problem Summary

When an event is declared with Action<T> and I attach an inline lambda as the handler, deployment fails with an MMP error. The device (FEZ Feather) gets stuck during deploy.

Fails (inline lambda):

public event Action<BDEFrameEventArgs> BDEFrameDecoded;

bde_.BDEFrameDecoded += (arg) =>
{
    // handler code
};

Deploy output:

Code

Failed to generate device specific assemblies:
Wrong type in blob: 1d
Unable to read value 0: 1d
Invalid blob:
MMP: error MMP0000: 0x81010002

Works (normal method):

bde_.BDEFrameDecoded += BDE__FrameDecoded;

private void BDE__FrameDecoded(BDEFrameEventArgs arg)
{
}

Notes

It looks like the metadata processor (MMP) can’t handle the synthetic types generated by inline lambdas when used with generic delegates (Action<T>). Using a named method works fine, so the issue seems specific to lambda expressions attached to Action<T> events.

Environment

  • TinyCLR OS

  • FEZ Feather

  • Visual Studio

  • C# event with Action<T>

Just wanted to report this so you can take a look. Let me know if you need a minimal repro project.

You are using the new stuff I see. That is great. We will look into this.

1 Like

We found a case that may cause your issue and fixed it. Please update the extension to v3.0.1.6001 (Visual Studio usually updates it automatically if that option is enabled). Nothing else needs to be updated — firmware and libraries are unchanged.

If it still happens, please post a simple project here so we can try it, but your issue is most likely addressed.

2 Likes