Questions

Getting value from appsettings.json in .net core

Not sure what am I missing here but I am not able to get the values from my appsettings.json in my .net core application. I have my appsettings.json as: ``` { "AppSettings": { "Version": ...

update to python 3.7 using anaconda

[Python 3.7](https://docs.python.org/3.7/whatsnew/3.7.html) alpha version is out, but I haven't been able to find any post on how to update to python 3.7 using Anaconda - maybe they will wait for the ...

10 Jan at 15:38

ASP.NET Core 2.0 combining Cookies and Bearer Authorization for the same endpoint

I've created a new ASP.NET Core Web Application project in VS17 using the "Web Application (Model-View-Controller)" template and ".Net Framework" + "ASP.NET Core 2" as the configuration. The authentic...

How to convert xls file to xlsx file using C#?

I was developing an application which read data from an excel file, but when I try to open it, an exception  was thrown if the source file is saved with the (File contains corrupted data error when o...

8 Feb at 11:22

Unable to resolve service for type while attempting to activate

In my ASP.NET Core application, I get the following error: > InvalidOperationException: Unable to resolve service for type 'Cities.Models.IRepository' while attempting to activate 'Cities.Controllers....

How to solve npm install throwing fsevents warning on non-MAC OS?

Following warning is being thrown on `npm install` command - ``` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\rea ct-scripts\node_modules\fsevents): npm WARN notsup SK...

25 Oct at 10:29

xunit constructor runs before each test

In a test class, the constructor starts before each test and the initialized data provided by the constructor isn't reachable by the following tests. I'd like the initialized data to be accessible fo...

17 Mar at 14:25

Property 'controls' does not exist on type 'AbstractControl' Angular 4

I am trying a nested reactive form in Angular 4. It is working fine but when I try to build AOT it's throwing the error > 'controls' does not exist on type 'AbstractControl' I googled and tried few...

How to purge messages for Service Bus Topic Subscription

Just wondering the best way (even if via Portal, Powershell, or C#) to purge the messages off of a Service Bus Topic's Subscription. Imagine we have a topic with 4 subscriptions, and we only want to p...

Error: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler

I've setup the environment for react native on Windows. But when I run the command ``` react-native run-android ``` I get the following errors - ``` * What went wrong: A problem occurred configur...

24 Oct at 18:14

The type initializer for 'SQLite.SQLiteConnection' threw an exception

I'm trying to implement an incredibly basic use of SQLite. I have a `Button` and an `EditText`. I want to store the contents of the `EditText` `OnClick`. I'm following this: [https://developer.xamar...

Is there a way to revert to a previous commit in VS code?

Is there a way to revert to a previous git commit in VS code? I know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commi...

21 Dec at 22:0

Cannot find module 'aspnet-webpack' when using 'dotnet publish' in .Net Core 2.0 & Angular

I have been trying to follow answers to this problem but to no avail.. I am trying to publish my .Net Core 2.0 & Angular project using the command line command 'dotnet publish' I successfully publish,...

What's the difference between a ReadOnlyDictionary and an ImmutableDictionary?

In C#, what is the key difference (in terms of features or use cases) between these two containers? There doesn't appear to be any information comparing these on Google. [System.Collections.ObjectMod...

2 Dec at 15:52

ServiceStack RedisAuthRepository not storing anything

I have this problem where I'm trying to use ServiceStack RedisAuthRepository to store user information so I can use it to rehydrate the User Session that’s embedded in the JWT Token. So far this is my...

25 Oct at 13:4

Controlling menu with the arrow keys and enter

I was trying to create an RPG. I have a problem with the menu where I can choose a class. I was trying to create an menu where you can control the directions with the arrow keys to the specific class ...

7 May at 05:52

Detecting *all* emojis

Right now I'm using this piece of code : ``` public static bool ContainsEmoji(this string text) { Regex rgx = new Regex(@"\p{Cs}"); return rgx.IsMatch(text); } ``` And it's being somewhat ...

24 Oct at 08:28

DataTestMethod vs TestMethod

I started to use MSTest 2 `DataRow` attributes to check multiple cases in a single test: ``` [TestMethod] [DataRow(1, 1, 2)] [DataRow(1, 2, 3)] public void AdditionWorks(int op1, int op2, int expecte...

25 Oct at 11:33

Call SignalR Core Hub method from Controller

I am using ASP.NET Core 2.0 with Microsoft.AspNetCore.SignalR (1.0.0-alpha2-final). I have windows service which communicate with Excel, SolidEdge ... When operation is complete it post request to ...

How to Replace by pattern with Regex in C#

I have a text, the text contains char sequence which begins with # and ends with ="" characters. Between the # and ="" characters just exists alphanumeric characters, without space or ; chars. I tried...

24 Oct at 07:20

Uploading File using Ajax in Asp.Net Core

Good day everyone, I'm trying to upload file using ajax from client side to server side (asp.net core) controller but I'm having a null value. Here's my html and javascript codes: ``` <input type="...

24 Oct at 06:44

Using a null IDisposable value with the using statement

The following code produces no errors when executed: ``` using ((IDisposable)null) { Console.WriteLine("A"); } Console.WriteLine("B"); ``` `using` If so, where is it documented? Most C# code I...

24 Oct at 02:13

ReadKey InvalidOperationException application does not have a console

I am trying to use `ReadKey()` to get a password field so it doesn't show in the console for a .net core app I am running on Ubuntu. This is code: ``` while (true) { var key = System.Console.ReadK...

1 Jul at 21:7

Cannot resolve scoped service Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope from root provider

I'm trying to use in my ASP.NET Core 2.0 web app this sample [RazorViewEngineEmailTemplates](https://github.com/ianrufus/BlogPosts/tree/master/RazorViewEngineEmailTemplates) to create an html email bo...

23 Oct at 20:29

Read a YAML file in C#?

I am trying to read a .yaml file into my C# application, and store the data in a custom class. I am attempting this using `YamlDotNet` from nuget. The file is pasted below, and the code I have (from t...

22 May at 04:22