{"record":{"id":"396fda4d82f8db6b","repo":"dotnet/maui","slug":"uri-396fda","errorCode":null,"errorMessage":"uri","messagePattern":"uri","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/iOS/iOSAppLinks.cs","lineNumber":22,"sourceCode":"using Foundation;\nusing ObjCRuntime;\nusing UIKit;\n\nnamespace Microsoft.Maui.Controls.Compatibility.Platform.iOS\n{\n\tinternal class IOSAppLinks : IAppLinks\n\t{\n\t\tpublic async void DeregisterLink(IAppLinkEntry appLink)\n\t\t{\n\t\t\tif (string.IsNullOrWhiteSpace(appLink.AppLinkUri?.ToString()))\n\t\t\t\tthrow new ArgumentNullException(\"AppLinkUri\");\n\t\t\tawait RemoveLinkAsync(appLink.AppLinkUri?.ToString());\n\t\t}\n\n\t\tpublic async void DeregisterLink(Uri uri)\n\t\t{\n\t\t\tif (string.IsNullOrWhiteSpace(uri?.ToString()))\n\t\t\t\tthrow new ArgumentNullException(nameof(uri));\n\t\t\tawait RemoveLinkAsync(uri.ToString());\n\t\t}\n\n\t\tpublic async void RegisterLink(IAppLinkEntry appLink)\n\t\t{\n\t\t\tif (string.IsNullOrWhiteSpace(appLink.AppLinkUri?.ToString()))\n\t\t\t\tthrow new ArgumentNullException(\"AppLinkUri\");\n\t\t\tawait AddLinkAsync(appLink);\n\t\t}\n\n\t\tpublic async void DeregisterAll()\n\t\t{\n\t\t\tawait ClearIndexedDataAsync();\n\t\t}\n\n\t\tstatic async Task AddLinkAsync(IAppLinkEntry deepLinkUri)\n\t\t{\n\t\t\tvar appDomain = NSBundle.MainBundle.BundleIdentifier;","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/iOS/iOSAppLinks.cs#L4-L40","documentation":"DeregisterLink(Uri) is the URI-based overload for removing a Spotlight-indexed deep link. It throws ArgumentNullException when the passed Uri is null or its string representation is empty/whitespace, because the URI string is used directly as the CoreSpotlight item identifier for deletion.","triggerScenarios":"Calling `Application.Current.AppLinks.DeregisterLink(uri)` where `uri` is null or `uri.ToString()` returns an empty or whitespace string. Passing a default(Uri) or a Uri constructed from an empty string.","commonSituations":"Storing URIs in collections where some entries were never populated. Passing a Uri variable that was conditionally assigned. Deserialization producing null Uri fields.","solutions":["Validate the Uri is non-null and well-formed before calling DeregisterLink.","Guard at the call site: `if (uri != null && !string.IsNullOrWhiteSpace(uri.ToString())) Application.Current.AppLinks.DeregisterLink(uri);`","Prefer the IAppLinkEntry overload when working with full AppLinkEntry objects that carry their own AppLinkUri."],"exampleFix":"// before\nApplication.Current.AppLinks.DeregisterLink(storedUri); // storedUri may be null\n\n// after\nif (storedUri is not null && Uri.IsWellFormedUriString(storedUri.ToString(), UriKind.Absolute))\n    Application.Current.AppLinks.DeregisterLink(storedUri);","handlingStrategy":"validation","validationCode":"if (uri is null || string.IsNullOrWhiteSpace(uri.ToString()))\n    return;\nApplication.Current.AppLinks.DeregisterLink(uri);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Uri is non-null and well-formed before calling DeregisterLink.","Keep a registry of successfully indexed URIs to deregister later.","Prefer the IAppLinkEntry overload when you have the full entry object."],"tags":["maui","ios","applinks","core-spotlight","argument-null"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}