Async/await with/without awaiting (fire and forget)

I have the following code: ``` static async Task Callee() { await Task.Delay(1000); } static async Task Caller() { Callee(); // #1 fire and forget await Callee(); // #2 >1s Task.Run((...

23 Jul at 13:55

Could not load file or assembly 'System.Security.Cryptography.Algorithms, Version = 4.1.0.0

I'm trying to use System.Security.Cryptography.RNGCryptoServiceProvider class in my .NET Standard 1.4 library and according to [this](https://stackoverflow.com/questions/38632735/rngcryptoserviceprovi...

Difference in C# between different getter styles

I do sometimes see abbreviations in properties for the getter. E.g. those two types: ``` public int Number { get; } = 0 public int Number => 0; ``` Can someone please tell me if there are any diff...

5 Sep at 05:52

Packages are not compatible with netcoreapp2.0

Today this error ocurred again. Visual Studio does not recognize most of the packages instaled in Microsoft.AspNetCore.All but I'm also getting problems with: - - - The error message is like this f...

4 Sep at 23:43

C# - Body content in POST request

I need to make some api calls in C#. I'm using Web API Client from Microsoft to do that. I success to make some POST requests, but I don't know how to add the field "Body" into my requests. Any idea ?...

6 Sep at 14:45

XMLSigner No longer works in 4.6.2 - Malformed reference element

After Upgrading an application from 3.5 to 4.6.2 The following block of code no longer works. I get "Malformed reference element" Errors, even though it worked just fine as a 3.5 application. The code...

5 Sep at 13:53

EF Core - Error when adding a related entity

I get an error when I try to update a related entity of an entity that I already got from database. For illustration purposes I have these entites: ``` class Car { int Id ..; string Name ..; ...

Environment variables configuration in .NET Core

I'm using the .NET Core 1.1 in my API and am struggling with a problem: 1. I need to have two levels of configurations: appsettings.json and environment variables. 2. I want to use the DI for my con...

ASP.NET Core 2 API call is redirected (302)

I'm trying to migrate this project [https://github.com/asadsahi/AspNetCoreSpa](https://github.com/asadsahi/AspNetCoreSpa) from .net core 1.1 to 2.0 but have a problem after a successful login. After ...

Root URL's for ServiceStack and .NET Core 2

I've recently had cause to upgrade a servicestack service from .NET Core 1.1 to .NET Core 2.0. Previously, my root URL was defined in the program class a bit like this... `IWebHost host = new WebH...

How to map nested child object properties in Automapper

I have current map: ``` CreateMap<Article, ArticleModel>() .ForMember(dest => dest.BaseContentItem, opts => opts.MapFrom(src => src.BaseContentItem)) .ForMember(dest => dest.BaseContentItem.T...

31 Aug at 16:44

How to create .ics file using c#?

[](https://i.stack.imgur.com/cryPd.png)I used below code for creating .ics file but it's not working can any one help me,where its going wrong. ``` System.Text.StringBuilder sbICSFile = new System.Te...

4 Sep at 09:45

AOP in Dotnet core : Dynamic Proxy with Real Proxy in Dotnet core

I am migrating my application from .Net Framework 4.5.1 to Dot Net Core. I was using [RealProxy](https://msdn.microsoft.com/en-us/library/system.runtime.remoting.proxies.realproxy(v=vs.110).aspx) Cla...

4 Sep at 03:59

How to manually parse a JSON string in net-core 2.0

I have a json string with the following structure ``` { "resource": "user", "method": "create", "fields": { "name": "John", "surname: "Smith", "email": "john@gmail...

Dictionary with class as Key

I am studying electronic engineering, and I am a beginner in C#. I have measured data and I would like to store it in a 2 dimensional way. I thought I could make a `Dictionary` like this: ``` Dictiona...

15 Jul at 16:26

MahApps and Property Grid

First of all, great thanks to MahApps. What a cool project! I have an existing application written in WPF that I have applied the MahApps library to. I used this tutorial: [http://mahapps.com/guid...

7 Sep at 10:11

Dependency injection for generic class

I have a generic class and a generic interface like this: ``` public interface IDataService<T> where T: class { IEnumerable<T> GetAll(); } public class DataService<T> : IDataService<T> where T :...

Use async without await when I don't need response

I want send a SMS from my app. SMS will send when I send a get request to an specific URL. All of my methods are async, but when I instance an `HttpClient` and want to use `response.Content.ReadAsStri...

3 Sep at 11:18

Fill Ellipse with wave animation

I have created an ellipse in Windows Phone 8.1 Silverlight App and UWP both and I wanted to fill it with animating waves, For this purpose, I am following this [solution](https://stackoverflow.com/que...

Configuration.GetSection always returns Value property null

Every time I call `Configuration.GetSection`, the `Value` property of the returned object is always null. My `Startup` constructor ``` public Startup(IHostingEnvironment env) { var builder = new...

3 Nov at 21:17

.net core Console application strongly typed Configuration

On an .NET Core Console app, I'm trying to map settings from a custom appsettings.json file into a custom configuration class. I've looked at several resources online but was not able to get the .Bin...

2 Sep at 14:38

Pass ILogger or ILoggerFactory to constructors in AspNet Core?

The MS docs article ["Introduction to Logging in ASP.NET Core"](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging?tabs=aspnetcore2x#log-category) gives 2 examples of constructor injec...

Writing and Reading excel files in C#

I am writing a program that takes data from a website via selenium web driver. I am trying to create football fixture for our projects. I am so far, I accomplished to take from the website. Also stil...

Protobuf equivalent of JsonHttpClient?

is there an equivalent of the new (-ish) JsonHttpClient that uses protobuf-net instead of JSON ? I realize that the old-style ProtobufServiceClient exists, but I'd like to replace it with something th...

2 Sep at 02:28

Sending http requests in C# with Unity

How can I send HTTP GET and POST requests in C# with Unity? What I want is: - - - What I've tried: - - - Most problems were with threading, I'm not experienced enough in it in C#. IDE, I use, i...

9 Sep at 14:55