{"record":{"id":"b0a8a6aaae0aba16","repo":"dotnet/maui","slug":"applinkuri","errorCode":null,"errorMessage":"AppLinkUri","messagePattern":"AppLinkUri","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/iOS/iOSAppLinks.cs","lineNumber":15,"sourceCode":"using System;\nusing System.Threading.Tasks;\nusing CoreSpotlight;\nusing 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()","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/iOS/iOSAppLinks.cs#L1-L33","documentation":"IOSAppLinks integrates .NET MAUI AppIndexing/AppLinks with iOS CoreSpotlight. DeregisterLink(IAppLinkEntry) removes a previously indexed deep link from Spotlight. It requires appLink.AppLinkUri to be a non-empty URI because that value is the lookup key used to delete the indexed item. Throwing ArgumentNullException here prevents a silent no-op deregistration of an unidentifiable link.","triggerScenarios":"Calling `Application.Current.AppLinks.DeregisterLink(appLinkEntry)` where `appLinkEntry.AppLinkUri` is null, an empty string, or whitespace. Occurs when an AppLinkEntry is constructed without setting AppLinkUri before deregistration.","commonSituations":"AppLinkEntry objects created at runtime from dynamic data where the URI field is optional. Serializing/deserializing AppLinkEntry across app launches where AppLinkUri was lost. Registering links conditionally but always attempting deregistration.","solutions":["Set AppLinkEntry.AppLinkUri before calling DeregisterLink: `entry.AppLinkUri = new Uri(\"myapp://detail/42\");`","Check the value before deregistering: `if (!string.IsNullOrWhiteSpace(entry.AppLinkUri?.ToString())) Application.Current.AppLinks.DeregisterLink(entry);`","Use the Uri overload DeregisterLink(Uri) if you already have the raw URI string."],"exampleFix":"// before\nvar entry = new AppLinkEntry { Title = \"Item\" };\nApplication.Current.AppLinks.DeregisterLink(entry);\n\n// after\nvar entry = new AppLinkEntry\n{\n    Title = \"Item\",\n    AppLinkUri = new Uri($\"myapp://item/{id}\")\n};\nApplication.Current.AppLinks.DeregisterLink(entry);","handlingStrategy":"validation","validationCode":"if (appLink is null || string.IsNullOrWhiteSpace(appLink.AppLinkUri?.ToString()))\n    return; // or handle missing URI gracefully\nApplication.Current.AppLinks.DeregisterLink(appLink);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set AppLinkUri when constructing an AppLinkEntry intended for indexing/deregistration.","Centralize AppLinkEntry creation in a factory that validates AppLinkUri.","Store registered URIs in a local set so you only deregister what you registered."],"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"}