Skip to content

[BUG]: Fody update causing Common Language Runtime detected an invalid program #8644

Description

@mrtristan

Tracer Version(s)

3.43.0

Operating system and platform

fargate mcr.microsoft.com/dotnet/sdk:10 / mcr.microsoft.com/dotnet/aspnet:10

Instrumentation Mode

automatic

TFM

net10

Bug Report

Very difficult to express steps to reproduce. We have an api receiving a request that fires a MassTransit message out to a receiver that's trying to process some work. Down that call stack we have an explosion that looks very much like something Fody would cause. Confirmed by reverting the pinned tracer version in docker and nuget to the last release before the Fody update (#7764)

System.InvalidProgramException: Common Language Runtime detected an invalid program.
   at OurNamespace.OurMethod(our method params)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   ... steps in our namespace ...
   at OurMassTransitConsumer.Consume(ConsumeContext`1 context) in /app/QueueConsumers/ProcessDeferredOrderCommandConsumer.cs:line 61
   at Datadog.Trace.ClrProfiler.CallTarget.Handlers.Continuations.TaskContinuationGenerator`3.SyncCallbackHandler.ContinuationAction(Task previousTask, TTarget target, CallTargetState state)
   at MassTransit.DependencyInjection.ScopeConsumerFactory`1.Send[TMessage](ConsumeContext`1 context, IPipe`1 next) in /_/src/MassTransit/DependencyInjection/DependencyInjection/ScopeConsumerFactory.cs:line 22
   at MassTransit.DependencyInjection.ScopeConsumerFactory`1.Send[TMessage](ConsumeContext`1 context, IPipe`1 next) in /_/src/MassTransit/DependencyInjection/DependencyInjection/ScopeConsumerFactory.cs:line 22
   at MassTransit.Middleware.ConsumerMessageFilter`2.MassTransit.IFilter<MassTransit.ConsumeContext<TMessage>>.Send(ConsumeContext`1 context, IPipe`1 next) in /_/src/MassTransit/Middleware/ConsumerMessageFilter.cs:line 48

Note this would also be followed usually with an unceremonious task crash with not-so-pretty logs. sometimes the stack trace is properly captured like above and other times it looks like this and tags aren't attached and then the process dies.

Image

again, reverting to 3.42.0 works

Reproduction Code

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions