diff --git a/core/extensions/DllMapDemo/NewLib.cpp b/core/extensions/DllMapDemo/NewLib.cpp index b0792d274ed..e9b1e4b765b 100644 --- a/core/extensions/DllMapDemo/NewLib.cpp +++ b/core/extensions/DllMapDemo/NewLib.cpp @@ -1,12 +1,10 @@ -#include - #if defined(__GNUC__) #define EXPORT extern "C" __attribute__((visibility("default"))) #elif defined(_MSC_VER) #define EXPORT extern "C" __declspec(dllexport) #endif -extern "C" EXPORT int NativeSum(int a, int b) +EXPORT int NativeSum(int a, int b) { return a + b; } diff --git a/core/hosting/HostWithCoreClrHost/src/SampleHost.cpp b/core/hosting/HostWithCoreClrHost/src/SampleHost.cpp index 04effd4a693..d39988028e0 100644 --- a/core/hosting/HostWithCoreClrHost/src/SampleHost.cpp +++ b/core/hosting/HostWithCoreClrHost/src/SampleHost.cpp @@ -238,18 +238,6 @@ int main(int argc, char* argv[]) printf("coreclr_shutdown failed - status: 0x%08x\n", hr); } - // Unload CoreCLR -#if WINDOWS - if (!FreeLibrary(coreClr)) - { - printf("Failed to free coreclr.dll\n"); - } -#elif LINUX - if (dlclose(coreClr)) - { - printf("Failed to free libcoreclr.so\n"); - } -#endif return 0; } diff --git a/machine-learning/tutorials/IrisFlowerClustering/IrisFlowerClustering.csproj b/machine-learning/tutorials/IrisFlowerClustering/IrisFlowerClustering.csproj index 0c891626a71..d188146d873 100644 --- a/machine-learning/tutorials/IrisFlowerClustering/IrisFlowerClustering.csproj +++ b/machine-learning/tutorials/IrisFlowerClustering/IrisFlowerClustering.csproj @@ -10,7 +10,7 @@ - + diff --git a/machine-learning/tutorials/IrisFlowerClustering/Program.cs b/machine-learning/tutorials/IrisFlowerClustering/Program.cs index 16dcc583d3b..132f48d0b9a 100644 --- a/machine-learning/tutorials/IrisFlowerClustering/Program.cs +++ b/machine-learning/tutorials/IrisFlowerClustering/Program.cs @@ -4,7 +4,6 @@ // // -using Microsoft.Data.DataView; using Microsoft.ML; using Microsoft.ML.Data; // @@ -32,7 +31,7 @@ static void Main(string[] args) string featuresColumnName = "Features"; var pipeline = mlContext.Transforms .Concatenate(featuresColumnName, "SepalLength", "SepalWidth", "PetalLength", "PetalWidth") - .Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, clustersCount: 3)); + .Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, numberOfClusters: 3)); // // @@ -42,12 +41,12 @@ static void Main(string[] args) // using (var fileStream = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write)) { - mlContext.Model.Save(model, fileStream); + mlContext.Model.Save(model, dataView.Schema, fileStream); } // // - var predictor = model.CreatePredictionEngine(mlContext); + var predictor = mlContext.Model.CreatePredictionEngine(model); // // diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.threading.threadlocal/cs/threadlocal.cs b/snippets/csharp/VS_Snippets_CLR_System/system.threading.threadlocal/cs/threadlocal.cs index ae60acbbcbf..7a55cdf9860 100644 --- a/snippets/csharp/VS_Snippets_CLR_System/system.threading.threadlocal/cs/threadlocal.cs +++ b/snippets/csharp/VS_Snippets_CLR_System/system.threading.threadlocal/cs/threadlocal.cs @@ -35,5 +35,14 @@ static void Main() ThreadName.Dispose(); } } - -// \ No newline at end of file +// This multithreading example can produce different outputs for each 'action' invocation and will vary with each run. +// Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor): +// ThreadName = Thread5 +// ThreadName = Thread6 +// ThreadName = Thread4 +// ThreadName = Thread6 (repeat) +// ThreadName = Thread1 +// ThreadName = Thread4 (repeat) +// ThreadName = Thread7 +// ThreadName = Thread5 (repeat) +// diff --git a/snippets/csharp/keywords/StackAllocExamples.cs b/snippets/csharp/keywords/StackAllocExamples.cs index a2ef91e8f31..998bc44db93 100644 --- a/snippets/csharp/keywords/StackAllocExamples.cs +++ b/snippets/csharp/keywords/StackAllocExamples.cs @@ -11,10 +11,10 @@ public static void Examples() InitializeBitMasks(); } - private static unsafe void InitializeBitMasks() + private static void InitializeBitMasks() { // - int* mask = stackalloc[] { + ReadOnlySpan mask = stackalloc[] { 0b_0000_0000_0000_0001, 0b_0000_0000_0000_0010, 0b_0000_0000_0000_0100, @@ -61,14 +61,13 @@ private static unsafe void FibonacciGeneration() { // const int arraySize = 20; - int* fib = stackalloc int[arraySize]; - int* p = fib; + Span fib = stackalloc int[arraySize]; // The sequence begins with 1, 1. - *p++ = *p++ = 1; - for (int i = 2; i < arraySize; ++i, ++p) + fib[0] = fib[1] = 1; + for (int i = 2; i < arraySize; ++i) { // Sum the previous two numbers. - *p = p[-1] + p[-2]; + fib[i] = fib[i-1] + fib[i-2]; } for (int i = 0; i < arraySize; ++i) { diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb index 2619cc645e6..574b09fb070 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb @@ -7,8 +7,8 @@ Imports System.Collections.Generic Module Example Public Sub Main() Dim names() As String = { "Samuel", "Dakota", "Koani", "Saya", - "Vanya", "Yiska", "Yuma", "Jody", - "Nikita" } + "Vanya", "Jody", "Yiska", "Yuma", + "Jody", "Nikita" } Dim nameList As New List(Of String)() nameList.AddRange(names) Console.WriteLine("List in unsorted order: ") @@ -27,8 +27,8 @@ Module Example End Module ' The example displays the following output: ' List in unsorted order: -' Samuel Dakota Koani Saya Vanya Yiska Yuma Jody Nikita +' Samuel Dakota Koani Saya Vanya Jody Yiska Yuma Jody Nikita ' ' List in sorted order: -' Dakota Jody Koani Nikita Samuel Saya Vanya Yiska Yuma +' Dakota Jody Jody Koani Nikita Samuel Saya Vanya Yiska Yuma ' diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.threading.threadlocal/vb/threadlocal.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.threading.threadlocal/vb/threadlocal.vb index 42b917d8025..73e3a5ba282 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.threading.threadlocal/vb/threadlocal.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.threading.threadlocal/vb/threadlocal.vb @@ -32,4 +32,14 @@ Module ThreadLocalDemo ThreadName.Dispose() End Sub End Module -' \ No newline at end of file +' This multithreading example can produce different outputs for each 'action' invocation and will vary with each run. +' Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor): +' ThreadName = Thread5 +' ThreadName = Thread6 +' ThreadName = Thread4 +' ThreadName = Thread6 (repeat) +' ThreadName = Thread1 +' ThreadName = Thread4 (repeat) +' ThreadName = Thread7 +' ThreadName = Thread5 (repeat) +'