-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Description
// Uri.CreateThisFromUri fires Debug.Assert: (_flags & Flags.Debug_LeftConstructor) == 0
// when combining a UNC file URI base with a "file:" relative URI.
//
// Source: System.Uri.DebugAssertInCtor() at Uri.cs:205
// System.Uri.CreateThisFromUri() at UriExt.cs:891
var baseUri = new Uri(@"\\aa", UriKind.Absolute); // parses as file://aa/
var relUri = new Uri("file:", UriKind.Relative);
_ = new Uri(baseUri, relUri); // Debug.Assert failureThe assert violation is in CreateThisFromUri — it expects the constructor flag Debug_LeftConstructor to not be set, but the re-entrant URI construction from a UNC base + file: relative violates this invariant.
This is from the extra DebugAssertInCtor I added to DebugSetLeftCtor in #123932. We should either remove the assert or avoid copying the Debug_LeftConstructor flag in CreateThisFromUri.
Reactions are currently unavailable