401 instantiations of XElement
BuildBoss (1)
InternalsVisibleTo.cs (1)
28var element = new XElement("InternalsVisibleTo");
CustomEncryptorSample (3)
CustomXmlDecryptor.cs (1)
24return new XElement(encryptedElement.Elements().Single());
CustomXmlEncryptor.cs (2)
26var newElement = new XElement("unencryptedKey", 28new XElement(plaintextElement));
dotnet-svcutil-lib (13)
Shared\MSBuildProj.cs (12)
84_projectReferenceGroup = new XElement("ItemGroup"); 107_referenceGroup = new XElement("ItemGroup"); 131_packageReferenceGroup = new XElement("ItemGroup"); 450XElement propertyGroup = new XElement(group); 538this.ProjectReferceGroup.Add(new XElement("ProjectReference", new XAttribute("Include", dependency.FullPath))); 541this.ReferenceGroup.Add(new XElement("Reference", new XAttribute("Include", dependency.AssemblyName), new XElement("HintPath", dependency.FullPath))); 544this.PacakgeReferenceGroup.Add(new XElement("PackageReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version))); 547this.ReferenceGroup.Add(new XElement("DotNetCliToolReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version))); 561this.ReferenceGroup.Add(new XElement("Content", 571this.PacakgeReferenceGroup.Add(new XElement("Content", 598XElement element = new XElement(propertyName, null);
Shared\Utilities\RuntimeEnvironmentHelper.cs (1)
100var addElement = new XElement("add");
dotnet-user-jwts (2)
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
dotnet-user-secrets (2)
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\MultiApplicationTests.cs (1)
132var newApplication = new XElement(application);
IIS.LongTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (2)
1410new XElement("binding", 1413new XElement("binding",
IIS.NewHandler.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (2)
1410new XElement("binding", 1413new XElement("binding",
IIS.NewShim.FunctionalTests (3)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (2)
1410new XElement("binding", 1413new XElement("binding",
IIS.ShadowCopy.Tests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
IISExpress.FunctionalTests (4)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\MultiApplicationTests.cs (1)
132var newApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (2)
1410new XElement("binding", 1413new XElement("binding",
illink (7)
ILLink.Tasks (1)
CombineLinkerXmlFiles.cs (1)
30 var combined = new XElement ("linker");
Microsoft.AspNetCore.App.Analyzers.Test (4)
RouteEmbeddedLanguage\RoutePatternParserTests.cs (4)
249var element = new XElement("Tree", 265var parameterElement = new XElement("Parameter", 276parameterElement.Add(new XElement("Policy", policy)); 285new XElement("Diagnostic",
Microsoft.AspNetCore.Authentication.Test (7)
CookieTests.cs (3)
1890var xml = new XElement("xml"); 1893xml.Add(result.Ticket.Principal.Claims.Select(claim => new XElement("claim", new XAttribute("type", claim.Type), new XAttribute("value", claim.Value)))); 1897xml.Add(result.Ticket.Properties.Items.Select(extra => new XElement("extra", new XAttribute("type", extra.Key), new XAttribute("value", extra.Value))));
TestExtensions.cs (4)
49var xml = new XElement("xml"); 55new XElement("claim", new XAttribute("type", claim.Type), 68var xml = new XElement("xml"); 73xml.Add(new XElement("token", new XAttribute("name", token.Name),
Microsoft.AspNetCore.DataProtection (45)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (3)
43var encryptionElement = new XElement("encryption", 48: (object)new XElement("validation", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (2)
37var masterKeyElement = new XElement("masterKey", 39new XElement("value", unprotectedSecretAsBase64String));
KeyManagement\XmlKeyManager.cs (12)
387var revocationElement = new XElement(RevocationElementName, 389new XElement(RevocationDateElementName, revocationDate), 391new XElement(KeyElementName, 393new XElement(ReasonElementName, reason)); 524var keyElement = new XElement(KeyElementName, 527new XElement(CreationDateElementName, creationDate), 528new XElement(ActivationDateElementName, activationDate), 529new XElement(ExpirationDateElementName, expirationDate), 632var revocationElement = new XElement(RevocationElementName, 634new XElement(RevocationDateElementName, revocationDate), 635new XElement(KeyElementName, 637new XElement(ReasonElementName, reason));
Repositories\EphemeralXmlRepository.cs (3)
41yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 70deletableElements.Add(new DeletableElement(storedElement, new XElement(storedElement)));
XmlEncryption\CertificateXmlEncryptor.cs (1)
89xmlDocument.Load(new XElement("root", plaintextElement).CreateReader());
XmlEncryption\DpapiNGXmlEncryptor.cs (2)
85var element = new XElement("encryptedKey", 88new XElement("value",
XmlEncryption\DpapiXmlEncryptor.cs (2)
82var element = new XElement("encryptedKey", 84new XElement("value",
XmlEncryption\EncryptedXmlDecryptor.cs (1)
69xmlDocument.Load(new XElement("root", encryptedElement).CreateReader());
XmlEncryption\NullXmlDecryptor.cs (1)
31return new XElement(encryptedElement.Elements().Single());
XmlEncryption\NullXmlEncryptor.cs (2)
56var newElement = new XElement("unencryptedKey", 58new XElement(plaintextElement) /* copy ctor */);
XmlEncryption\XmlEncryptionExtensions.cs (7)
29var doc = new XDocument(new XElement(element)); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 56var newPlaceholder = new XElement("placeholder"); 111var doc = new XDocument(new XElement(element)); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 150new XElement(XmlConstants.EncryptedSecretElementName,
XmlExtensions.cs (1)
21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.DataProtection.Tests (39)
Internal\KeyManagementOptionsPostSetupTest.cs (1)
17private static readonly XElement xElement = new("element");
KeyManagement\XmlKeyManagerTests.cs (10)
154new XElement("creationDate", creationDate), 155new XElement("activationDate", activationDate), 156new XElement("expirationDate", expirationDate)); 253new XElement("creationDate", creationDate), 254new XElement("activationDate", activationDate), 255new XElement("expirationDate", expirationDate)); 282new XElement("creationDate", creationDate), 283new XElement("activationDate", activationDate), 284new XElement("expirationDate", expirationDate)); 712new XElement("revocationDate", revocationDate));
Repositories\EphemeralXmlRepositoryTests.cs (3)
47var element1 = new XElement("element1"); 48var element2 = new XElement("element2"); 91repository.StoreElement(new XElement("element1"), friendlyName: "friendly1");
Repositories\FileSystemXmlRepositoryTests.cs (9)
130repository.StoreElement(new XElement("element1"), friendlyName: null); 131repository.StoreElement(new XElement("element2"), friendlyName: null); 132repository.StoreElement(new XElement("element3"), friendlyName: null); 152var element1 = new XElement("element1"); 153var element2 = new XElement("element2"); 201repository.StoreElement(new XElement("element1"), friendlyName: "friendly1"); 202repository.StoreElement(new XElement("element2"), friendlyName: "friendly2"); 203repository.StoreElement(new XElement("element3"), friendlyName: "friendly3"); 253repository.StoreElement(new XElement("element1"), friendlyName: "friendly1");
Repositories\RegistryXmlRepositoryTests.cs (6)
117repository.StoreElement(new XElement("element1"), friendlyName: null); 118repository.StoreElement(new XElement("element2"), friendlyName: null); 119repository.StoreElement(new XElement("element3"), friendlyName: null); 140var element1 = new XElement("element1"); 141var element2 = new XElement("element2"); 196repository.StoreElement(new XElement("element1"), friendlyName: "friendly1");
ServiceCollectionTests.cs (1)
99var xElement = new XElement("element");
XmlEncryption\EncryptedXmlDecryptorTests.cs (4)
20var data = new XElement("SampleData", "Lorem ipsum"); 38var data = new XElement("SampleData", "Lorem ipsum"); 56var data = new XElement("SampleData", "Lorem ipsum"); 78var data = new XElement("SampleData", "Lorem ipsum");
XmlEncryption\XmlEncryptionExtensionsTests.cs (5)
179.Returns<XElement>(el => new XElement(el.Name.LocalName + "_decrypted", new XElement(XmlConstants.EncryptedSecretElementName, "nested"))); 217mockXmlEncryptor.Setup(o => o.Encrypt(It.IsAny<XElement>())).Returns(new EncryptedXmlInfo(new XElement("theElement"), typeof(MyXmlDecryptor))); 265.Returns<XElement>(element => new EncryptedXmlInfo(new XElement(element.Name.LocalName + "_encrypted"), typeof(MyXmlDecryptor))); 314.Returns<XElement>(element => new EncryptedXmlInfo(new XElement(element), typeof(MyXmlDecryptor)));
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (3)
UnaryServerCallHandlerTests.cs (3)
1137var requestContent = new XDocument(new XElement("name", "World")).ToString(); 1291var requestContent = new XDocument(new XElement("name", "World")).ToString(); 1321var requestContent = new XDocument(new XElement("name", "World")).ToString();
Microsoft.AspNetCore.Http.Connections.Tests (2)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (2)
31 yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.AspNetCore.Identity.InMemory.Test (3)
FunctionalTest.cs (3)
409var xml = new XElement("xml"); 412xml.Add(result.Principal.Claims.Select(claim => new XElement("claim", new XAttribute("type", claim.Type), new XAttribute("value", claim.Value)))); 416xml.Add(result.Properties.Items.Select(extra => new XElement("extra", new XAttribute("type", extra.Key), new XAttribute("value", extra.Value))));
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (1)
XmlAssert.cs (1)
70return new XElement(
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
src\Mvc\Mvc.Formatters.Xml\test\XmlAssert.cs (1)
70return new XElement(
Microsoft.AspNetCore.Rewrite (1)
IISUrlRewrite\UrlRewriteFileParser.cs (1)
28throw new InvalidUrlRewriteFormatException(new XElement(RewriteTags.Rewrite), "The root element '<rewrite>' is missing");
Microsoft.AspNetCore.Server.IntegrationTesting (2)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (2)
169environmentVariablesSection = new XElement("environmentVariables"); 175var environmentVariable = new XElement("environmentVariable");
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (3)
XElementExtensions.cs (3)
26existing = new XElement(name); 38existing = new XElement(name, new XAttribute(attribute, attributeValue)); 47var innerElement = new XElement(name, new XAttribute(attribute, attributeValue));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (2)
31 yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.AspNetCore.SignalR.Tests (2)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (2)
31 yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.Build.Tasks.Core (14)
AssemblyDependency\GenerateBindingRedirects.cs (6)
80runtimeNode = new XElement("runtime"); 91select new XElement( 93new XElement( 95new XElement( 100new XElement( 335new XElement("configuration"));
AssemblyDependency\ResolveAssemblyReference.cs (4)
1220var node = new XElement( 1222new XElement( 1224new XElement( 1227new XElement(
CombineTargetFrameworkInfoProperties.cs (3)
49new("TargetFramework", new XAttribute("Name", EscapingUtilities.Escape(RootElementName))) : 50new(RootElementName); 54root.Add(new XElement(item.ItemSpec, item.GetMetadata("Value")));
CombineXmlElements.cs (1)
36XElement root = new XElement(RootElementName);
Microsoft.Cci.Extensions (5)
Dgml\DgmlExtensions.cs (5)
31var xRoot = new XElement(XName.Get("DirectedGraph", dgmlNsp)); 34var xNodes = new XElement(XName.Get("Nodes", dgmlNsp)); 41var xNode = new XElement(XName.Get("Node", dgmlNsp), 47var xLinks = new XElement(XName.Get("Links", dgmlNsp)); 54var xLink = new XElement(XName.Get("Link", dgmlNsp),
Microsoft.CodeAnalysis (1)
InternalUtilities\XmlUtilities.cs (1)
28XContainer temp = new XElement("temp");
Microsoft.CodeAnalysis.CodeStyle (13)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
464=> new(nameof(NamingStyle),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (4)
321return new XElement("NamingPreferencesInfo", 324new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 325new XElement("NamingRules", NamingRules.Select(n => n.CreateXElement()))); 384UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
34var element = new XElement(nameof(SerializableNamingRule),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (7)
248var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 260var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 272var modifiersElement = new XElement(nameof(RequiredModifierList)); 375SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 376SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 377SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 538=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (17)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (10)
189=> new XElement("Tree", 200var element = new XElement("Diagnostic"); 227var element = new XElement(node.Kind.ToString()); 238=> new( 247=> new( 254=> new( 260=> new( 274var element = new XElement(token.Kind.ToString()); 292=> new( 366return new XElement(element.Name, children);
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (7)
200var element = new XElement("Tree", 210new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value), GetTextAttribute(text, kvp.Value))), 212new XElement("Capture", new XAttribute("Name", kvp.Key), new XAttribute("Span", kvp.Value), GetTextAttribute(text, kvp.Value))))); 220new XElement("Diagnostic", 233var element = new XElement(node.Kind.ToString()); 248var element = new XElement(alternationNode.Kind.ToString()); 257var element = new XElement(token.Kind.ToString());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Metadata\PE\LoadingNamespacesAndTypes.cs (1)
106XElement elem = new XElement("type");
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
EmitMetadataTestBase.cs (2)
48XElement elem = new XElement("type"); 87XElement elem = new XElement("field");
Microsoft.CodeAnalysis.Test.Utilities (4)
InstrumentationChecker.cs (1)
273public static readonly XElement InstrumentationHelperSource = new XElement("file", new XAttribute("name", "c.vb"), InstrumentationHelperSourceStr);
Syntax\XmlHelpers.cs (3)
123xml = new XElement("Node", 164XElement retVal = new XElement("Node", 217XElement retVal = new XElement("Node",
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
Emit\EmitMetadata.vb (2)
157Dim elem As Xml.Linq.XElement = New System.Xml.Linq.XElement("type") 191Dim elem As Xml.Linq.XElement = New System.Xml.Linq.XElement("field")
Microsoft.CodeAnalysis.Workspaces (15)
Shared\Extensions\ISymbolExtensions.cs (2)
440var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 575XContainer temp = new XElement("temp");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
464=> new(nameof(NamingStyle),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (4)
321return new XElement("NamingPreferencesInfo", 324new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 325new XElement("NamingRules", NamingRules.Select(n => n.CreateXElement()))); 384UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
34var element = new XElement(nameof(SerializableNamingRule),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (7)
248var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 260var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 272var modifiersElement = new XElement(nameof(RequiredModifierList)); 375SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 376SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 377SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 538=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
src\Compilers\Core\Portable\InternalUtilities\XmlUtilities.cs (1)
28XContainer temp = new XElement("temp");
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (4)
SolutionGeneration.cs (2)
333return new XElement(XName.Get(name, NS)); 338element.Add(new XElement(XName.Get(elementName, NS), elementValue));
VisualStudioMSBuildWorkspaceTests.cs (2)
2439r => r.Add(new XElement(XName.Get("ReferenceOutputAssembly", MSBuildNamespace), "false"))); 2459r => r.Add(new XElement(XName.Get("ReferenceOutputAssembly", MSBuildNamespace), "false")));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (8)
Workspaces\TestWorkspace_XmlCreation.cs (8)
80return new XElement(WorkspaceElementName, projectElements); 91return new XElement(ProjectElementName, 147var element = new XElement(CompilationOptionsElementName); 155element.Add(vbOptions.GlobalImports.AsEnumerable().Select(i => new XElement(GlobalImportElementName, i.Name))); 187=> new XElement(MetadataReferenceElementName, path); 192var element = new XElement(DocumentElementName, 209return new XElement(DocumentFromSourceGeneratorElementName, 220: new XElement(ParseOptionsElementName,
Microsoft.DotNet.Arcade.Sdk (6)
src\GenerateResxSource.cs (1)
427string escapedTrimmedValue = new XElement("summary", value).ToString();
src\SourceBuild\AddSourceMappingToNugetConfig.cs (3)
58pkgSrcMappingClearElement = new XElement("clear"); 62var pkgSrc = new XElement("packageSource", new XAttribute("key", SourceName)); 65pkgSrc.Add(new XElement("package", new XAttribute("pattern", packagePattern)));
src\SourceBuild\AddSourceToNuGetConfig.cs (2)
43var sourceElementToAdd = new XElement( 71packageSourcesElement.AddFirst(new XElement("clear"));
Microsoft.DotNet.Build.Tasks.Installers (10)
src\GenerateMacOSDistributionFile.cs (10)
41var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 62var scriptElement = new XElement("script", new XCData(archScriptContent)); 65.Select(component => new XElement("choice", 70new XElement("pkg-ref", new XAttribute("id", component.GetMetadata("FileNameWithExtension"))))); 77choiceElements.Select(c => new XElement(c) 80choiceElements.Select(c => new XElement(c) 87.Select(c => new XElement("line", new XAttribute("choice", c.Attribute("id").Value))); 90.Select(component => new XElement("pkg-ref", 98optionsElement = new XElement("options"); 116document.Root.Add(new XElement("choices-outline", choiceLineElements));
Microsoft.DotNet.Build.Tasks.Workloads (6)
Msi\MsiPayloadPackageProject.wix.cs (1)
61itemGroup.Add(new XElement("None",
Msi\WorkloadPackGroupMsi.wix.cs (5)
95componentGroupRefElement.ReplaceWith(Enumerable.Range(1, _package.Packs.Count).Select(n => new XElement(ns + "ComponentGroupRef", new XAttribute("Id", "CG_PackageContents" + n)))); 105registryKeyElement.Add(new XElement(ns + "RegistryKey", new XAttribute("Key", pack.Id), 106new XElement(ns + "RegistryKey", new XAttribute("Key", pack.PackageVersion), 107new XElement(ns + "RegistryValue", new XAttribute("Value", ""), new XAttribute("Type", "string"))))); 184var xml = new XElement(ns + "Directory");
Microsoft.DotNet.PackageTesting (9)
VerifyClosure.cs (9)
346var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 360linksElement.Add(new XElement(s_dgmlns + "Link", 369linksElement.Add(new XElement(s_dgmlns + "Link", 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 380categoriesElement.Add(new XElement(s_dgmlns + "Category", 385categoriesElement.Add(new XElement(s_dgmlns + "Category", 400parent.Add(new XElement(s_dgmlns + "Node",
Microsoft.DotNet.SharedFramework.Sdk (11)
src\CreateFrameworkListFile.cs (2)
67var frameworkManifest = new XElement("FileList", rootAttributes); 158var element = new XElement(
src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (9)
346var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 360linksElement.Add(new XElement(s_dgmlns + "Link", 369linksElement.Add(new XElement(s_dgmlns + "Link", 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 380categoriesElement.Add(new XElement(s_dgmlns + "Category", 385categoriesElement.Add(new XElement(s_dgmlns + "Category", 400parent.Add(new XElement(s_dgmlns + "Node",
Microsoft.DotNet.SourceBuild.Tasks (15)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (1)
30public XElement ToXml() => new XElement(
src\UsageReport\UsageData.cs (7)
18public XElement ToXml() => new XElement( 20CreatedByRid == null ? null : new XElement( 23ProjectDirectories?.Any() != true ? null : new XElement( 26.Select(dir => new XElement("Dir", dir))), 27NeverRestoredTarballPrebuilts?.Any() != true ? null : new XElement( 32IgnorePatterns?.Any() != true ? null : new XElement( 36Usages?.Any() != true ? null : new XElement(
src\UsageReport\UsagePattern.cs (1)
15public XElement ToXml() => new XElement(
src\UsageReport\ValidateUsageAgainstBaseline.cs (3)
83var report = new XElement("BaselineComparison"); 97new XElement( 111report.Add(new XElement("Removed", diff.Removed.Select(id => id.ToXElement())));
src\UsageReport\WriteUsageReports.cs (1)
107var report = new XElement("AnnotatedUsages");
src\UsageReport\XmlParsingHelpers.cs (1)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement(
Microsoft.DotNet.VersionTools (12)
BuildManifest\Model\BlobArtifactModel.cs (1)
97public XElement ToXml() => new XElement(
BuildManifest\Model\BuildIdentity.cs (1)
163public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes());
BuildManifest\Model\BuildModel.cs (1)
28public XElement ToXml() => new XElement(
BuildManifest\Model\EndpointModel.cs (1)
49public XElement ToXml() => new XElement(
BuildManifest\Model\OrchestratedBuildModel.cs (1)
42public XElement ToXml() => new XElement(
BuildManifest\Model\PackageArtifactModel.cs (1)
115public XElement ToXml() => new XElement(
BuildManifest\Model\SigningInformationModel.cs (6)
35public XElement ToXml() => IsEmpty() ? null : new XElement( 101public XElement ToXml() => new XElement( 150public XElement ToXml() => new XElement( 186public XElement ToXml() => new XElement( 216public XElement ToXml() => new XElement( 257public XElement ToXml() => new XElement(
Microsoft.DotNet.XliffTasks (10)
Model\XElementExtensions.cs (3)
35targetElement = new XElement(Target, new XAttribute("state", "new")); 69targetElement = new XElement(Target); 122noteElement = new XElement(Note);
Model\XlfDocument.cs (7)
49new XElement(Xliff, 54new XElement(File, 59new XElement(Body)))); 188new(TransUnit, 190new XElement(Source, sourceNode.Source), 191new XElement(Target, new XAttribute("state", "new"), sourceNode.Source), 192new XElement(Note, sourceNode.Note == "" ? null : sourceNode.Note));
Microsoft.Extensions.FileProviders.Embedded.Tests (6)
Manifest\TestEntry.cs (3)
24new XElement("File", new XAttribute("Name", Name), new XElement("ResourcePath", ResourcePath)) : 25new XElement("Directory", new XAttribute("Name", Name), Children.Select(c => c.ToXElement()));
TestAssembly.cs (3)
34new XElement("Manifest", 35new XElement("ManifestVersion", "1.0"), 36new XElement("FileSystem", entry.Children.Select(c => c.ToXElement()))));
Microsoft.Maui.Resizetizer (13)
GeneratePackageAppxManifest.cs (10)
84 identity = new XElement(xidentity); 128 properties = new XElement(xproperties); 174 applications = new XElement(xapplications); 183 application = new XElement(xapplication); 192 visual = new XElement(xvisual); 255 tile = new XElement(xtile); 312 showname = new XElement(xshowname); 320 showname.Add(new XElement(xshowon, new XAttribute("Tile", "square150x150Logo"))); 322 showname.Add(new XElement(xshowon, new XAttribute("Tile", "wide310x150Logo"))); 331 splash = new XElement(xsplash);
GenerateTizenManifest.cs (3)
125 label = new XElement(xmlns + LabelName); 165 splashscreensElement = new XElement(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName);
Microsoft.ML.Maml (1)
HelpCommand.cs (1)
509return new XElement("DefaultValue", a.DefaultValue);
Microsoft.VisualStudio.LanguageServices (14)
Snippets\SnippetExpansionClient.cs (14)
657declarations.Add(new XElement( 659new XElement(snippetNamespace + "ID", new XText(parameter.Name)), 660new XElement(snippetNamespace + "Default", new XText(parameterValues.GetValueOrDefault(parameter.Name, ""))))); 669declarations.Add(new XElement( 671new XElement(snippetNamespace + "ID", new XText(PlaceholderSnippetField)), 672new XElement(snippetNamespace + "Default", new XText("")))); 687new XElement( 689new XElement( 692new XElement( 694new XElement(snippetNamespace + "Title", new XText(methodName)), 695new XElement(snippetNamespace + "Description", new XText(s_fullMethodCallDescriptionSentinel))), 696new XElement( 698new XElement(snippetNamespace + "Declarations", declarations.ToArray()), 699new XElement(
PresentationFramework-SystemXmlLinq (1)
SystemXmlLinqExtension.cs (1)
21XElement xelement = new XElement("Dummy");
SignalR.Client.FunctionalTestApp (2)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (2)
31 yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Stress.ApiService (2)
Program.cs (2)
198var xmlWithUrl = new XElement(new XElement("url", "http://localhost:8080")).ToString();
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
373o = new System.Xml.Linq.XElement("default");
System.Private.Xml.Linq (14)
System\Xml\Linq\XContainer.cs (6)
164AddNode(new XElement(x)); 491AddNodeSkipNotify(new XElement(x)); 906XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 960XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1020XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1134XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName));
System\Xml\Linq\XElement.cs (5)
164XElement xe = new XElement(default(AsyncConstructionSentry)); 812XElement e = new XElement(reader, options); 848XElement e = new XElement(default(AsyncConstructionSentry)); 1270AddNode(new XElement(name, GetStringValue(value))); 1955return new XElement(this);
System\Xml\Linq\XLinq.cs (1)
95AddNode(new XElement(x));
System\Xml\Linq\XNode.cs (1)
444return new XElement(reader);
System\Xml\Linq\XNodeBuilder.cs (1)
183AddNode(new XElement(XNamespace.Get(namespaceName!).GetName(localName)));
XmlFileLogger (19)
LogProcessNode.cs (2)
128var propElement = new XElement("Properties"); 131propElement.Add(new XElement("Property", new XAttribute("Name", p.Key)) { Value = p.Value });
ObjectModel\Build.cs (2)
47var root = new XElement("Build", 66WriteChildren<Message>(parentElement, () => new XElement("BuildMessageEvents"));
ObjectModel\Item.cs (2)
71var element = new XElement("Item"); 79var metadataElement = new XElement(metadataItem.Key);
ObjectModel\Message.cs (1)
36element.Add(new XElement("Message", new XAttribute("Timestamp", _timestamp), new XText(_message)));
ObjectModel\Project.cs (2)
98var element = new XElement("Project", 107WriteChildren<Message>(element, () => new XElement("ProjectMessageEvents"));
ObjectModel\Target.cs (3)
35var element = new XElement("Target", 43WriteChildren<Message>(element, () => new XElement("TargetMessages")); 44WriteChildren<ItemGroup>(element, () => new XElement("ItemGroups"));
ObjectModel\Task.cs (6)
49var task = new XElement("Task", 56WriteChildren<Message>(task, () => new XElement("TaskMessages")); 57WriteChildren<InputParameter>(task, () => new XElement("Parameters")); 58WriteChildren<OutputItem>(task, () => new XElement("OutputItems")); 59WriteChildren<OutputProperty>(task, () => new XElement("OutputProperties")); 63task.Add(new XElement("CommandLineArguments") { Value = CommandLineArguments });
ObjectModel\TaskParameter.cs (1)
46XElement element = new XElement(name);
xunit.console (2)
ConsoleRunner.cs (2)
282assembliesElement = new XElement("assemblies"); 335var assemblyElement = needsXml ? new XElement("assembly") : null;
2372 references to XElement
BuildBoss (16)
InternalsVisibleTo.cs (1)
28var element = new XElement("InternalsVisibleTo");
ProjectCheckerUtil.cs (1)
81foreach (var element in _projectUtil.GetAllPropertyGroupElements())
ProjectUtil.cs (14)
47internal XElement GetTargetFramework() => Document.XPathSelectElements("//mb:TargetFramework", Manager).FirstOrDefault(); 49internal XElement GetTargetFrameworks() => Document.XPathSelectElements("//mb:TargetFrameworks", Manager).FirstOrDefault(); 66var targetFramework = GetTargetFramework(); 72var targetFrameworks = GetTargetFrameworks(); 82internal IEnumerable<XElement> GetAllPropertyGroupElements() 85foreach (var group in groups) 87foreach (var element in group.Elements()) 94internal IEnumerable<XElement> GetTargets() 99internal IEnumerable<XElement> GetImports() 116foreach (var r in references) 130var projectElement = r.Element(Namespace.GetName("Project")); 147foreach (var ivt in Document.XPathSelectElements("//mb:InternalsVisibleTo", Manager)) 155internal InternalsVisibleTo GetInternalsVisibleTo(XElement element) 164internal XElement FindSingleProperty(string localName) => GetAllPropertyGroupElements().SingleOrDefault(x => x.Name.LocalName == localName);
ConfigurationSchemaGenerator (6)
ConfigSchemaEmitter.cs (6)
363return XElement.Parse(xml).ToString(SaveOptions.None); 437var memberRoot = doc.Element("member") ?? doc.Element("doc"); 438var summary = memberRoot?.Element("summary"); 469internal static string FormatDescription(XElement element) 508XElement element => GetElementText(element), 539private static string GetElementText(XElement element)
ConfigurationSchemaGenerator.Tests (8)
GeneratorTests.cs (8)
80var summaryElement = ConvertToSummaryElement(input); 97var summaryElement = ConvertToSummaryElement(input); 111var summaryElement = ConvertToSummaryElement(input); 129var summaryElement = ConvertToSummaryElement(input); 140var summaryElement = ConvertToSummaryElement(input); 151var summaryElement = ConvertToSummaryElement(input); 157private static XElement ConvertToSummaryElement(string input) 163return (XElement)XNode.ReadFrom(reader);
CustomEncryptorSample (4)
CustomXmlDecryptor.cs (2)
20public XElement Decrypt(XElement encryptedElement)
CustomXmlEncryptor.cs (2)
20public EncryptedXmlInfo Encrypt(XElement plaintextElement) 26var newElement = new XElement("unencryptedKey",
dotnet-svcutil-lib (47)
Shared\MSBuildProj.cs (45)
71private XElement ProjectNode { get; set; } 73private XElement _projectReferenceGroup; 74private XElement ProjectReferceGroup 80IEnumerable<XElement> refItems = this.ProjectNode.Elements("ProjectReference"); 96private XElement _referenceGroup; 97private XElement ReferenceGroup 103IEnumerable<XElement> refItems = this.ProjectNode.Elements("Reference"); 120private XElement _packageReferenceGroup; 121private XElement PacakgeReferenceGroup 127IEnumerable<XElement> refItems = this.ProjectNode.Elements("PackageReference"); 189IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFramework"); 211IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFrameworks"); 245IEnumerable<XElement> runtimeIdentifierElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "RuntimeIdentifier"); 251IEnumerable<XElement> packageReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "PackageReference"); 252foreach (XElement reference in packageReferenceElements) 268IEnumerable<XElement> toolReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "DotNetCliToolReference"); 269foreach (XElement reference in toolReferenceElements) 281IEnumerable<XElement> projectReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "ProjectReference"); 282foreach (XElement reference in projectReferenceElements) 291IEnumerable<XElement> binReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "Reference"); 292foreach (XElement reference in binReferenceElements) 302XElement hintPath = reference.Element("HintPath"); 303XElement path = reference.Element("Path"); 429var ele = doc.Root?.Descendants(elementStr).FirstOrDefault(); 442private static IEnumerable<XElement> GetGroupValues(XElement projectElement, string group, bool createOnMissing = false) 445IEnumerable<XElement> groups = projectElement.Elements(group); 450XElement propertyGroup = new XElement(group); 452return new XElement[] { propertyGroup }; 459private static IEnumerable<XElement> GetSubGroupValues(XElement projectElement, XNamespace msbuildNS, string group, string subGroupName) 461IEnumerable<XElement> groups = GetGroupValues(projectElement, group); 462IEnumerable<XElement> subGroupValues = groups.Elements(msbuildNS + subGroupName); 466private static string GetItemValue(XElement reference, string itemName, bool throwIfMissing = false) 475XElement itemNameElement = null; 489public static bool TryGetItemIdentity(XElement itemName, out string itemIdentity) 503private static string GetItemIdentity(XElement itemName) 598XElement element = new XElement(propertyName, null); 600IEnumerable<XElement> existingElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", propertyName); 607IEnumerable<XElement> propertyGroupItems = GetGroupValues(this.ProjectNode, "PropertyGroup", createOnMissing: true); 608XElement propertyGroup = propertyGroupItems.First(); 657IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFramework"); 660var targetFrameworkNode = targetFrameworkElements.Last(); 665IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFrameworks"); 668var targetFrameworksNode = targetFrameworksElements.Last();
Shared\Utilities\RuntimeEnvironmentHelper.cs (2)
82var pkgSourcesNode = doc.Element("configuration")?.Element("packageSources"); 100var addElement = new XElement("add");
dotnet-user-jwts (4)
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
dotnet-user-secrets (4)
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
IIS.FunctionalTests (16)
src\Servers\IIS\IIS\test\Common.FunctionalTests\FrebTests.cs (4)
152var xDocument = XDocument.Load(xmlFile).Root; 155foreach (var eventElement in eventElements) 157var eventElementWithOpCode = eventElement.Descendants(nameSpace + "RenderingInfo").Single().Descendants(nameSpace + "Opcode").Single(); 158var requestStatus = eventElement.Element(nameSpace + "EventData").Descendants().Where(el => el.Attribute("Name").Value == "requestStatus").SingleOrDefault();
src\Servers\IIS\IIS\test\Common.FunctionalTests\GlobalVersionTests.cs (2)
239.OfType<XElement>() 248foreach (var element in moduleNodes)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
src\Servers\IIS\IIS\test\Common.FunctionalTests\MultiApplicationTests.cs (4)
112private void DuplicateApplication(XElement config, string contentRoot) 114var siteElement = config 119var application = siteElement 132var newApplication = new XElement(application);
IIS.LongTests (10)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (4)
317var ancmElement = element 548private static Dictionary<string, (string, Action<XElement>)> InvalidConfigTransformations = InitInvalidConfigTransformations(); 572public static Dictionary<string, (string, Action<XElement>)> InitInvalidConfigTransformations() 574var dictionary = new Dictionary<string, (string, Action<XElement>)>();
IIS.NewHandler.FunctionalTests (10)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (4)
317var ancmElement = element 548private static Dictionary<string, (string, Action<XElement>)> InvalidConfigTransformations = InitInvalidConfigTransformations(); 572public static Dictionary<string, (string, Action<XElement>)> InitInvalidConfigTransformations() 574var dictionary = new Dictionary<string, (string, Action<XElement>)>();
IIS.NewShim.FunctionalTests (10)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (4)
317var ancmElement = element 548private static Dictionary<string, (string, Action<XElement>)> InvalidConfigTransformations = InitInvalidConfigTransformations(); 572public static Dictionary<string, (string, Action<XElement>)> InitInvalidConfigTransformations() 574var dictionary = new Dictionary<string, (string, Action<XElement>)>();
IIS.ShadowCopy.Tests (6)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
IIS.Tests (2)
Utilities\TestServer.cs (2)
129var siteElement = webHostConfig.Root 134var binding = siteElement
IISExpress.FunctionalTests (20)
src\Servers\IIS\IIS\test\Common.FunctionalTests\FrebTests.cs (4)
152var xDocument = XDocument.Load(xmlFile).Root; 155foreach (var eventElement in eventElements) 157var eventElementWithOpCode = eventElement.Descendants(nameSpace + "RenderingInfo").Single().Descendants(nameSpace + "Opcode").Single(); 158var requestStatus = eventElement.Element(nameSpace + "EventData").Descendants().Where(el => el.Attribute("Name").Value == "requestStatus").SingleOrDefault();
src\Servers\IIS\IIS\test\Common.FunctionalTests\GlobalVersionTests.cs (2)
239.OfType<XElement>() 248foreach (var element in moduleNodes)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (5)
97public static void ModifyWebConfig(this DeploymentResult deploymentResult, Action<XElement> action) 254public static string CreateEmptyApplication(XElement config, string contentRoot) 256var siteElement = config 261var application = siteElement 269var rootApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\IISCompressionSiteFixture.cs (1)
27var webServerElement = element
src\Servers\IIS\IIS\test\Common.FunctionalTests\MultiApplicationTests.cs (4)
112private void DuplicateApplication(XElement config, string contentRoot) 114var siteElement = config 119var application = siteElement 132var newApplication = new XElement(application);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (4)
317var ancmElement = element 548private static Dictionary<string, (string, Action<XElement>)> InvalidConfigTransformations = InitInvalidConfigTransformations(); 572public static Dictionary<string, (string, Action<XElement>)> InitInvalidConfigTransformations() 574var dictionary = new Dictionary<string, (string, Action<XElement>)>();
illink (2)
ILLink.Tasks (2)
CombineLinkerXmlFiles.cs (2)
30 var combined = new XElement ("linker"); 34 foreach (var element in subFile.Root.Elements ()) {
KeyManagementSimulator (9)
Program.cs (9)
234private static readonly XElement serializedDescriptor = XElement.Parse(@" 259IAuthenticatedEncryptorDescriptor IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement element) => descriptor; 523private readonly List<XElement> _elements = new(); 530IReadOnlyCollection<XElement> IXmlRepository.GetAllElements() 538void IXmlRepository.StoreElement(XElement element, string _friendlyName) 557EncryptedXmlInfo IXmlEncryptor.Encrypt(XElement plaintextElement) 576XElement IXmlDecryptor.Decrypt(XElement encryptedElement)
Microsoft.AspNetCore.App.Analyzers.Test (9)
RouteEmbeddedLanguage\RoutePatternParserTests.cs (9)
197var expectedDiagnostics = CreateDiagnosticsElement(sourceText, tree); 249var element = new XElement("Tree", 263private static XElement CreateParameter(RouteParameter parameter) 265var parameterElement = new XElement("Parameter", 282private static XElement CreateDiagnosticsElement(SourceText text, RoutePatternTree tree) 293private static XElement NodeToElement(RoutePatternNode node) 295var element = new XElement(node.Kind.ToString()); 304private static XElement TokenToElement(RoutePatternToken token) 306var element = new XElement(token.Kind.ToString());
Microsoft.AspNetCore.App.UnitTests (1)
TargetingPackTests.cs (1)
315void CompareFrameworkElements(HashSet<string> expectedAssemblyNames, IEnumerable<XElement> actualElements, string type)
Microsoft.AspNetCore.Authentication.Test (26)
CertificateTests.cs (11)
468XElement responseAsXml = null; 474responseAsXml = XElement.Parse(responseContent); 599XElement responseAsXml = null; 605responseAsXml = XElement.Parse(responseContent); 624responseAsXml = XElement.Parse(responseContent); 669XElement responseAsXml = null; 675responseAsXml = XElement.Parse(responseContent); 726XElement responseAsXml = null; 732responseAsXml = XElement.Parse(responseContent); 751responseAsXml = XElement.Parse(responseContent); 773responseAsXml = XElement.Parse(responseContent);
CookieTests.cs (5)
1754var claim = transaction.ResponseElement.Elements("claim").SingleOrDefault(elt => elt.Attribute("type").Value == claimType); 1764var property = transaction.ResponseElement.Elements("extra").SingleOrDefault(elt => elt.Attribute("type").Value == key); 1890var xml = new XElement("xml"); 1929transaction.ResponseElement = XElement.Parse(transaction.ResponseText); 1943public XElement ResponseElement { get; set; }
JwtBearerTests.cs (1)
1268transaction.ResponseElement = XElement.Parse(transaction.ResponseText);
JwtBearerTests_Handler.cs (1)
1335transaction.ResponseElement = XElement.Parse(transaction.ResponseText);
OpenIdConnect\TestServerExtensions.cs (1)
45transaction.ResponseElement = XElement.Parse(transaction.ResponseText);
OpenIdConnect\TestTransaction.cs (1)
19public XElement ResponseElement { get; set; }
TestExtensions.cs (3)
40transaction.ResponseElement = XElement.Parse(transaction.ResponseText); 49var xml = new XElement("xml"); 68var xml = new XElement("xml");
Transaction.cs (3)
17public XElement ResponseElement { get; set; } 38var claim = ResponseElement.Elements("claim") 50var claim = ResponseElement.Elements("token")
Microsoft.AspNetCore.CookiePolicy.Test (3)
TestExtensions.cs (1)
37transaction.ResponseElement = XElement.Parse(transaction.ResponseText);
Transaction.cs (2)
18public XElement ResponseElement { get; set; } 39var claim = ResponseElement.Elements("claim")
Microsoft.AspNetCore.DataProtection (159)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (2)
43var encryptionElement = new XElement("encryption", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 33var encryptionElement = element.Element("encryption")!; 39var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 35var encryptionElement = element.Element("encryption")!; 40var hashElement = element.Element("hash")!;
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializer.cs (3)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!;
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptor.cs (2)
18/// An <see cref="XmlSerializedDescriptorInfo"/> wrapping the <see cref="XElement"/> which represents the serialized 23/// element should be marked via the <see cref="XmlExtensions.MarkAsRequiresEncryption(XElement)" />
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptorDeserializer.cs (1)
19IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element);
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!; 38var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (3)
16/// <returns>The master key <see cref="XElement"/>.</returns> 17public static XElement ToMasterKeyElement(this ISecret secret) 37var masterKeyElement = new XElement("masterKey",
AuthenticatedEncryption\ConfigurationModel\XmlExtensions.cs (4)
11/// Data protection extensions for <see cref="XElement"/>. 15internal static bool IsMarkedAsRequiringEncryption(this XElement element) 21/// Marks the provided <see cref="XElement"/> as requiring encryption before being persisted 24public static void MarkAsRequiresEncryption(this XElement element)
AuthenticatedEncryption\ConfigurationModel\XmlSerializedDescriptorInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains the XML-serialized representation of an 21/// <param name="deserializerType">The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 23public XmlSerializedDescriptorInfo(XElement serializedDescriptorElement, Type deserializerType) 40/// The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 48public XElement SerializedDescriptorElement { get; }
Internal\KeyManagementOptionsPostSetup.cs (2)
99EncryptedXmlInfo IXmlEncryptor.Encrypt(XElement plaintextElement) 112public override void StoreElement(XElement element, string friendlyName)
KeyManagement\IKeyEscrowSink.cs (1)
25void Store(Guid keyId, XElement element);
KeyManagement\Internal\IInternalXmlKeyManager.cs (1)
27IAuthenticatedEncryptorDescriptor DeserializeDescriptorFromKeyElement(XElement keyElement);
KeyManagement\Key.cs (2)
63XElement keyElement, 223private static Func<IAuthenticatedEncryptorDescriptor> GetLazyDescriptorDelegate(IInternalXmlKeyManager keyManager, XElement keyElement)
KeyManagement\KeyEscrowServiceProviderExtensions.cs (1)
33public void Store(Guid keyId, XElement element)
KeyManagement\XmlKeyManager.cs (13)
178private object?[] ProcessAllElements(IReadOnlyCollection<XElement> allElements, out DateTimeOffset? mostRecentMassRevocationDate) 190foreach (var element in allElements) 288private Key? ProcessKeyElement(XElement keyElement) 344private object ProcessRevocationElement(XElement revocationElement) 387var revocationElement = new XElement(RevocationElementName, 490private void WriteKeyDeserializationErrorToLog(Exception error, XElement keyElement) 524var keyElement = new XElement(KeyElementName, 550var possiblyEncryptedKeyElement = KeyEncryptor?.EncryptIfNecessary(keyElement) ?? keyElement; 571IAuthenticatedEncryptorDescriptor IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement) 576var descriptorElement = keyElement.Element(DescriptorElementName); 580var unencryptedInputToDeserializer = descriptorElement.Elements().Single().DecryptElement(_activator); 632var revocationElement = new XElement(RevocationElementName, 730public void Store(Guid keyId, XElement element)
LoggingExtensions.cs (3)
104public static partial void ExceptionWhileProcessingRevocationElement(this ILogger logger, XElement revocationElement, Exception exception); 113public static partial void ExceptionWhileProcessingKeyElement(this ILogger logger, XElement element, Exception exception); 116public static partial void AnExceptionOccurredWhileProcessingElementDebug(this ILogger logger, XElement element, Exception exception);
Repositories\EphemeralXmlRepository.cs (14)
19private readonly List<XElement> _storedElements = new List<XElement>(); 27public IReadOnlyCollection<XElement> GetAllElements() 36private IEnumerable<XElement> GetAllElementsCore() 39foreach (XElement element in _storedElements) 45public void StoreElement(XElement element, string friendlyName) 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 67foreach (var storedElement in _storedElements) 84var storedElement = deletableElement.StoredElement; 100public DeletableElement(XElement storedElement, XElement element) 107public XElement Element { get; } 109/// <summary>The <see cref="XElement"/> from which <see cref="Element"/> was cloned.</summary> 110public XElement StoredElement { get; }
Repositories\FileSystemXmlRepository.cs (9)
69public virtual IReadOnlyCollection<XElement> GetAllElements() 75private IEnumerable<XElement> GetAllElementsCore() 107private XElement ReadElementFromFile(string fullPath) 113return XElement.Load(fileStream); 118public virtual void StoreElement(XElement element, string friendlyName) 132private void StoreElementCore(XElement element, string filename) 189var element = ReadElementFromFile(fullPath); 221public DeletableElement(FileSystemInfo fileSystemInfo, XElement element) 228public XElement Element { get; }
Repositories\IDeletableElement.cs (1)
14public XElement Element { get; }
Repositories\IXmlRepository.cs (2)
20IReadOnlyCollection<XElement> GetAllElements(); 34void StoreElement(XElement element, string friendlyName);
Repositories\RegistryXmlRepository.cs (10)
56public virtual IReadOnlyCollection<XElement> GetAllElements() 62private IEnumerable<XElement> GetAllElementsCore() 72var element = ReadElementFromRegKey(RegistryKey, valueName); 127private XElement? ReadElementFromRegKey(RegistryKey regKey, string valueName) 132return (!string.IsNullOrEmpty(data)) ? XElement.Parse(data) : null; 136public virtual void StoreElement(XElement element, string friendlyName) 150private void StoreElementCore(XElement element, string valueName) 168var element = ReadElementFromRegKey(RegistryKey, valueName); 202public DeletableElement(string valueName, XElement element) 209public XElement Element { get; }
XmlEncryption\CertificateXmlEncryptor.cs (6)
59/// Encrypts the specified <see cref="XElement"/> with an X.509 certificate. 67public EncryptedXmlInfo Encrypt(XElement plaintextElement) 75var encryptedElement = EncryptElement(plaintextElement); 83private XElement EncryptElement(XElement plaintextElement) 98return XElement.Load(xmlDocument.DocumentElement.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\DpapiNGXmlDecryptor.cs (2)
47public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiNGXmlEncryptor.cs (3)
49/// Encrypts the specified <see cref="XElement"/>. 57public EncryptedXmlInfo Encrypt(XElement plaintextElement) 85var element = new XElement("encryptedKey",
XmlEncryption\DpapiXmlDecryptor.cs (2)
44public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiXmlEncryptor.cs (3)
42/// Encrypts the specified <see cref="XElement"/>. 50public EncryptedXmlInfo Encrypt(XElement plaintextElement) 82var element = new XElement("encryptedKey",
XmlEncryption\EncryptedXmlDecryptor.cs (3)
57public XElement Decrypt(XElement encryptedElement) 78return XElement.Load(xmlDocument.DocumentElement!.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\EncryptedXmlInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains a blob of encrypted XML 20/// <param name="decryptorType">The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> 22public EncryptedXmlInfo(XElement encryptedElement, Type decryptorType) 39/// The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> method can be used to 47public XElement EncryptedElement { get; }
XmlEncryption\IXmlDecryptor.cs (3)
19/// Implementations of this method must not mutate the <see cref="XElement"/> 22XElement Decrypt(XElement encryptedElement);
XmlEncryption\IXmlEncryptor.cs (3)
14/// Encrypts the specified <see cref="XElement"/>. 23/// Implementations of this method must not mutate the <see cref="XElement"/> 26EncryptedXmlInfo Encrypt(XElement plaintextElement);
XmlEncryption\NullXmlDecryptor.cs (2)
21public XElement Decrypt(XElement encryptedElement)
XmlEncryption\NullXmlEncryptor.cs (3)
36/// Encrypts the specified <see cref="XElement"/> with a null encryptor, i.e., 45public EncryptedXmlInfo Encrypt(XElement plaintextElement) 56var newElement = new XElement("unencryptedKey",
XmlEncryption\XmlEncryptionExtensions.cs (22)
19public static XElement DecryptElement(this XElement element, IActivator activator) 35var placeholderReplacements = new Dictionary<XElement, XElement>(); 39var elementWhichRequiresDecryption = doc.Descendants(XmlConstants.EncryptedSecretElementName).FirstOrDefault(); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 52var decryptedElement = decryptorInstance.Decrypt(clonedElementWhichRequiresDecryption.Elements().Single()); 56var newPlaceholder = new XElement("placeholder"); 101public static XElement? EncryptIfNecessary(this IXmlEncryptor encryptor, XElement element) 117var placeholderReplacements = new Dictionary<XElement, EncryptedXmlInfo>(); 121var elementWhichRequiresEncryption = doc.Descendants().FirstOrDefault(DoesSingleElementRequireEncryption); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 158/// Converts an <see cref="XElement"/> to a <see cref="Secret"/> so that it can be kept in memory 161public static Secret ToSecret(this XElement element) 182/// Converts a <see cref="Secret"/> back into an <see cref="XElement"/>. 184public static XElement ToXElement(this Secret secret) 193return XElement.Load(memoryStream); 202private static bool DoesElementOrDescendentRequireDecryption(XElement element) 207private static bool DoesElementOrDescendentRequireEncryption(XElement element) 212private static bool DoesSingleElementRequireEncryption(XElement element)
XmlExtensions.cs (3)
19public static XElement WithoutChildNodes(this XElement element) 21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (4)
EntityFrameworkCoreXmlRepository.cs (4)
41public virtual IReadOnlyCollection<XElement> GetAllElements() 46IEnumerable<XElement> GetAllElementsCore() 58yield return XElement.Parse(key.Xml); 66public void StoreElement(XElement element, string friendlyName)
Microsoft.AspNetCore.DataProtection.StackExchangeRedis (4)
RedisXmlRepository.cs (4)
33public IReadOnlyCollection<XElement> GetAllElements() 38private IEnumerable<XElement> GetAllElementsCore() 48yield return XElement.Parse((string)value!); 53public void StoreElement(XElement element, string friendlyName)
Microsoft.AspNetCore.DataProtection.Tests (155)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
33var deserializedDescriptor = new AuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml));
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
40var deserializedDescriptor = new CngCbcAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml));
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
37var deserializedDescriptor = new CngGcmAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml));
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs (4)
41var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)); 75var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)); 102var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)); 125var ex = Assert.Throws<InvalidOperationException>(() => new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)));
Internal\KeyManagementOptionsPostSetupTest.cs (1)
17private static readonly XElement xElement = new("element");
Internal\KeyManagementOptionsSetupTest.cs (2)
136public void Store(Guid keyId, XElement element) 144public void Store(Guid keyId, XElement element)
KeyManagement\DeferredKeyTests.cs (7)
25mockInternalKeyManager.Setup(o => o.DeserializeDescriptorFromKeyElement(It.IsAny<XElement>())) 26.Returns<XElement>(element => 34var key = new Key(keyId, creationDate, activationDate, expirationDate, mockInternalKeyManager.Object, XElement.Parse(@"<node />"), new[] { encryptorFactory }); 50var key = new Key(Guid.Empty, now, now, now, new Mock<IInternalXmlKeyManager>().Object, XElement.Parse(@"<node />"), new[] { encryptorFactory }); 64mockKeyManager.Setup(o => o.DeserializeDescriptorFromKeyElement(It.IsAny<XElement>())) 65.Returns<XElement>(element => 73var key = new Key(Guid.Empty, now, now, now, mockKeyManager.Object, XElement.Parse(@"<node />"), new[] { encryptorFactory });
KeyManagement\KeyEscrowServiceProviderExtensionsTests.cs (8)
36mockKeyEscrowSink.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>())) 37.Callback<Guid, XElement>((keyId, element) => 48sink.Store(new Guid("39974d8e-3e53-4d78-b7e9-4ff64a2a5d7b"), XElement.Parse("<theElement />")); 61mockKeyEscrowSink1.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>())) 62.Callback<Guid, XElement>((keyId, element) => 68mockKeyEscrowSink2.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>())) 69.Callback<Guid, XElement>((keyId, element) => 81sink.Store(new Guid("39974d8e-3e53-4d78-b7e9-4ff64a2a5d7b"), XElement.Parse("<theElement />"));
KeyManagement\XmlKeyManagerTests.cs (33)
23private static readonly XElement serializedDescriptor = XElement.Parse(@" 84XElement elementStoredInRepository = null; 95.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>())) 96.Callback<XElement, string>((el, friendlyName) => 171XElement elementStoredInEscrow = null; 173XElement elementStoredInRepository = null; 184.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>())) 185.Callback<XElement, string>((el, friendlyName) => 192.Setup(o => o.Store(It.IsAny<Guid>(), It.IsAny<XElement>())) 193.Callback<Guid, XElement>((innerKeyId, el) => 599mockXmlRepository.Setup(o => o.GetAllElements()).Returns(XElement.Parse(xml).Elements().ToArray()); 616XElement elementStoredInRepository = null; 620.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>())) 621.Callback<XElement, string>((el, friendlyName) => 666XElement elementStoredInRepository = null; 670.Setup(o => o.StoreElement(It.IsAny<XElement>(), It.IsAny<string>())) 671.Callback<XElement, string>((el, friendlyName) => 768.Setup(o => o.ImportFromXml(It.IsAny<XElement>())) 775.Setup(o => o.Decrypt(It.IsAny<XElement>())) 776.Returns<XElement>(element => 785.Setup(o => o.Encrypt(It.IsAny<XElement>())) 787.Returns<XElement>(element => new EncryptedXmlInfo(element, typeof(IXmlDecryptor))); 850.Setup(o => o.ImportFromXml(It.IsAny<XElement>())) 857.Setup(o => o.Decrypt(It.IsAny<XElement>())) 858.Returns<XElement>(element => 875var keyElement = XElement.Parse(@" 1007IReadOnlyCollection<XElement> IXmlRepository.GetAllElements() => []; 1008void IXmlRepository.StoreElement(XElement element, string friendlyName) => throw new InvalidOperationException(); 1017IReadOnlyCollection<XElement> IXmlRepository.GetAllElements() => []; 1018void IXmlRepository.StoreElement(XElement element, string friendlyName) => throw new InvalidOperationException(); 1024public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element)
MockExtensions.cs (5)
26.Setup(o => o.ImportFromXml(It.IsAny<XElement>())) 27.Returns<XElement>(el => 49.Setup(o => o.Decrypt(It.IsAny<XElement>())) 50.Returns<XElement>(el => 54return XElement.Parse(outputXml);
RegistryPolicyResolverTests.cs (2)
308public void Store(Guid keyId, XElement element) 316public void Store(Guid keyId, XElement element)
Repositories\EphemeralXmlRepositoryTests.cs (8)
25var element1 = XElement.Parse(@"<element1 />"); 26var element2 = XElement.Parse(@"<element1 />"); 27var element3 = XElement.Parse(@"<element1 />"); 47var element1 = new XElement("element1"); 48var element2 = new XElement("element2");
Repositories\FileSystemXmlRepositoryTests.cs (12)
68var element = XElement.Parse("<element1 />"); 82var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName)); 98var element = XElement.Parse("<element1 />"); 116var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName)); 152var element1 = new XElement("element1"); 153var element2 = new XElement("element2"); 301var element = XElement.Parse("<element1 />");
Repositories\RegistryXmlRepositoryTests.cs (10)
56var element = XElement.Parse("<element1 />"); 70var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string); 87var element = XElement.Parse("<element1 />"); 102var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string); 140var element1 = new XElement("element1"); 141var element2 = new XElement("element2");
ServiceCollectionTests.cs (1)
99var xElement = new XElement("element");
XmlAssert.cs (13)
17/// Asserts that a <see cref="string"/> and an <see cref="XElement"/> are semantically equivalent. 19public static void Equal(string expected, XElement actual) 23Equal(XElement.Parse(expected), actual); 27/// Asserts that two <see cref="XElement"/> instances are semantically equivalent. 29public static void Equal(XElement expected, XElement actual) 48private static bool AreEqual(XElement expected, XElement actual) 68else if (expected is XElement && actual is XElement) 70return AreEqual((XElement)expected, (XElement)actual); 119if (node is XText /* includes XCData */ || node is XElement)
XmlEncryption\CertificateXmlEncryptionTests.cs (3)
45var originalXml = XElement.Parse(@"<mySecret value='265ee4ea-ade2-43b1-b706-09b259e58b6b' />"); 55var roundTrippedElement = decryptor.Decrypt(encryptedXmlInfo.EncryptedElement);
XmlEncryption\DpapiNGXmlEncryptionTests.cs (3)
18var originalXml = XElement.Parse(@"<mySecret value='265ee4ea-ade2-43b1-b706-09b259e58b6b' />"); 28var roundTrippedElement = decryptor.Decrypt(encryptedXmlInfo.EncryptedElement);
XmlEncryption\DpapiXmlEncryptionTests.cs (3)
20var originalXml = XElement.Parse(@"<mySecret value='265ee4ea-ade2-43b1-b706-09b259e58b6b' />"); 30var roundTrippedElement = decryptor.Decrypt(encryptedXmlInfo.EncryptedElement);
XmlEncryption\EncryptedXmlDecryptorTests.cs (5)
20var data = new XElement("SampleData", "Lorem ipsum"); 38var data = new XElement("SampleData", "Lorem ipsum"); 56var data = new XElement("SampleData", "Lorem ipsum"); 78var data = new XElement("SampleData", "Lorem ipsum"); 82var decrypted = decryptor.Decrypt(encryptedXml.EncryptedElement);
XmlEncryption\NullXmlEncryptionTests.cs (3)
17var retVal = decryptor.Decrypt(XElement.Parse("<unencryptedKey><theElement /></unencryptedKey>")); 30var retVal = encryptor.Encrypt(XElement.Parse("<theElement />"));
XmlEncryption\XmlEncryptionExtensionsTests.cs (29)
18var original = XElement.Parse(@"<element />"); 32var original = XElement.Parse(@" 58var original = XElement.Parse(@$" 88var original = XElement.Parse(@$" 120var original = XElement.Parse(@$" 150var original = XElement.Parse(@" 178.Setup(o => o.Decrypt(It.IsAny<XElement>())) 179.Returns<XElement>(el => new XElement(el.Name.LocalName + "_decrypted", new XElement(XmlConstants.EncryptedSecretElementName, "nested"))); 200var original = XElement.Parse(@"<element />"); 215var original = XElement.Parse(@"<rootNode x:requiresEncryption='true' xmlns:x='http://schemas.asp.net/2015/03/dataProtection' />"); 217mockXmlEncryptor.Setup(o => o.Encrypt(It.IsAny<XElement>())).Returns(new EncryptedXmlInfo(new XElement("theElement"), typeof(MyXmlDecryptor))); 233var original = XElement.Parse(@" 264.Setup(o => o.Encrypt(It.IsAny<XElement>())) 265.Returns<XElement>(element => new EncryptedXmlInfo(new XElement(element.Name.LocalName + "_encrypted"), typeof(MyXmlDecryptor))); 278var original = XElement.Parse(@" 313.Setup(o => o.Encrypt(It.IsAny<XElement>())) 314.Returns<XElement>(element => new EncryptedXmlInfo(new XElement(element), typeof(MyXmlDecryptor))); 325public XElement Decrypt(XElement encryptedElement)
Microsoft.AspNetCore.Http.Connections.Tests (7)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (7)
11 private readonly List<XElement> _storedElements = new List<XElement>(); 17 public IReadOnlyCollection<XElement> GetAllElements() 26 private IEnumerable<XElement> GetAllElementsCore() 29 foreach (XElement element in _storedElements) 35 public void StoreElement(XElement element, string friendlyName) 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.AspNetCore.Identity.InMemory.Test (4)
FunctionalTest.cs (4)
283var claim = transaction.ResponseElement.Elements("claim").SingleOrDefault(elt => elt.Attribute("type").Value == claimType); 409var xml = new XElement("xml"); 458transaction.ResponseElement = XElement.Parse(transaction.ResponseText); 472public XElement ResponseElement { get; set; }
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlAssert.cs (2)
64XElement element = node as XElement;
Microsoft.AspNetCore.Mvc.FunctionalTests (10)
AsyncEnumerableTestBase.cs (2)
95string GetName(XElement element) 97var name = element.Element(XName.Get("Name", @namespace));
src\Mvc\Mvc.Formatters.Xml\test\XmlAssert.cs (2)
64XElement element = node as XElement;
XmlDataContractSerializerFormattersWrappingTest.cs (3)
237var root = XDocument.Parse(content).Root; 279var root = XDocument.Parse(content).Root; 283var mvcErrors = root.Element(root.Name.Namespace.GetName("MVC-Errors"));
XmlSerializerFormattersWrappingTest.cs (3)
220var root = XDocument.Parse(content).Root; 262var root = XDocument.Parse(content).Root; 265var mvcErrors = root.Element(root.Name.Namespace.GetName("MVC-Errors"));
Microsoft.AspNetCore.Rewrite (20)
IISUrlRewrite\InvalidUrlRewriteFormatException.cs (3)
14public InvalidUrlRewriteFormatException(XElement element, string message) 19public InvalidUrlRewriteFormatException(XElement element, string message, Exception innerException) 27private static string FormatMessage(XElement element, string message)
IISUrlRewrite\RewriteMapParser.cs (4)
11public static IISRewriteMapCollection? Parse(XElement xmlRoot) 15var mapsElement = xmlRoot.Descendants(RewriteTags.RewriteMaps).SingleOrDefault(); 22foreach (var mapElement in mapsElement.Elements(RewriteTags.RewriteMap)) 25foreach (var addElement in mapElement.Elements(RewriteTags.Add))
IISUrlRewrite\UrlRewriteFileParser.cs (13)
24var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault(); 39private void ParseRules(XElement? rules, IList<IISUrlRewriteRule> result, bool global) 46foreach (var rule in rules.Elements(RewriteTags.Rule)) 58private void ParseRuleAttributes(XElement rule, UrlRewriteRuleBuilder builder) 74var match = rule.Element(RewriteTags.Match); 80var action = rule.Element(RewriteTags.Action); 91private static void ParseMatch(XElement match, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 104private void ParseConditions(XElement? conditions, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 121foreach (var cond in adds) 127private void ParseCondition(XElement conditionElement, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 188private void ParseUrlAction(XElement urlAction, UrlRewriteRuleBuilder builder, bool stopProcessing) 253private static bool ParseBool(XElement element, string rewriteTag, bool defaultValue) 268private static TEnum ParseEnum<TEnum>(XElement element, string rewriteTag, TEnum defaultValue)
Microsoft.AspNetCore.Rewrite.Tests (1)
IISUrlRewrite\RewriteMapParserTests.cs (1)
28var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault();
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (3)
155var aspNetCoreSection = webConfig.Descendants("aspNetCore") 166var environmentVariablesSection = aspNetCoreSection.Elements("environmentVariables").FirstOrDefault(); 175var environmentVariable = new XElement("environmentVariable");
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (56)
IISDeployer.cs (5)
129protected override IEnumerable<Action<XElement, string>> GetWebConfigActions() 137var aspNetCore = element 345private void ConfigureAppHostConfig(XElement config, string contentRoot, int port) 355var pool = config 362var environmentVariables = pool
IISDeployerBase.cs (10)
23public void ModifyApplicationHostConfig(Action<XElement> action) 54protected virtual IEnumerable<Action<XElement, string>> GetWebConfigActions() 72protected virtual IEnumerable<Action<XElement, string>> GetServerConfigActions() 80public void RunServerConfigActions(XElement config, string contentRoot) 109private void AddWebConfigEnvironmentVariables(XElement element, string contentRoot) 111var environmentVariables = element 124private void AddHandlerSettings(XElement element, string contentRoot) 126var handlerSettings = element 139protected void ConfigureModuleAndBinding(XElement config, string contentRoot, int port) 141var siteElement = config
IISDeploymentParameterExtensions.cs (18)
16public static void AddServerConfigAction(this IISDeploymentParameters parameters, Action<XElement> action) 21public static void AddServerConfigAction(this IISDeploymentParameters parameters, Action<XElement, string> action) 64var windowsAuthentication = element 71var providers = windowsAuthentication.GetOrAdd("providers"); 113var element = config 148var webServerElement = element 151var addElement = webServerElement 161var traceAreasElement = addElement 163var innerAddElement = traceAreasElement.GetOrAdd("add", "provider", "WWW Server"); 173var webServerElement = element 176var traceProviderDefinitionsElement = webServerElement 180var innerAddElement = traceProviderDefinitionsElement.GetOrAdd("add", "name", "WWW Server"); 185var areasElement = innerAddElement.GetOrAdd("areas"); 186var iae = areasElement.GetOrAdd("add", "name", "ANCM"); 195var traceFailedRequestsElement = element 211var aspNetCoreElement = config.Descendants("aspNetCore").Single(); 221var aspNetCoreElement = config.Descendants("aspNetCore").Single(); 236var webServerElement = element
IISDeploymentParameters.cs (4)
40public IList<Action<XElement, string>> WebConfigActionList { get; } = new List<Action<XElement, string>>(); 42public IList<Action<XElement, string>> ServerConfigActionList { get; } = new List<Action<XElement, string>>();
IISExpressDeployer.cs (5)
314private void AddAspNetCoreElement(XElement config) 316var aspNetCore = config 324var handlers = config 329var aspNetCoreHandler = handlers 341protected override IEnumerable<Action<XElement, string>> GetWebConfigActions()
WebConfigHelpers.cs (2)
10public static Action<XElement, string> AddOrModifyAspNetCoreSection(string key, string value) 22public static Action<XElement, string> AddOrModifyHandlerSection(string key, string value)
XElementExtensions.cs (12)
10public static XElement RequiredElement(this XElement element, string name) 12var existing = element.Element(name); 21public static XElement GetOrAdd(this XElement element, string name) 23var existing = element.Element(name); 33public static XElement GetOrAdd(this XElement element, string name, string attribute, string attributeValue) 35var existing = element.Elements(name).FirstOrDefault(e => e.Attribute(attribute)?.Value == attributeValue); 45public static XElement AddAndGetInnerElement(this XElement element, string name, string attribute, string attributeValue) 47var innerElement = new XElement(name, new XAttribute(attribute, attributeValue));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (7)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (7)
11 private readonly List<XElement> _storedElements = new List<XElement>(); 17 public IReadOnlyCollection<XElement> GetAllElements() 26 private IEnumerable<XElement> GetAllElementsCore() 29 foreach (XElement element in _storedElements) 35 public void StoreElement(XElement element, string friendlyName) 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.AspNetCore.SignalR.Tests (7)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (7)
11 private readonly List<XElement> _storedElements = new List<XElement>(); 17 public IReadOnlyCollection<XElement> GetAllElements() 26 private IEnumerable<XElement> GetAllElementsCore() 29 foreach (XElement element in _storedElements) 35 public void StoreElement(XElement element, string friendlyName) 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
Microsoft.Build.BuildCheck.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.CommandLine.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Engine.OM.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Engine.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Framework.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Tasks.Core (23)
AssemblyDependency\GenerateBindingRedirects.cs (11)
73XElement runtimeNode = doc.Root 75.OfType<XElement>() 193private void UpdateExistingBindingRedirects(XElement runtimeNode, IDictionary<AssemblyName, string> redirects) 198.OfType<XElement>() 201foreach (var assemblyBinding in assemblyBindingNodes) 205.OfType<XElement>() 208foreach (var dependentAssembly in dependentAssemblies) 210var assemblyIdentity = dependentAssembly 212.OfType<XElement>() 223var bindingRedirect = dependentAssembly 225.OfType<XElement>()
AssemblyDependency\ResolveAssemblyReference.cs (1)
1220var node = new XElement(
CombineTargetFrameworkInfoProperties.cs (1)
48XElement root = UseAttributeForTargetFrameworkInfoPropertyNames ?
CombineXmlElements.cs (2)
36XElement root = new XElement(RootElementName); 40root.Add(XElement.Parse(item.ItemSpec));
GenerateResource.cs (1)
3063foreach (XElement dataElem in doc.Element("root").Elements("data"))
ResourceHandling\MSBuildResXReader.cs (4)
32foreach (XElement elem in doc.Element("root").Elements()) 56private static void ParseAssemblyAlias(Dictionary<string, string> aliases, XElement elem) 110XElement elem, 118XElement valueElement = elem.Element("value");
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (3)
322XElement codeElement = null; 332XElement child = (XElement)node;
Microsoft.Build.Tasks.UnitTests (3)
GenerateBindingRedirects_Tests.cs (2)
142XElement targetAppConfig = XElement.Parse(redirectResults.TargetAppConfigContent);
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Utilities.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Cci.Extensions (5)
Dgml\DgmlExtensions.cs (5)
31var xRoot = new XElement(XName.Get("DirectedGraph", dgmlNsp)); 34var xNodes = new XElement(XName.Get("Nodes", dgmlNsp)); 41var xNode = new XElement(XName.Get("Node", dgmlNsp), 47var xLinks = new XElement(XName.Get("Links", dgmlNsp)); 54var xLink = new XElement(XName.Get("Link", dgmlNsp),
Microsoft.CodeAnalysis (17)
InternalUtilities\XmlUtilities.cs (5)
45var sourceElement = ((XElement)(object)node); 46var targetElement = ((XElement)copy); 68internal static XElement[]? TrySelectElements(XNode node, string xpath, out string? errorMessage, out bool invalidXPath)
RuleSet\RuleSetProcessor.cs (12)
66XElement? ruleSetNode = null; 81List<XElement> nodeList = ruleSetDocument.Elements(RuleSetNodeName).ToList(); 96private static RuleSet ReadRuleSet(XElement ruleSetNode, string filePath) 106foreach (XElement childNode in ruleSetNode.Elements()) 149private static List<KeyValuePair<string, ReportDiagnostic>> ReadRules(XElement rulesNode) 157foreach (XElement ruleNode in rulesNode.Elements()) 178private static KeyValuePair<string, ReportDiagnostic> ReadRule(XElement ruleNode) 191private static RuleSetInclude ReadRuleSetInclude(XElement includeNode) 205private static ReportDiagnostic ReadAction(XElement node, bool allowDefault) 242private static ReportDiagnostic ReadIncludeAll(XElement includeAllNode) 253private static string ReadNonEmptyAttribute(XElement node, string attributeName) 287private static void ValidateAttribute(XElement node, string attributeName)
Microsoft.CodeAnalysis.CodeStyle (40)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (5)
19XElement ToXElement(); 31ICodeStyleOption2 FromXElement(XElement element); 115public XElement ToXElement() 165ICodeStyleOption2 ICodeStyleOption2.FromXElement(XElement element) 168public static CodeStyleOption2<T> FromXElement(XElement element)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
463internal XElement CreateXElement() 472internal static NamingStyle FromXElement(XElement namingStyleElement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
300public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 319internal XElement CreateXElement() 328internal static NamingStylePreferences FromXElement(XElement element) 378private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 396: XElement.Parse(DefaultNamingPreferencesString); 399private static void UpgradeSerialization_4To5(XElement rootElement) 405foreach (var element in methodElements) 407element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
32internal XElement CreateXElement() 34var element = new XElement(nameof(SerializableNamingRule), 42internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
217internal XElement CreateXElement() 246private XElement CreateSymbolKindsXElement() 248var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 258private XElement CreateAccessibilitiesXElement() 260var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 270private XElement CreateModifiersXElement() 272var modifiersElement = new XElement(nameof(RequiredModifierList)); 282internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 290private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 293foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 298foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 303foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 311private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 314private static Accessibility ParseAccessibility(XElement accessibilityElement) 317private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 372internal XElement CreateXElement() 424internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 437internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 440internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 537internal XElement CreateXElement() 540internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
Microsoft.CodeAnalysis.CSharp (8)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (8)
179XElement element = (XElement)node; 215XElement element = (XElement)container; 252private static bool ElementNameIs(XElement element, string name) 266private XNode[] RewriteIncludeElement(XElement includeElement, string currentXmlFilePath, CSharpSyntaxNode originatingSyntax, out string commentMessage) 355XElement[] loadedElements = XmlUtilities.TrySelectElements(doc, xpathValue, out errorMessage, out invalidXPath); 464private Location GetIncludeElementLocation(XElement includeElement, ref string currentXmlFilePath, ref CSharpSyntaxNode originatingSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
20/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 37/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (38)
ChangeSignature\RemoveParametersTests.cs (3)
255using var testState = ChangeSignatureTestState.Create(XElement.Parse(workspaceXml)); 340using var testState = ChangeSignatureTestState.Create(XElement.Parse(workspaceXml)); 365using var workspace = EditorTestWorkspace.Create(XElement.Parse("""
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (4)
3146var text = XElement.Parse(@"<Workspace> 3210var source = XElement.Parse(@"<Workspace>
ConvertNamespace\ConvertNamespaceCommandHandlerTests.cs (3)
26public ConvertNamespaceTestState(XElement workspaceElement) 36public static XElement GetWorkspaceXml(string markup) 37=> XElement.Parse(string.Format("""
EncapsulateField\EncapsulateFieldCommandHandlerTests.cs (1)
194using var workspace = EditorTestWorkspace.Create(XElement.Parse("""
EventHookup\EventHookupCommandHandlerTests.cs (1)
966using var testState = new EventHookupTestState(XElement.Parse(workspaceXml), options: null);
EventHookup\EventHookupTestState.cs (3)
31public EventHookupTestState(XElement workspaceElement, OptionsCollection options) 53public static XElement GetWorkspaceXml(string markup) 54=> XElement.Parse(string.Format("""
ExtractInterface\ExtractInterfaceTests.cs (1)
1440using var workspace = EditorTestWorkspace.Create(XElement.Parse("""
ExtractMethod\ExtractMethodTests.cs (1)
11368using var workspace = EditorTestWorkspace.Create(XElement.Parse("""
MoveToNamespace\MoveToNamespaceTests.cs (1)
1442using var workspace = EditorTestWorkspace.Create(System.Xml.Linq.XElement.Parse(input), composition: s_composition, openDocuments: false);
NavigateTo\NavigateToTests.cs (9)
87var content = XElement.Parse(""" 108var content = XElement.Parse(""" 1723await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse(""" 1768await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse(""" 1813await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse(""" 1858await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse(""" 1903await TestAsync(testHost, Composition.FirstActiveAndVisible, XElement.Parse("""
Organizing\OrganizeTypeDeclarationTests.cs (1)
1167using var workspace = EditorTestWorkspace.Create(XElement.Parse("""
QuickInfo\SemanticQuickInfoSourceTests.cs (1)
7191using var workspace = EditorTestWorkspace.Create(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive);
RawStringLiteral\RawStringLiteralCommandHandlerTests.cs (3)
27public RawStringLiteralTestState(XElement workspaceElement) 37public static XElement GetWorkspaceXml(string markup, bool withSpansOnly) 40return XElement.Parse($"""
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (3)
43public StringCopyPasteTestState(XElement workspaceElement, bool mockCopyPasteService) 55public static XElement GetWorkspaceXml(string? copyFileMarkup, string pasteFileMarkup) 56=> XElement.Parse(($@"
SymbolKey\SymbolKeyTests.cs (2)
236return TestWorkspace.CreateWorkspace(XElement.Parse($@" 245return TestWorkspace.CreateWorkspace(XElement.Parse($@"
TaskList\NoCompilationTaskListTests.cs (1)
30var workspace = EditorTestWorkspace.CreateWorkspace(XElement.Parse(
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (28)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (18)
93var diagnosticsElement = XElement.Parse(value); 94foreach (var diagnosticElement in diagnosticsElement.Elements("Diagnostic")) 200var element = new XElement("Diagnostic"); 215private static XElement NodeToElement(JsonNode node) 225private static XElement NodeToElementWorker(JsonNode node) 227var element = new XElement(node.Kind.ToString()); 234private static XElement NodeOrTokenToElement(EmbeddedSyntaxNodeOrToken<JsonKind, JsonNode> child) 237private static XElement ConstructorNodeToElement(JsonConstructorNode node) 246private static XElement ObjectNodeToElement(JsonObjectNode node) 253private static XElement CompilationUnitToElement(JsonCompilationUnit node) 259private static XElement ArrayNodeToElement(JsonArrayNode node) 266private static XElement CreateSequenceNode(ImmutableArray<JsonValueNode> sequence) 269private static XElement CreateSequenceNode(JsonSeparatedList sequence) 272private static XElement TokenToElement(JsonToken token) 274var element = new XElement(token.Kind.ToString()); 291private static XElement TriviaToElement(JsonTrivia trivia) 359if (node is not XElement element)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (10)
185var expectedDiagnostics = CreateDiagnosticsElement(sourceText, tree); 200var element = new XElement("Tree", 217private static XElement CreateDiagnosticsElement(SourceText text, RegexTree tree) 228private static XElement NodeToElement(RegexNode node) 233var element = new XElement(node.Kind.ToString()); 240private static XElement AlternationToElement(RegexAlternationNode alternationNode, int end) 248var element = new XElement(alternationNode.Kind.ToString()); 255private static XElement TokenToElement(RegexToken token) 257var element = new XElement(token.Kind.ToString()); 277private static XElement TriviaToElement(RegexTrivia trivia)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
DocumentationComments\DocumentationCommentCompilerTests.cs (1)
3355Assert.Throws<XmlException>(() => XElement.Parse(xml));
Symbols\Metadata\PE\LoadingNamespacesAndTypes.cs (12)
27XElement dumpXML = LoadChildNamespace1(assembly.Modules[0].GlobalNamespace); 29var baseLine = XElement.Load(new MemoryStream(TestResources.SymbolsTests.Metadata.MscorlibNamespacesAndTypes)); 41XElement dumpXML = LoadChildNamespace2(assembly.Modules[0].GlobalNamespace); 43var baseLine = XElement.Load(new MemoryStream(TestResources.SymbolsTests.Metadata.MscorlibNamespacesAndTypes)); 51internal static XElement LoadChildNamespace1(NamespaceSymbol n) 53XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name)); 69private XElement LoadChildNamespace2(NamespaceSymbol n) 71XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name)); 104private static XElement LoadChildType(NamedTypeSymbol t) 106XElement elem = new XElement("type");
Symbols\MockSymbolTests.cs (4)
103private Symbol CreateMockSymbol(NamespaceExtent extent, XElement xel) 185XElement.Parse( 201XElement.Parse( 212XElement.Parse(
Microsoft.CodeAnalysis.CSharp.Test.Utilities (7)
EmitMetadataTestBase.cs (7)
24internal static XElement DumpTypeInfo(ModuleSymbol moduleSymbol) 29internal static XElement LoadChildNamespace(NamespaceSymbol n) 31XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name)); 46private static XElement LoadChildType(NamedTypeSymbol t) 48XElement elem = new XElement("type"); 85private static XElement LoadField(FieldSymbol f) 87XElement elem = new XElement("field");
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
20/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 37/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (23)
AbstractCommandHandlerTestState.cs (1)
56XElement workspaceElement,
CodeLens\AbstractCodeLensTest.cs (8)
20protected static async Task RunCountTest(XElement input, int cap = 0) 46=> RunCountTest(XElement.Parse(input), cap); 48protected static async Task RunReferenceTest(XElement input) 72=> RunReferenceTest(XElement.Parse(input)); 74protected static async Task RunMethodReferenceTest(XElement input) 98=> RunMethodReferenceTest(XElement.Parse(input)); 100protected static async Task RunFullyQualifiedNameTest(XElement input) 123=> RunFullyQualifiedNameTest(XElement.Parse(input));
Debugging\AbstractDataTipInfoGetterTests.cs (2)
25protected Task TestAsync(XElement markup, string? expectedText = null) 28protected Task TestNoDataTipAsync(XElement markup)
ExtractInterface\ExtractInterfaceTestState.cs (1)
44? EditorTestWorkspace.CreateWorkspace(XElement.Parse(markup), composition: Composition)
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
379workspace.InitializeDocuments(XElement.Parse(xmlContent), openDocuments: false);
NavigateTo\AbstractNavigateToTests.cs (3)
100protected async Task TestAsync(TestHost testHost, Composition composition, XElement content, Func<EditorTestWorkspace, Task> body) 122XElement content, Func<EditorTestWorkspace, Task> body, TestHost testHost, 130XElement workspaceElement,
Workspaces\EditorTestWorkspace_Create.cs (5)
15=> Create(XElement.Parse(xmlDefinition), openDocuments, composition); 18XElement workspaceElement, 27XElement workspaceElement, 92var workspaceElement = CreateWorkspaceElement(language, compilationOptions, parseOptions, files, sourceGeneratedFiles, metadataReferences, extension, commonReferences, isMarkup); 107var workspaceElement = CreateWorkspaceElement(
Workspaces\InteractiveCSharpTestWorkspaceFixture.cs (1)
24return EditorTestWorkspace.Create(XElement.Parse(workspaceDefinition), composition: composition, workspaceKind: WorkspaceKind.Interactive);
Workspaces\TestWorkspaceFixture.cs (1)
42_workspace = EditorTestWorkspace.CreateWorkspace(XElement.Parse(markup), composition: composition, workspaceKind: workspaceKind);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
SymbolFinder\DependentTypeFinderTests.cs (1)
46return TestWorkspace.CreateWorkspace(XElement.Parse("<Workspace></Workspace>"), composition: composition);
Microsoft.CodeAnalysis.Features (19)
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (7)
282var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 303var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 323var element = (XElement)node; 448private static (string target, string hint)? GetNavigationTarget(XElement element, SemanticModel semanticModel, int position, SymbolDisplayFormat format)
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
SymbolSearch\Windows\SymbolSearchUpdateEngine.Update.cs (11)
242var element = await DownloadFileAsync(serverPath, cancellationToken).ConfigureAwait(false); 250FileInfo databaseFileInfo, XElement element, CancellationToken cancellationToken) 422var element = await DownloadFileAsync(serverPath, cancellationToken).ConfigureAwait(false); 467FileInfo databaseFileInfo, XElement patchElement, Func<byte[]> getDatabaseBytes, CancellationToken cancellationToken) 491FileInfo databaseFileInfo, XElement patchElement, Func<byte[]> getDatabaseBytes, CancellationToken cancellationToken) 535private static void ParsePatchElement(XElement patchElement, out bool upToDate, out bool tooOld, out byte[]? patchBytes) 571private async Task<XElement> DownloadFileAsync(string serverPath, CancellationToken cancellationToken) 611private async Task<(XElement? element, TimeSpan delay)> TryDownloadFileAsync(IFileDownloader fileDownloader, CancellationToken cancellationToken) 644var element = XElement.Load(reader); 686private async Task<(bool succeeded, byte[]? contentBytes)> TryParseDatabaseElementAsync(XElement element, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
Options\NamingStyleTestUtilities.cs (5)
31var xml = preferences.CreateXElement(); 34var elementsToRemove = new List<XElement>(); 35foreach (var element in xml.DescendantsAndSelf()) 43foreach (var element in elementsToRemove) 51foreach (var element in xml.DescendantsAndSelf())
Microsoft.CodeAnalysis.LanguageServer.Protocol (17)
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (17)
33public CodeSnippet(XElement codeSnippetElement) 35var header = GetElementWithoutNamespace(codeSnippetElement, "Header"); 56public XElement CodeSnippetElement { get; } 73private static ImmutableArray<XElement>? ReadCodeSnippetElements(XDocument document) 75var codeSnippetsElement = document.Root; 91public static IEnumerable<XElement> GetElementsWithoutNamespace(XElement element, string localName) 96public static XElement? GetElementWithoutNamespace(XElement? element, string localName) 101public static string GetElementInnerText(XElement element, string subElementName) 103var subElement = GetElementWithoutNamespace(element, subElementName); 134var snippetElement = CodeSnippet.GetElementWithoutNamespace(snippet.CodeSnippetElement, "Snippet"); 135var declarationsElement = CodeSnippet.GetElementWithoutNamespace(snippetElement, "Declarations"); 137var code = CodeSnippet.GetElementWithoutNamespace(snippetElement, "Code"); 151private void ReadDeclarations(XElement? declarations) 158foreach (var declarationElement in declarations.Elements()) 161var functionElement = CodeSnippet.GetElementWithoutNamespace(declarationElement, "Function");
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
VSTypeScriptHandlerTests.cs (1)
96testWorkspace.InitializeDocuments(XElement.Parse(workspaceXml), openDocuments: false);
Workspaces\LspWorkspaceManagerTests.cs (4)
302XElement.Parse(secondWorkspaceXml), 366testWorkspaceTwo.InitializeDocuments(XElement.Parse(secondWorkspaceXml)); 425testWorkspaceTwo.InitializeDocuments(XElement.Parse(secondWorkspaceXml)); 471testWorkspace.InitializeDocuments(XElement.Parse(workspaceXml));
Microsoft.CodeAnalysis.Test.Utilities (77)
Assert\AssertXml.cs (47)
32Equal(XElement.Parse(expected), XElement.Parse(actual), message: null, expectedValueSourcePath: null, expectedValueSourceLine: 0, expectedIsXmlLiteral: true); 35public static void Equal(XElement expected, XElement actual) 44XElement expectedRoot, 45XElement actualRoot, 65private static string GetXmlString(XElement node, bool expectedIsXmlLiteral) 91XElement expectedRoot, 92Tuple<XElement, XElement> firstMismatch, 140private static bool CheckEqual(XElement expectedRoot, XElement actualRoot, IEqualityComparer<XElement> shallowComparer, out Tuple<XElement, XElement> firstMismatch) 146Tuple<XElement, XElement> rootPair = new Tuple<XElement, XElement>(expectedRoot, actualRoot); 154Stack<Tuple<XElement, XElement>> stack = new Stack<Tuple<XElement, XElement>>(); 159Tuple<XElement, XElement> pair = stack.Pop(); 163XElement[] children1 = pair.Item1.Elements().ToArray(); 164MultiDictionary<XElement, XElement> children2Dict = new MultiDictionary<XElement, XElement>(shallowComparer); 167foreach (XElement child in pair.Item2.Elements()) 178HashSet<XElement> children2Used = new HashSet<XElement>(ReferenceEqualityComparer.Instance); 179foreach (XElement child1 in children1) 181XElement child2 = null; 198stack.Push(new Tuple<XElement, XElement>(child1, child2)); 212private class ShallowElementComparer : IEqualityComparer<XElement> 214public static readonly IEqualityComparer<XElement> Instance = new ShallowElementComparer(); 218public bool Equals(XElement element1, XElement element2) 228public int GetHashCode(XElement element) 237private class NameAndAttributeComparer : IEqualityComparer<XElement> 239public static readonly IEqualityComparer<XElement> Instance = new NameAndAttributeComparer(); 243public bool Equals(XElement element1, XElement element2) 259public int GetHashCode(XElement element)
Compilation\CompilationDifference.cs (1)
96sequencePointMarkers = ILValidation.GetSequencePointMarkers(XElement.Parse(actualPdb));
CompilationVerifier.cs (3)
638var xmlDocument = XElement.Parse(actualPdbXml); 639var xmlMethod = ILValidation.GetMethodElement(xmlDocument, methodToken);
InstrumentationChecker.cs (2)
170public void CompleteCheck(Compilation compilation, XElement source) 273public static readonly XElement InstrumentationHelperSource = new XElement("file", new XAttribute("name", "c.vb"), InstrumentationHelperSourceStr);
Metadata\ILValidation.cs (10)
330public static XElement GetMethodElement(XElement document, int methodToken) 339public static ImmutableDictionary<string, string> GetDocumentIdToPathMap(XElement document) 344public static Dictionary<int, string> GetSequencePointMarkers(XElement methodXml) 351foreach (var e in methodXml.Descendants()) 359foreach (var e in methodXml.Descendants()) 375public static Dictionary<int, string> GetSequencePointMarkers(XElement methodXml, Func<string, SourceText> getSource) 382foreach (var e in methodXml.Descendants()) 395foreach (var e in methodXml.Descendants()) 409private static string SnippetFromSpan(SourceText text, XElement sequencePointXml)
Syntax\XmlHelpers.cs (14)
49private static void AddNodeInfo(NodeInfo info, XElement xml) 61public static void AddInfo(SyntaxNode node, XElement xml) 66public static void AddInfo(SyntaxNodeOrToken node, XElement xml) 71public static void AddInfo(SyntaxToken node, XElement xml) 76public static void AddInfo(SyntaxTrivia node, XElement xml) 81public static void AddErrors(XElement xml) 98public static XElement ToXml(this SyntaxNodeOrToken node, SyntaxTree syntaxTree, XmlOptions options = null) 100XElement xml = null; 113public static XElement ToXml(this SyntaxNode node, SyntaxTree syntaxTree, XmlOptions options = null) 120XElement xml = null; 157public static XElement ToXml(this SyntaxToken token, SyntaxTree syntaxTree, XmlOptions options = null) 164XElement retVal = new XElement("Node", 210public static XElement ToXml(this SyntaxTrivia trivia, SyntaxTree syntaxTree, XmlOptions options = null) 217XElement retVal = new XElement("Node",
Microsoft.CodeAnalysis.VisualBasic (6)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (6)
273Dim element = DirectCast(node, XElement) 304Dim element = DirectCast(container, XElement) 431Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean 441Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode() 511Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath) 579Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (64)
Attributes\AttributeTests_Experimental.vb (1)
15Private Shared ReadOnly DeprecatedAndExperimentalAttributeSource As XElement =
Attributes\AttributeTests_StructLayout.vb (1)
788Private Sub VerifyStructLayout(source As System.Xml.Linq.XElement, hasInstanceFields As Boolean)
Attributes\InternalsVisibleToAndStrongNameTests.vb (5)
2222Dim sourceA As XElement = 2232Dim sourceB As XElement = 2254Dim sourceA As XElement = 2264Dim sourceB As XElement = 2286Dim source As XElement =
CodeGen\CodeGenVBCore.vb (1)
3295source As XElement,
Emit\DynamicAnalysis\DynamicAnalysisResourceTests.vb (10)
19ReadOnly InstrumentationHelperSource As XElement = <file name="a.vb"> 38ReadOnly ExampleSource As XElement = <file name="c.vb"> 71Dim source As XElement = <compilation></compilation> 116Dim testSource As XElement = <file name="c.vb"> 254Dim testSource As XElement = <file name="c.vb"> 319Dim testSource As XElement = <file name="c.vb"> 392Dim testSource As XElement = <file name="c.vb"> 508Dim testSource As XElement = <file name="c.vb"> 615Dim testSource As XElement = <file name="c.vb"> 687Dim testSource As XElement = <file name="c.vb">
Emit\DynamicAnalysis\DynamicInstrumentationTests.vb (31)
21Dim testSource As XElement = <file name="c.vb"> 35Dim source As XElement = <compilation></compilation> 110Dim testSource As XElement = <file name="c.vb"> 124Dim source As XElement = <compilation></compilation> 167Dim testSource As XElement = <file name="c.vb"> 182Dim testSource1 As XElement = <file name="d.vb"> 193Dim testSource2 As XElement = <file name="e.vb"> 202Dim source As XElement = <compilation></compilation> 250Dim testSource As XElement = <file name="c.vb"> 284Dim source As XElement = <compilation></compilation> 390Dim testSource As XElement = <file name="c.vb"> 419Dim source As XElement = <compilation></compilation> 467Dim testSource As XElement = <file name="c.vb"> 493Dim source As XElement = <compilation></compilation> 627Dim testSource As XElement = <file name="c.vb"> 671Dim source As XElement = <compilation></compilation> 888Dim testSource As XElement = <file name="c.vb"> 961Dim source As XElement = <compilation></compilation> 1044Dim testSource As XElement = <file name="c.vb"> 1124Dim testSource As XElement = <file name="c.vb"> 1212Dim testSource As XElement = <file name="c.vb"> 1278Dim testSource As XElement = <file name="c.vb"> 1375Dim testSource As XElement = <file name="c.vb"> 1454Dim testSource As XElement = <file name="c.vb"> 1540Dim testSource As XElement = <file name="c.vb"> 1652Dim testSource As XElement = <file name="c.vb"> 1742Dim testSource As XElement = <file name="c.vb"> 1875Dim testSource As XElement = <file name="c.vb"> 2810Private Function CreateCompilation(source As XElement) As Compilation 2814Private Overloads Function CompileAndVerify(source As XElement, Optional expectedOutput As XCData = Nothing, Optional options As VisualBasicCompilationOptions = Nothing) As CompilationVerifier 2822Private Overloads Function CompileAndVerify(source As XElement, Optional expectedOutput As String = Nothing, Optional options As VisualBasicCompilationOptions = Nothing) As CompilationVerifier
Emit\EditAndContinue\EditAndContinueTestBase.vb (2)
43Friend Shared Function MarkedSource(source As XElement, Optional fileName As String = "", Optional options As VisualBasicParseOptions = Nothing) As SourceWithMarkedNodes 326Public Function WithSource(compilation As VisualBasicCompilation, newSource As XElement) As VisualBasicCompilation
Emit\NoPiaEmbedTypes.vb (3)
502Private Shared Sub VerifyEmitDiagnostics(compilation As VisualBasicCompilation, Optional errors As XElement = Nothing) 512Private Shared Sub VerifyEmitMetadataOnlyDiagnostics(compilation As VisualBasicCompilation, Optional errors As XElement = Nothing) 4370Private Shared Sub AssertTheseDiagnostics(verifier As CompilationVerifier, diagnostics As XElement)
Emit\OptionalArgumentsTests.vb (1)
23Private ReadOnly _librarySource As XElement =
ExpressionTrees\CodeGenExprLambda.vb (7)
1857Private Sub VerifyExpressionTreesDiagnostics(sourceFile As XElement, diagnostics As XElement, 1875Private Function TestExpressionTreesVerifier(sourceFile As XElement, result As String, 1897Private Sub TestExpressionTrees(sourceFile As XElement, result As String, 1908Private Sub TestExpressionTrees(sourceFile As XElement, result As XCData, 8338Private ReadOnly _exprTesting As XElement = <file name="exprlambdatest.vb"><%= ExpTreeTestResources.ExprLambdaUtils %></file> 8340Private ReadOnly _queryTesting As XElement = <file name="QueryHelper.vb"><%= ExpTreeTestResources.QueryHelper %></file>
PDB\PDBLambdaTests.vb (2)
246Dim actual1 As XElement = GetPdbXml(compilation) 247Dim actual2 As XElement = GetPdbXml(compilation)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (7)
CodeActions\AbstractVisualBasicCodeActionTest_NoEditor.vb (3)
29Protected Overloads Async Function TestAsync(initialMarkup As XElement, expected As XElement, Optional index As Integer = 0, Optional parseOptions As ParseOptions = Nothing) As Threading.Tasks.Task 39Protected Overloads Async Function TestMissingAsync(initialMarkup As XElement) As Threading.Tasks.Task
EditAndContinue\BreakpointSpansTests.vb (4)
21Private Shared Sub TestSpan(markup As XElement) 25Private Shared Sub TestMissing(markup As XElement) 29Private Shared Sub TestLine(markup As XElement) 33Private Shared Sub TestAll(markup As XElement)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (22)
Binding\BindingScopeTests.vb (1)
16expectedScope As XElement)
Binding\ForEachTests.vb (5)
189Dim expectedErrors As New Dictionary(Of String, XElement) From { 556Dim expectedErrors As New Dictionary(Of String, XElement) From { 1168Dim expectedErrors As New Dictionary(Of String, XElement) From { 1489Dim expectedErrors As New Dictionary(Of String, XElement) From { 2922Dim expectedErrors As New Dictionary(Of String, XElement) From {
Binding\ImplicitVariableTests.vb (1)
1219Friend Shared Function GetSourceXElementFromTemplate(code As XCData) As XElement
FlowAnalysis\FlowTestBase.vb (11)
61Protected Function CompileAndAnalyzeControlFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As ControlFlowAnalysis 65Protected Function CompileAndAnalyzeDataFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As DataFlowAnalysis 69Protected Function CompileAndAnalyzeControlAndDataFlow(program As XElement, Optional ilSource As XCData = Nothing, Optional errors As XElement = Nothing) As Tuple(Of ControlFlowAnalysis, DataFlowAnalysis) 73Private Function CompileAndGetModelAndSpan(Of T)(program As XElement, analysisDelegate As Func(Of SemanticModel, List(Of VisualBasicSyntaxNode), List(Of VisualBasicSyntaxNode), T), ilSource As XCData, errors As XElement) As T 80Protected Function CompileAndGetModelAndSpan(program As XElement, startNodes As List(Of VisualBasicSyntaxNode), endNodes As List(Of VisualBasicSyntaxNode), ilSource As XCData, errors As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As VisualBasicCompilation 211code As XElement,
Semantics\ConditionalExpressionsTests.vb (3)
244Optional errors As XElement = Nothing, 522Private Sub TestInvalidTernaryIfOperatorsStrict(strict As OptionStrict, errs As XElement) 672Private Sub TestInvalidBinaryIfOperatorsStrict(strict As OptionStrict, errs As XElement)
Semantics\UseSiteErrorTests.vb (1)
562Private Shared Function CompileWithMissingReference(sources As XElement) As VisualBasicCompilation
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (78)
DocumentationComments\DocCommentTests.vb (10)
10873Private Sub ExtendedCref_BinaryOperatorCore(op As String, opName As String, errors As XElement) 11098Optional checkErrors As XElement = Nothing, 11929Private Function FormatSourceXml(xml As XElement, ParamArray obj() As Object) As XElement 11936Private Function FormatXmlSimple(xml As XElement, ParamArray obj() As Object) As XElement 12103sources As XElement, 12104errors As XElement, 12105Optional expectedDocXml As XElement = Nothing, 12156expectedDocXml As XElement,
SymbolDisplay\SymbolDisplayTests.vb (21)
3654Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3697Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3731Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3792Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3870Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3910Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3935Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3960Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 3984Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4150Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4202Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4252Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4297Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4344Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4371code = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4416Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4472Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4613Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 4798Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString 6038text As XElement, 6082text As XElement,
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (3)
1967Private Function Compile(text As XElement, ByRef tree As SyntaxTree, nodes As List(Of SyntaxNode), Optional errors As XElement = Nothing) As VisualBasicCompilation 2001Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\GenericConstraintTests.vb (2)
4450Dim expected As XElement 5166Dim expected As XElement
SymbolsTests\Metadata\PE\LoadingNamespacesAndTypes.vb (10)
21Dim dumpXML As XElement = LoadChildNamespace1(assembly.Modules(0).GlobalNamespace) 23Dim baseLine = XElement.Load(New MemoryStream(TestResources.SymbolsTests.Metadata.MscorlibNamespacesAndTypes)) 34Dim dumpXML As XElement = LoadChildNamespace2(assembly.Modules(0).GlobalNamespace) 36Dim baseLine = XElement.Load(New MemoryStream(TestResources.SymbolsTests.Metadata.MscorlibNamespacesAndTypes)) 44Private Function LoadChildNamespace1(n As NamespaceSymbol) As XElement 45Dim elem As XElement = New XElement(If(n.Name.Length = 0, "Global", n.Name)) 61Private Function LoadChildNamespace2(n As NamespaceSymbol) As XElement 62Dim elem As XElement = New XElement(If(n.Name.Length = 0, "Global", n.Name)) 91Private Function LoadChildType(t As NamedTypeSymbol) As XElement 93Dim elem As XElement = <type name=<%= t.Name %>/>
SymbolsTests\Metadata\WinMdEventTest.vb (1)
62Private ReadOnly _dynamicCommonSrc As XElement =
SymbolsTests\MyBaseMyClassSemanticsTests.vb (3)
116Private Function Compile(text As XElement, ByRef tree As SyntaxTree, nodes As List(Of SyntaxNode), Optional errors As XElement = Nothing) As VisualBasicCompilation 150Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\Retargeting\NoPia.vb (7)
20Private Shared ReadOnly s_sourcePia1 As XElement = <compilation name="Pia1"><file name="a.vb"><![CDATA[ 51Private Shared ReadOnly s_sourceLocalTypes1_IL As XElement = <compilation name="LocalTypes1"><file name="a.vb"><![CDATA[ 74Private Shared ReadOnly s_sourceLocalTypes1 As XElement = <compilation name="LocalTypes1"><file name="a.vb"><![CDATA[ 84Private Shared ReadOnly s_sourceLocalTypes2_IL As XElement = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[ 109Private Shared ReadOnly s_sourceLocalTypes2 As XElement = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[ 119Private Shared ReadOnly s_sourceLocalTypes3_IL As XElement = <compilation name="LocalTypes3"><file name="a.vb"><![CDATA[ 174Private Shared ReadOnly s_sourceLocalTypes3 As XElement = <compilation name="LocalTypes3"><file name="a.vb"><![CDATA[
SymbolsTests\Source\ComClassTests.vb (10)
23) As XElement 36Private Function ReflectType(type As PENamedTypeSymbol, Optional memberFilter As Func(Of Symbol, Boolean) = Nothing) As XElement 82Private Function ReflectAttributes(attrData As ImmutableArray(Of VisualBasicAttributeData)) As XElement 103Private Function ReflectMethod(m As PEMethodSymbol) As XElement 144Private Function ReflectParameter(p As PEParameterSymbol) As XElement 183Private Function ReflectProperty(p As PEPropertySymbol) As XElement 205Private Function ReflectEvent(e As PEEventSymbol) As XElement 231Private Function ReflectField(f As PEFieldSymbol) As XElement 247Private Sub AssertReflection(expected As XElement, actual As XElement)
SymbolsTests\Source\EnumTests.vb (3)
1330Private Shared Function GenerateEnum(n As Integer, getMemberValue As Func(Of Integer, Integer, String)) As XElement 1348Private Shared Function VerifyEnumsValue(text As XElement, enumName As String, ParamArray expectedEnumValues As Object()) As List(Of Symbol) 1353Private Shared Function VerifyEnumsValue(text As XElement, enumName As String, underlyingType As SpecialType, ParamArray expectedEnumValues As Object()) As List(Of Symbol)
SymbolsTests\Source\FieldTests.vb (2)
327Dim expectedErrors() As XElement = { 394Dim expectedErrors() As XElement = {
SymbolsTests\Source\PropertyTests.vb (2)
4354Private ReadOnly _propertiesCallBaseSource As XElement = 8235Private Function CompileWithCustomPropertiesAssembly(source As XElement, Optional options As VisualBasicCompilationOptions = Nothing) As VisualBasicCompilation
SymbolsTests\SymbolErrorTests.vb (1)
17159Dim expectedErrors As New Dictionary(Of String, XElement) From {
SymbolsTests\WithStatementSymbolsTests.vb (3)
269Private Function Compile(text As XElement, ByRef tree As SyntaxTree, nodes As List(Of SyntaxNode), Optional errors As XElement = Nothing) As VisualBasicCompilation 303Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (3)
Parser\ParseExpression.vb (2)
19Private Function ParseExpressionAsRhs(text As XElement) As ExpressionSyntax 41Private Function ParseExpression(text As XElement) As ExpressionSyntax
PreprocessorEETests.vb (1)
15Private Function ParseExpression(text As XElement) As ExpressionSyntax
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (30)
BasicTestSource.vb (2)
39Dim xmlSource = TryCast(Value, XElement) 84Public Shared Widening Operator CType(source As XElement) As BasicTestSource
CompilationTestUtils.vb (21)
165Public Function CreateCompilationWithWinRt(source As XElement) As VisualBasicCompilation 169Public Function CreateCompilationWithMscorlib40AndReferences(source As XElement, 186Public Function CreateCompilationWithMscorlib40(source As XElement, 203source As XElement, 223Public Function CreateCompilationWithMscorlib40AndVBRuntime(source As XElement, 245source As XElement, 270source As XElement, 289Public Function CreateEmptyCompilationWithReferences(source As XElement, 298Public Function ParseSourceXml(sources As XElement, 312Public Function ToSourceTrees(compilationSources As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As IEnumerable(Of SyntaxTree) 356Public Function CreateCompilationWithCustomILSource(sources As XElement, ilSource As XCData) As VisualBasicCompilation 373Public Function CreateCompilationWithCustomILSource(sources As XElement, 635Public Function CreateParseTree(programElement As XElement) As SyntaxTree 647Public Function CreateParseTreeAndSpans(programElement As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As (tree As SyntaxTree, spans As IList(Of TextSpan)) 783Public Sub AssertTheseDeclarationDiagnostics(compilation As VisualBasicCompilation, errs As XElement, Optional suppressInfos As Boolean = True) 788Public Sub AssertTheseParseDiagnostics(compilation As VisualBasicCompilation, errs As XElement, Optional suppressInfos As Boolean = True) 801Public Sub AssertTheseCompileDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True) 817Public Sub AssertTheseEmitDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True) 830Public Sub AssertTheseDiagnostics(tree As SyntaxTree, errs As XElement, Optional suppressInfos As Boolean = True) 843Public Sub AssertTheseDiagnostics(compilation As Compilation, Optional errs As XElement = Nothing, Optional suppressInfos As Boolean = True) 867Public Sub AssertTheseDiagnostics(errors As ImmutableArray(Of Diagnostic), errs As XElement, Optional suppressInfos As Boolean = True)
ParserTestUtilities.vb (7)
23Public Function ParseAndVerify(code As XCData, Optional expectedErrors As XElement = Nothing) As SyntaxTree 28Public Function ParseAndVerify(code As XCData, options As VisualBasicParseOptions, Optional expectedErrors As XElement = Nothing) As SyntaxTree 33Public Function ParseAndVerify(source As String, options As VisualBasicParseOptions, Optional expectedErrors As XElement = Nothing) As SyntaxTree 50Public Function ParseAndVerify(source As String, Optional expectedErrors As XElement = Nothing) As SyntaxTree 462Public Function ToXml(errors As IEnumerable(Of Diagnostic)) As XElement 598Private Function AreErrorsEquivalent(syntaxError As Diagnostic, xmlError As XElement) As Boolean 633expectedErrors As XElement)
Microsoft.CodeAnalysis.Workspaces (58)
CodeStyle\CodeStyleOption.cs (3)
18XElement ToXElement(); 61public XElement ToXElement() => UnderlyingOption.ToXElement(); 63public static CodeStyleOption<T> FromXElement(XElement element)
Shared\Extensions\ISymbolExtensions.cs (14)
243var element = XElement.Parse(xmlText, LoadOptions.PreserveWhitespace); 301var element = (XElement)node; 345private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken) 427foreach (var typeParameterRef in typeParameterRefs) 440var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 538static string BuildXPathForElement(XElement element) 547for (var current = element; current != null; current = current.Parent) 592var sourceElement = (XElement)(object)node; 593var targetElement = (XElement)copy; 634private static bool ElementNameIs(XElement element, string name)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (5)
19XElement ToXElement(); 31ICodeStyleOption2 FromXElement(XElement element); 115public XElement ToXElement() 165ICodeStyleOption2 ICodeStyleOption2.FromXElement(XElement element) 168public static CodeStyleOption2<T> FromXElement(XElement element)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
463internal XElement CreateXElement() 472internal static NamingStyle FromXElement(XElement namingStyleElement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
300public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 319internal XElement CreateXElement() 328internal static NamingStylePreferences FromXElement(XElement element) 378private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 396: XElement.Parse(DefaultNamingPreferencesString); 399private static void UpgradeSerialization_4To5(XElement rootElement) 405foreach (var element in methodElements) 407element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
32internal XElement CreateXElement() 34var element = new XElement(nameof(SerializableNamingRule), 42internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
217internal XElement CreateXElement() 246private XElement CreateSymbolKindsXElement() 248var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 258private XElement CreateAccessibilitiesXElement() 260var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 270private XElement CreateModifiersXElement() 272var modifiersElement = new XElement(nameof(RequiredModifierList)); 282internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 290private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 293foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 298foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 303foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 311private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 314private static Accessibility ParseAccessibility(XElement accessibilityElement) 317private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 372internal XElement CreateXElement() 424internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 437internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 440internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 537internal XElement CreateXElement() 540internal static ModifierKind FromXElement(XElement modifierElement)
Utilities\Documentation\XmlDocumentationProvider.cs (1)
77foreach (var e in doc.Descendants("member"))
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (5)
src\Compilers\Core\Portable\InternalUtilities\XmlUtilities.cs (5)
45var sourceElement = ((XElement)(object)node); 46var targetElement = ((XElement)copy); 68internal static XElement[]? TrySelectElements(XNode node, string xpath, out string? errorMessage, out bool invalidXPath)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (11)
SolutionGeneration.cs (8)
265var propertyGroup = document.Root.Descendants(XName.Get("PropertyGroup", NS)).First(); 279var importTargets = document.Root.Elements().Last(); 312XElement addBefore, 316Action<T, XElement> elementModifier = null) 318var itemGroup = CreateXElement("ItemGroup"); 323var itemElement = CreateXElement(itemTypeSelector(item)); 331private static XElement CreateXElement(string name) 336private static void AddXElement(XElement element, string elementName, string elementValue)
VisualStudioMSBuildWorkspaceTests.cs (3)
2476private static FileSet VisitProjectReferences(FileSet files, Action<XElement> visitProjectReference) 2493private static string VisitProjectReferences(string projectFileText, Action<XElement> visitProjectReference) 2497foreach (var projectReferenceItem in projectReferenceItems)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (60)
Extensions\XElementExtensions.cs (1)
11public static string NormalizedValue(this XElement element)
Workspaces\TestWorkspace_Create.cs (5)
15=> Create(XElement.Parse(xmlDefinition), openDocuments, composition); 18XElement workspaceElement, 27XElement workspaceElement, 92var workspaceElement = CreateWorkspaceElement(language, compilationOptions, parseOptions, files, sourceGeneratedFiles, metadataReferences, extension, commonReferences, isMarkup); 107var workspaceElement = CreateWorkspaceElement(
Workspaces\TestWorkspace_XmlConsumption.cs (33)
117XElement workspaceElement, 118XElement projectElement, 163foreach (var documentElement in documentElements) 177foreach (var sourceGeneratedDocumentElement in projectElement.Elements(DocumentFromSourceGeneratorElementName)) 202foreach (var additionalDocumentElement in additionalDocumentElements) 217foreach (var analyzerConfigElement in analyzerConfigElements) 233private static ParseOptions GetParseOptions(XElement projectElement, string language, HostLanguageServices languageServices) 240private static ParseOptions GetParseOptionsWorker(XElement projectElement, string language, HostLanguageServices languageServices) 328private static DocumentationMode? GetDocumentationMode(XElement projectElement) 341private string GetAssemblyName(XElement projectElement, ref int projectId) 357private string GetLanguage(XElement projectElement) 377private string GetRootNamespace(CompilationOptions compilationOptions, XElement projectElement) 396XElement projectElement, 400var compilationOptionsElement = projectElement.Element(CompilationOptionsElementName); 406private CompilationOptions CreateCompilationOptions(string language, XElement compilationOptionsElement, ParseOptions parseOptions) 545XElement workspaceElement, 546XElement documentElement, 566var originalProject = workspaceElement.Elements(ProjectElementName).FirstOrDefault(p => 615var optionsElement = documentElement.Element(ParseOptionsElementName); 677private static TestDocumentServiceProvider? GetDocumentServiceProvider(XElement documentElement) 694private string GetFileName(XElement documentElement, ref int documentId) 708private static IReadOnlyList<string> GetFolders(XElement documentElement) 724private MetadataReference CreateMetadataReferenceFromSource(XElement projectElement, XElement referencedSource) 753private Compilation CreateCompilation(XElement referencedSource) 775foreach (var documentElement in documentElements) 802private IList<MetadataReference> CreateReferenceList(XElement element) 805foreach (var reference in element.Elements(MetadataReferenceElementName)) 815foreach (var metadataReferenceFromSource in element.Elements(MetadataReferenceFromSourceElementName)) 823private static IList<AnalyzerReference> CreateAnalyzerList(XElement projectElement) 826foreach (var analyzer in projectElement.Elements(AnalyzerElementName)) 838private IList<MetadataReference> CreateCommonReferences(XElement element) 956private static void AssertNoChildText(XElement element)
Workspaces\TestWorkspace_XmlCreation.cs (13)
19internal static XElement CreateWorkspaceElement( 31var documentElements = new List<XElement>(); 73var projectElement = CreateProjectElement(compilationOptions?.ModuleName ?? "Test", language, commonReferences, parseOptions, compilationOptions, documentElements); 77protected static XElement CreateWorkspaceElement( 78params XElement[] projectElements) 83protected static XElement CreateProjectElement( 143private static XElement CreateCompilationOptionsElement(CompilationOptions options) 147var element = new XElement(CompilationOptionsElementName); 186private static XElement CreateMetadataReference(string path) 189protected static XElement CreateDocumentElement( 192var element = new XElement(DocumentElementName, 207protected static XElement CreateDocumentFromSourceGeneratorElement(string code, string hintName, ParseOptions parseOptions = null) 216private static XElement CreateParseOptionsElement(ParseOptions parseOptions)
Workspaces\TestWorkspace`1.cs (8)
615var workspaceElement = CreateWorkspaceElement( 629XElement workspaceElement, 639var projectElementToProjectName = new Dictionary<XElement, string>(); 643foreach (var projectElement in workspaceElement.Elements(ProjectElementName)) 681foreach (var projectElement in workspaceElement.Elements(ProjectElementName)) 683foreach (var projectReference in projectElement.Elements(ProjectReferenceElementName)) 731IEnumerable<XElement> submissionElements, 737foreach (var submissionElement in submissionElements)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
CodeStyle\NamingStylePreferencesUpgradeTests.cs (1)
21var preferences = NamingStylePreferences.FromXElement(XElement.Parse(serializedPreferences));
Options\CodeStyleOptionTests.cs (2)
82var serialized = option.ToXElement(); 101var serialized = option.ToXElement();
Microsoft.DotNet.Arcade.Sdk (14)
src\ExtractNgenMethodList.cs (2)
55var parentElement = document.Root.Element("MethodProfilingData"); 58foreach (var child in parentElement.Elements("Item"))
src\GenerateResxSource.cs (1)
106foreach (var node in XDocument.Load(ResourceFile).Descendants("data"))
src\SourceBuild\AddSourceMappingToNugetConfig.cs (4)
28XElement pkgSrcMappingElement = document.Root.Descendants().FirstOrDefault(e => e.Name == "packageSourceMapping"); 45internal void AddPkgSourceMapping(XElement pkgSrcMappingElement) 55XElement pkgSrcMappingClearElement = pkgSrcMappingElement.Descendants().FirstOrDefault(e => e.Name == "clear"); 62var pkgSrc = new XElement("packageSource", new XAttribute("key", SourceName));
src\SourceBuild\AddSourceToNuGetConfig.cs (4)
40XElement packageSourcesElement = document.Root 43var sourceElementToAdd = new XElement( 48XElement existingSourceElement = packageSourcesElement 52XElement lastClearElement = packageSourcesElement
src\SourceBuild\ReadSourceBuildIntermediateNupkgDependencies.cs (3)
45XElement root = XElement.Load(VersionDetailsXmlFile, LoadOptions.PreserveWhitespace); 57XElement sourceBuildElement = d.Element(CreateQualifiedName("SourceBuild"));
Microsoft.DotNet.Arcade.Sdk.Tests (3)
SourceMappingToNugetConfigTest.cs (3)
49XElement packageSourceMapping = document.Root; 54XElement generatedMapping = packageSourceMapping 78XElement firstElement = packageSourceMapping
Microsoft.DotNet.Build.Tasks.Feed (1)
src\BuildModelFactory.cs (1)
242return BuildModel.Parse(XElement.Load(assetManifestPath));
Microsoft.DotNet.Build.Tasks.Installers (10)
src\CreateWixCommandPackageDropBase.cs (4)
245IEnumerable<XElement> iels = doc.XPathSelectElements(xpath, nsmgr); 249foreach (XElement row in iels) 251IEnumerable<XElement> fields = row.XPathSelectElements("wix:field", nsmgr); 265foreach (XElement field in fields)
src\GenerateMacOSDistributionFile.cs (5)
41var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 62var scriptElement = new XElement("script", new XCData(archScriptContent)); 94var optionsElement = document.Root.Element("options"); 134public static XElement WithAttribute(this XElement element, XName attribute, object value)
src\StabilizeWixFileId.cs (1)
67XElement[] matchingFileElements = content.Element(GetQualifiedName("Wix"))
Microsoft.DotNet.Build.Tasks.Packaging (2)
GenerateNuSpec.cs (1)
164var licenseUrlElement = nuspec.Descendants(NuSpecXmlNamespace + "licenseUrl").Single();
PackageIndex.cs (1)
217foreach (var file in frameworkList.Element("FileList").Elements("File"))
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\FinalizeInsertionVsixFile.cs (1)
79var installationElement = document.Element(XName.Get("PackageManifest", VsixNamespace))?.Element(XName.Get("Installation", VsixNamespace));
Microsoft.DotNet.Build.Tasks.Workloads (6)
Msi\MsiPayloadPackageProject.wix.cs (1)
58var itemGroup = proj.Root.Element("ItemGroup");
Msi\WorkloadPackGroupMsi.wix.cs (5)
85var dotnetHomeElement = directoriesDoc.Root.Descendants().Where(d => (string)d.Attribute("Id") == "DOTNETHOME").Single(); 94var componentGroupRefElement = productDoc.Root.Descendants(ns + "ComponentGroupRef").Single(); 102var registryKeyElement = registryDoc.Root.Descendants(ns + "RegistryKey").Single(); 181public XElement ToXml() 184var xml = new XElement(ns + "Directory");
Microsoft.DotNet.MacOsPkg (7)
Package.cs (7)
56var xml = XElement.Load(distribution); 57List<XElement> componentPackages = xml.Elements("pkg-ref").Where(e => e.Value.Trim() != "").ToList(); 58foreach (var package in componentPackages) 133XElement pkgInfo = XElement.Load(packageInfo); 176private static string GetPackageInfoAttribute(XElement pkgInfo, string elementName) =>
Microsoft.DotNet.NuGetRepack.Tasks (10)
src\NuGetVersionUpdater.cs (8)
149var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 161var versionElement = metadata.Element(XName.Get("version", nuspecXmlns)); 264private static bool IsDotnetTool(string nuspecXmlns, XElement metadata) 266var packageTypesElement = metadata.Element(XName.Get("packageTypes", nuspecXmlns)); 269foreach (var packageType in packageTypesElement.Elements(XName.Get("packageType", nuspecXmlns)) ?? Array.Empty<XElement>()) 293Descendants(XName.Get("dependency", package.NuspecXmlns)) ?? Array.Empty<XElement>(); 295foreach (var dependency in dependencies)
src\ReplacePackageParts.cs (2)
155var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 169var versionElement = metadata.Element(XName.Get("version", nuspecXmlns));
Microsoft.DotNet.NuGetRepack.Tests (2)
TestHelpers\FakeBuildEngine.cs (2)
26public readonly List<ImmutableArray<XElement>> FilesToSign = new List<ImmutableArray<XElement>>();
Microsoft.DotNet.PackageTesting (4)
VerifyClosure.cs (4)
347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 396private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
Microsoft.DotNet.SharedFramework.Sdk (6)
src\CreateFrameworkListFile.cs (2)
67var frameworkManifest = new XElement("FileList", rootAttributes); 158var element = new XElement(
src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (4)
347var nodesElement = new XElement(s_dgmlns + "Nodes"); 348var linksElement = new XElement(s_dgmlns + "Links"); 377var categoriesElement = new XElement(s_dgmlns + "Categories"); 396private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
Microsoft.DotNet.SignTool.Tests (3)
FakeBuildEngine.cs (3)
28public readonly List<ImmutableArray<XElement>> FilesToSign = new List<ImmutableArray<XElement>>(); 61foreach (var file in filesToSign)
Microsoft.DotNet.SourceBuild.Tasks (20)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (2)
30public XElement ToXml() => new XElement( 38public static Usage Parse(XElement xml) => new Usage
src\UsageReport\UsageData.cs (2)
18public XElement ToXml() => new XElement( 43public static UsageData Parse(XElement xml) => new UsageData
src\UsageReport\UsagePattern.cs (2)
15public XElement ToXml() => new XElement( 20public static UsagePattern Parse(XElement xml) => new UsagePattern
src\UsageReport\UsageValidationData.cs (1)
13public XElement Report { get; set; }
src\UsageReport\ValidateUsageAgainstBaseline.cs (3)
52var used = UsageData.Parse(XElement.Parse(File.ReadAllText(DataFile))); 58var baseline = UsageData.Parse(XElement.Parse(baselineText)); 83var report = new XElement("BaselineComparison");
src\UsageReport\WriteUsageReports.cs (7)
63UsageData data = UsageData.Parse(XElement.Parse(File.ReadAllText(DataFile))); 81var xml = XElement.Parse(File.ReadAllText(ProdConBuildManifestFile)); 82foreach (var x in xml.Descendants("Package")) 107var report = new XElement("AnnotatedUsages"); 178Xml = XElement.Parse(content) 244public static PackageVersionPropsElement[] Parse(XElement xml)
src\UsageReport\XmlParsingHelpers.cs (2)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement( 26public static PackageIdentity ParsePackageIdentity(XElement xml) => new PackageIdentity(
Microsoft.DotNet.SourceBuild.Tasks.Tests (1)
ValidateUsageAgainstBaselineTests.cs (1)
42XElement
Microsoft.DotNet.VersionTools (36)
Automation\NupkgInfoFactory.cs (3)
59XElement metadataElement = GetSingleElement(doc.Root, "metadata"); 63private static XElement GetSingleElement(XElement el, string name)
BuildManifest\BuildManifestClient.cs (5)
36XElement contents = await FetchModelXmlAsync(project, @ref, basePath); 119XElement remoteModelXml = await FetchModelXmlAsync( 145XElement modifiedModelXml = modifiedModel.ToXml(); 201private async Task<XElement> FetchModelXmlAsync( 216return XElement.Parse(contents);
BuildManifest\Model\ArtifactSet.cs (2)
23public IEnumerable<XElement> ToXml() => Enumerable.Concat( 32public static ArtifactSet Parse(XElement xml) => new ArtifactSet
BuildManifest\Model\BlobArtifactModel.cs (2)
97public XElement ToXml() => new XElement( 103public static BlobArtifactModel Parse(XElement xml) => new BlobArtifactModel
BuildManifest\Model\BuildIdentity.cs (2)
163public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes()); 165public static BuildIdentity Parse(XElement xml) => new BuildIdentity
BuildManifest\Model\BuildModel.cs (2)
28public XElement ToXml() => new XElement( 34public static BuildModel Parse(XElement xml) => new BuildModel(BuildIdentity.Parse(xml))
BuildManifest\Model\EndpointModel.cs (2)
49public XElement ToXml() => new XElement( 54public static EndpointModel Parse(XElement xml) => new EndpointModel
BuildManifest\Model\OrchestratedBuildModel.cs (2)
42public XElement ToXml() => new XElement( 48public static OrchestratedBuildModel Parse(XElement xml) => new OrchestratedBuildModel(BuildIdentity.Parse(xml))
BuildManifest\Model\PackageArtifactModel.cs (2)
115public XElement ToXml() => new XElement( 121public static PackageArtifactModel Parse(XElement xml) => new PackageArtifactModel
BuildManifest\Model\SigningInformationModel.cs (12)
35public XElement ToXml() => IsEmpty() ? null : new XElement( 65public static SigningInformationModel Parse(XElement xml) => xml == null ? null : new SigningInformationModel 101public XElement ToXml() => new XElement( 107public static FileExtensionSignInfoModel Parse(XElement xml) => new FileExtensionSignInfoModel 150public XElement ToXml() => new XElement( 156public static FileSignInfoModel Parse(XElement xml) => new FileSignInfoModel 186public XElement ToXml() => new XElement( 192public static CertificatesSignInfoModel Parse(XElement xml) => new CertificatesSignInfoModel 216public XElement ToXml() => new XElement( 222public static ItemToSignModel Parse(XElement xml) => new ItemToSignModel 257public XElement ToXml() => new XElement( 263public static StrongNameSignInfoModel Parse(XElement xml) => new StrongNameSignInfoModel
BuildManifest\Model\XElementParsingExtensions.cs (2)
13public static string GetRequiredAttribute(this XElement element, XName name) 24public static Dictionary<string, string> CreateAttributeDictionary(this XElement element)
Microsoft.DotNet.VersionTools.Tasks (1)
BaseDependenciesTask.cs (1)
226XElement.Parse(
Microsoft.DotNet.VersionTools.Tests (21)
BuildManifest\ManifestModelTests.cs (21)
115Action act = () => SigningInformationModel.Parse(XElement.Parse(builder.ToString())); 120SigningInformationModel.Parse(XElement.Parse(builder.ToString())).Should().NotBeNull(); 397XElement xml = XElement.Parse(ExampleBuildString); 399XElement modelXml = model.ToXml(); 407XElement xml = XElement.Parse(ExampleOrchestratedBuildString); 409XElement modelXml = model.ToXml(); 417XElement xml = XElement.Parse( 420XElement modelXml = model.ToXml(); 429XElement modelXml = model.ToXml(); 430XElement xml = XElement.Parse(@"<Build Name=""SimpleBuildManifest"" BuildId=""123""><Package Id=""Foo"" Version=""1.2.3-example"" /></Build>"); 447orchestratedModel.AddParticipantBuild(BuildModel.Parse(XElement.Parse(ExampleBuildString))); 449XElement modelXml = orchestratedModel.ToXml(); 450XElement xml = XElement.Parse(@" 472XElement modelXml = buildModel.ToXml(); 473XElement xml = XElement.Parse(ExampleBuildStringWithSigningInformation);
Microsoft.DotNet.XliffTasks (61)
Model\ResxDocument.cs (4)
18foreach (XElement node in Document.Descendants("data")) 27XElement valueElement = node.Element("value"); 59foreach (XElement node in Document.Descendants("data")) 63XElement valueNodeOfFileRef = node.Element("value");
Model\TranslatableXmlDocument.cs (2)
29private readonly XElement _element; 31public TranslatableXmlElement(string id, string source, string note, XElement element)
Model\VsctDocument.cs (4)
20foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 31foreach (XElement child in strings.Elements()) 64foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 79foreach (XElement imageTag in Document.Descendants(Document.Root.Name.Namespace + "Bitmap"))
Model\XamlRuleDocument.cs (11)
27foreach (XElement? element in Document.Descendants()) 30var descendentDisplayName = element.Elements(XName.Get($"{element.Name.LocalName}.DisplayName", element.Name.NamespaceName)).FirstOrDefault(); 31var descendentDescription = element.Elements(XName.Get($"{element.Name.LocalName}.Description", element.Name.NamespaceName)).FirstOrDefault(); 125var parent = xObject.Parent; 133var grandparent = parent.Parent; 145private static string GenerateIdForPropertyMetadata(XElement element, XAttribute? attribute = null) 147var ancestorWithNameAttributeCandidate = element.Parent?.Parent; // start at grandparent 194private static string? GetComment(XElement element, string attributeName) 210private static string XmlName(XObject container) => container is XElement element ? XmlName(element) : XmlName((XAttribute)container); 211private static string XmlName(XElement element) 220private static string? AttributedName(XElement element) => element.Attribute("Name")?.Value;
Model\XDocumentExtensions.cs (1)
28public static void SelfCloseIfPossible(this XElement element)
Model\XElementExtensions.cs (24)
16/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 19public static string GetTargetValue(this XElement transUnitElement) => 27/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 29public static void SetTargetValue(this XElement transUnitElement, string value) 31XElement targetElement = transUnitElement.Element(Target); 34XElement sourceElement = transUnitElement.Element(Source); 51/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 53public static string GetTargetState(this XElement transUnitElement) => 61/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 63public static void SetTargetState(this XElement transUnitElement, string value) 65XElement targetElement = transUnitElement.Element(Target); 68XElement sourceElement = transUnitElement.Element(Source); 88/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 90public static string GetSourceValue(this XElement transUnitElement) => 96/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 98public static void SetSourceValue(this XElement transUnitElement, string value) => 104/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 106public static string GetNoteValue(this XElement transUnitElement) => 114/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 116public static void SetNoteValue(this XElement transUnitElement, string value) 118XElement noteElement = transUnitElement.Element(Note); 121XElement priorElement = transUnitElement.Element(Target) ?? transUnitElement.Element(Source); 133/// <param name="transUnitElement">An <see cref="XElement"/> representing the <code>trans-unit</code>.</param> 135public static string GetId(this XElement transUnitElement) =>
Model\XlfDocument.cs (13)
89XElement fileElement = _document.Root.Element(File); 98XElement bodyElement = fileElement.Element(Body); 99XElement groupElement = bodyElement.Element(Group); 108foreach (XElement unitElement in bodyElement.Descendants(TransUnit).ToList()) 187XElement newTransUnit = 195foreach (XElement transUnit in bodyElement.Elements(TransUnit)) 226XElement fileElement = _document.Root.Element(File); 227XElement bodyElement = fileElement.Element(Body); 229IEnumerable<XElement> transUnits = bodyElement.Elements(TransUnit); 235SortedList<string, XElement> sortedTransUnits = new(comparer); 238foreach (XElement transUnit in transUnits) 244foreach (XElement transUnit in sortedTransUnits.Values) 264foreach (XElement element in _document.Descendants(TransUnit))
Tasks\TransformTemplates.cs (2)
77foreach (XElement projectNode in templateXml.Descendants().Where(d => d.Name.LocalName == "Project")) 84foreach (XElement templateItem in templateXml.Descendants().Where(d => d.Name.LocalName == "ProjectItem"))
Microsoft.DotNet.XliffTasks.Tests (11)
XElementExtensionsTests.cs (11)
16XElement transUnitElement = 29XElement transUnitElement = 42XElement transUnitElement = 54XElement transUnitElement = 68XElement transUnitElement = 82XElement transUnitElement = 95XElement transUnitElement = 107XElement transUnitElement = new(TransUnit); 117XElement transUnitElement = 132XElement transUnitElement = 145XElement transUnitElement =
Microsoft.Extensions.FileProviders.Embedded (11)
Manifest\ManifestParser.cs (11)
38var manifest = EnsureElement(document, "Manifest"); 39var manifestVersion = EnsureElement(manifest, "ManifestVersion"); 47var fileSystem = EnsureElement(manifest, "FileSystem"); 51foreach (var element in entries) 80private static ManifestEntry BuildEntry(XElement element) 92var path = EnsureElement(element, "ResourcePath"); 101foreach (var child in element.Elements()) 115private static XElement EnsureElement(XContainer container, string elementName) 117var element = container.Element(elementName); 126private static string EnsureName(XElement element) 137private static string EnsureText(XElement element)
Microsoft.Extensions.FileProviders.Embedded.Tests (1)
Manifest\TestEntry.cs (1)
23public XElement ToXElement() => IsFile ?
Microsoft.Maui.Resizetizer (22)
GeneratePackageAppxManifest.cs (10)
81 var identity = appx.Root.Element(xidentity); 125 var properties = appx.Root.Element(xproperties); 136 var xelem = properties.Element(xname); 145 var xelem = properties.Element(xname); 171 var applications = appx.Root.Element(xapplications); 180 var application = applications.Element(xapplication); 189 var visual = application.Element(xvisual); 252 var tile = visual.Element(xtile); 309 var showname = tile.Element(xshowname); 328 var splash = visual.Element(xsplash);
GenerateTizenManifest.cs (12)
84 var manifest = tizenManifest.Root; 85 var uiApplication = manifest.Element(xmlns + UiApplicationName); 97 void UpdateSharedManifest(XNamespace xmlns, XElement manifest) 99 var uiApplication = manifest.Element(xmlns + UiApplicationName); 122 var label = uiApplication.Element(xmlns + LabelName); 132 void UpdateSharedResources(XNamespace xmlns, XElement manifestElement) 134 var uiApplicationElement = manifestElement.Element(xmlns + UiApplicationName); 143 foreach (var icon in iconPlaceholderElements) 162 var splashscreensElement = uiApplicationElement.Element(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName); 190 void UpdateElementAttribute(XElement element, XName attrName, string? value, string? placeholder) 199 void UpdateElementValue(XElement element, string? value, string? placeholder)
Microsoft.ML.Maml (2)
HelpCommand.cs (2)
463var content = new XElement("Components", 494private XElement CreateDefaultValueElement(IChannel ch, string name, CmdParser.ArgInfo.Arg a)
Microsoft.VisualStudio.LanguageServices (21)
ColorSchemes\ColorSchemeApplier.ColorSchemeReader.cs (7)
37private static ColorTheme ReadColorTheme(XElement themeElement) 42var categoryElement = themeElement.Descendants("Category").Single(); 48private static ColorCategory ReadColorCategory(XElement categoryElement) 61private static ColorItem? ReadColorItem(XElement colorElement) 65var backgroundElement = colorElement.Descendants("Background").SingleOrDefault(); 70var foregroundElement = colorElement.Descendants("Foreground").SingleOrDefault(); 83private static (__VSCOLORTYPE Type, uint Color) ReadColor(XElement colorElement)
Options\VisualStudioSettingsOptionPersister.cs (2)
133return NamingStylePreferences.FromXElement(XElement.Parse(value)); 150return new Optional<object?>(codeStyle.FromXElement(XElement.Parse(value)));
Snippets\AbstractSnippetExpansionLanguageHelper.cs (1)
33public abstract Task<Document> AddImportsAsync(Document document, AddImportPlacementOptions addImportOptions, SyntaxFormattingOptions formattingOptions, int position, XElement snippetNode, CancellationToken cancellationToken);
Snippets\ISnippetExpansionLanguageHelper.cs (1)
27Task<Document> AddImportsAsync(Document document, AddImportPlacementOptions addImportOptions, SyntaxFormattingOptions formattingOptions, int position, XElement snippetNode, CancellationToken cancellationToken);
Snippets\SnippetExpansionClient.cs (10)
304if (!TryGetSnippetNode(pSession, out var snippetNode)) 310var codeNode = snippetNode.Element(XName.Get("Code", ns)); 341private static bool TryGetSnippetNode(IVsExpansionSession pSession, [NotNullWhen(true)] out XElement? snippetNode) 359snippetNode = XElement.Parse(xmlNode.xml); 644var declarations = new List<XElement>(); 1057if (!TryGetSnippetNode(pSession, out var snippetNode)) 1078private static void AddReferences(Project originalProject, XElement snippetNode) 1080var referencesNode = snippetNode.Element(XName.Get("References", snippetNode.Name.NamespaceName)); 1093foreach (var reference in referencesNode.Elements(XName.Get("Reference", snippetNode.Name.NamespaceName))) 1096var assemblyElement = reference.Element(assemblyXmlName);
Microsoft.VisualStudio.LanguageServices.CSharp (9)
CodeModel\CSharpCodeModelService.cs (2)
1405if (xmlDocument.FirstNode is not XElement docElement || 1416foreach (var child in docElement.Elements())
Options\AutomationObject\AutomationObject.Naming.cs (1)
21SetOption(NamingStyleOptions.NamingPreferences, NamingStylePreferences.FromXElement(XElement.Parse(value)));
Snippets\CSharpSnippetExpansionLanguageHelper.cs (6)
75XElement snippetNode, 78var importsNode = snippetNode.Element(XName.Get("Imports", snippetNode.Name.NamespaceName)); 109SyntaxNode contextLocation, XElement snippetNode, XElement importsNode) 115foreach (var import in importsNode.Elements(XName.Get("Import", snippetNode.Name.NamespaceName))) 117var namespaceElement = import.Element(namespaceXmlName);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (3)
Interactive\Commands\InteractiveWindowCommandHandlerTestState.cs (3)
44public InteractiveWindowCommandHandlerTestState(XElement workspaceElement) 59var workspaceXml = XElement.Parse($@"
netstandard (1)
netstandard.cs (1)
2273[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
PresentationFramework-SystemXmlLinq (3)
SystemXmlLinqExtension.cs (3)
21XElement xelement = new XElement("Dummy"); 33return item is XElement; 39XName name = ((XElement)item).Name;
Roslyn.Test.PdbUtilities (29)
Reader\PdbValidation.cs (29)
33XElement expectedPdb, 79XElement expectedPdb, 96public static void VerifyPdb(this CompilationDifference diff, IEnumerable<MethodDefinitionHandle> methodHandles, XElement expectedPdb) 116XElement expectedPdb, 191XElement expectedPdb, 205XElement expectedPdb, 306var actualPdb = XElement.Parse(PdbToXmlConverter.ToXml(pdbStream, peStream, pdbToXmlOptions, methodName: qualifiedMethodName)).ToString(); 345var actualConverted = AdjustForConversionArtifacts(XElement.Parse(PdbToXmlConverter.ToXml(pdbStreamConverted, peStreamOriginal, pdbToXmlOptions, methodName: qualifiedMethodName)).ToString()); 361var xml = XElement.Parse(pdb); 362var pendingRemoval = new List<XElement>(); 363foreach (var e in xml.DescendantsAndSelf()) 385foreach (var e in pendingRemoval) 396var actualXml = XElement.Parse(actualPdb); 397var expectedXml = XElement.Parse(expectedPdb); 428private static bool RemoveElements(IEnumerable<XElement> elements) 432foreach (var e in array) 440private static void RemoveEmptyCustomDebugInfo(XElement pdb) 447private static void RemoveEmptyScopes(XElement pdb) 455private static void RemoveEmptySequencePoints(XElement pdb) 462private static void RemoveEmptyMethods(XElement pdb) 469private static void RemoveNonPortableElements(XElement expectedNativePdb) 493private static void RemoveElementsWithSpecifiedFormat(XElement expectedNativePdb, string format) 500private static void RemoveFormatAttributes(XElement pdb) 502foreach (var element in pdb.DescendantsAndSelf()) 651var pdbXml = XElement.Parse(pdb);
ServerComparison.FunctionalTests (1)
ResponseCompressionTests.cs (1)
113var compressionElement = element
SignalR.Client.FunctionalTestApp (7)
src\SignalR\common\Shared\EphemeralDataProtectionProvider.cs (7)
11 private readonly List<XElement> _storedElements = new List<XElement>(); 17 public IReadOnlyCollection<XElement> GetAllElements() 26 private IEnumerable<XElement> GetAllElementsCore() 29 foreach (XElement element in _storedElements) 35 public void StoreElement(XElement element, string friendlyName) 37 var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
System.ComponentModel.TypeConverter (52)
MS\Internal\Xml\Linq\ComponentModel\XComponentModel.cs (52)
44if (typeof(T) == typeof(XElement)) 144internal sealed class XElementAttributePropertyDescriptor : XPropertyDescriptor<XElement, object> 155return _value = new XDeferredSingleton<XAttribute>((e, n) => e.Attribute(n), (component as XElement)!, null); 196internal sealed class XElementDescendantsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>> 198private XDeferredAxis<XElement>? _value; 207return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Descendants(n) : e.Descendants(), (component as XElement)!, null); 218XElement? e = sender as XElement; 225e = sender as XElement; 242XElement? e = sender as XElement; 249internal sealed class XElementElementPropertyDescriptor : XPropertyDescriptor<XElement, object> 251private XDeferredSingleton<XElement>? _value; 252private XElement? _changeState; 260return _value = new XDeferredSingleton<XElement>((e, n) => e.Element(n), (component as XElement)!, null); 270XElement? e = sender as XElement; 277e = sender as XElement; 285e = sender as XElement; 310XElement? e = sender as XElement; 317internal sealed class XElementElementsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>> 319private XDeferredAxis<XElement>? _value; 328return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Elements(n) : e.Elements(), (component as XElement)!, null); 338XElement? e = sender as XElement; 345e = sender as XElement; 353e = sender as XElement; 370XElement? e = sender as XElement; 374e = sender as XElement; 381internal sealed class XElementValuePropertyDescriptor : XPropertyDescriptor<XElement, string> 383private XElement? _element; 396_element = component as XElement; 404_element = component as XElement; 418if (sender is XElement || sender is XText) 433internal sealed class XElementXmlPropertyDescriptor : XPropertyDescriptor<XElement, string> 435private XElement? _element; 443_element = component as XElement; 499private readonly Func<XElement, XName?, IEnumerable<T>> _func; 500internal XElement element; 503public XDeferredAxis(Func<XElement, XName?, IEnumerable<T>> func, XElement element, XName? name) 543private readonly Func<XElement, XName, T?> _func; 544internal XElement element; 547public XDeferredSingleton(Func<XElement, XName, T?> func, XElement element, XName? name)
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
371if (type == typeof(System.Xml.Linq.XElement))
System.Private.Xml.Linq (610)
System\Xml\Linq\Extensions.cs (126)
16/// Returns all of the <see cref="XAttribute"/>s for each <see cref="XElement"/> of 17/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 21/// Attributes for every <see cref="XElement"/> in the target <see cref="IEnumerable"/> 22/// of <see cref="XElement"/>. 24public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source) 33/// <see cref="XElement"/>'s <see cref="XAttribute"/>s in the target <see cref="IEnumerable"/> 34/// of <see cref="XElement"/> are scanned for a matching <see cref="XName"/>. 38/// Attributes with a matching <see cref="XName"/> for every <see cref="XElement"/> in 39/// the target <see cref="IEnumerable"/> of <see cref="XElement"/>. 41public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source, XName? name) 49/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 50/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this 51/// <see cref="IEnumerable"/> of <see cref="XElement"/>. 54/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 55/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this 56/// <see cref="IEnumerable"/> of <see cref="XElement"/>. 58public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source) where T : XNode 66/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 68/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 71/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 73/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 75public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source, XName? name) where T : XNode 79return name != null ? GetAncestors(source, name, false) : XElement.EmptySequence; 83/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 84/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root). 85/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of 86/// <see cref="XElement"/>. 89/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 90/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root). 91/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of 92/// <see cref="XElement"/>. 94public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source) 102/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 103/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root) 105/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 108/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 109/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root) 111/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 113public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source, XName? name) 117return name != null ? GetAncestors(source, name, true) : XElement.EmptySequence; 160/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 161/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in 162/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 165/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 166/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in 167/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 169public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source) where T : XContainer 177/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 179/// for each <see cref="XElement"/> in the target <see cref="IEnumerable"/> of <see cref="XElement"/>. 182/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 184/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 186public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source, XName? name) where T : XContainer 190return name != null ? GetDescendants(source, name, false) : XElement.EmptySequence; 194/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 195/// <see cref="XElement"/> and it's descendants 197/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 200/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 201/// <see cref="XElement"/> and descendants. 203/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 205public static IEnumerable<XNode> DescendantNodesAndSelf(this IEnumerable<XElement?> source) 213/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 214/// <see cref="XElement"/> and it's descendants (children and children's children down 215/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> 216/// of <see cref="XElement"/>. 219/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 220/// <see cref="XElement"/> and it's descendants (children and children's children down 221/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> 222/// of <see cref="XElement"/>. 224public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source) 232/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 233/// <see cref="XElement"/> and it's descendants (children and children's children down 235/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 238/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 239/// <see cref="XElement"/> and it's descendants (children and children's children down 241/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 243public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source, XName? name) 247return name != null ? GetDescendants(source, name, true) : XElement.EmptySequence; 251/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 252/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 255/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 256/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 258public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source) where T : XContainer 266/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 267/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 270/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 271/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 273public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source, XName? name) where T : XContainer 277return name != null ? GetElements(source, name) : XElement.EmptySequence; 281/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 282/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 285/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 286/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 341private static IEnumerable<XAttribute> GetAttributes(IEnumerable<XElement?> source, XName? name) 343foreach (XElement? e in source) 360private static IEnumerable<XElement> GetAncestors<T>(IEnumerable<T?> source, XName? name, bool self) where T : XNode 366XElement? e = (self ? node : node.parent) as XElement; 370e = e.parent as XElement; 404private static IEnumerable<XElement> GetDescendants<T>(IEnumerable<T?> source, XName? name, bool self) where T : XContainer 412XElement e = (XElement)root; 429XElement? e = n as XElement; 437private static IEnumerable<XElement> GetElements<T>(IEnumerable<T?> source, XName? name) where T : XContainer 449XElement? e = n as XElement;
System\Xml\Linq\XAttribute.cs (8)
114get { return parent != null && ((XElement)parent).lastAttr != this ? next : null; } 143XAttribute a = ((XElement)parent).lastAttr!; 148return a != ((XElement)parent).lastAttr ? a : null; 183((XElement)parent).RemoveAttribute(this); 188/// <seealso cref="XElement.SetValue"/> 189/// <seealso cref="XElement.SetAttributeValue"/> 190/// <seealso cref="XElement.SetElementValue"/> 694if (parent != null) return ((XElement)parent).GetPrefixOfNamespace(ns);
System\Xml\Linq\XContainer.cs (46)
20/// <see cref="XDocument"/> and <see cref="XElement"/>. 239/// applies only for <see cref="XElement"/>. 259/// Returns the descendant <see cref="XElement"/>s of this <see cref="XContainer"/>. Note this method will 260/// not return itself in the resulting IEnumerable. See <see cref="XElement.DescendantsAndSelf()"/> if you 261/// need to include the current <see cref="XElement"/> in the results. 262/// <seealso cref="XElement.DescendantsAndSelf()"/> 265/// An IEnumerable of <see cref="XElement"/> with all of the descendants below this <see cref="XContainer"/> in the XML tree. 267public IEnumerable<XElement> Descendants() 273/// Returns the Descendant <see cref="XElement"/>s with the passed in <see cref="XName"/> as an IEnumerable 276/// <param name="name">The <see cref="XName"/> to match against descendant <see cref="XElement"/>s.</param> 277/// <returns>An <see cref="IEnumerable"/> of <see cref="XElement"/></returns> 278public IEnumerable<XElement> Descendants(XName? name) 280return name != null ? GetDescendants(name, false) : XElement.EmptySequence; 292/// An <see cref="XElement"/> child that matches the <see cref="XName"/> passed in, or null. 294public XElement? Element(XName name) 302XElement? e = n as XElement; 310/// Returns the child <see cref="XElement"/>s of this <see cref="XContainer"/>. 316/// An <see cref="IEnumerable"/> over all of this <see cref="XContainer"/>'s child <see cref="XElement"/>s. 318public IEnumerable<XElement> Elements() 327/// The <see cref="XName"/> to match against the <see cref="XElement"/> children of this <see cref="XContainer"/>. 330/// An <see cref="IEnumerable"/> of <see cref="XElement"/> children of this <see cref="XContainer"/> that have 333public IEnumerable<XElement> Elements(XName? name) 335return name != null ? GetElements(name) : XElement.EmptySequence; 341/// <seealso cref="XElement.Attributes()"/> 346/// <seealso cref="XElement.Attributes()"/> 364/// methods does not remove attributes. See <see cref="XElement.RemoveAttributes()"/>. 365/// <seealso cref="XElement.RemoveAttributes()"/> 385if (this is XElement) 554if (this is XElement) 766internal IEnumerable<XElement> GetDescendants(XName? name, bool self) 770XElement e = (XElement)this; 787XElement? e = n as XElement; 793private IEnumerable<XElement> GetElements(XName? name) 801XElement? e = n as XElement; 906XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 960XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1020XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1058XElement? e = _currentContainer as XElement; 1134XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1174XElement? e = _currentContainer as XElement;
System\Xml\Linq\XDocument.cs (2)
149public XElement? Root 153return GetFirstNode<XElement>();
System\Xml\Linq\XElement.cs (257)
26/// An <see cref="XElement"/> can contain the following types of content: 29/// <item><see cref="XElement"/></item> 41public static IEnumerable<XElement> EmptySequence 45return Array.Empty<XElement>(); 106public XElement(XElement other) 162internal static async Task<XElement> CreateAsync(XmlReader r, CancellationToken cancellationToken) 164XElement xe = new XElement(default(AsyncConstructionSentry)); 170/// Outputs this <see cref="XElement"/>'s underlying XML tree. The output can 175/// Output this <see cref="XElement"/> to a file. 180/// <see cref="XElement.Save(string, SaveOptions)"/>) enabling 194/// Output this <see cref="XElement"/> to a file. 240if (n is XElement) return true; 323/// Returns this <see cref="XElement"/> and all of it's ancestors up 329/// Returns this <see cref="XElement"/> and all of it's ancestors up to 334/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of 335/// this <see cref="XElement"/>'s ancestors up to the root node (including 336/// this <see cref="XElement"/>. 338public IEnumerable<XElement> AncestorsAndSelf() 344/// Returns the ancestor(s) of this <see cref="XElement"/> with the matching 345/// <see cref="XName"/>. If this <see cref="XElement"/>'s <see cref="XName"/> 347/// resulting <see cref="IEnumerable"/> or <see cref="XElement"/>. 354/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 355/// ancestors of this <see cref="XElement"/> with a matching <see cref="XName"/>. 357public IEnumerable<XElement> AncestorsAndSelf(XName? name) 359return name != null ? GetAncestors(name, true) : XElement.EmptySequence; 363/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/> that has this 388/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/>. Optionally 392/// Returns all of the <see cref="XAttribute"/>s associated with this <see cref="XElement"/>. 397/// associated with this <see cref="XElement"/>. 405/// Returns the <see cref="XAttribute"/>(s) associated with this <see cref="XElement"/> that has the passed 407/// <seealso cref="XElement.Attributes()"/> 421/// Get the self and descendant nodes for an <see cref="XElement"/> 430/// Returns this <see cref="XElement"/> and all of it's descendants. Overloads allow 432/// of a descendant <see cref="XElement"/> to match. 435/// Returns this <see cref="XElement"/> and all of it's descendant <see cref="XElement"/>s 436/// as an <see cref="IEnumerable"/> of <see cref="XElement"/>. 437/// <seealso cref="XElement.DescendantsAndSelf()"/> 440/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing this <see cref="XElement"/> 443public IEnumerable<XElement> DescendantsAndSelf() 449/// Returns the descendants of this <see cref="XElement"/> that have a matching <see cref="XName"/> 450/// to the one passed in, including, potentially, this <see cref="XElement"/>. 451/// <seealso cref="XElement.DescendantsAndSelf(XName)"/> 454/// The <see cref="XName"/> of the descendant <see cref="XElement"/> that is being targeted. 457/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of the descendant 458/// <see cref="XElement"/>s that have this <see cref="XName"/>. 460public IEnumerable<XElement> DescendantsAndSelf(XName? name) 462return name != null ? GetDescendants(name, true) : XElement.EmptySequence; 466/// Returns the default <see cref="XNamespace"/> of an <see cref="XElement"/> 475/// Get the namespace associated with a particular prefix for this <see cref="XElement"/> 501XElement? e = this; 528e = e.parent as XElement; 544/// <see cref="XElement"/> and initializing it from a data source containing 550/// <seealso cref="XElement.Parse(string)"/> 553/// Create a new <see cref="XElement"/> based on the contents of the file 555/// <see cref="XElement.Parse(string)"/> to create an <see cref="XElement"/> from 558/// <seealso cref="XElement.Parse(string)"/> 567/// A URI string referencing the file to load into a new <see cref="XElement"/>. 570/// An <see cref="XElement"/> initialized with the contents of the file referenced 573public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri) 579/// Create a new <see cref="XElement"/> based on the contents of the file 592/// A string representing the URI of the file to be loaded into a new <see cref="XElement"/>. 598/// An <see cref="XElement"/> initialized with the contents of the file referenced 602public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri, LoadOptions options) 612/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 617/// created <see cref="XElement"/>. 620/// A new <see cref="XElement"/> containing the contents of the passed in 623public static XElement Load(Stream stream) 629/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 640/// created <see cref="XElement"/>. 646/// A new <see cref="XElement"/> containing the contents of the passed in 649public static XElement Load(Stream stream, LoadOptions options) 659/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 670/// created <see cref="XElement"/>. 678/// A new <see cref="XElement"/> containing the contents of the passed in 681public static async Task<XElement> LoadAsync(Stream stream, LoadOptions options, CancellationToken cancellationToken) 694/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 699/// created <see cref="XElement"/>. 702/// A new <see cref="XElement"/> containing the contents of the passed in 705public static XElement Load(TextReader textReader) 711/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 722/// created <see cref="XElement"/>. 728/// A new <see cref="XElement"/> containing the contents of the passed in 731public static XElement Load(TextReader textReader, LoadOptions options) 741/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 752/// created <see cref="XElement"/>. 760/// A new <see cref="XElement"/> containing the contents of the passed in 763public static async Task<XElement> LoadAsync(TextReader textReader, LoadOptions options, CancellationToken cancellationToken) 776/// Create a new <see cref="XElement"/> containing the contents of the 781/// <see cref="XElement"/>. 784/// A new <see cref="XElement"/> containing the contents of the passed 787public static XElement Load(XmlReader reader) 793/// Create a new <see cref="XElement"/> containing the contents of the 798/// <see cref="XElement"/>. 804/// A new <see cref="XElement"/> containing the contents of the passed 807public static XElement Load(XmlReader reader, LoadOptions options) 812XElement e = new XElement(reader, options); 819/// Create a new <see cref="XElement"/> containing the contents of the 824/// <see cref="XElement"/>. 832/// A new <see cref="XElement"/> containing the contents of the passed 835public static Task<XElement> LoadAsync(XmlReader reader, LoadOptions options, CancellationToken cancellationToken) 840return Task.FromCanceled<XElement>(cancellationToken); 844private static async Task<XElement> LoadAsyncInternal(XmlReader reader, LoadOptions options, CancellationToken cancellationToken) 848XElement e = new XElement(default(AsyncConstructionSentry)); 859/// Parses a string containing XML into an <see cref="XElement"/>. Optionally 863/// Parses a string containing XML into an <see cref="XElement"/>. 869/// A string containing the XML to parse into an <see cref="XElement"/>. 872/// An <see cref="XElement"/> created from the XML string passed in. 874public static XElement Parse(string text) 880/// Parses a string containing XML into an <see cref="XElement"/> and optionally 894/// A string containing the XML to parse into an <see cref="XElement"/>. 900/// An <see cref="XElement"/> created from the XML string passed in. 902public static XElement Parse(string text, LoadOptions options) 915/// Removes content and attributes from this <see cref="XElement"/>. 916/// <seealso cref="XElement.RemoveAttributes"/> 926/// Removes that attributes of this <see cref="XElement"/>. 927/// <seealso cref="XElement.RemoveAll"/> 928/// <seealso cref="XElement.RemoveAttributes"/> 1032/// Output this <see cref="XElement"/> to the passed in <see cref="Stream"/>. 1037/// <see cref="XElement.Save(Stream, SaveOptions)"/>) enabling 1043/// The <see cref="Stream"/> to output this <see cref="XElement"/> to. 1051/// Output this <see cref="XElement"/> to a <see cref="Stream"/>. 1070/// Output this <see cref="XElement"/> to a <see cref="Stream"/>. 1094/// Output this <see cref="XElement"/> to the passed in <see cref="TextWriter"/>. 1099/// <see cref="XElement.Save(TextWriter, SaveOptions)"/>) enabling 1105/// The <see cref="TextWriter"/> to output this <see cref="XElement"/> to. 1113/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>. 1132/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>. 1156/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>. 1171/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>. 1201/// <seealso cref="XElement.SetElementValue"/> 1202/// <seealso cref="XElement.SetValue"/> 1241/// <seealso cref="XElement.SetAttributeValue"/> 1242/// <seealso cref="XElement.SetValue"/> 1257XElement? e = Element(name); 1278/// <seealso cref="XElement.SetAttributeValue"/> 1279/// <seealso cref="XElement.SetElementValue"/> 1296/// Write this <see cref="XElement"/> to the passed in <see cref="XmlWriter"/>. 1299/// The <see cref="XmlWriter"/> to write this <see cref="XElement"/> to. 1309/// Write this <see cref="XElement"/> to the passed in <see cref="XmlTextWriter"/>. 1312/// The <see cref="XmlTextWriter"/> to write this <see cref="XElement"/> to. 1325/// Cast the value of this <see cref="XElement"/> to a <see cref="string"/>. 1328/// If the <see cref="XElement"/> is a subtree (an <see cref="XElement"/> 1329/// that has <see cref="XElement"/> children. The concatenated string 1330/// value of all of the <see cref="XElement"/>'s text and descendants 1334/// The <see cref="XElement"/> to cast to a string. 1337/// The content of this <see cref="XElement"/> as a <see cref="string"/>. 1341public static explicit operator string?(XElement? element) 1348/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>. 1351/// The <see cref="XElement"/> to cast to <see cref="bool"/>. 1354/// The content of this <see cref="XElement"/> as a <see cref="bool"/>. 1363public static explicit operator bool(XElement element) 1371/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>?. 1374/// The <see cref="XElement"/> to cast to <see cref="bool"/>?. 1377/// The content of this <see cref="XElement"/> as a <see cref="bool"/>?. 1384public static explicit operator bool?(XElement? element) 1391/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>. 1394/// The <see cref="XElement"/> to cast to <see cref="int"/>. 1397/// The content of this <see cref="XElement"/> as a <see cref="int"/>. 1406public static explicit operator int(XElement element) 1414/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>?. 1417/// The <see cref="XElement"/> to cast to <see cref="int"/>?. 1420/// The content of this <see cref="XElement"/> as a <see cref="int"/>?. 1427public static explicit operator int?(XElement? element) 1434/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>. 1437/// The <see cref="XElement"/> to cast to <see cref="uint"/>. 1440/// The content of this <see cref="XElement"/> as a <see cref="uint"/>. 1449public static explicit operator uint(XElement element) 1457/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>?. 1460/// The <see cref="XElement"/> to cast to <see cref="uint"/>?. 1463/// The content of this <see cref="XElement"/> as a <see cref="uint"/>?. 1470public static explicit operator uint?(XElement? element) 1477/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>. 1480/// The <see cref="XElement"/> to cast to <see cref="long"/>. 1483/// The content of this <see cref="XElement"/> as a <see cref="long"/>. 1492public static explicit operator long(XElement element) 1500/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>?. 1503/// The <see cref="XElement"/> to cast to <see cref="long"/>?. 1506/// The content of this <see cref="XElement"/> as a <see cref="long"/>?. 1513public static explicit operator long?(XElement? element) 1520/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>. 1523/// The <see cref="XElement"/> to cast to <see cref="ulong"/>. 1526/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>. 1535public static explicit operator ulong(XElement element) 1543/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>?. 1546/// The <see cref="XElement"/> to cast to <see cref="ulong"/>?. 1549/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>?. 1556public static explicit operator ulong?(XElement? element) 1563/// Cast the value of this <see cref="XElement"/> to a <see cref="float"/>. 1566/// The <see cref="XElement"/> to cast to <see cref="float"/>. 1569/// The content of this <see cref="XElement"/> as a <see cref="float"/>. 1578public static explicit operator float(XElement element) 1586/// Cast the value of this <see cref="XElement"/> to an <see cref="float"/>?. 1589/// The <see cref="XElement"/> to cast to <see cref="float"/>?. 1592/// The content of this <see cref="XElement"/> as a <see cref="float"/>?. 1599public static explicit operator float?(XElement? element) 1606/// Cast the value of this <see cref="XElement"/> to a <see cref="double"/>. 1609/// The <see cref="XElement"/> to cast to <see cref="double"/>. 1612/// The content of this <see cref="XElement"/> as a <see cref="double"/>. 1621public static explicit operator double(XElement element) 1629/// Cast the value of this <see cref="XElement"/> to an <see cref="double"/>?. 1632/// The <see cref="XElement"/> to cast to <see cref="double"/>?. 1635/// The content of this <see cref="XElement"/> as a <see cref="double"/>?. 1642public static explicit operator double?(XElement? element) 1649/// Cast the value of this <see cref="XElement"/> to a <see cref="decimal"/>. 1652/// The <see cref="XElement"/> to cast to <see cref="decimal"/>. 1655/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>. 1664public static explicit operator decimal(XElement element) 1672/// Cast the value of this <see cref="XElement"/> to an <see cref="decimal"/>?. 1675/// The <see cref="XElement"/> to cast to <see cref="decimal"/>?. 1678/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>?. 1685public static explicit operator decimal?(XElement? element) 1692/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTime"/>. 1695/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>. 1698/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>. 1707public static explicit operator DateTime(XElement element) 1715/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTime"/>?. 1718/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>?. 1721/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>?. 1728public static explicit operator DateTime?(XElement? element) 1735/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTimeOffset"/>. 1738/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>. 1741/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>. 1750public static explicit operator DateTimeOffset(XElement element) 1758/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTimeOffset"/>?. 1761/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>?. 1764/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>?. 1771public static explicit operator DateTimeOffset?(XElement? element) 1778/// Cast the value of this <see cref="XElement"/> to a <see cref="TimeSpan"/>. 1781/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>. 1784/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>. 1793public static explicit operator TimeSpan(XElement element) 1801/// Cast the value of this <see cref="XElement"/> to an <see cref="TimeSpan"/>?. 1804/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>?. 1807/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>?. 1814public static explicit operator TimeSpan?(XElement? element) 1821/// Cast the value of this <see cref="XElement"/> to a <see cref="Guid"/>. 1824/// The <see cref="XElement"/> to cast to <see cref="Guid"/>. 1827/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>. 1836public static explicit operator Guid(XElement element) 1844/// Cast the value of this <see cref="XElement"/> to an <see cref="Guid"/>?. 1847/// The <see cref="XElement"/> to cast to <see cref="Guid"/>?. 1850/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>?. 1857public static explicit operator Guid?(XElement? element) 1872/// Generates a <see cref="XElement"/> from its XML representation. 1875/// The <see cref="XmlReader"/> stream from which the <see cref="XElement"/> 1888/// Converts a <see cref="XElement"/> into its XML representation. 1891/// The <see cref="XmlWriter"/> stream to which the <see cref="XElement"/> 1936private bool AttributesEqual(XElement e) 1960XElement? e = node as XElement; 1977private string? GetNamespaceOfPrefixInScope(string prefix, XElement? outOfScope) 1979XElement? e = this; 1993e = e.parent as XElement;
System\Xml\Linq\XLinq.cs (14)
45if (_parent is XElement) 206public void WriteElement(XElement e) 209XElement root = e; 213XElement? current = n as XElement; 250public async Task WriteElementAsync(XElement e, CancellationToken cancellationToken) 253XElement root = e; 257XElement? current = n as XElement; 306private void PushAncestors(XElement? e) 310e = e!.parent as XElement; 327private void PushElement(XElement e) 370private void WriteStartElement(XElement e) 389private async Task WriteStartElementAsync(XElement e, CancellationToken cancellationToken)
System\Xml\Linq\XNode.cs (22)
21/// <see cref="XElement"/>, 191public IEnumerable<XElement> Ancestors() 208public IEnumerable<XElement> Ancestors(XName? name) 210return name != null ? GetAncestors(name, false) : XElement.EmptySequence; 348public IEnumerable<XElement> ElementsAfterSelf() 362public IEnumerable<XElement> ElementsAfterSelf(XName? name) 364return name != null ? GetElementsAfterSelf(name) : XElement.EmptySequence; 374public IEnumerable<XElement> ElementsBeforeSelf() 388public IEnumerable<XElement> ElementsBeforeSelf(XName? name) 390return name != null ? GetElementsBeforeSelf(name) : XElement.EmptySequence; 501return await XElement.CreateAsync(reader, cancellationToken).ConfigureAwait(false); 594/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 630internal IEnumerable<XElement> GetAncestors(XName? name, bool self) 632XElement? e = (self ? this : parent) as XElement; 636e = e.parent as XElement; 640private IEnumerable<XElement> GetElementsAfterSelf(XName? name) 646XElement? e = n as XElement; 651private IEnumerable<XElement> GetElementsBeforeSelf(XName? name) 660XElement? e = n as XElement;
System\Xml\Linq\XNodeBuilder.cs (3)
110_parent = ((XElement)_parent!).parent; 139XElement e = (XElement)_parent!;
System\Xml\Linq\XNodeEqualityComparer.cs (2)
28/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 67/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same
System\Xml\Linq\XNodeReader.cs (64)
45XElement? e = GetElementInAttributeScope(); 133XElement? e = GetElementInAttributeScope(); 188XElement? e = _source as XElement; 204XElement? e = _source as XElement; 251XElement? e = _source as XElement; 319XElement? e = _source as XElement; 396XElement? e = GetElementInScope(); 407e = e.parent as XElement; 422XElement? e = GetElementInScope(); 441e = e.parent as XElement; 470XElement? e = GetElementInAttributeScope(); 516XElement? e = GetElementInAttributeScope(); 562XElement? e = GetElementInAttributeScope(); 594XElement? e = GetElementInScope(); 612XElement? e = GetElementInAttributeScope(); 650XElement? e = GetElementInAttributeScope(); 698XElement? e = GetElementInAttributeScope(); 752XElement? e = GetElementInAttributeScope(); 782XElement? e = _source as XElement; 818if (a.parent != null && ((XElement)a.parent).lastAttr != a) 883XElement? c = _source as XElement; 890foreach (XElement e in c.Descendants()) 908XElement? e = _source as XElement; 933foreach (XElement e in n.ElementsAfterSelf()) 943if (n.parent is XElement) 952if (_parent is XElement) 983XElement? e = _source as XElement; 1008XElement? e = _source as XElement; 1038XElement? e = _source as XElement; 1080private XElement? GetElementInAttributeScope() 1082XElement? e = _source as XElement; 1094return (XElement?)a.parent; 1099return (XElement?)a.parent; 1104private XElement? GetElementInScope() 1106XElement? e = _source as XElement; 1114return n.parent as XElement; 1119return (XElement?)a.parent; 1121e = _parent as XElement; 1129return (XElement?)a.parent; 1134private static void GetNameInAttributeScope(string? qualifiedName, XElement e, out string? localName, out string? namespaceName) 1162XElement? e = _source as XElement; 1205private bool ReadIntoElement(XElement e) 1240XElement? e = (XElement?)a.parent; 1278if (_parent is XElement) 1333XElement? element = candidateAttribute.parent as XElement; 1339element = element.parent as XElement; 1374element = element.parent as XElement; 1392XElement? e = candidate.parent as XElement;
System\Xml\Linq\XObject.cs (4)
66/// Gets the parent <see cref="XElement"/> of this <see cref="XObject"/>. 69/// If this <see cref="XObject"/> has no parent <see cref="XElement"/>, this property returns null. 71public XElement? Parent 73get { return parent as XElement; }
System\Xml\Schema\XNodeValidator.cs (16)
83ValidateElement((XElement)source); 171private void PushAncestorsAndSelf(XElement? e) 195e = e.parent as XElement; 199private void PushElement(XElement e, ref string? xsiType, ref string? xsiNil) 259private void ValidateAttributes(XElement e) 296private void ValidateElement(XElement e) 322private void ValidateNodes(XElement e) 331XElement? c = n as XElement; 435/// Gets the schema information that has been assigned to the <see cref="XElement"/> as a result of schema validation. 438public static IXmlSchemaInfo? GetSchemaInfo(this XElement source) 489/// Validate a <see cref="XElement"/> 499public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler) 505/// Validate a <see cref="XElement"/> 515/// <param name="addSchemaInfo">If enabled the <see cref="XElement"/> and the corresponding 518public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler, bool addSchemaInfo)
System\Xml\XPath\XNodeNavigator.cs (46)
47private XElement? _parent; 84XElement? element = _source as XElement; 122XElement? e = _source as XElement; 134XElement? e = _source as XElement; 176XElement? e = _source as XElement; 232XElement? e = _source as XElement; 275return ((XElement)_source).Value; 279XElement? root = ((XDocument)_source).Root; 325XElement? e = _source as XElement; 347foreach (XElement element in c.Elements()) 384XElement? e = _source as XElement; 418XElement? e = _source as XElement; 456XElement? e = _source as XElement; 523foreach (XElement element in currentNode.ElementsAfterSelf()) 573XElement? e = (XElement?)currentAttribute.GetParent(); 750if (c.GetParent() != null || c is XElement) 772private static XAttribute? GetFirstNamespaceDeclarationGlobal(XElement e) 774XElement? ce = e; 787private static XAttribute? GetFirstNamespaceDeclarationLocal(XElement e) 801XElement? e = (XElement?)a.GetParent(); 821XElement? e = a.Parent; 848private static bool HasNamespaceDeclarationInScope(XAttribute a, XElement e) 851XElement? ce = e; 966/// Select an <see cref="XElement"/> using a XPath expression 970/// <returns>An <see cref="XElement"> or null</see></returns> 971public static XElement? XPathSelectElement(this XNode node, string expression) 977/// Select an <see cref="XElement"/> using a XPath expression 983/// <returns>An <see cref="XElement"> or null</see></returns> 984public static XElement? XPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver? resolver) 990/// Select a set of <see cref="XElement"/> using a XPath expression 995public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression) 1001/// Select a set of <see cref="XElement"/> using a XPath expression 1008public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression, IXmlNamespaceResolver? resolver) 1012return (IEnumerable<XElement>)XPathEvaluator.Evaluate<XElement>(node, expression, resolver);
System.Xml.Linq (1)
System.Xml.Linq.cs (1)
15[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
System.Xml.XDocument (1)
artifacts\obj\System.Xml.XDocument\Debug\net10.0\System.Xml.XDocument.Forwards.cs (1)
14[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
XmlFileLogger (22)
ILogNode.cs (1)
19void SaveToElement(XElement parentElement);
LogProcessNode.cs (7)
78public abstract void SaveToElement(XElement parentElement); 124protected void WriteProperties(XElement parentElement) 128var propElement = new XElement("Properties"); 143protected void WriteChildren<T>(XElement parentElement) where T : ILogNode 158protected void WriteChildren<T>(XElement parentElement, Func<XElement> subNodeFactory) where T : ILogNode 162var node = subNodeFactory();
ObjectModel\Build.cs (2)
47var root = new XElement("Build", 64public override void SaveToElement(XElement parentElement)
ObjectModel\Item.cs (3)
69public void SaveToElement(XElement parentElement, string xmlAttributeName, bool collapseSingleItem) 71var element = new XElement("Item"); 79var metadataElement = new XElement(metadataItem.Key);
ObjectModel\Message.cs (1)
34public void SaveToElement(XElement element)
ObjectModel\Project.cs (2)
88public override void SaveToElement(XElement parentElement) 98var element = new XElement("Project",
ObjectModel\Target.cs (2)
33public override void SaveToElement(XElement parentElement) 35var element = new XElement("Target",
ObjectModel\Task.cs (2)
47public override void SaveToElement(XElement element) 49var task = new XElement("Task",
ObjectModel\TaskParameter.cs (2)
44public void SaveToElement(XElement parentElement) 46XElement element = new XElement(name);
xunit.console (10)
ConsoleRunner.cs (5)
273XElement assembliesElement = null; 290foreach (var assemblyElement in results.Where(result => result != null)) 297var assemblyElement = ExecuteAssembly(consoleLock, assembly, serialize, needsXml, parallelizeTestCollections, maxThreadCount, diagnosticMessages, noColor, appDomains, failSkips, stopOnFail, project.Filters, internalDiagnosticMessages); 318XElement ExecuteAssembly(object consoleLock, 335var assemblyElement = needsXml ? new XElement("assembly") : null;
Utility\Transform.cs (1)
13public Action<XElement, string> OutputHandler;
Utility\TransformFactory.cs (4)
59public static List<Action<XElement>> GetXmlTransformers(XunitProject project) 61.Select(output => new Action<XElement>(xml => instance.availableTransforms[output.Key].OutputHandler(xml, output.Value))) 64static void Handler_DirectWrite(XElement xml, string outputFileName) 70static void Handler_XslTransform(string key, string resourceName, XElement xml, string outputFileName)