Upgrade ServiceStack with Castle.Windsor from 4.x to 5.7

We upgraded ServiceStack from v4.x to v5.7 for ASP.NET 4.5.2 In v4.x we used Castle.Windsor with PerWebRequst lifecycle. We updated it to LifestyleScoped. Error we recieved: Scope was not available. D...

13 Nov at 04:59

NLog with Application Insights - logging exceptions as an exception instead of a trace

Currently I am using a .NET Core Web Application built using Service Stack. Logging is currently provided by using NLog, with Azure Application Insights as a target. Currently when I log messages and...

Blazor Component Reference Null on First Render

I have a custom component with an event Action called TabChanged. In my Razor page I set the reference to it up like so: ``` <TabSet @ref="tabSet"> ... </TabSet> @code { private TabSet tabSet;...

Service Stack [Required] Annotation does not work

I have a model and I have added a required annotation on it but it does not do anything. It does not throw any error. Do I have to add something to configuration to make sure annotations are fired. `...

12 Nov at 19:48

Does ServiceStack 4 keep logs of the received HTTP request?

Is there any log file automatically created and maintained by the ServiceStack web server

12 Nov at 16:43

ServiceStack RedisPubSubServer will enter in OnStop, OnInit, and OnStart frequently

Here is my situation: 1. I instantiate a RedisPubSubServer and configure it with OnInit, OnStart, and OnStop callbacks. 2. I keep this reference as long as the application lives and, in the end, I d...

13 Nov at 13:54

Returning a custom HTTP response code when the authentication fails for a custom basic auth provider

I know that I can return a custom reponse when using a custom authentication provider like the code below: Return a custom auth response object from ServiceStack authentication I'm just wondering if...

12 Nov at 15:12

Azure Function should log or throw exception on error?

I have Azure Function (Http trigger) that can fail. I also have Application Insights configured for it. In case of error (Which is better): 1. Catch exception, wrap with more info and rethrow it. (...

Automapper Object reference is required for the non static field, method or property

I recently Upgraded my .net core to 3.0 and Automapper from 6.2 to 9.0. Now the automapper is throwing the following compile time error when using mapper.map inside mapfrom function. ``` CreateMap<Do...

11 Nov at 20:27

@attribute [AllowAnonymous] in Blazor server-side component has no effect

I have created a fresh Blazor server-side project with .NET Core 3.0 and have closed down the application for non-authenticated users. I am now trying to allow anonymous access to Index.razor compon...

C# 8 understanding await using syntax

I have next method: ``` public async Task<IEnumerable<Quote>> GetQuotesAsync() { using var connection = new SqlConnection(_connectionString); var allQuotes = await connection.QueryAsync<Quot...

System.Text.Json.JsonSerializer.Serialize returns empty Json object "{}"

Environment: Visual Studio 2019 16.3.8, .NET 3.0.100, .NET Core 3.0 unit test. All 3 calls below to System.Text.Json.JsonSerializer.Serialize return empty objects: "{}" I must be doing something wro...

9 Nov at 23:35

ServiceStack - [Authenticate] attribute is called before request filters. Does not work with OrmLiteMultitenancyAuthRepository / OrmLiteCacheClient

I have a multitenant application with a schema per tenant postgres database The database contains the following schemas: ``` tenant_cf5f3518bd524c3797b884457b374e50 tenant_46255f07079046139f8c0f9429...

9 Nov at 15:46

Restrictions on arguments to PathRelativePathTo in a "long path aware" environment

For a [long path aware](https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/) process on Windows 10, I'm trying to understand what the argument restrictions ...

14 Nov at 02:49

TS2339: Property 'style' does not exist on type 'Element'

Here's the code: ``` const test = Array.from(document.getElementsByClassName('mat-form-field-infix')); test.forEach((element) => { element.outerHTML = '<div class="good-day-today" style="width: 0...

8 Nov at 20:52

Performing a health check in .NET Core Worker Service

How can I implement health checks in a .NET Core Worker Service? The service will be run inside Docker and needs to be able to check the health of the service.

23 Dec at 04:59

How do I generate .proto files or use 'Code First gRPC' in C#

I want to use gRPC with .NET in an asp.net core web application. How do I generate the necessary .proto file from an existing C# class and model objects? I don't want to re-write a .proto file that mi...

12 Jan at 20:40

The AsyncTask API is deprecated in Android 11. What are the alternatives?

Google is deprecating Android AsyncTask API in Android 11 and suggesting to use `java.util.concurrent` instead. you can check out the commit [here](https://android-review.googlesource.com/c/platform/f...

Nuget package creation - Class library that targets .NET framework 4.6.1 can not target correct framework

I created a class library that targets .net framework 4.6.1 (so pretty much a blank canvas, with a single method to return a string, just for testing purposes). I want to make this into a nuget packag...

8 Nov at 15:31

Object Oriented Programming - how to avoid duplication in processes that differ slightly depending on a variable

Something that comes up quite a lot in my current work is that there is a generalised process that needs to happen, but then the odd part of that process needs to happen slightly differently depending...

17 Sep at 14:22

Cannot install dotnet-ef tool on Windows 10

I'm trying to install the `dotnet-ef` tool via the dotnet-cli. The command that I enter: `dotnet tool install --global dotnet-ef` I gives me the following error: ``` The tool package could not be r...

CMD opens Windows Store when I type 'python'

Today when I tried to run simple code on Sublime Text 3, the following message appeared: > Python was not found but can be installed from the Microsoft Store: [https://go.microsoft.com/fwlink?linkID=2...

17 Jun at 22:55

How to set basepath for openapi with servicestack?

The REST endpoints of my application all start with /api/. The swagger-ui lists all REST pathes under /api/, which is a mess. I want to set the basepath to /api/, so that only the REST endpoints are ...

How to use new c# 8.0 features in Razor views

I've updated my ASP.NET Mvc 5 web application to use the new c# 8.0 features through Visual Studio 2019 and everything works fine until I try to use these new features inside a Razor view. For exampl...

7 Nov at 14:49

Why declare a local function static in C# 8.0

In C# 8.0, [Static Local Functions are announced](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#static-local-functions) Can anyone help enlighten me as to why you would want to d...

7 Nov at 09:36