WHIZ059: GUID Interception Suppressed¶
Verified by tests
GuidInterceptorGeneratorTests — library CI run #37346231411 (2026-10-05)
Severity: Info Category: Source Generation
Description¶
This informational diagnostic is reported when a GUID creation call could be intercepted but was suppressed via the [SuppressGuidInterception] attribute. This indicates intentional opt-out from TrackedGuid wrapping.
The diagnostic is reported whenever the generator runs — even if the MSBuild property WhizbangGuidInterceptionEnabled is not set (the property only gates whether interceptor code is generated for the non-suppressed calls).
Suppression via #pragma warning disable WHIZ055/WHIZ056 around a call disables interception silently — those calls produce no WHIZ059 (only attribute-based suppression is reported).
Diagnostic Message¶
Interception suppressed for System.Guid.NewGuid at /src/MyApp/TestData.cs:15 via SuppressGuidInterceptionAttribute on method
The last part identifies the suppression scope: on method, on local function, on type, or on assembly.
Why Suppress Interception¶
Common reasons to suppress GUID interception:
1. Test Fixtures¶
Test Fixtures
using Whizbang.Core;
[SuppressGuidInterception]
public static class TestData {
// Tests may need raw GUIDs for fixture data
public static readonly Guid KnownOrderId = Guid.Parse("550e8400-e29b-41d4-a716-446655440000");
public static Guid CreateTestGuid() {
return Guid.NewGuid(); // WHIZ059 reported here
}
}
2. Integration with External Systems¶
Integration with External Systems
public class ExternalApiClient {
[SuppressGuidInterception]
public Guid CreateExternalRequestId() {
// External system expects raw GUID format
return Guid.NewGuid(); // WHIZ059 reported here
}
}
3. Performance-Critical Paths¶
Performance-Critical Paths
public class HighThroughputProcessor {
[SuppressGuidInterception]
public Guid CreateTransientId() {
// Avoid TrackedGuid overhead for transient IDs
return Guid.NewGuid(); // WHIZ059 reported here
}
}
4. Legacy Code Migration¶
Legacy Code Migration
[SuppressGuidInterception]
public class LegacyService {
// Gradual migration - suppress for now
public Guid CreateId() => Guid.NewGuid();
}
Suppression Scopes¶
The [SuppressGuidInterception] attribute can be applied at different scopes:
Method Scope¶
Method Scope
public class MyService {
[SuppressGuidInterception]
public Guid CreateRawGuid() {
return Guid.NewGuid(); // Suppressed
}
public Guid CreateTrackedGuid() {
return Guid.NewGuid(); // Intercepted
}
}
Class Scope¶
Class Scope
[SuppressGuidInterception]
public class TestFixtures {
public Guid Id1 => Guid.NewGuid(); // Suppressed
public Guid Id2 => Guid.NewGuid(); // Suppressed
}
Local Function Scope¶
Local Function Scope
public Guid CreateId() {
[SuppressGuidInterception]
static Guid CreateRaw() => Guid.NewGuid(); // Suppressed
return CreateRaw();
}
Assembly Scope¶
Assembly Scope
// In AssemblyInfo.cs or any file
[assembly: SuppressGuidInterception]
// All GUID calls in this assembly are suppressed
Suppressing This Diagnostic¶
If you don't want to see WHIZ059 diagnostics:
Project-Level¶
Project-Level
Code-Level¶
Code-Level
#pragma warning disable WHIZ059
[SuppressGuidInterception]
public Guid CreateId() => Guid.NewGuid();
#pragma warning restore WHIZ059
Related Diagnostics¶
- WHIZ058 - GUID call intercepted (the inverse - when interception happens)
- WHIZ055 - Warning for
Guid.NewGuid()usage - WHIZ056 - Warning for
Guid.CreateVersion7()usage
See Also¶
- WhizbangIds - TrackedGuid and strongly-typed IDs
- TrackedGuid Interception - Full interception documentation
- SuppressGuidInterceptionAttribute - Attribute documentation