{"record":{"id":"62db34a53a865689","repo":"dotnet/maui","slug":"uniquename-must-not-contain-a","errorCode":null,"errorMessage":"uniqueName must not contain a .","messagePattern":"uniqueName must not contain a \\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Controls/src/Core/ExportEffectAttribute.cs","lineNumber":22,"sourceCode":"\nnamespace Microsoft.Maui.Controls\n{\n#pragma warning disable CS1734 // XML comment on 'ExportEffectAttribute' has a paramref tag for 'effectType', but there is no parameter by that name\n\t/// <summary>Attribute that identifies a <see cref=\"Microsoft.Maui.Controls.Effect\"/> with a unique identifier that can be used with <see cref=\"M:Microsoft.Maui.Controls.Effect.Resolve(System.String)\"/> to locate an effect.</summary>\n#pragma warning restore CS1734\n\t[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]\n\tpublic sealed class ExportEffectAttribute : Attribute\n\t{\n\t\t/// <summary>Creates a new <see cref=\"Microsoft.Maui.Controls.ExportEffectAttribute\"/>.</summary>\n\t\t/// <param name=\"effectType\">The type of the marked <see cref=\"Microsoft.Maui.Controls.Effect\"/>.</param>\n\t\t/// <param name=\"uniqueName\">A unique name for the <see cref=\"Microsoft.Maui.Controls.Effect\"/>.</param>\n\t\t/// <remarks>Developers must supply a</remarks>\n\t\tpublic ExportEffectAttribute(\n\t\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type effectType,\n\t\t\tstring uniqueName)\n\t\t{\n\t\t\tif (uniqueName.IndexOf(\".\", StringComparison.Ordinal) != -1)\n\t\t\t\tthrow new ArgumentException(\"uniqueName must not contain a .\");\n\t\t\tType = effectType;\n\t\t\tId = uniqueName;\n\t\t}\n\n\t\tinternal string Id { get; private set; }\n\n\t\t[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]\n\t\tinternal Type Type { get; private set; }\n\t}\n}","sourceCodeStart":4,"sourceCodeEnd":32,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Controls/src/Core/ExportEffectAttribute.cs#L4-L32","documentation":"ExportEffectAttribute rejects any uniqueName containing '.', because the runtime resolves effects via the 'ResolutionGroupName.Name' composite and an embedded dot would collide with that scheme or produce an ambiguous id. The constructor (ExportEffectAttribute.cs:22) does an ordinal IndexOf check and throws ArgumentException before storing the id.","triggerScenarios":"Decorating an assembly with `[assembly: ExportEffect(typeof(MyEffect), \"My.Group.Name\")]` or any name containing a period. Also triggered by copy-paste from ExportCell/ExportHandler attributes whose naming conventions differ.","commonSituations":"Migrating from Xamarin.Forms where names were reused, auto-generating effect attributes from a script that joins segments with '.', or accidentally including a namespace prefix in the uniqueName.","solutions":["Remove all '.' characters from the uniqueName argument, e.g. use \"MyEffect\" not \"MyCompany.MyEffect\".","Keep the resolution group name on ExportEffect via the separate [assembly: ResolutionGroupName(\"MyCompany\")] attribute; the group and the effect name are concatenated by the runtime.","If you need namespacing for uniqueness, use camelCase or underscores (\"MyCompany_MyEffect\") rather than dots.","Audit every ExportEffect assembly attribute for stray dots after bulk edits."],"exampleFix":"// before\n[assembly: ExportEffect(typeof(MyEffect), \"Acme.MyEffect\")]\n\n// after\n[assembly: ResolutionGroupName(\"Acme\")]\n[assembly: ExportEffect(typeof(MyEffect), \"MyEffect\")]","handlingStrategy":"validation","validationCode":"if (uniqueName.Contains('.')) throw new ArgumentException(\"uniqueName must not contain '.'\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define effect names as constants without dots and reference them in the attribute.","Put the company prefix in ResolutionGroupName, not in the ExportEffect name.","Add a build-time check or unit test that scans assembly attributes for names containing '.'."],"tags":["maui","effects","attributes","configuration"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}