Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

ExecutionEngineException in diagnostic source listener #53

Closed
@rynowak

Description

@rynowak

You can cause the CLR to crash by using an invalid combination of types.

new { bar = new Guid() }

...

[DiagnosticName(...)]
public void OnFoo (string bar)
{
    ...
}

This is not valid, but the failure mode should be throwing an exception explaining the mistake, not shutting down the CLR 😆


The issue here is that the generated thunk for splatting the type isn't doing the right thing when the result of accessing the anonymoustype<>.bar property is a value type.

Adding the following at ProxyMethodEmitter@L160 fixing the issue

if (mapping.PropertyType.GetTypeInfo().IsValueType)
{
    il.Emit(OpCodes.Box, mapping.PropertyType);
}

Additionally, we should see if we can do anything to surface errors about this with context as it is today when you fix the bug, the exception message you get doesn't mention the method on the adapter which caused the problem.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions