.net-standard

How to get memory available or used in C# .net core / .net standard

故事扮演 提交于 2020-01-13 09:56:39
问题 Is there a way to know the current used memory in the current process? I checked many questions: How to get the amount of memory used by an application How to get memory available or used in C# They are not available in .Net Standard 1.6. 回答1: Here you can check how it is done in HealthChecks project. You can use Process class from System.Diagnostics namespace. * EDIT * System.Diagnostics.Process Nuget package might need to be added. Only xxxx64 memory properties are supported in .NET

Using assemblies compiled from IL with .NET Core & Xamarin

主宰稳场 提交于 2020-01-12 05:34:45
问题 Updated with a solution that works for me. See the bottom of this question. Context: I needed a way to evaluate the size of a generic type for the purpose of calculating array lengths to fit within a certain byte size. Basically, sizeof similar to what C/C++ provides. C#'s sizeof and Marshal.SizeOf are not suitable for this, because of their many limitations. With this in mind, I wrote an assembly in IL that enables the functionality I was looking for through the sizeof opcode. I'm aware that

Visual Studio 2017 won't load .NET Framework references in .NET Standard library

回眸只為那壹抹淺笑 提交于 2020-01-11 04:46:27
问题 I've installed Visual Studio 2017. I have a class library in the new .NET Standard format (which is able to surface both .NET Framework and .NET Core). But when I go to "Add" - "Reference", then "Assemblies" - "Framework", it spins for a long time and then says, "No Framework assemblies were found on the machine." (This machine has VS 2015 installed and running fine, as well as .NET 4.6.1.) How do I resolve this? ETA: My .csproj file currently looks like this: <Project Sdk="Microsoft.NET.Sdk"

Azure Function gives error: System.Drawing is not supported on this platform

自古美人都是妖i 提交于 2020-01-09 03:49:26
问题 (If this question is poorly worded, could someone please help me clear it up?) I have an Azure Function (2.0) which relies on some System.Drawing code. I've added a NuGet reference to System.Drawing.Common (4.5.0). After publishing the app, however, when the function is called, it produces the error: System.Private.CoreLib: Exception while executing function: [MyFunctionName]. System.Drawing.Common: System.Drawing is not supported on this platform. As far as I'm aware, System.Drawing.Common

SignalR class library for both UWP and WPF

陌路散爱 提交于 2020-01-06 04:59:06
问题 I'm interested in writing a class library that can be consumed from both a UWP application and a WPF (desktop) application. This library will incorporate SignalR to allow those two application types to function as servers pushing data. The client will most likely be another UWP application. According to Microsoft in such cases the class library should target .NET Standard. My current understanding is that .NET Core is an implementation of the .NET Standard. Since SignalR has now been included

Which .Net Standard version supports which Android versions?

假装没事ソ 提交于 2020-01-04 09:40:46
问题 I want to convert a Xamarin PCL project to .Net Standard. My question is, what versions of Android will that support? My current project supports Android 4. Will .Net Standard be able to support it? Does it depend on the .Net Standard version? I've seen this table but it only tells me the "Xamarin" version supported, and I don't understand the connection between that and the Android version. Is .Net Standard unrelated to the Android version (somewhat like the C# version is separate from the

Porting .NET Framework code to .NET Standard, using Process, RegistryKey

℡╲_俬逩灬. 提交于 2020-01-03 08:45:12
问题 I have a method from an existing .NET Framework project that gets the path to the default browser in Windows from the Registry and launches it with a Process call: string browser = ""; RegistryKey regKey = null; try { regKey = Registry.ClassesRoot.OpenSubKey("HTTP\\shell\\open\\command", false); browser = regKey.GetValue(null).ToString().Replace("" + (char)34, ""); if (!browser.EndsWith(".exe")) browser = browser.Substring(0, browser.LastIndexOf(".exe") + 4); } finally { if (regKey != null)

How to test .NET Standard 2 library with either NUnit, xUnit or MSTest from either Rider or VS 2017?

≡放荡痞女 提交于 2020-01-03 08:28:07
问题 I have a project where I use Azure Durable Functions, and they are available only on .NET Standard 2. So, it defines which class library can be used in testing projects. But, I cannot put together a library where either xUnit, NUnit or MSTest is used in unit/integration testing. Adding NUnit to a project where .NET Standard 2 is class library fails with the following error: INFO: Restoring packages for C:\VSTS\github.com\netstandardXunitMsTestNunit\src\Netstandard2xUnitMsTestnUnit\nunit\nunit

Where does .net core search for certificates on linux platform

这一生的挚爱 提交于 2020-01-03 07:01:09
问题 On Windows, for .NET Framework classes we can specify sslkeyrepository as *SYSTEM/*USER.On linux where does the .NET Core classes search for the certificates by default and what could be the values for sslkeyrepository . 回答1: .Net Core uses OpenSSL on Linux, as a result, you need to set up your Linux environment in the container so that OpenSSL will pick up the certificate. You can do this by two ways: Copying the the certificate .crt file to a location that update-ca-certificates will scan

I am using .net core with C# on linux, lib System.Drawing is missing

五迷三道 提交于 2020-01-03 06:04:06
问题 Program.cs(1,14): error CS0234: The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference? Is it possible to fix that? or I am not meant to be using this lib, if I am developing in Linux with C#? 回答1: The System.Drawing namespace is at the moment not part of corefx as it relies on the GDI+ features from Windows. But there are plans to support it in the future. But there are multiple alternatives: CoreCompat.System.Drawing CoreCompat