Skip to content

Commit

Permalink
Annotate all XAML attributes for NRT
Browse files Browse the repository at this point in the history
  • Loading branch information
halgab committed Jan 14, 2024
1 parent cc329a6 commit 5c06d70
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

// Description: Implementation of a FriendAccessAllowedAttribute attribute that is used to mark internal metadata
// that is allowed to be accessed from friend assemblies.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if !SYSTEM_XAML
#nullable disable
#pragma warning disable CS8632
#endif

// Description:
// This attribute is placed on a class to identify the property that will
Expand Down Expand Up @@ -34,23 +37,15 @@ public sealed class RuntimeNamePropertyAttribute: Attribute
/// <summary/>
public RuntimeNamePropertyAttribute(string name)
{
_name = name;
Name = name;
}

/// <summary>
/// The Name of the property in the class that will contain the ID of
/// the class, this property needs to be of type string and have
/// both get and set access
/// </summary>
public string Name
{
get
{
return _name;
}
}

private string _name;
public string Name { get; }
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AcceptedMarkupExtensionExpressionTypeAttribute: Attribute
public Type Type { get; set; }

public AcceptedMarkupExtensionExpressionTypeAttribute(Type type)
{
{
Type = type;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand All @@ -30,14 +28,14 @@ public ContentPropertyAttribute()
/// of XAML content with property of the given name.
/// </summary>
/// <param name="name">The property to associate to direct XAML content</param>
public ContentPropertyAttribute(string name)
public ContentPropertyAttribute(string? name)
{
Name = name;
}

/// <summary>
/// The name of the property that is associated with direct XAML content
/// </summary>
public string Name { get; }
public string? Name { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down Expand Up @@ -42,7 +40,7 @@ public ContentWrapperAttribute(Type contentWrapper)
/// Overrides Object.Equals to implement correct equality semantics for this
/// attribute.
/// </summary>
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return
obj is ContentWrapperAttribute other &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
/// <summary>
Expand All @@ -16,23 +14,23 @@ public MarkupExtensionReturnTypeAttribute()
{
}

public MarkupExtensionReturnTypeAttribute(Type returnType)
public MarkupExtensionReturnTypeAttribute(Type? returnType)
{
ReturnType = returnType;
}

[Obsolete("The expressionType argument is not used by the XAML parser. To specify the expected return type, " +
"use MarkupExtensionReturnTypeAttribute(Type). To specify custom handling for expression types, use " +
"XamlSetMarkupExtensionAttribute.")]
public MarkupExtensionReturnTypeAttribute(Type returnType, Type expressionType)
public MarkupExtensionReturnTypeAttribute(Type? returnType, Type? expressionType)
{
ReturnType = returnType;
ExpressionType = expressionType;
}

public Type ReturnType { get; }
public Type? ReturnType { get; }

[Obsolete("This is not used by the XAML parser. Please look at XamlSetMarkupExtensionAttribute.")]
public Type ExpressionType { get; }
public Type? ExpressionType { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand All @@ -12,17 +10,17 @@ namespace System.Windows.Markup
[TypeForwardedFrom("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
public sealed class NameScopePropertyAttribute : Attribute
{
public NameScopePropertyAttribute (string name)
public NameScopePropertyAttribute(string name)
{
Name = name;
}

public NameScopePropertyAttribute (string name, Type type) : this(name)
public NameScopePropertyAttribute(string name, Type? type) : this(name)
{
Type = type;
}

public string Name { get; }
public Type Type { get; }
public Type? Type { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,32 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class XamlDeferLoadAttribute : Attribute
{
string _contentTypeName;
string _loaderTypeName;

public XamlDeferLoadAttribute(Type loaderType, Type contentType)
{
ArgumentNullException.ThrowIfNull(loaderType);
ArgumentNullException.ThrowIfNull(contentType);
_loaderTypeName = loaderType.AssemblyQualifiedName;
_contentTypeName = contentType.AssemblyQualifiedName;
LoaderTypeName = loaderType.AssemblyQualifiedName!;
ContentTypeName = contentType.AssemblyQualifiedName!;
LoaderType = loaderType;
ContentType = contentType;
}

public XamlDeferLoadAttribute(string loaderType, string contentType)
{
_loaderTypeName = loaderType ?? throw new ArgumentNullException(nameof(loaderType));
_contentTypeName = contentType ?? throw new ArgumentNullException(nameof(contentType));
LoaderTypeName = loaderType ?? throw new ArgumentNullException(nameof(loaderType));
ContentTypeName = contentType ?? throw new ArgumentNullException(nameof(contentType));
}

public string LoaderTypeName
{
get { return _loaderTypeName; }
}
public string LoaderTypeName { get; }

public string ContentTypeName
{
get { return _contentTypeName; }
}
public string ContentTypeName { get; }

public Type LoaderType { get; private set; }
public Type ContentType { get; private set; }
public Type? LoaderType { get; private set; }
public Type? ContentType { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
[AttributeUsage(AttributeTargets.Class, Inherited=true, AllowMultiple=false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

namespace System.Windows.Markup
{
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand All @@ -29,14 +27,14 @@ public sealed class XmlLangPropertyAttribute : Attribute
/// Creates a new XmlLangPropertyAttribute with the given string
/// as the property name.
/// </summary>
public XmlLangPropertyAttribute(string name)
public XmlLangPropertyAttribute(string? name)
{
Name = name;
}

/// <summary>
/// The name of the property that is designated to accept the xml:lang value
/// </summary>
public string Name { get; }
public string? Name { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down Expand Up @@ -35,7 +33,7 @@ namespace System.Windows.Markup
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[TypeForwardedFrom("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
public sealed class XmlnsDefinitionAttribute: Attribute
public sealed class XmlnsDefinitionAttribute : Attribute
{
/// <summary>
/// Constructor
Expand Down Expand Up @@ -74,6 +72,6 @@ public XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace)
/// If the assemblyName is not set, the code should take the assembly
/// for which the instance of this attribute is created.
/// </summary>
public string AssemblyName { get; set; }
public string? AssemblyName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Runtime.CompilerServices;

namespace System.Windows.Markup
Expand Down

0 comments on commit 5c06d70

Please sign in to comment.