{"record":{"id":"d19ab36ee92f3d85","repo":"dotnet/wpf","slug":"argumentexception-path","errorCode":null,"errorMessage":"ArgumentException: path","messagePattern":"ArgumentException: path","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/PathInternal.cs","lineNumber":38,"sourceCode":"using System.Runtime.CompilerServices;\n\nnamespace MS.Internal\n{\n    internal sealed class PathInternal \n    {\n        internal static string GetRelativePath(string relativeTo, string path, StringComparison comparisonType)\n        {\n            if (relativeTo == null)\n                throw new ArgumentNullException(nameof(relativeTo));\n\n            if (PathInternal.IsEffectivelyEmpty(relativeTo.AsSpan()))\n                throw new ArgumentException(nameof(relativeTo));\n\n            if (path == null)\n                throw new ArgumentNullException(nameof(path));\n\n            if (PathInternal.IsEffectivelyEmpty(path.AsSpan()))\n                throw new ArgumentException(nameof(path));\n\n            Debug.Assert(comparisonType == StringComparison.Ordinal || comparisonType == StringComparison.OrdinalIgnoreCase);\n\n            relativeTo = Path.GetFullPath(relativeTo);\n            path = Path.GetFullPath(path);\n\n            // Need to check if the roots are different- if they are we need to return the \"to\" path.\n            if (!PathInternal.AreRootsEqual(relativeTo, path, comparisonType))\n                return path;\n\n            int commonLength = PathInternal.GetCommonPathLength(relativeTo, path, ignoreCase: comparisonType == StringComparison.OrdinalIgnoreCase);\n\n            // If there is nothing in common they can't share the same root, return the \"to\" path as is.\n            if (commonLength == 0)\n                return path;\n\n            // Trailing separators aren't significant for comparison\n            int relativeToLength = relativeTo.Length;","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/PathInternal.cs#L20-L56","documentation":"ICollection<KeyValuePair<K,V>>.Remove(item) on this internal ConcurrentDictionary is a stub that always throws NotImplementedException. Pair-based removal through the collection interface is not supported.","triggerScenarios":"Calling Remove(pair) via the ICollection<KeyValuePair<K,V>> interface; generic removal helpers or LINQ-style code paths binding to the interface member.","commonSituations":"Generic collection-editing utilities; code ported from Dictionary<K,V>; test code clearing entries through the interface.","solutions":["Remove entries with the key-based Remove(key) member instead of the pair-based interface method.","Guard the removal with ContainsKey if existence matters.","Adapt generic ICollection<T> consumers to call the key-based Remove.","File a WPF issue if the interface contract is required."],"exampleFix":"// before\n((ICollection<KeyValuePair<K,V>>)dict).Remove(pair); // throws\n// after\ndict.Remove(pair.Key);","handlingStrategy":"validation","validationCode":"if (dict.ContainsKey(item.Key)) dict.Remove(item.Key);","typeGuard":null,"tryCatchPattern":"try { coll.Remove(pair); } catch (NotImplementedException) { dict.Remove(pair.Key); }","preventionTips":["Use the key-based Remove(key) member","Guard removal with ContainsKey when existence matters","Avoid generic ICollection<T> mutation helpers on this type","Centralize dictionary mutation in helper methods that use supported members"],"tags":["not-implemented","dictionary","wpf","xaml"],"backgroundTag":"method-not-implemented","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}