When to null-check arguments with nullable reference types enabled
Given a function in a program using C# 8.0's nullable reference types feature, should I still be performing null checks on the arguments? ``` void Foo(string s, object o) { if (s == null) throw n...
- Modified
- 14 Jul at 03:24
.NET Core console app fails to run on Windows Server
I have a relatively simple .NET Core console app. It has no external dependencies. I build it using the following: dotnet publish -c Release -r win10-x64 It generates a `\bin\Release\netcoreapp2.2\w...
- Modified
- 4 Jun at 03:41
Randomly getting Renci.SshNet.SftpClient.Connect throwing SshConnectionException
I've seen other threads about this error, but I am having this error randomly. Out of 30 connects, 12 got this error. Trying to understand why this is, and what possible solutions are. ``` using (Sf...
How do I add color to my svg image in react
I have a list of icons. I want to change the icons colors to white. By default my icons are black. Any suggestions guys? I normally use `'fill: white'` in my css but now that I am doing this in Reac...
How can I cast Memory<T> to another
We can cast `Span<T>` and `ReadOnlySpan<T>` to another using [MemoryMarshal.Cast](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.memorymarshal.cast) method overloads. Like...
- Modified
- 4 Feb at 06:54
How to control which order the EF Core run custom migrations?
I am running an application that uses custom migrations (the auto generated ones don't fit my requirements). I am trying to understand how to control in which order the Entity Framework will run those...
- Modified
- 3 Feb at 08:38
Asp.net Core Email confirmation sometimes says InvalidToken
I am using asp.net core identity 2.1 and i am having a random issue with email confirmation, which while email confirmation sometimes says . The token is also not expired. We are using , and we have...
- Modified
- 20 Feb at 12:9
Alternative to XML Documentation Comments in C#
When asking around for the conventions of documentation comments in C# code, the answer always leads to using XML comments. Microsoft recommends this approach themselves aswell. [https://learn.microso...
- Modified
- 2 Feb at 20:49
Typescript: Type 'string | undefined' is not assignable to type 'string'
When I make any property of an interface optional, and while assigning its member to some other variable like this: ``` interface Person { name?: string, age?: string, gender?: string, occupat...
- Modified
- 9 May at 12:24
Is it safe to call StateHasChanged() from an arbitrary thread?
Is it safe to call `StateHasChanged()` from an arbitrary thread? Let me give you some context. Imagine a Server-side Blazor/Razor Components application where you have: - `NewsProvider``BreakingNews...
- Modified
- 2 Feb at 23:43
What is the C# equivalent to Promise.all?
I would like to fetch data from multiple locations from Firebase Realtime Database like described [here](https://stackoverflow.com/a/43485344/4841380) and [here](https://stackoverflow.com/a/35932786/4...
- Modified
- 4 Aug at 23:59
C# Jwt Token generation failed asp.net core 2.2
i am trying to generate token for userId, unfortunately i am not able to get it worked. This is my JwtTokenGenerator class ``` namespace WebApiDocker.Config.Jwt { //https://www.c-sharpcorner.com...
- Modified
- 2 Feb at 11:8
Media query syntax for Reactjs
How do I do the following CSS media query in Reactjs? ``` .heading { text-align: right; /* media queries */ @media (max-width: 767px) { text-align: center; } @media (max-width: 400px) {...
- Modified
- 15 Jun at 21:16
error converting YAML to JSON, did not find expected key kubernetes
I am doing a lab about kubernetes in google cloud. I have create the YAML file, but when I am trying to deploy it a shell shows me this error: ``` error converting YAML to JSON: yaml: line 34: did ...
- Modified
- 7 Dec at 18:0
Typescript: Type X is missing the following properties from type Y length, pop, push, concat, and 26 more. [2740]
I have this Product interface: ``` export interface Product{ code: string; description: string; type: string; } ``` Service with method calling product endpoint: ``` public getProducts(): Obser...
- Modified
- 2 Jul at 12:58
What is wrong with this code. Why can't I use SqlConnection?
I am 100% newbie to SQl and wanted to make a ConsoleApp with the use of database. I read some about it and tried. When I needed to make SqlConnection, my VS 2019 Preview showed me this > Severity ...
How to solve Warning: React does not recognize the X prop on a DOM element
I'm using a thing called [react-firebase-js](https://react-firebase-js.com) to handle firebase auth, but my understanding of react and of the provider-consumer idea is limited. I started with a bui...
- Modified
- 4 Feb at 16:42
Blazor: Managing Environment Specific Variables
How can I manage access variables which differ among environments in client side blazor? Normally since I use Azure to publish applications, I'd use the `appsettings.json` file for local app settings ...
- Modified
- 1 Feb at 11:30
RangeError: Invalid time value
I'm getting frequent errors when i start my server. Here is the error: Here is the code: ``` var start = timestamp; const expiryDate = (new Date(start)).toISOString().split('T')[0]; ```
- Modified
- 31 Jan at 14:5
404 from server events heartbeat endpoint
We are recieving proportionately low but consistent 404 from server events from a channel subscription. This seems to only be via our react interface which uses the typescript adapter here: [https://...
- Modified
- 31 Jan at 13:28
How to return 403 instead of redirect to access denied when AuthorizeFilter fails
In Startup.ConfigureServices() I configure authorization filter like this: ``` services.AddMvc(options => { options.Filters.Add(new AuthorizeFilter(myAuthorizationPolicy)); }) ``` and I use eit...
- Modified
- 31 Jan at 12:55
How to detect we're running under the ARM64 version of Windows 10 in .NET?
I created a C# .NET console application that can run in Windows 10 x86, x64 and ARM64 (via emulator layer). I would like to know how to detect that the application is running in those platforms. I kno...
Microsoft.SqlServer.Types incompatible with .NET Standard
I'm attempting to convert all of our C# class libraries from .NET Framework to .NET Standard projects, as we are starting to leverage .NET Core so need these to be consumable by both .NET Core and .NE...
- Modified
- 12 Jul at 12:54
ServiceModel vs ServiceInterface in Servicestack
What is the correct approach to structure a ServiceStack project? As of now I do it in the following way: Under `ServiceModel`, I have all the models (entities), and have defined the different route...
- Modified
- 30 Jan at 23:1
How do I run/test my Flutter app on a real device?
I want to run/test (not automated test) my Flutter app on a real iPhone and Android phone during development. However, Flutter docs seem to only document how to do it with the iOS simulator or Android...
- Modified
- 21 Feb at 03:37