Skip to content

Decide whether auto instrumented transactions in MAUI should set Scope.Transaction #5313

Description

@jamescrosswell

Description

See:

// Note that we may be creating a transaction here and if so we explicitly don't store it on
// Scope.Transaction, because Scope.Transaction is AsyncLocal<T> and MAUI Apps have a global scope. The
// results would be that we would store the transaction on the scope, but it would never be cleared again,
// since the next call to OnPropertyChanged for this RelayCommand will (likely) be from a different thread.
var span = hub.StartSpan(SpanName, SpanOp);
if (span is ITransactionTracer transaction)
{
hub.ConfigureScope(scope => scope.Transaction = transaction);
}

The code comment contradicts the code implementation. Either we change/remove the comment or we change the code.

If the comment is correct then the code itself needs to be changed (seems likely but need to verify).

Metadata

Metadata

Assignees

No one assigned

    Labels

    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