React SPA / Embedded Identity Server issue after .net core 3 preview 8 upgrade

We have a React SPA which was initially created using the SPA templates and running on .NET Core 3 preview 7. The React SPA "The client" was configured for implicit flow and successfully using the oid...

Calling C# interface default method from implementing class

C# 8 supports default method implementations in interfaces. My idea was to inject a logging method into classes like this: ``` public interface ILoggable { void Log(string message) => DoSomething...

9 Sep at 11:37

Conditional dependency resolver on run-time (.net Core)

I have two classes `PaymentGatewayFoo`, `PaymentGatewayBoo` that both implements a common interface of `IPaymentGateway`: ``` interface IPaymentGateway { } class PaymentGatewayFoo : IPaymentGateway ...

2 Sep at 14:1

I have to integrate ServiceStack together with Kephas. How do I make them both play together with Dependency Injection?

ServiceStack uses a dialect of Funq (no support for metadata), where Kephas uses one of MEF/Autofac (requires metadata support). My question has two parts: - How to make ServiceStack and Kephas use o...

2 Sep at 13:23

Postfix ! (exclamation) operator in C#

The last day I was exploring .NET sources on GitHub and stumbled upon the following construct: `((SomeTypeToCast)variable!).SomeMethodToCall()`. Please, notice the postfix which is oroginally liste...

2 Sep at 11:5

"The project 'Web' must provide a value for Configuration" error after migrating to .NET Core 3

I've migrated an ASP.NET Core 2.2 project to Core 3.0 and am getting the error: > The project [Project location] must provide a value for Configuration. There's not really a lot to go on with that...

How to cancel .Net Core Web API request using Angular?

I have the following two applications - - I am making request to API using Angular's as shown below ``` this.subscription = this.httpClient.get('api/Controller/LongRunningProcess') ...

Unable to create an object of type 'MyContext'. For the different patterns supported at design time

I have ConsoleApplication on .NET Core and also I added my DbContext to dependencies, but howewer I have an error: > Unable to create an object of type 'MyContext'. For the different patterns supporte...

UserWarning: Could not import the lzma module. Your installed Python is incomplete

After Installing Google Cloud Bigquery Module, if I import the module into python code. I see this warning message. Happening to me in python 3.7.3 Virtualenv. Tried to reinstall GCP bigquery module ...

13 Nov at 12:28

Blob Code download much slower than MS Azure Storage Explorer

I'm downloading a blob from blob storage that is 1GB in size. If I use MS Azure storage explorer it takes under 10 minutes (I have a 20 megabits down line). However when I use code: ``` await blobR...

1 Jan at 10:6

How do I get the value of a tensor in PyTorch?

Printing a tensor `x` gives: ``` >>> x = torch.tensor([3]) >>> print(x) tensor([3]) ``` Indexing `x.data` gives: ``` >>> x.data[0] tensor(3) ``` How do I get just a regular non-tensor value `3`?

11 Jul at 08:46

Response includes stacktrace even though DebugMode and WriteErrorsToResponse are disabled

I am running a self-hosted API on the latest version of ServiceStack (5.6.0). I am struggling to deal with exceptions early on in the request processing pipeline. More specifically when requests con...

30 Aug at 12:5

How and Who calling the ConfigureServices and Configure method of startup class in .net core

As everyone know that Main method of Program.cs is the entry point of application. As you can see in the .net core default code created when we create any project. ``` public static void Main(string[]...

18 Jan at 08:43

Curious ambiguity in attribute specification (two using directives)

In an [attribute specification](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#attribute-specification), there is sometimes two valid ways to wri...

TypeError: cannot unpack non-iterable int objec

How can I solve this error After running my code as follows . I am using the function below and implementin running window for loop on it but end up getting the error below. The for loop works and hun...

How to fix ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)?

I am trying to send an email with python, but it keeps saying `ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)`. Here is my code: ``` server = smtplib.SMTP_SSL('smtp.mail...

22 Dec at 12:55

.NET Core environment variable returns null

I have a .NET Core console application. I'm trying to retrieve the environment variable using the below code. ``` var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); ``` ...

Mocking of extension method result in System.NotSupportedException

I'm unit testing a ClientService that uses the `IMemoryCache` interface: ClientService.cs: ``` public string Foo() { //... code _memoryCache.Set("MyKey", "SomeValue", new TimeSpan(0...

How do you read a simple value out of some json using System.Text.Json?

I have this json ``` {"id":"48e86841-f62c-42c9-ae20-b54ba8c35d6d"} ``` How do I get the `48e86841-f62c-42c9-ae20-b54ba8c35d6d` out of it? All examples I can find show to do something like ``` var ...

27 Nov at 05:26

ServiceStack: AppHost.OnRequestEndCallbacks handler gets called twice when an exception is thrown outside of a service

I have a snippet in the OnEndRequestCallbacks block of the app host that records a row in an audit table for business purposes. The unexpected behavior is that when a request fails for some reason out...

28 Aug at 19:6

VS 2019 optimize code in release mode broken?

For me it looks quite strange, and like a bug. This code in Release mode in Visual Studio 2019 provides infinite loop. ``` class Program { private static int _a; static void Main(string[] ar...

28 Aug at 13:17

Detect if I clicked on a certain part of text

I'm using Unity to create an Android/IOS application. In a page containing a paragraph, I want to know if I click on the last sentence of the text. ("Click here for more details" for example). After ...

28 Aug at 11:15

How could I avoid == null checking?

Here is my code which is used widely in project, and I'm wondering can I refactor this somehow so I might avoid `== null` checks all the time?

5 May at 13:37

Pitfalls when sharing IDbConnection in ServiceStack

I have a service that use several repositories. I want them all to use the same transaction so that, if anything goes wrong, I can rollback the transactions and nothing is left in an invalid state in ...

Servicestack JWT UserAuth null

When using JWT from postman. I get a bearer token. But all the requests when calling UserAuth from a service are null. Also In my custom AuthUSerSession session is null. I removed basicauth from th...

28 Aug at 06:7