# Google.Cloud.Diagnostics.Common - Class NullManagedTracer (5.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.3.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.NullManagedTracer)
- [5.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.NullManagedTracer)
- [5.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.NullManagedTracer)
- [5.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.NullManagedTracer)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.NullManagedTracer)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.NullManagedTracer)

    public sealed class NullManagedTracer : IManagedTracer

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class NullManagedTracer.

A managed tracer that does not trace.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> NullManagedTracer

## Implements

[IManagedTracer](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IManagedTracer)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Diagnostics.Common](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)

## Assembly

Google.Cloud.Diagnostics.Common.dll

## Fields

### Instance

    public static readonly NullManagedTracer Instance

Instance of [NullManagedTracer](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.NullManagedTracer)

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.NullManagedTracer` |   |

## Methods

### AnnotateSpan(Dictionary\<string, string\>)

    public void AnnotateSpan(Dictionary<string, string> labels)

Does nothing.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `labels` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2https://learn.microsoft.com/dotnet/api/system.stringhttps://learn.microsoft.com/dotnet/api/system.string` |

### GetCurrentSpanId()

    public ulong? GetCurrentSpanId()

Always returns null.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.uint64` |   |

### GetCurrentTraceId()

    public string GetCurrentTraceId()

Always returns null.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### RunInSpan(Action, string, StartSpanOptions)

    public void RunInSpan(Action action, string name, StartSpanOptions options = null)

Calls `action`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `action` | `https://learn.microsoft.com/dotnet/api/system.action` |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.StartSpanOptions` |

### RunInSpanAsync\<T\>(Func\<Task\<T\>\>, string, StartSpanOptions)

    public Task<T> RunInSpanAsync<T>(Func<Task<T>> func, string name, StartSpanOptions options = null)

Calls `func` asynchronously and returns the result.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `func` | `https://learn.microsoft.com/dotnet/api/system.func-1https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.StartSpanOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` |   |

### RunInSpan\<T\>(Func\<T\>, string, StartSpanOptions)

    public T RunInSpan<T>(Func<T> func, string name, StartSpanOptions options = null)

Calls `func` and returns the result.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `func` | `https://learn.microsoft.com/dotnet/api/system.func-1` |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.StartSpanOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` |   |

### SetStackTrace(StackTrace)

    public void SetStackTrace(StackTrace stackTrace)

Does nothing.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stackTrace` | `https://learn.microsoft.com/dotnet/api/system.diagnostics.stacktrace` |

### StartSpan(string, StartSpanOptions)

    public ISpan StartSpan(string name, StartSpanOptions options = null)

Does nothing.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.StartSpanOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ISpan` | Returns an [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable) that does nothing when disposed. |