3.3.0 (latest) 3.2.0 3.1.1 3.0.0 2.1.0

    public sealed class SourceContext : IMessage<SourceContext>, IMessage, IEquatable<SourceContext>, IDeepCloneable<SourceContext>

Reference documentation and code samples for the Google.Cloud.DevTools.Common class SourceContext.

A SourceContext is a reference to a tree of files. A SourceContext together
with a path point to a unique revision of a single file or directory.

## Inheritance

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

## Implements

[IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.md.txt)[SourceContext](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DevTools.Common/latest/Google.Cloud.DevTools.Source.V1.SourceContext.md.txt), [IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.md.txt), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SourceContext](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DevTools.Common/latest/Google.Cloud.DevTools.Source.V1.SourceContext.md.txt), [IDeepCloneable](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.md.txt)[SourceContext](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DevTools.Common/latest/Google.Cloud.DevTools.Source.V1.SourceContext.md.txt)

## 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.DevTools.Source.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DevTools.Common/latest/Google.Cloud.DevTools.Source.V1.md.txt)

## Assembly

Google.Cloud.DevTools.Common.dll

## Constructors

### SourceContext()

    public SourceContext()

### SourceContext(SourceContext)

    public SourceContext(SourceContext other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `SourceContext` |

## Fields

### GitRevisionIdLogLabel

    public const string GitRevisionIdLogLabel = "git_revision_id"

Gets the custom log label of Stackdriver Logging entry to set Git revision id.
When writing a Stackdriver Logging entry, the user should add this custom label,
with a value of the git revision id for the source code.
This enables Google Cloud Tools for Visual Studio to locate the source file revision
of the log entry.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

## Properties

### AppSourceContext

    public static SourceContext AppSourceContext { get; }

Gets the [SourceContext](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DevTools.Common/latest/Google.Cloud.DevTools.Source.V1.SourceContext.md.txt) for the application.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `SourceContext` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `InvalidProtocolBufferException` | The source context file is valid JSON, but is not valid as a SourceContext. |
| `InvalidJsonException` | The source context file is not valid JSON. |
| `SecurityException` | The application does not have permission to read the file. |
| `UnauthorizedAccessException` | The application is not authorized to access the file. |

### CloudRepo

    public CloudRepoSourceContext CloudRepo { get; set; }

A SourceContext referring to a revision in a cloud repo.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `CloudRepoSourceContext` |   |

### CloudWorkspace

    public CloudWorkspaceSourceContext CloudWorkspace { get; set; }

A SourceContext referring to a snapshot in a cloud workspace.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `CloudWorkspaceSourceContext` |   |

### ContextCase

    public SourceContext.ContextOneofCase ContextCase { get; }

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `SourceContextContextOneofCase` |   |

### Gerrit

    public GerritSourceContext Gerrit { get; set; }

A SourceContext referring to a Gerrit project.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `GerritSourceContext` |   |

### Git

    public GitSourceContext Git { get; set; }

A SourceContext referring to any third party Git repo (e.g. GitHub).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `GitSourceContext` |   |