{"record":{"id":"3d491d48398f7449","repo":"PrismLibrary/Prism","slug":"uri","errorCode":null,"errorMessage":"uri","messagePattern":"uri","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Prism.Core/Common/UriParsingHelper.cs","lineNumber":161,"sourceCode":"        /// <param name=\"uri\">The URI.</param>\n        public static INavigationParameters ParseQuery(Uri uri)\n        {\n            var query = GetQuery(uri);\n\n            return new NavigationParameters(query);\n        }\n\n        /// <summary>\n        /// Parses a uri string to a properly initialized Uri for Prism\n        /// </summary>\n        /// <param name=\"uri\">A uri string.</param>\n        /// <returns>A <see cref=\"Uri\"/>.</returns>\n        /// <exception cref=\"ArgumentNullException\">Throws an <see cref=\"ArgumentNullException\"/> when the string is null or empty.</exception>\n        public static Uri Parse(string uri)\n        {\n            if (uri == null)\n            {\n                throw new ArgumentNullException(nameof(uri));\n            }\n\n            return uri.StartsWith(\"/\", StringComparison.Ordinal)\n                ? new Uri(\"http://localhost\" + uri, UriKind.Absolute)\n                : new Uri(uri, UriKind.RelativeOrAbsolute);\n        }\n\n        /// <summary>\n        /// This will provide the existing <see cref=\"Uri\"/> if it is already Absolute, otherwise\n        /// it will build a new Absolute <see cref=\"Uri\"/>.\n        /// </summary>\n        /// <param name=\"uri\">The source <see cref=\"Uri\"/>.</param>\n        /// <returns>An Absolute <see cref=\"Uri\"/>.</returns>\n        public static Uri EnsureAbsolute(Uri uri)\n        {\n            if (uri.IsAbsoluteUri)\n            {\n                return uri;","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Prism.Core/Common/UriParsingHelper.cs#L143-L179","documentation":"UriParsingHelper.Parse throws ArgumentNullException with parameter name 'uri' when passed a null string. Note the docs say null-or-empty, but the code only checks null; an empty string is passed to new Uri and would fail later.","triggerScenarios":"Calling UriParsingHelper.Parse(null), typically via NavigationService navigation APIs given a null URI, or CommandParameter-bound URIs that never received a value.","commonSituations":"XAML bindings to a navigation command whose Uri property was never set; view-model navigation calls with null segment strings after failed configuration.","solutions":["Ensure a non-null uri string is passed","Check the value before navigating: if (uri is not null) navigationService.NavigateAsync(uri)","Fix the binding/data source that produced null"],"exampleFix":"// before\nawait _navigationService.NavigateAsync(_nextUri); // _nextUri null\n// after\nif (_nextUri is not null)\n    await _navigationService.NavigateAsync(_nextUri);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(uri))\n    throw new ArgumentException(\"uri must be a non-empty string\", nameof(uri));\nawait navigationService.NavigateAsync(uri);","typeGuard":"bool isNavigableUri(string uri) => !string.IsNullOrEmpty(uri);","tryCatchPattern":"try { await navigationService.NavigateAsync(uri); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"uri\") { /* fallback navigation */ }","preventionTips":["Initialize navigation URI properties to defaults","Null-check command parameters in navigation commands","Use UriParsingHelper only on verified non-null strings"],"tags":["null-argument","uri","navigation","prism"],"backgroundTag":"null-argument","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}