Resl2001 Unsafe Oneof.Ast Access Warning Code Fix
title: RESL2001 — Unsafe OneOf.AsT* Access [Warning + Code Fix]
var oneOf = GetResult(); // OneOf<User, NotFound, ValidationError>
var user = oneOf.AsT1; // ⚠️ RESL2001: Access to '.AsT1' without checking '.IsT1'
// 💡 Fix: Replace with oneOf.Match(...)
// ✅ Safe alternatives:
if (oneOf.IsT1)
var user = oneOf.AsT1; // No warning — guarded
var user = oneOf.Match( // No warning — exhaustive pattern match
user => user,
notFound => throw new NotFoundException(),
error => throw new ValidationException());