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.