Is this pattern matching expression equivalent to not null
I stumbled upon [this code](https://github.com/devmentors/Nanoservice/blob/37f5e3afee84dabefad654495ea0839e90032200/src/Sidecar/Program.cs#L71) on github: ``` if (requestHeaders is {}) ``` and I do...
Publish Single File (Release) fails for WPF .NET Core 3.1 application
I'm trying to publish a WPF Application (to a folder) targeting .NET Core 3.1, using Publish Single File, targeting win-x86. The application publishes fine for Debug, but fails for Release. If I desel...
- Modified
- 16 Dec at 13:37
How to Upload File from Angular to ASP.NET Core Web API
Similar questions have been asked but after looking through all of those and many blog posts on the subject I have not been able to figure this out so please forgive me. I am creating a simple blog w...
- Modified
- 16 Dec at 01:36
Equivalent of UseUrls for .NET Core IHostBuilder
Previously, with .NET Core, I could add `UseUrls` to my `Program.cs` file to set the URL that the web server would run on: However, in .NET Core 3.1, the default format of `Program.cs` changed: I trie...
- Modified
- 6 May at 05:43
No handles with labels found to put in legend
I'm trying to create a parallelogram in PyPlot. I'm not up to drawing the parallelogram--first I'm putting in the vector arrows--using the following code: ``` fig = plt.figure() ax = fig.add_subplot(1...
- Modified
- 12 Jul at 17:52
Error occurred while access Microsoft.Extensions.HostingServices. Could not parse JSON file
I was trying to create a migration for an MVC ASP.NET Core 3.10 project using Visual Studio 2019. I got two errors: 1. An error occurred while accessing the Microsoft.Extensions.Hosting services. Co...
- Modified
- 15 Dec at 18:2
Problem with EF OrderBy after migration to .net core 3.1
Consider this code: ``` _dbContext.Messages .GroupBy(m => new { MinId = m.SenderId <= m.RecipientId ? m.SenderId : m.RecipientId, MaxId = m.SenderId > m.RecipientI...
- Modified
- 15 Dec at 19:4
Message: Trying to access array offset on value of type null
I'm getting this error on multiple occasion in a script (invoiceplane) I have been using for a few years now but which hasn't been maintained unfortunately by its creators: ``` Message: Trying to acc...
Error when trying to run code: Debugger operation failed, Native error= Cannot find the specified file
I recently completely transitioned to Linux but struggle to find a good way to code in C#. I discovered Monodevelop which looks similar to Visual Studio, but whenever I try to run any code I get this ...
- Modified
- 30 Aug at 09:31
Xamarin & IIS LocalHost WebApi gives error - System.Net.Http.HttpRequestException: 'Network subsystem is down'
I have 2 Applications here. One is a Xamarin Application and the other is a Asp.Net MVC Application which has the WebApi to connect to a SqlServer Database "where the database is on a Hosted Website o...
- Modified
- 14 Dec at 11:24
How use Microsoft.Extensions.Logging from Library code?
I have a hard time understanding what is the best way to use Microsoft.Extensions.Logging in a general library. with NLog you can do: ``` public class MyClass { private static readonly NLog.Logger...
Error while validating the service descriptor 'ServiceType: INewsRepository Lifetime: Singleton ImplementationType: NewsRepository':
I try get data from my database with repository Pattern i have 3 project > Bmu.Mode 'this is for model to create database'Bmu.Repo 'it have 2 folder for repository include contract/InewsRepository....
- Modified
- 13 Dec at 21:9
CorsAuthorizationFilterFactory in asp.net core 3
I am trying to migrate a project from asp.net Core 2.2.6 to asp.net core 3.0 In my startup I had ``` services.AddMvc(options => { options.Filters.Add(new CorsAuthorizationFilterFactory("default")...
- Modified
- 13 Dec at 15:20
Command to clear all breakpoints in VSCode (as in visual studio)
In visual studio you can `Ctrl+Shit+F9` to clear all breakpoints. Is there a similar function in VsCode? I couldn't find any good answer. Thanks!
- Modified
- 13 Dec at 14:16
C#.net Web Request could not get 404 custom error message while calling web API but postman does
I am calling external Web API in my own Web API using ServiceStack. For the unsubscribed user, external web API throws expected "404 Not found" exception with the custom message as . I can see it in...
- Modified
- 13 Dec at 09:4
How to get the digits before some particular word using regex in c#?
We will use below regex to get the digits before the words. Example : > 838123 someWord 8 someWord 12 someWord `(\d+)\s*someWord` But sometimes anything will come between Number and word.Ple...
Deserialize anonymous type with System.Text.Json
I am updating some apps for .NET Core 3.x, and as part of that I'm trying to move from `Json.NET` to the new `System.Text.Json` classes. With Json.NET, I could deserialize an anonymous type like so: ...
- Modified
- 12 Dec at 22:2
Why does this code give a "Possible null reference return" compiler warning?
Consider the following code: ``` using System; #nullable enable namespace Demo { public sealed class TestClass { public string Test() { bool isNull = _test == nu...
- Modified
- 12 Dec at 15:26
How to upgrade all solution projects .Net framework 4.5.1 to 4.8 Visual Studio 2019
I have a solution in Visual Studio 2019 with many C # projects. I need to retarget all of the projects from the .NET Framework 4.5.1 to 4.8. Is it possible to change target at once or do I have to do ...
- Modified
- 12 Dec at 13:46
How can I get access to the IWebHostEnvironment from within an ASP.NET Core 3 controller?
I would like to be able to browse a directory in the web root (such as my \img directory or \pdf directory) from code within a controller. I would like to use something like the following where `env`...
- Modified
- 12 Dec at 13:16
No IUserTwoFactorTokenProvider named 'Default' is registered. Problem is AddDefaultTokenProviders() in two (2) ASP.NET Core Identity registrations
I have (2) `Identity systems`, each in its own `Context`: ``` 1: CustomerContext : IdentityDbContext<CustomerUser> 2: ApplicationContext : IdentityDbContext<ApplicationUser> ``` I have successfully...
- Modified
- 12 Dec at 11:45
Rendering view to string in core 3.0: Could not find an IRouter associated with the ActionContext
In my application, I want to use a template for my e-mails. Unfortunately code I used before in another project doesn't work anymore. ``` Could not find an IRouter associated with the ActionConte...
- Modified
- 12 Dec at 10:25
What's the difference between returning AsyncEnumerable with EnumeratorCancellation or looping WithCancellation
I have the following method that reads a csv document from a http stream ``` public async IAsyncEnumerable<Line> GetLines([EnumeratorCancellation] CancellationToken cancellationToken) { HttpRespo...
- Modified
- 15 Jun at 13:4
How to pass a URL input parameter value to Blazor page?
This passes a value into a blazor component ``` [Parameter] public string Id { get; set; } ``` But what about passing a value from the URL input parameter?
- Modified
- 12 Dec at 07:0
Initialize Google Protobuf RepeatedField collections
When you try to initialize a repeated field member (property) of already generated Google Protobuf message type, you can't use a setter since they are read-only. How to initialize google Protobuf mess...
- Modified
- 16 Aug at 11:23