Skip to main content

Class ProfilerMarkerExtensionsForGenerator

Namespace:
Assembly: Aspid.FastTools.dll

Provides the extension methods that mark call sites for the profiler-marker source generator.

public static class ProfilerMarkerExtensionsForGenerator

Inheritance​

object ← ProfilerMarkerExtensionsForGenerator

Methods​

Marker<T>(T)​

Opens the ProfilerMarker of this call site, named Type.Member (line).

public static ProfilerMarker.AutoScope Marker<T>(this T instance)

Parameters​

instance T

The instance the scope is opened on; its value is never read.

Returns​

ProfilerMarker.AutoScope

An empty scope: this overload runs only when the call gets no marker.

Type Parameters​

T

The type of instance; generic, so a struct is not boxed.

Remarks​

For every type that calls this method on its own instance the generator emits a closer overload that overload resolution picks instead, holding one ProfilerMarker per line of that type. This overload runs only for calls the generator cannot support; analyzer AFT0010 reports them.

WithName(in AutoScope, string)​

Names the ProfilerMarker that the generator creates for the preceding ProfilerMarkerExtensionsForGenerator.Marker<T> call.

public static ProfilerMarker.AutoScope WithName(this in ProfilerMarker.AutoScope marker, string name)

Parameters​

marker ProfilerMarker.AutoScope

The scope returned by ProfilerMarkerExtensionsForGenerator.Marker<T>.

name string

The text replacing the member part of the marker name. Read from the source at compile time, so it must be a string literal or an interpolated string without holes; anything else leaves the name untouched.

Returns​

ProfilerMarker.AutoScope

marker unchanged — at runtime the call is a pass-through.