diff --git a/NuGet.config b/NuGet.config index b7091897b412..6f604b71bc39 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,7 +10,7 @@ - + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index badfbce2dd20..2b82a67e189c 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,14 +6,14 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26371.110 - 10.0.0-beta.26371.110 + 10.0.0-beta.26374.115 + 10.0.0-beta.26374.115 0.11.5-alpha.26070.104 - 10.0.0-beta.26371.110 + 10.0.0-beta.26374.115 10.0.3-servicing.26070.104 10.0.3 10.0.3 - 10.0.400-preview.0.26371.110 + 10.0.400-preview.0.26374.115 10.0.3 10.0.400 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 15fc0a0f47d1..a062720d59d9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/dotnet - 5a7ae45dbddbaf6a1545a974c52edad5f94a04e0 + dfdd32e8a9349462e71f687679bc7e5837b8ef4a https://github.com/dotnet/dotnet @@ -95,25 +95,25 @@ - + https://github.com/dotnet/dotnet - 5a7ae45dbddbaf6a1545a974c52edad5f94a04e0 + dfdd32e8a9349462e71f687679bc7e5837b8ef4a - + https://github.com/dotnet/dotnet - 5a7ae45dbddbaf6a1545a974c52edad5f94a04e0 + dfdd32e8a9349462e71f687679bc7e5837b8ef4a https://github.com/dotnet/dotnet - 5a7ae45dbddbaf6a1545a974c52edad5f94a04e0 + dfdd32e8a9349462e71f687679bc7e5837b8ef4a https://github.com/dotnet/xharness 65e5795252474ebd04e4e872bd4152e86c558209 - + https://github.com/dotnet/dotnet - 5a7ae45dbddbaf6a1545a974c52edad5f94a04e0 + dfdd32e8a9349462e71f687679bc7e5837b8ef4a diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 8cfee107e7a3..18397a60eb85 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -6,6 +6,7 @@ Param( [string][Alias('v')]$verbosity = "minimal", [string] $msbuildEngine = $null, [bool] $warnAsError = $true, + [string] $warnNotAsError = '', [bool] $nodeReuse = $true, [switch] $buildCheck = $false, [switch][Alias('r')]$restore, @@ -70,6 +71,7 @@ function Print-Usage() { Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + Write-Host " -warnNotAsError Sets a semi-colon delimited list of warning codes that should not be treated as errors" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" diff --git a/eng/common/build.sh b/eng/common/build.sh index 9767bb411a4f..c8bea7cbc2df 100644 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -42,6 +42,7 @@ usage() echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo " --warnNotAsError Sets a semi-colon delimited list of warning codes that should not be treated as errors" echo " --buildCheck Sets /check msbuild parameter" echo " --fromVMR Set when building from within the VMR" echo "" @@ -78,6 +79,7 @@ ci=false clean=false warn_as_error=true +warn_not_as_error='' node_reuse=true build_check=false binary_log=false @@ -176,6 +178,10 @@ while [[ $# > 0 ]]; do warn_as_error=$2 shift ;; + -warnnotaserror) + warn_not_as_error=$2 + shift + ;; -nodereuse) node_reuse=$2 shift diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index c6a1d6eaec4f..bde220ad85b7 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -34,6 +34,9 @@ # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } +# Specifies semi-colon delimited list of warning codes that should not be treated as errors. +[string]$warnNotAsError = if (Test-Path variable:warnNotAsError) { $warnNotAsError } else { '' } + # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). [string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } @@ -836,6 +839,11 @@ function MSBuild-Core() { $cmdArgs += ' /p:TreatWarningsAsErrors=false' } + if ($warnAsError -and $warnNotAsError) { + $escapedWarnNotAsError = $warnNotAsError -replace ';', '%3B' + $cmdArgs += " /warnnotaserror:$warnNotAsError /p:AdditionalWarningsNotAsErrors=$escapedWarnNotAsError" + } + foreach ($arg in $args) { if ($null -ne $arg -and $arg.Trim() -ne "") { if ($arg.EndsWith('\')) { diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 62aeb73fe510..df76f062a76c 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -52,6 +52,9 @@ fi # Configures warning treatment in msbuild. warn_as_error=${warn_as_error:-true} +# Specifies semi-colon delimited list of warning codes that should not be treated as errors. +warn_not_as_error=${warn_not_as_error:-''} + # True to attempt using .NET Core already that meets requirements specified in global.json # installed on the machine instead of downloading one. use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} @@ -532,7 +535,12 @@ function MSBuild-Core { mt_switch="-mt" fi - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" + local warnnotaserror_switch="" + if [[ -n "$warn_not_as_error" && "$warn_as_error" == true ]]; then + warnnotaserror_switch="/warnnotaserror:$warn_not_as_error /p:AdditionalWarningsNotAsErrors=${warn_not_as_error//;/%3B}" + fi + + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } function GetDarc { diff --git a/global.json b/global.json index d84e22cd773e..9fe37c1717f8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.400-preview.0.26371.110", + "version": "10.0.400-preview.0.26374.115", "paths": [ "builds/downloads/dotnet", "$host$" @@ -8,9 +8,9 @@ "errorMessage": "The .NET SDK could not be found, please run 'make dotnet -C builds'." }, "tools": { - "dotnet": "10.0.400-preview.0.26371.110" + "dotnet": "10.0.400-preview.0.26374.115" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26371.110" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26374.115" } } diff --git a/src/Contacts/CNContactFetchRequest.cs b/src/Contacts/CNContactFetchRequest.cs index 53174aae2350..ac604417bf19 100644 --- a/src/Contacts/CNContactFetchRequest.cs +++ b/src/Contacts/CNContactFetchRequest.cs @@ -9,17 +9,15 @@ namespace Contacts { public partial class CNContactFetchRequest { - /// To be added. - /// Creates and returns a new that retrieves data with the specified . - /// To be added. + /// Creates and returns a new that retrieves data with the specified . + /// The keys to fetch. public CNContactFetchRequest (params ICNKeyDescriptor [] keysToFetch) : this (NSArray.FromNativeObjects (keysToFetch)) { } - /// To be added. - /// Creates a new that retrieves data with the specified . - /// To be added. + /// Creates a new that retrieves data with the specified . + /// The keys to fetch. public CNContactFetchRequest (params NSString [] keysToFetch) : this (NSArray.FromNSObjects (keysToFetch)) { @@ -29,9 +27,8 @@ public CNContactFetchRequest (params NSString [] keysToFetch) // but a ctor using this (ICNKeyDescriptor) would not accept NSString // so if you want to mix both NSString and (NSObjectProtocol, NSSecureCoding, NSCopying) you need to use // this constructor, which will manually verify the requirements (at runtime, not a compile time) - /// To be added. - /// Creates a new that retrieves data with the specified . - /// To be added. + /// Creates a new that retrieves data with the specified . + /// The keys to fetch. public CNContactFetchRequest (params INativeObject [] keysToFetch) : this (Validate (keysToFetch)) { diff --git a/src/CoreImage/CIImageInitializationOptions.cs b/src/CoreImage/CIImageInitializationOptions.cs index 175ce3f45db3..d4b415adf8c1 100644 --- a/src/CoreImage/CIImageInitializationOptions.cs +++ b/src/CoreImage/CIImageInitializationOptions.cs @@ -35,8 +35,6 @@ namespace CoreImage { public partial class CIImageInitializationOptions { #if !COREBUILD /// Gets or sets the color space. - /// To be added. - /// To be added. public CGColorSpace? ColorSpace { get { return GetNativeValue (CIImageInitializationOptionsKeys.ColorSpaceKey); @@ -49,7 +47,6 @@ public CGColorSpace? ColorSpace { } /// A type of that has additional metadata properties. - /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -58,14 +55,12 @@ public CGColorSpace? ColorSpace { public class CIImageInitializationOptionsWithMetadata : CIImageInitializationOptions { #if !COREBUILD /// Creates a new CIImageInitializationOptionsWithMetadata with default values. - /// To be added. public CIImageInitializationOptionsWithMetadata () { } - /// To be added. - /// Creates a new CIImageInitializationOptionsWithMetadata by using the specified dictionary of options. - /// To be added. + /// Creates a new CIImageInitializationOptionsWithMetadata by using the specified dictionary of options. + /// The dictionary. public CIImageInitializationOptionsWithMetadata (NSDictionary dictionary) : base (dictionary) { diff --git a/src/CoreVideo/CVTime.cs b/src/CoreVideo/CVTime.cs index 7c39b994cc2b..e3d9cfc8c1fb 100644 --- a/src/CoreVideo/CVTime.cs +++ b/src/CoreVideo/CVTime.cs @@ -48,35 +48,27 @@ namespace CoreVideo { public struct CVTime { /// Determines how many TimeValues are represented by this CVTime. - /// - /// public /* int64_t */ long TimeValue; /// Determines how many TimeValues make up one second. - /// - /// - /// If the value of TimeScale is 600, that means that there are 600 TimeValues per second. - /// - /// - /// If the TimeScale is 600 and TimeValue is 2,400 that means that the CVTime represents four seconds. - /// - /// + /// + /// + /// If the value of TimeScale is 600, that means that there are 600 TimeValues per second. + /// + /// + /// If the TimeScale is 600 and TimeValue is 2,400 that means that the CVTime represents four seconds. + /// + /// public /* int64_t */ long TimeScale; /// Flags for CVTime, if set to 1, the CVTime is indefinite and neither the TimeValue and TimeScale are valid. - /// Currently only the value 1 is supported, the CVTime is indefinite. + /// Currently only the value 1 is supported, the CVTime is indefinite. public /* int32_t */ CVTimeFlags TimeFlags; /// Flags for CVTime, if set to IsIndefinite, the CVTime is indefinite and neither the TimeValue and TimeScale are valid. - /// - /// - /// Currently only the value IsIndefinited is supported, the CVTime is indefinite. + /// Currently only the value IsIndefinited is supported, the CVTime is indefinite. public int Flags { get { return (int) TimeFlags; } set { TimeFlags = (CVTimeFlags) value; } } #if !COREBUILD - /// Represents a zero duration.. - /// - /// - /// - /// + /// Represents a zero duration. public static CVTime ZeroTime { get { return Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVZeroTime"))!; @@ -84,10 +76,6 @@ public static CVTime ZeroTime { } /// Unknown or indefinite time. - /// - /// - /// - /// public static CVTime IndefiniteTime { get { return Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVIndefiniteTime"))!; @@ -95,11 +83,10 @@ public static CVTime IndefiniteTime { } #endif + /// Determines whether two CVTime objects are equal. /// Object to compare with. - /// Determines whether two CVTime objects are equal. - /// - /// - /// Two CVTime structures are considered to be equal if their TimeValue, TimeScale and Flags fields are the same. + /// if the two CVTime objects are equal; otherwise, . + /// Two CVTime structures are considered to be equal if their TimeValue, TimeScale and Flags fields are the same. public override bool Equals (object? other) { if (!(other is CVTime)) @@ -111,10 +98,6 @@ public override bool Equals (object? other) } /// Returns the hashcode for this object. - /// - /// - /// - /// public override int GetHashCode () { return HashCode.Combine (TimeValue, TimeScale, Flags); @@ -122,27 +105,21 @@ public override int GetHashCode () // CVHostTime.h - /// To be added. - /// To be added. - /// To be added. + /// Returns the current value of the host time clock, in units of the host time clock frequency. [DllImport (Constants.CoreVideoLibrary, EntryPoint = "CVGetCurrentHostTime")] public static extern /* uint64_t */ ulong GetCurrentHostTime (); /// Returns the system's clock frequency. - /// - /// - /// - /// - /// The value 1,000,000,000 would represent a nanosecond (10^-9). - /// - /// + /// + /// + /// The value 1,000,000,000 would represent a nanosecond (10^-9). + /// + /// [DllImport (Constants.CoreVideoLibrary, EntryPoint = "CVGetHostClockFrequency")] public static extern /* double */ double GetHostClockFrequency (); - /// To be added. - /// To be added. - /// To be added. + /// Returns the smallest time delta that the host clock can represent. [DllImport (Constants.CoreVideoLibrary, EntryPoint = "CVGetHostClockMinimumTimeDelta")] public static extern /* uint32_t */ uint GetHostClockMinimumTimeDelta (); } diff --git a/src/Foundation/NSInputStream.cs b/src/Foundation/NSInputStream.cs index 14dc85346cd0..426b2c6aa2de 100644 --- a/src/Foundation/NSInputStream.cs +++ b/src/Foundation/NSInputStream.cs @@ -30,23 +30,19 @@ public partial class NSInputStream : NSStream { CFStreamClientContext context; // This is done manually because the generator can't handle byte[] as a native pointer (it will try to use NSArray instead). + /// Reads data from the stream into the provided buffer. /// The buffer where data should be put. /// The size of the buffer (in bytes). - /// Reads data from the stream into the provided buffer. /// The number of bytes actually written. - /// - /// public nint Read (byte [] buffer, nuint len) { return objc_msgSend (Handle, Selector.GetHandle (selReadMaxLength), buffer, len); } - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Reads data from the stream into the provided buffer starting at the given offset. + /// The buffer where data should be stored. + /// The byte offset in at which to begin storing data. + /// The maximum number of bytes to read. public unsafe nint Read (byte [] buffer, int offset, nuint len) { if (offset + (long) len > buffer.Length) @@ -91,14 +87,11 @@ protected override void Dispose (bool disposing) } // Private API, so no documentation. + /// Adds a client for the stream. This method is not supposed to be called by managed code, it will be called by consumers of the stream. When overriding it make sure to call the base implementation. /// Flags. - /// The callbacks to call when events occur. - /// User-defined data for the callback. - /// Adds a client for the stream. This method is not supposed to be called by managed code, it will be called by consumers of the stream. When overriding it make sure to call the base implementation. - /// - /// - /// - /// + /// The callbacks to call when events occur. + /// User-defined data for the callback. + /// if the client was added successfully; otherwise, . [Export ("_setCFClientFlags:callback:context:")] protected virtual bool SetCFClientFlags (CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr) { @@ -129,10 +122,8 @@ protected unsafe virtual bool GetBuffer (out IntPtr buffer, out nuint len) return false; } + /// Notifies consumers of events in the stream. /// The events to notify. - /// Notifies consumers of events in the stream. - /// - /// public void Notify (CFStreamEventType eventType) { if ((flags & eventType) == 0) diff --git a/src/GameplayKit/GKBehavior.cs b/src/GameplayKit/GKBehavior.cs index ac7cd932ed3d..b281506951fc 100644 --- a/src/GameplayKit/GKBehavior.cs +++ b/src/GameplayKit/GKBehavior.cs @@ -12,18 +12,14 @@ namespace GameplayKit { public partial class GKBehavior { - /// To be added. /// Retrieves the at the specified index. (see ) - /// To be added. - /// To be added. + /// The index. public GKGoal this [nuint index] { get { return ObjectAtIndexedSubscript (index); } } - /// To be added. /// Retrieves the weight for the . - /// To be added. - /// To be added. + /// The goal. public NSNumber this [GKGoal goal] { // The docs show that ObjectForKeyedSubscript should return 0.0 if the GKGoal is not // available but actually returns null: https://developer.apple.com/documentation/gameplaykit/gkbehavior/1388723-objectforkeyedsubscript?language=objc diff --git a/src/GameplayKit/GKState.cs b/src/GameplayKit/GKState.cs index 2b63aa8a2d92..b5cf92064755 100644 --- a/src/GameplayKit/GKState.cs +++ b/src/GameplayKit/GKState.cs @@ -38,20 +38,16 @@ internal static Class GetClass (NSObject instance, string parameterName) } // helper - cannot be virtual as it would not be called from GameplayKit/ObjC - /// To be added. - /// Whether the can transition from this to . - /// To be added. - /// To be added. + /// Whether the can transition from this to . + /// The state type. public bool IsValidNextState (Type stateType) { return IsValidNextState (GetClass (stateType, "stateType")); } // helper [#32844] - cannot be virtual as it would not be called from GameplayKit/ObjC - /// To be added. - /// Whether the can transition from this to . - /// To be added. - /// To be added. + /// Whether the can transition from this to . + /// The state. public bool IsValidNextState (GKState state) { return IsValidNextState (GetClass (state, "state")); diff --git a/src/NaturalLanguage/NLLanguageRecognizer.cs b/src/NaturalLanguage/NLLanguageRecognizer.cs index 0fbca84ecacf..981b7652f9c9 100644 --- a/src/NaturalLanguage/NLLanguageRecognizer.cs +++ b/src/NaturalLanguage/NLLanguageRecognizer.cs @@ -29,10 +29,9 @@ namespace NaturalLanguage { public partial class NLLanguageRecognizer { + /// Returns the language in which the text that was analyzed with was most likely written. /// The text to recognize. - /// Returns the language in which the text that was analyzed with was most likely written. - /// The language in which the text was most likely written. - /// To be added. + /// The language in which the text was most likely written. public static NLLanguage GetDominantLanguage (string @string) { var nsstring = CFString.CreateNative (@string); @@ -44,10 +43,8 @@ public static NLLanguage GetDominantLanguage (string @string) } } - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Returns the most likely languages for the previously processed text, ranked by confidence. + /// The maximum number of language hypotheses to return. public Dictionary GetLanguageHypotheses (nuint maxHypotheses) { using (var hypo = GetNativeLanguageHypotheses (maxHypotheses)) { @@ -56,8 +53,7 @@ public Dictionary GetLanguageHypotheses (nuint maxHypotheses } /// Gets or sets a list of language hints. - /// A list of language hints. - /// To be added. + /// A list of language hints. public Dictionary LanguageHints { get { return NLLanguageExtensions.Convert (NativeLanguageHints); diff --git a/src/NetworkExtension/NEHotspotHelperOptions.cs b/src/NetworkExtension/NEHotspotHelperOptions.cs index 0ee76447d7f1..84beab00da40 100644 --- a/src/NetworkExtension/NEHotspotHelperOptions.cs +++ b/src/NetworkExtension/NEHotspotHelperOptions.cs @@ -5,21 +5,16 @@ namespace NetworkExtension { /// Represents options for registering a Hotspot Helper. - /// To be added. public class NEHotspotHelperOptions : DictionaryContainer { #if !COREBUILD /// Creates a new empty hotspot helper options object. - /// To be added. public NEHotspotHelperOptions () : base (new NSMutableDictionary ()) { } - /// To be added. - /// Creates a new hotspot helper options object from the provided dictionary. - /// To be added. + /// Creates a new hotspot helper options object from the provided dictionary. + /// The dictionary. public NEHotspotHelperOptions (NSDictionary dictionary) : base (dictionary) { } /// Gets or sets the display name for the helper. - /// To be added. - /// To be added. public NSString? DisplayName { get { return GetNSStringValue (NEHotspotHelperOptionInternal.DisplayName); diff --git a/src/SceneKit/SCNScene.cs b/src/SceneKit/SCNScene.cs index ccbf3b8cfdde..3d5ea9a13269 100644 --- a/src/SceneKit/SCNScene.cs +++ b/src/SceneKit/SCNScene.cs @@ -14,25 +14,20 @@ namespace SceneKit { public partial class SCNScene : IEnumerable { - /// To be added. - /// Adds a node to the scene. - /// To be added. + /// Adds a node to the scene. + /// The node. public void Add (SCNNode node) { RootNode.AddChildNode (node); } /// Returns an enumerator for iterating over the nodes in the scene. - /// To be added. - /// To be added. public IEnumerator GetEnumerator () { return RootNode.GetEnumerator (); } /// Internal. - /// To be added. - /// To be added. IEnumerator IEnumerable.GetEnumerator () { return GetEnumerator (); diff --git a/src/Social/SLComposeViewController.cs b/src/Social/SLComposeViewController.cs index 96d8ef37527b..4064a0d0c27c 100644 --- a/src/Social/SLComposeViewController.cs +++ b/src/Social/SLComposeViewController.cs @@ -16,19 +16,15 @@ namespace Social { public partial class SLComposeViewController { - /// To be added. - /// Creates a new compose view controller for the specified service. - /// To be added. - /// To be added. + /// Creates a new compose view controller for the specified service. + /// The kind of social service (such as Twitter or Facebook) to compose a message for. public static SLComposeViewController FromService (SLServiceKind serviceKind) { return FromService (serviceKind.GetConstant ()!); } - /// To be added. - /// Returns if the application can send a request for the specified service type. - /// To be added. - /// To be added. + /// Returns if the application can send a request for the specified service type. + /// The kind of social service to check availability for. public static bool IsAvailable (SLServiceKind serviceKind) { return IsAvailable (serviceKind.GetConstant ()!); diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 5e17d1f20e58..42b0eaede147 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -7113,6 +7113,7 @@ public void Generate (Type type) var eventArgs = AttributeManager.GetCustomAttribute (mi); var xmlDocs = eventArgs?.XmlDocs; + var hasXmlDocs = !string.IsNullOrEmpty (xmlDocs); if (!string.IsNullOrEmpty (xmlDocs)) { var docLines = xmlDocs.Split ('\n'); foreach (var line in docLines) @@ -7122,10 +7123,15 @@ public void Generate (Type type) if (mi.ReturnType == TypeCache.System_Void) { PrintObsoleteAttributes (mi); - if (bta.Singleton && mi.GetParameters ().Length == 0 || mi.GetParameters ().Length == 1) + if (bta.Singleton && mi.GetParameters ().Length == 0 || mi.GetParameters ().Length == 1) { + if (!hasXmlDocs && BindingTouch.SupportsXmlDocumentation) + print ("/// Raised by the object's delegate to signal an event."); print ("public event EventHandler {0} {{", Nomenclator.GetEventName (mi).CamelCase ()); - else + } else { + if (!hasXmlDocs && BindingTouch.SupportsXmlDocumentation) + print ("/// Raised by the object's delegate to signal an event, providing event data in a object.", Nomenclator.GetEventArgName (mi)); print ("public event EventHandler<{0}> {1} {{", Nomenclator.GetEventArgName (mi), Nomenclator.GetEventName (mi).CamelCase ()); + } print ("\tadd {{ Ensure{0} ({1})!.{2} += value; }}", dtype.Name, ensureArg, miname); print ("\tremove {{ Ensure{0} ({1})!.{2} -= value; }}", dtype.Name, ensureArg, miname); print ("}\n"); diff --git a/tests/assembly-preparer/BaseClass.cs b/tests/assembly-preparer/BaseClass.cs index b4b2a4a8d1fe..f4aaf6d81d53 100644 --- a/tests/assembly-preparer/BaseClass.cs +++ b/tests/assembly-preparer/BaseClass.cs @@ -54,7 +54,7 @@ public bool AssertPrepareCode (ApplePlatform platform, bool isCoreCLR, Action? configure, string code, out AssemblyPreparerInfo testInfo, string extraCsproj = "", string extraConfig = "", IEnumerable<(string FileName, byte [] Content)>? extraFiles = null) + public AssemblyPreparer CreatePreparer (ApplePlatform platform, bool isCoreCLR, Action? configure, string code, out AssemblyPreparerInfo testInfo, string extraCsproj = "", string extraConfig = "", IEnumerable<(string FileName, byte [] Content)>? extraFiles = null, string testTrimMode = "link") { Configuration.IgnoreIfIgnoredPlatform (platform); @@ -101,7 +101,7 @@ public AssemblyPreparer CreatePreparer (ApplePlatform platform, bool isCoreCLR, var assemblies = Configuration.GetImplementationAssemblies (platform, isCoreCLR); assemblies.Add (Path.Combine (assemblyDir, "Test.dll")); - var infos = assemblies.Select (v => new AssemblyPreparerInfo (v, Path.Combine (assemblyDir, "out", Path.GetFileName (v)), true, "link")).ToArray (); + var infos = assemblies.Select (v => new AssemblyPreparerInfo (v, Path.Combine (assemblyDir, "out", Path.GetFileName (v)), true, Path.GetFileNameWithoutExtension (v) == "Test" ? testTrimMode : "link")).ToArray (); var logger = new TestLogger () { Platform = platform }; var preparer = new AssemblyPreparer (logger, infos, configpath); if (configure is not null) diff --git a/tests/assembly-preparer/ManagedRegistrarStepTests.cs b/tests/assembly-preparer/ManagedRegistrarStepTests.cs new file mode 100644 index 000000000000..9dc216938325 --- /dev/null +++ b/tests/assembly-preparer/ManagedRegistrarStepTests.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +namespace AssemblyPreparerTests; + +public class ManagedRegistrarStepTests : BaseClass { + [TestCase (XamarinRuntime.CoreCLR, false)] + [TestCase (XamarinRuntime.MonoVM, true)] + public void UnmanagedCallersOnlyEntryPoint (XamarinRuntime runtime, bool expectedEntryPoint) + { + var code = @" + using Foundation; + using ObjCRuntime; + + class MyClass : NSObject { + [Export (""myMethod"")] + public void MyMethod () + { + } + } + "; + + // The runtime is configured independently of the reference assembly set used to compile the test code. + AssertPrepare (ApplePlatform.iOS, false, RegistrarMode.ManagedStatic, code, out var assemblyDefinition, $"XamarinRuntime={runtime}"); + + var type = assemblyDefinition.MainModule.Types.Single (v => v.Name == "MyClass"); + var callbackType = type.NestedTypes.Single (v => v.Name == "__Registrar_Callbacks__"); + var callback = callbackType.Methods.Single (v => v.Name.EndsWith ("_MyMethod", StringComparison.Ordinal)); + var attribute = callback.CustomAttributes.Single (v => v.AttributeType.FullName == "System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute"); + var entryPointFields = attribute.Fields.Where (v => v.Name == "EntryPoint").ToArray (); + + if (expectedEntryPoint) { + Assert.That (entryPointFields, Has.Exactly (1).Items, "EntryPoint fields"); + Assert.That (entryPointFields [0].Argument.Value, Is.EqualTo (callback.Name), "EntryPoint"); + } else { + Assert.That (entryPointFields, Is.Empty, "EntryPoint fields"); + } + } +} diff --git a/tests/assembly-preparer/RemoveUserResourcesSubStepTests.cs b/tests/assembly-preparer/RemoveUserResourcesSubStepTests.cs index 77e8da92077f..6da0bf509b56 100644 --- a/tests/assembly-preparer/RemoveUserResourcesSubStepTests.cs +++ b/tests/assembly-preparer/RemoveUserResourcesSubStepTests.cs @@ -26,8 +26,9 @@ static string GetContentPrefix (ApplePlatform platform) // Builds a user assembly with an embedded MonoTouch/XamMac content resource, then runs the // RemoveUserResourcesSubStep with the provided value of HotReloadCompatibleBuild and returns the - // resource names still present in the (in-memory) assembly after the step ran. - List GetResourcesAfterStep (ApplePlatform platform, bool isCoreCLR, bool hotReloadCompatibleBuild) + // resource names still present in the (in-memory) assembly after the step ran. The 'trimMode' + // controls whether the Test assembly is linked ("link") or copied ("copy", i.e. reloadable). + List GetResourcesAfterStep (ApplePlatform platform, bool isCoreCLR, bool hotReloadCompatibleBuild, string trimMode = "link") { var prefix = GetContentPrefix (platform); var resourceName = prefix + "TestResource.bin"; @@ -47,7 +48,7 @@ class MyClass : NSObject { var extraConfig = $"HotReloadCompatibleBuild={(hotReloadCompatibleBuild ? "true" : "false")}"; - using var preparer = CreatePreparer (platform, isCoreCLR, p => p.Registrar = RegistrarMode.Dynamic, code, out var testInfo, extraCsproj: extraCsproj, extraConfig: extraConfig, extraFiles: new [] { ("TestResource.bin", content) }); + using var preparer = CreatePreparer (platform, isCoreCLR, p => p.Registrar = RegistrarMode.Dynamic, code, out var testInfo, extraCsproj: extraCsproj, extraConfig: extraConfig, extraFiles: new [] { ("TestResource.bin", content) }, testTrimMode: trimMode); var context = preparer.Configuration.DerivedLinkContext; new LoadAssembliesStep ().Process (context); @@ -78,10 +79,25 @@ public void ResourceKeptForHotReload (ApplePlatform platform, bool isCoreCLR) { var prefix = GetContentPrefix (platform); var resourceName = prefix + "TestResource.bin"; - var resources = GetResourcesAfterStep (platform, isCoreCLR, hotReloadCompatibleBuild: true); + // A reloadable (non-linked, i.e. copied) assembly must be left untouched: the step must not + // remove the resource (which would upgrade the assembly to AssemblyAction.Save and break Hot Reload). + var resources = GetResourcesAfterStep (platform, isCoreCLR, hotReloadCompatibleBuild: true, trimMode: "copy"); - // The resource must be left untouched: the step must not remove it (and thus not upgrade the - // user assembly to AssemblyAction.Save, which is what would break Hot Reload). - Assert.That (resources, Has.Some.EqualTo (resourceName), "The user resource must be kept when HotReloadCompatibleBuild is enabled."); + Assert.That (resources, Has.Some.EqualTo (resourceName), "The user resource must be kept for a reloadable assembly when HotReloadCompatibleBuild is enabled."); + } + + [Test] + [TestCase (ApplePlatform.iOS, false)] + [TestCase (ApplePlatform.TVOS, false)] + [TestCase (ApplePlatform.MacCatalyst, false)] + [TestCase (ApplePlatform.MacOSX, true)] + public void ResourceRemovedForLinkedAssemblyInHotReload (ApplePlatform platform, bool isCoreCLR) + { + var prefix = GetContentPrefix (platform); + // A linked assembly is re-serialized regardless (it's not reloadable), so its resources must be + // stripped even in a Hot Reload compatible build. + var resources = GetResourcesAfterStep (platform, isCoreCLR, hotReloadCompatibleBuild: true, trimMode: "link"); + + Assert.That (resources, Has.None.StartsWith (prefix), "The user resource should be stripped from a linked assembly even when HotReloadCompatibleBuild is enabled."); } } diff --git a/tests/bgen/tests/ExpectedXmlDocs.MacCatalyst.xml b/tests/bgen/tests/ExpectedXmlDocs.MacCatalyst.xml index 8eeb660173e1..3f3eef4fda7d 100644 --- a/tests/bgen/tests/ExpectedXmlDocs.MacCatalyst.xml +++ b/tests/bgen/tests/ExpectedXmlDocs.MacCatalyst.xml @@ -633,6 +633,12 @@ TClassDelegate.DidChangeMutteringVolume - EventArgs. + + Raised by the object's delegate to signal an event, providing event data in a object. + + + Raised by the object's delegate to signal an event. + Provides data for an event based on an Objective-C protocol method. @@ -662,6 +668,12 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + + + TClassDelegate.DidFinish + Extension methods to the interface to support all the methods from the TClassDelegate protocol. @@ -674,6 +686,9 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + TClassDelegate @@ -747,6 +762,9 @@ TClassDelegate.DidChangeUtteringSpeed + + TClassDelegate.DidFinish + Summary for TG1 diff --git a/tests/bgen/tests/ExpectedXmlDocs.iOS.xml b/tests/bgen/tests/ExpectedXmlDocs.iOS.xml index 5a5cae9e279b..5fa892606e54 100644 --- a/tests/bgen/tests/ExpectedXmlDocs.iOS.xml +++ b/tests/bgen/tests/ExpectedXmlDocs.iOS.xml @@ -633,6 +633,12 @@ TClassDelegate.DidChangeMutteringVolume - EventArgs. + + Raised by the object's delegate to signal an event, providing event data in a object. + + + Raised by the object's delegate to signal an event. + Provides data for an event based on an Objective-C protocol method. @@ -662,6 +668,12 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + + + TClassDelegate.DidFinish + Extension methods to the interface to support all the methods from the TClassDelegate protocol. @@ -674,6 +686,9 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + TClassDelegate @@ -747,6 +762,9 @@ TClassDelegate.DidChangeUtteringSpeed + + TClassDelegate.DidFinish + Summary for TG1 diff --git a/tests/bgen/tests/ExpectedXmlDocs.macOS.xml b/tests/bgen/tests/ExpectedXmlDocs.macOS.xml index 8eeb660173e1..3f3eef4fda7d 100644 --- a/tests/bgen/tests/ExpectedXmlDocs.macOS.xml +++ b/tests/bgen/tests/ExpectedXmlDocs.macOS.xml @@ -633,6 +633,12 @@ TClassDelegate.DidChangeMutteringVolume - EventArgs. + + Raised by the object's delegate to signal an event, providing event data in a object. + + + Raised by the object's delegate to signal an event. + Provides data for an event based on an Objective-C protocol method. @@ -662,6 +668,12 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + + + TClassDelegate.DidFinish + Extension methods to the interface to support all the methods from the TClassDelegate protocol. @@ -674,6 +686,9 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + TClassDelegate @@ -747,6 +762,9 @@ TClassDelegate.DidChangeUtteringSpeed + + TClassDelegate.DidFinish + Summary for TG1 diff --git a/tests/bgen/tests/ExpectedXmlDocs.tvOS.xml b/tests/bgen/tests/ExpectedXmlDocs.tvOS.xml index 8eeb660173e1..3f3eef4fda7d 100644 --- a/tests/bgen/tests/ExpectedXmlDocs.tvOS.xml +++ b/tests/bgen/tests/ExpectedXmlDocs.tvOS.xml @@ -633,6 +633,12 @@ TClassDelegate.DidChangeMutteringVolume - EventArgs. + + Raised by the object's delegate to signal an event, providing event data in a object. + + + Raised by the object's delegate to signal an event. + Provides data for an event based on an Objective-C protocol method. @@ -662,6 +668,12 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + + + TClassDelegate.DidFinish + Extension methods to the interface to support all the methods from the TClassDelegate protocol. @@ -674,6 +686,9 @@ TClassDelegate.DidChangeMutteringVolume + + TClassDelegate.DidFinish + TClassDelegate @@ -747,6 +762,9 @@ TClassDelegate.DidChangeUtteringSpeed + + TClassDelegate.DidFinish + Summary for TG1 diff --git a/tests/bgen/tests/xmldocs.cs b/tests/bgen/tests/xmldocs.cs index ecefd211e9e2..7f6c6ca201fc 100644 --- a/tests/bgen/tests/xmldocs.cs +++ b/tests/bgen/tests/xmldocs.cs @@ -291,6 +291,12 @@ interface TClassDelegate { TClassDelegate.DidChangeMutteringVolume - EventArgs. """)] void DidChangeMutteringVolume (TClass obj, double mutteringVolume); + + // A single-parameter delegate method with no [EventArgs] docs generates a + // non-generic EventHandler event, which gets a default generated summary. + /// TClassDelegate.DidFinish + [Export ("speechSynthesizerDidFinish:")] + void DidFinish (TClass obj); } interface ITClassDelegate { } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 7db0e0a9e222..106f906960e3 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -1,10 +1,4 @@ E:AddressBook.ABAddressBook.ExternalChange -E:AppKit.NSApplication.ProtectedDataDidBecomeAvailable -E:AppKit.NSApplication.ProtectedDataWillBecomeUnavailable -E:AppKit.NSSavePanel.DidSelectType -E:AppKit.NSTableView.UserDidChangeVisibility -E:AppKit.NSTextView.WritingToolsDidEnd -E:AppKit.NSTextView.WritingToolsWillBegin E:AudioToolbox.AudioConverter.InputData E:AudioToolbox.InputAudioQueue.InputCompleted E:AudioToolbox.OutputAudioQueue.BufferCompleted @@ -19,16 +13,6 @@ E:AVFoundation.AVAudioSession.InputAvailabilityChanged E:AVFoundation.AVAudioSession.InputChannelsChanged E:AVFoundation.AVAudioSession.OutputChannelsChanged E:AVFoundation.AVAudioSession.SampleRateChanged -E:AVFoundation.AVSpeechSynthesizer.DidCancelSpeechUtterance -E:AVFoundation.AVSpeechSynthesizer.DidContinueSpeechUtterance -E:AVFoundation.AVSpeechSynthesizer.DidFinishSpeechUtterance -E:AVFoundation.AVSpeechSynthesizer.DidPauseSpeechUtterance -E:AVFoundation.AVSpeechSynthesizer.DidStartSpeechUtterance -E:AVFoundation.AVSpeechSynthesizer.WillSpeakMarker -E:AVFoundation.AVSpeechSynthesizer.WillSpeakRangeOfSpeechString -E:CoreBluetooth.CBCentralManager.ConnectionEventDidOccur -E:CoreBluetooth.CBCentralManager.DidDisconnectPeripheral -E:CoreBluetooth.CBCentralManager.DidUpdateAncsAuthorization E:CoreFoundation.CFSocket.AcceptEvent E:CoreFoundation.CFSocket.ConnectEvent E:CoreFoundation.CFSocket.DataEvent @@ -39,25 +23,6 @@ E:CoreFoundation.CFStream.ClosedEvent E:CoreFoundation.CFStream.ErrorEvent E:CoreFoundation.CFStream.HasBytesAvailableEvent E:CoreFoundation.CFStream.OpenCompletedEvent -E:CoreLocation.CLLocationManager.AuthorizationChanged -E:CoreLocation.CLLocationManager.DeferredUpdatesFinished -E:CoreLocation.CLLocationManager.DidChangeAuthorization -E:CoreLocation.CLLocationManager.DidDetermineState -E:CoreLocation.CLLocationManager.DidFailRangingBeacons -E:CoreLocation.CLLocationManager.DidRangeBeacons -E:CoreLocation.CLLocationManager.DidRangeBeaconsSatisfyingConstraint -E:CoreLocation.CLLocationManager.DidStartMonitoringForRegion -E:CoreLocation.CLLocationManager.DidVisit -E:CoreLocation.CLLocationManager.Failed -E:CoreLocation.CLLocationManager.LocationsUpdated -E:CoreLocation.CLLocationManager.LocationUpdatesPaused -E:CoreLocation.CLLocationManager.LocationUpdatesResumed -E:CoreLocation.CLLocationManager.MonitoringFailed -E:CoreLocation.CLLocationManager.RangingBeaconsDidFailForRegion -E:CoreLocation.CLLocationManager.RegionEntered -E:CoreLocation.CLLocationManager.RegionLeft -E:CoreLocation.CLLocationManager.UpdatedHeading -E:CoreLocation.CLLocationManager.UpdatedLocation E:CoreMidi.MidiClient.IOError E:CoreMidi.MidiClient.ObjectAdded E:CoreMidi.MidiClient.ObjectRemoved @@ -68,41 +33,9 @@ E:CoreMidi.MidiClient.ThruConnectionsChanged E:CoreMidi.MidiEndpoint.MessageReceived E:CoreMidi.MidiPort.MessageReceived E:CoreServices.FSEventStream.Events -E:HomeKit.HMHome.DidUpdateSupportedFeatures -E:HomeKit.HMHomeManager.DidReceiveAddAccessoryRequest -E:HomeKit.HMHomeManager.DidUpdateAuthorizationStatus -E:ImageKit.IKCameraDeviceView.DidDownloadFile -E:ImageKit.IKDeviceBrowserView.SelectionDidChange -E:ImageKit.IKScannerDeviceView.DidScanToBandData -E:MapKit.MKMapView.DidDeselectAnnotation -E:MapKit.MKMapView.DidSelectAnnotation E:ObjCRuntime.Runtime.AssemblyRegistration E:ObjCRuntime.Runtime.MarshalManagedException E:ObjCRuntime.Runtime.MarshalObjectiveCException -E:PassKit.PKPaymentAuthorizationViewController.DidChangeCouponCode -E:PassKit.PKPaymentAuthorizationViewController.DidRequestMerchantSessionUpdate -E:QuickLook.QLPreviewController.DidSaveEditedCopy -E:QuickLook.QLPreviewController.DidUpdateContents -E:UIKit.UISplitViewController.DidCollapse -E:UIKit.UISplitViewController.DidExpand -E:UIKit.UISplitViewController.DidHideColumn -E:UIKit.UISplitViewController.DidShowColumn -E:UIKit.UISplitViewController.InteractivePresentationGestureDidEnd -E:UIKit.UISplitViewController.InteractivePresentationGestureWillBegin -E:UIKit.UISplitViewController.WillHideColumn -E:UIKit.UISplitViewController.WillShowColumn -E:UIKit.UITabBarController.AcceptItemsFromDropSession -E:UIKit.UITabBarController.DidBeginEditing -E:UIKit.UITabBarController.DidSelectTab -E:UIKit.UITabBarController.DisplayOrderDidChangeForGroup -E:UIKit.UITabBarController.VisibilityDidChangeForTabs -E:UIKit.UITabBarController.WillBeginEditing -E:UIKit.UITextView.DidBeginFormatting -E:UIKit.UITextView.DidEndFormatting -E:UIKit.UITextView.WillBeginFormatting -E:UIKit.UITextView.WillEndFormatting -E:UIKit.UITextView.WritingToolsDidEnd -E:UIKit.UITextView.WritingToolsWillBegin F:Accessibility.AXChartDescriptorContentDirection.BottomToTop F:Accessibility.AXChartDescriptorContentDirection.LeftToRight F:Accessibility.AXChartDescriptorContentDirection.RadialClockwise diff --git a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs index 6a7edecabfa0..fe650eeb2c36 100644 --- a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs +++ b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs @@ -1272,7 +1272,8 @@ StaticRegistrar StaticRegistrar { CustomAttribute CreateUnmanagedCallersAttribute (string entryPoint) { var unmanagedCallersAttribute = new CustomAttribute (abr.UnmanagedCallersOnlyAttribute_Constructor); - unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("EntryPoint", new CustomAttributeArgument (abr.System_String, entryPoint))); + if (App.XamarinRuntime != XamarinRuntime.CoreCLR) + unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("EntryPoint", new CustomAttributeArgument (abr.System_String, entryPoint))); return unmanagedCallersAttribute; } diff --git a/tools/linker/RemoveUserResourcesSubStep.cs b/tools/linker/RemoveUserResourcesSubStep.cs index f3489fb634fa..85801c2fa584 100644 --- a/tools/linker/RemoveUserResourcesSubStep.cs +++ b/tools/linker/RemoveUserResourcesSubStep.cs @@ -97,9 +97,10 @@ bool ModifyAssembly (AssemblyDefinition assembly) return false; #if ASSEMBLY_PREPARER - // In the assembly-preparer any modification re-serializes (saves) the assembly, which breaks Hot - // Reload. So skip resource stripping entirely for Hot Reload compatible builds. - if (Configuration.HotReloadCompatibleBuild) + // In Hot Reload compatible builds, don't strip resources from reloadable (non-linked) assemblies, + // because modifying them re-serializes (saves) the assembly, breaking Hot Reload. Linked assemblies + // are re-serialized regardless, so stripping them is fine. + if (Configuration.HotReloadCompatibleBuild && Annotations.GetAction (assembly) != AssemblyAction.Link) return false; #endif