Questions

Using ActivatorUtilities.CreateInstance To Create Instance From Type

I am trying to rewrite some code in .Net Core using the built in .Net Dependency Injection. Previously, I was using the current code to create the instance (It was using Unity for DI) which worked gre...

Wrong return value in FromObjectDictionary method

I noticed in ServiceStack.Text\PlatformExtensions.cs file that FromObjectDictionary method could return a wrong value. ``` public static object FromObjectDictionary(this IReadOnlyDictionary<string, o...

4 Oct at 09:9

Multiple ng-content

I am trying to build a custom component using multiple `ng-content` in Angular 6, but this is not working and I have no idea why. This is my component code: ``` <div class="header-css-class"> <ng-...

Why are we receiving TypeIntializer Exception in ServiceStack after upgrading to Core 2.1 and Framework 4.7.2?

We have a Visual Studio C# solution with several projects including .NET Standard class libraries, .NET Framework applications (because they use 3rd party references that are written on Framework), an...

Batching on duration or threshold using TPL Dataflow

I have implemented a producer..consumer pattern using TPL Dataflow. The use case is that code reads messages from the Kafka bus. For efficiency, we need to process messages in batches when going to th...

NamedPipeServerStream.ReadAsync() does not exit when CancellationToken requests cancellation

When the NamedPipeServer stream reads any data from the pipe it does not react to `CancellationTokenSource.Cancel()` Why is that? How can I limit the time I'm waiting in the server for data from the...

How to add multiple policies in action using Authorize attribute using identity 2.0?

I am identity 2.1.2 with asp.net core 2.0, I have application claim table which have claim type and claim value i.e Assets ,Assets Edit,Assets, Assets View, where claim types are same with distinct c...

Can I use HttpClientFactory in a .NET.core app which is not ASP.NET Core?

I have read the popular blog post [https://www.stevejgordon.co.uk/introduction-to-httpclientfactory-aspnetcore](https://www.stevejgordon.co.uk/introduction-to-httpclientfactory-aspnetcore) on using Ht...

JSON.net deserialize object nested data

I'm working with SwiftType Elastic Search + C# and running into an issue deserializing the response due to the fact that SwiftType returns all of the fields as objects with a `raw` property ([https://...

How to initialize an object in TypeScript

I have a simple model class ``` export interface Category { name: string; description: string; } ``` I need to declare and initialize a variable in an angular component. Tried: ``` category:...

2 Oct at 20:48

Different NuGet package based on operating system

I have a test project in dotnet 2.1 that needs to work across multiple platforms (specifically, windows and linux-based systems) as well as access DB2 databases. IBM provides separate NuGet packages ...

2 Oct at 17:9

Why is ASP.NET Core executing a custom middleware only once?

I have an ASP.NET Core with the following controller that accepts a POST request: ``` [Route("api/v1/tenants/tests")] public class TestsController : Controller { [HttpPost] public IAct...

15 Jul at 11:35

Why does a for loop behave differently when migrating VB.NET code to C#?

I'm in the process of migrating a project from Visual Basic to C# and I've had to change how a `for` loop being used is declared. In VB.NET the `for` loop is declared below: ``` Dim stringValue As S...

30 Nov at 10:10

Select command in Servicestack.Ormlite is difference in 4.0.54 and 4.0.56 when I profiling

When I profiling the same select command: 4.0.50: ``` SELECT "CustomerID", "CustomerCode", "CustomerName" FROM "dbo"."Customer" WHERE "CustomerCode" In ('871110000','864483025') ``` 4.0.56: ``` e...

4 Oct at 04:47

WPF designer issues : XDG0008 The name "NumericTextBoxConvertor" does not exist in the namespace "clr-namespace:PulserTester.Convertors"

I have an error that not let me see my designer.. but I have no error on a build and my program runs fine with no problem I have tried to: - - - - Nothing helped. I have no idea what more I can to ...

12 Dec at 12:0

Change the JSON serialization settings of a single ASP.NET Core controller

I'm having two controller controllers: `ControllerA` and `ControllerB`. The base class of each controller is `Controller`. The `ControllerA` needs to return JSON in the default format (camelCase). Th...

Get claims and subscription in Web Api Controller (.Net Core 2.1)

I'm using JWT with .Net Core 2.1, and the ``` [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] ``` decorator on my controller class. In 2.0 it seemed you had to do some...

C# under Linux, Process.Start() exception of "No such file or directory"

I am having trouble calling a program with the Process class to start a program. The hierarchy to the executable is in under the bin directory while the current working directory needs to be under the...

1 Oct at 21:26

return tuple result in async method .net core

I have an async method. This method get list of 10 row from database and getting total count of query result. Because I'm using for grid pagination. So, I'm using tuple which one element is List and o...

1 Oct at 20:9

Azure File Storage: Create nested directories

My code looks like this ``` CloudFileClient client = ...; client.GetShareReference("fileStorageShare") .GetRootDirectoryReference() .GetDirectoryReference("one/two/three") .Create(); ```...

31 Dec at 08:0

.NET JIT compiler volatile optimizations

[https://msdn.microsoft.com/en-us/magazine/jj883956.aspx](https://msdn.microsoft.com/en-us/magazine/jj883956.aspx) > Consider the polling loop pattern:``` private bool _flag = true; public void Run(...

1 Oct at 13:29

How to configure CsvHelper to skip MissingFieldFound rows

``` public interface ICsvProductReaderConfigurationFactory { Configuration Build(); } public class CsvProductReaderConfigurationFactory : ICsvProductReaderConfigurationFactory { private reado...

11 Jan at 12:30

Why does Prettier not format code in VS Code?

In my Nuxt application where ESlint and Prettier are installed and enabled, I switched to Visual Studio Code. When I open a file and press + + and choose , my file does not get [formatted](https:/...

Convert Unicode surrogate pair to literal string

I am trying to read a high Unicode character from one string into another. For brevity, I will simplify my code as shown below: ``` public static void UnicodeTest() { var highUnicodeChar = ""; //...

1 Oct at 03:42

Post request in Laravel - Error - 419 Sorry, your session/ 419 your page has expired

I installed Laravel 5.7 Added a form to the file `\resources\views\welcome.blade.php` ``` <form method="POST" action="/foo" > @csrf <input type="text" name="name"/><br/> <input type="sub...

23 Jul at 16:50