Skip to content

WHIZ058: GUID Call Intercepted

Verified by tests

GuidInterceptorGeneratorTests, ThirdPartyGuidInterceptionTests — library CI run #31657041675 (2026-08-13)

Severity: Info Category: Source Generation

Description

This informational diagnostic is reported when the GuidInterceptorGenerator identifies a GUID creation call eligible for interception and wraps it with TrackedGuid. This enables metadata tracking for the generated GUID.

The diagnostic itself is reported whenever the generator finds an interceptable call — even if WhizbangGuidInterceptionEnabled is not set. However, the actual interceptor code (the TrackedGuid wrapping) is only generated when the MSBuild property WhizbangGuidInterceptionEnabled=true is set.

Calls inside Whizbang.* namespaces are never intercepted (the library controls its own GUID creation), so no WHIZ058 is reported for them.

Diagnostic Message

Intercepted System.Guid.NewGuid() at /src/MyApp/OrderService.cs:15 - wrapped with TrackedGuid for metadata tracking

What Gets Intercepted

The following GUID creation methods are intercepted:

Method Metadata
Guid.NewGuid() Version4 \| SourceMicrosoft
Guid.CreateVersion7() Version7 \| SourceMicrosoft
CombGuidIdGeneration.NewGuid() Version7 \| SourceMarten
UUIDNext.Uuid.NewSequential() Version7 \| SourceUuidNext
UUIDNext.Uuid.NewDatabaseFriendly() Version7 \| SourceUuidNext
Medo.Uuid7.NewUuid7() Version7 \| SourceMedo

Enabling Interception

Add to your project file:

Enabling Interception

<PropertyGroup>
  <WhizbangGuidInterceptionEnabled>true</WhizbangGuidInterceptionEnabled>
</PropertyGroup>

Suppressing This Diagnostic

If you want to suppress interception for specific code:

Method-Level Suppression

Method-Level Suppression

using Whizbang.Core;

[SuppressGuidInterception]
public Guid CreateRawGuid() {
  return Guid.NewGuid();  // Not intercepted, no WHIZ058
}

Class-Level Suppression

Class-Level Suppression

[SuppressGuidInterception]
public class TestFixtures {
  // All GUID calls in this class are not intercepted
}

Pragma Suppression

Wrapping a call in #pragma warning disable WHIZ055 (or WHIZ056) disables interception entirely for that call — no interceptor is generated and neither WHIZ058 nor WHIZ059 is reported:

Pragma Suppression

#pragma warning disable WHIZ055
var id = Guid.NewGuid();  // Not intercepted, no WHIZ058
#pragma warning restore WHIZ055

Note: #pragma warning disable WHIZ058 does not stop interception — the generator keys pragma suppression off the analyzer IDs WHIZ055/WHIZ056, not WHIZ058.

Project-Level Suppression

Hides the WHIZ058 informational message from build output. This does not stop interception — use [SuppressGuidInterception] or the WHIZ055/WHIZ056 pragma for that:

Project-Level Suppression

<PropertyGroup>
  <NoWarn>$(NoWarn);WHIZ058</NoWarn>
</PropertyGroup>

Why This Matters

TrackedGuid interception provides: - Version tracking - Know if a GUID is v4 (random) or v7 (time-ordered) - Source tracking - Know which library generated the GUID - Runtime validation - Validate that time-ordered GUIDs are used where required - Debugging - Trace GUID origins in complex systems

  • WHIZ059 - Interception suppressed (when [SuppressGuidInterception] is used)
  • WHIZ055 - Warning for Guid.NewGuid() usage (analyzer, separate from interception)
  • WHIZ056 - Warning for Guid.CreateVersion7() usage (analyzer)

See Also