Using a custom sink with ServiceStack.Logging.Serilog?

Is there a non-obvious way (to me at least) to add a custom sink e.g. MongoDB or MicrosoftTeams as part of instantiating the Serilog factory in the ServiceStack framework or will it be a case of rolli...

9 Aug at 22:8

append dictionary to data frame

I have a function, which returns a dictionary like this: ``` {'truth': 185.179993, 'day1': 197.22307753038834, 'day2': 197.26118010160317, 'day3': 197.19846975345905, 'day4': 197.1490578795196, 'day5...

9 Aug at 20:41

TryValidateModel in asp.net core throws Null Reference Exception while performing unit test

I'm trying to write unit tests for ModelState validation for an Asp.Net Core Web API. I read that, the best way to do so is to use `TryValidateModel` function. But, every time I run the unit test, it...

10 Aug at 04:34

Generic Repository or Specific Repository for each entity?

## Background At the company I work for I have been ordered to update an old MVC app and implement a repository pattern for a SQL database. I have created the context of the database using Entity ...

How to add Mime Types in ASP.NET Core

When developing an application using .NET Framework 4.6 (MVC4/5), I used to add custom mime types in the web.config file, like this (this is the actual mime types I need to add in my app): ``` <syste...

9 Aug at 19:48

Why do HTTPS requests produce SSL CERTIFICATE_VERIFY_FAILED error?

Here is my Python code: ``` import requests requests.get('https://google.com') ``` This is the error: ``` requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443): Max retri...

2 Sep at 12:54

Is there a way to print a console message with Flutter?

I'm debugging an app, but I need to know some values in the fly, I was wondering if there's a way to print a message in console like console.log using Javascript. I appreciate the help.

9 Aug at 13:11

How to get user id from email address in Microsoft Graph API C#

I want to add User to a Group but I don't have the User's `id`, I only have the email address. Here is the code: ``` User userToAdd = await graphClient .Users["objectID"] .Request() .Get...

9 Aug at 13:30

exceptions in my service stack service not moving messages to dead letter queue

I have a service stack service with the standard service stack RabbitMQ abstraction. Message queues are automatically created for my type MyRequest, and I have a service method which I have set up to ...

10 Aug at 10:15

Element in unit tests left pending after completion

I'm seeing this warnings in Resharper after running tests, all the tests pass. > 2018.08.09 11:11:58.524 WARN Element Data.Tests.Infra.IntegrationTests.ResolvedIdentityTests was left pending aft...

9 Aug at 10:17

Why is there Console.Error() in C#, but no Console.Warning?

In C#, if we want to output an error to the console, we can simply write: ``` Console.Error.Write("Error!"); ``` But when I try to write a warning to the console, I found that there isn't any: ``` Co...

19 Jan at 00:57

Cancel or Delete Scheduled Job - HangFire

I have scheduled a Job via using Hangfire library. My scheduled Code like below. ``` BackgroundJob.Schedule(() => MyRepository.SomeMethod(2),TimeSpan.FromDays(7)); public static bool DownGradeUserPl...

19 Sep at 22:20

Multipart Content with refit

I am using multipart with Refit. I try to upload profile picture for my service the code generated from postman is looking like this ``` var client = new RestClient("http://api.example.com/api/users/...

10 Aug at 15:9

System.InvalidOperationException: Value must be set. Setting Null Parameters for SQLite

I am using Microsoft.Data.Sqlite 2.1.0 on .NETStandard 2.0 and .NET Core 2.1.0 to interact with a local SQLite database. SQLitePCL is mentioned in the exception and is also a dependency. I want to b...

3 Dec at 09:8

How to break ForEach Loop in TypeScript

I have a the below code, on which i am unable to break the loop on certain conditions. ``` function isVoteTally(): boolean { let count = false; this.tab.committee.ratings.forEach((element) => { ...

Where does .net core search for certificates on linux platform

On Windows, for .NET Framework classes we can specify `sslkeyrepository` as *SYSTEM/*USER.On `linux` where does the .NET Core classes search for the `certificates` by default and what could be the val...

How to use FirstOrDefaultAsync() in async await WEB API's

I have created one .NET Core API , where my all methods are asynchronous but there is one requirement like `GetBalance()` which just return one entity (record) only. I am not able to using `SingleOrDe...

ActionResult<IEnumerable<T>> has to return a List<T>

Take the following code using ASP.NET Core 2.1: ``` [HttpGet("/unresolved")] public async Task<ActionResult<IEnumerable<UnresolvedIdentity>>> GetUnresolvedIdentities() { var results = await _ident...

Why does this code crash Visual Studio 2015?

For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why? ``` unsafe struct node { node*[] child; } ``` It seems to occur when ...

.Net core HttpClient bug? SocketException: An existing connection was forcibly closed by the remote host

The following code runs without any error in a full .Net framework console program. However, it got the following error when running in .Net core 2.1. ``` class Program { static void Main(str...

7 Aug at 18:12

Error build VSTS: ## [error] Error: Unable to locate the 'nuget'

I created a test project with C# + SpecFlow and I am trying to build the solution through VSTS, however in Nuget Restore is presenting the error below. > 2018-08-07T15:29:39.6678023Z ##[error]Error: ...

13 Aug at 21:13

What are single and zero element tuples good for?

C# 7.0 introduced value tuples and also some language level support for them. They [added the support](https://github.com/dotnet/corefx/blob/master/src/System.ValueTuple/src/System/ValueTuple/ValueTup...

7 Aug at 09:8

c# Anonymous Interface Implementation

i've already seen this question a few times but i still don't get it. In Java, i can do this: ``` new Thread(new Runnable(){ @Override public void run() { System.out.println("Hello"); } })....

7 Aug at 09:5

How to Generate ASP.NET Password using PHP

I have existing ap.net c# website is working with mysql database. now i am planning to create mobile app for that website for that API needs to be ready. I am creating an API into PHP Laravel Framewor...

7 Aug at 07:7

Find the smallest positive integer that does not occur in a given sequence

I was trying to solve this problem: > Write a function:``` class Solution { public int solution(int[] A); } ``` that, given an array A of N integers, returns the smallest positive integer (greater tha...

12 May at 15:12