Disable SQL logging in ORMLite

How do I turn off SQL logging? I have NLOG registered like so: ``` LogManager.LogFactory = new NLogFactory(); SetConfig(new HostConfig { AddRedirectParamsToQueryString = true, DebugMode...

21 Jun at 22:15

Why does this error occur when using SingleAsync?

Find if an item is duplicated. Expected: an exception to be thrown only if more than one item is found. but we get a different exception here? ``` try { // Find duplicate item ...

20 Jun at 16:10

Unable to create an object of type 'DbContext'

When I try to run ``` dotnet ef migration add Init ``` I get error > Unable to create an object of type 'IdentityContext'. I know what caused the problem. I wanted to learn using message bus and...

20 Jun at 13:30

Complement higher order function

I'm trying to write a complement function, such that when provided with a function `f`, it returns a function which, when provided with the same input as `f`, returns it's logical opposite. Having pu...

20 Jun at 08:5

C# 8 switch expression with multiple cases with same result

How can a switch expression be written to support multiple cases returning the same result? With C# prior to version 8, a switch may be written like so: ``` var switchValue = 3; var resultText = strin...

26 Nov at 00:34

How to return nested objects of many-to-many relationship with autoquery

Lets say I have 3 classes: ``` public class Book { [Autoincrement] public int Id {get; set;} public string Title {get; set;} [Reference] public list<BookAuthor> BookAuthors {get; ...

19 Jun at 19:15

ServiceStack: async/await service handlers

I have read a few SO questions that touches in this question, even though many of them are several years old: There are no docs on docs.servicestack.net that mentions async/await at all, I just fin...

How to enable or disable authentication using config parameter or variable?

I would like to implement a switch in configuration that allows to enable (`windowsAuth=true`) or disable Windows authentication (`windowsAuth=false`), so it will be used as anonymous. How to achieve...

Invalid hook call. Hooks can only be called inside of the body of a function component

I want to show some records in a table using React but I got this error: > Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the foll...

Module not found error in VS code despite the fact that I installed it

I'm trying to debug some python code using VS code. I'm getting the following error about a module that I am sure is installed. ``` Exception has occurred: ModuleNotFoundError No module named 'Simpl...

19 Jun at 00:15

"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure." when plotting figure with pyplot on Pycharm

I am trying to plot a simple graph using pyplot, e.g.: ``` import matplotlib.pyplot as plt plt.plot([1,2,3],[5,7,4]) plt.show() ``` but the figure does not appear and I get the following message: ...

18 Jun at 20:43

Does C# 8 support the .NET Framework?

In Visual Studio 2019 Advanced Build settings, C# 8 does not appear to be available for a .NET Framework project, only (as in the picture below) for a .NET Core 3.0 project: [](https://i.stack.imgur....

How to enable logging in EF Core 3?

I am using Entity Framework Core 3 Preview 5 and ASP.NET Core 3 Preview 5. In my Debug Output Window of Visual Studio 2019 I get no logs from EF Core. I read the documentation, but after that I am eve...

How can I write unit test for my background service?

I'm working with the HostBuilder in .NET Core (not the WebHost !). I have one Hosted Service running in my application that overrides the ExecuteAsync/StopAsync methods of the background Service and I...

Use preview features & preview language in Visual Studio

How can I turn on features in Visual Studio? > The feature 'nullable reference types' is currently in Preview and "unsupported". To use Preview features, use the 'preview' language version. The pr...

23 Jun at 21:21

C# compiler throws Language Version (LangVersion) reference error "Invalid 'nullable' value: 'Enable' for C# 7.3"

I have solution with couple .NET Standard projects in all I wanted to enable c# 8 and nullable like below: ``` <PropertyGroup> <TargetFramework>netstandard2.1</TargetFramework> <LangVersion>8....

How to Style React-Icons

I am trying to figure out how to style icons that I import using [react-icons](https://react-icons.netlify.com/#/). In particular, I would like to be able to create a look similar to this: [](https:...

17 Jun at 17:44

Activate auto-complete for C# in Visual Studio 2019

I have the problem, that I get some suggestions for autocompletion (for example, I type "Cons" and I get the suggestion for "Console"), but these can't be applied with the Return-key. Normally, the s...

17 Jun at 09:28

Could not find the implementation for builder @angular-devkit/build-angular:dev-server on ng serve command

I tried to update the angular CLI following [this](https://www.npmjs.com/package/@angular/cli#updating-angular-cli), but now I can't run my app. When I try to run the command `ng serve`, it gives me t...

How to resolve .NET Core package version conflicts

I am migrating from a .NET MVC 5 Web Application to a .NET Core 2.2 Web API project along with five .NET Standard 2.0 projects all housed under one solution. I am now receiving 28 warnings (MSB3277)...

Display wait or spinner on API call

In my Blazor app I am making an API call to a back end server that could take some time. I need to display feedback to the user, a wait cursor or a "spinner" image. How is this done in Blazor? I have ...

7 Oct at 20:5

What is the behaviour of the '==' operator for a generic type value and the 'default' keyword?

Part 1 of the question: In the following code why does `value == default` compile fine but the other alternatives do not? ``` bool MyEqual<T>(T value) { T value2 = default; if (value == value...

14 Jun at 17:25

Where does ServiceStack publish vulnerability information?

If a vulnerability were to be discovered for any versions 3/4/5 and a patch were to be released - where would ServiceStack publish vulnerability information?

14 Jun at 12:28

Check that button is disabled in react-testing-library

I have a React component that generates a button whose content contains a `<span>` element like this one: ``` function Click(props) { return ( <button disable={props.disable}> ...

25 Jan at 15:49

How to validate uploaded file in ASP.Net Core

I'm using ASP.NET Core 2.2 and I'm using model binding for uploading file. This is my ``` public class UserViewModel { [Required(ErrorMessage = "Please select a file.")] [DataType(DataType...

13 Jun at 22:29