From 844aca698f104de16f674ff31dbb9703668d6e42 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 12 May 2020 14:21:11 +0100 Subject: [PATCH] Add Write and WriteLine to Debug class - Bump version to 1.2.1-preview. - Bump AssemblyNativeVersion to 100.0.6.2. Signed-off-by: josesimoes --- source/nanoFramework.Runtime.Native/Debug.cs | 38 +++++++++++++++++-- .../Properties/AssemblyInfo.cs | 2 +- source/version.json | 5 +-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/source/nanoFramework.Runtime.Native/Debug.cs b/source/nanoFramework.Runtime.Native/Debug.cs index 75f5479..086ceb2 100644 --- a/source/nanoFramework.Runtime.Native/Debug.cs +++ b/source/nanoFramework.Runtime.Native/Debug.cs @@ -20,7 +20,9 @@ public static class Debug /// true if garbage collection should be forced; otherwise, false. /// The amount of free (unused) memory, in bytes. [MethodImpl(MethodImplOptions.InternalCall)] +#pragma warning disable S4200 // Native methods should be wrapped extern static public uint GC(bool force); +#pragma warning restore S4200 // Native methods should be wrapped /// /// Specifies whether GC (garbage collection) messages are enabled. @@ -31,7 +33,9 @@ public static class Debug /// RTM builds (which remove all non essential features) are one of those situations. /// [MethodImpl(MethodImplOptions.InternalCall)] +#pragma warning disable S4200 // Native methods should be wrapped extern static public void EnableGCMessages(bool enable); +#pragma warning restore S4200 // Native methods should be wrapped //--// @@ -39,7 +43,7 @@ public static class Debug /// Causes a break in execution if the specified assertion (condition) evaluates to false. /// /// The condition to be evaluated. If the value is false, program execution stops. - [System.Diagnostics.Conditional("DEBUG")] + [Conditional("DEBUG")] static public void Assert(bool condition) { if (!condition) @@ -53,7 +57,7 @@ static public void Assert(bool condition) /// /// The condition to be evaluated. If the value is false, program execution stops. /// The text to be output if the assertion is false. - [System.Diagnostics.Conditional("DEBUG")] + [Conditional("DEBUG")] static public void Assert(bool condition, string message) { if (!condition) @@ -68,7 +72,7 @@ static public void Assert(bool condition, string message) /// The condition to be evaluated. If the value is false, program execution stops. /// The text to be output if the assertion is false. /// The detailed message to be displayed if the assertion is false. - [System.Diagnostics.Conditional("DEBUG")] + [Conditional("DEBUG")] static public void Assert(bool condition, string message, string detailedMessage) { if (!condition) @@ -76,5 +80,33 @@ static public void Assert(bool condition, string message, string detailedMessage Debugger.Break(); } } + + /// + /// Writes a message to the trace listeners in the Listeners collection. + /// + /// A message to write. + /// + /// In nanoFramework implementation the message is output to Visual Studio debugger window. + /// + [Conditional("DEBUG")] +#pragma warning disable S4200 // Native methods should be wrapped + public static void Write(string message) => WriteLineNative(message, false); +#pragma warning restore S4200 // Native methods should be wrapped + + /// + /// Writes a message followed by a line terminator to the trace listeners in the Listeners collection. + /// + /// A message to write. + /// + /// In nanoFramework implementation the message is output to Visual Studio debugger window. + /// + [Conditional("DEBUG")] +#pragma warning disable S4200 // Native methods should be wrapped + public static void WriteLine(string message) => WriteLineNative(message, true); +#pragma warning restore S4200 // Native methods should be wrapped + + + [MethodImpl(MethodImplOptions.InternalCall)] + extern static private void WriteLineNative(string text, bool addLineFeed); } } diff --git a/source/nanoFramework.Runtime.Native/Properties/AssemblyInfo.cs b/source/nanoFramework.Runtime.Native/Properties/AssemblyInfo.cs index 26bf40a..2bf2b0f 100644 --- a/source/nanoFramework.Runtime.Native/Properties/AssemblyInfo.cs +++ b/source/nanoFramework.Runtime.Native/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////// // update this whenever the native assembly signature changes // -[assembly: AssemblyNativeVersion("100.0.6.1")] +[assembly: AssemblyNativeVersion("100.0.6.2")] //////////////////////////////////////////////////////////////// // Setting ComVisible to false makes the types in this assembly not visible diff --git a/source/version.json b/source/version.json index 52e8b13..6463c30 100644 --- a/source/version.json +++ b/source/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.2.0-preview.{height}", + "version": "1.2.1-preview.{height}", "assemblyVersion": { "precision": "revision" }, @@ -13,8 +13,7 @@ "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { - "setAllVariables": true, - "buildNumber": null + "setAllVariables": true }, "release": { "branchName": "release-v{version}",