{"record":{"id":"1bedafdff9781d8e","repo":"dotnet/wpf","slug":"sr-badinternalsvisibleto2","errorCode":null,"errorMessage":"SR.BadInternalsVisibleTo2","messagePattern":"SR\\.BadInternalsVisibleTo2","errorType":"exception","errorClass":"XamlSchemaException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs","lineNumber":292,"sourceCode":"            }\n\n            return result;\n        }\n\n        private void LoadInternalsVisibleToHelper(List<AssemblyName> result, string assemblyName, Assembly assembly)\n        {\n            if (assemblyName is null)\n            {\n                throw new XamlSchemaException(SR.Format(SR.BadInternalsVisibleTo1, assembly.FullName));\n            }\n\n            try\n            {\n                result.Add(new AssemblyName(assemblyName));\n            }\n            catch (ArgumentException ex)\n            {\n                throw new XamlSchemaException(SR.Format(SR.BadInternalsVisibleTo2, assemblyName, assembly.FullName), ex);\n            }\n\n            // AssemblyName.ctor throws FLE on malformed assembly name\n            catch (FileLoadException ex)\n            {\n                throw new XamlSchemaException(SR.Format(SR.BadInternalsVisibleTo2, assemblyName, assembly.FullName), ex);\n            }\n        }\n\n        private Dictionary<string, string> LoadOldToNewNs()\n        {\n            Dictionary<string, string> result = new Dictionary<string, string>(StringComparer.Ordinal);\n\n            Assembly assembly = Assembly;\n            if (assembly is null)\n            {\n                return result;\n            }","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs#L274-L310","documentation":"LoadInternalsVisibleToHelper throws this XamlSchemaException when the assembly name string from an InternalsVisibleToAttribute cannot be parsed into an AssemblyName (ArgumentException from the constructor). It converts a malformed friend-assembly name into a schema error naming the offending assembly.","triggerScenarios":"Thrown at src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs:292 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a simple assembly name string (e.g. 'FriendAssembly') in InternalsVisibleTo without invalid qualifiers","Catch XamlSchemaException when scanning third-party assemblies with malformed InternalsVisibleTo attributes","Fix the attribute declaration in the assembly that carries it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}