Task Exception Handling without Wait
When working with Tasks, I am not sure how to do handling when I do not call Wait on my task. The example below is not executed in an async method. Here is an example: ``` var t = Task.Run(() => { ...
ServiceStack Identity on field other than PK - Insert fails
When I try to use the "Insert" function in ServiceStack (against SQL Server 2014) using an object from the below class, it tries to insert a 0 (default of the ContactId property) for the ContactId ins...
- Modified
- 5 Jul at 19:48
Separating digits for large numbers in C# code
In C++ you can separate the digits for readability in your code with apostrophes: ``` int num = 1'000'000; ``` In Ruby, you can use underscores: ``` num = 1_000_000 ``` Is there a similar syntax...
- Modified
- 5 Jul at 18:2
Is it possible to change the colour of the line below / Border of a TextBox (Entry)
I am creating a `Xamarin.Forms` application on `Android` and I am trying to change the colour of the line below my `Xamarin.Forms` `Entry` control. I have an `Entry` control like so: ``` <Entry Text...
- Modified
- 5 Jul at 15:20
Why does C# require parentheses when using nullables in an expression?
I'm new to C# and while exploring the language features, I came across something strange: ``` struct Foo { public Foo Identity() { return this; } public static void Bar(Foo? foo) { ...
Roslyn throws The language 'C#' is not supported
I have created a and did some processing and also used Roslyn to generate code. I use the library in a WPF GUI application as a reference. These are the NuGet packages: [](https://i.stack.imgur.co...
JSON properties now lower case on swap from ASP .Net Core 1.0.0-rc2-final to 1.0.0
I've just swapped our project from ASP .Net Core 1.0.0-rc2-final to 1.0.0. Our website and client have stopped working because of the capitalization of JSON properties. For example, this line of JavaS...
- Modified
- 14 Jan at 20:26
NSubstitute: Difference between Substitute.For<> and Substitute.ForPartsOf
I'm using NSubstitute. I have to fake a class and cannot dig out the difference of [Substitute.For<...>()](http://nsubstitute.github.io/help/creating-a-substitute/) and [Substitute.ForPartsOf<...>](ht...
- Modified
- 5 Jul at 09:4
How to properly mask a numpy 2D array?
Say I have a two dimensional array of coordinates that looks something like `x = array([[1,2],[2,3],[3,4]])` Previously in my work so far, I generated a mask that ends up looking something like `ma...
- Modified
- 5 Jul at 01:18
How to unapply a migration in ASP.NET Core with EF Core
When I run `PM> Remove-Migration -context BloggingContext` in VS2015 with an ASP.NET Core project using EF Core I get the following error: ``` System.InvalidOperationException: The migration '2016070...
- Modified
- 4 Jul at 22:9
Convert ICollection<T> to List<T>
I am trying to convert ICollection to List using below code- ``` ICollection<DataStructure> list_Stuctures = dataConnectorService.ListStructures(dataConnector, SupportedDataStructures.All); List<Data...
- Modified
- 20 Jun at 09:12
Dapper.net "where ... in" query doesn't work with PostgreSQL
The following query always produces the error ". ``` connection.Query<CarStatsProjection>( @"select manufacturer, model, year, AVG(price) as averageprice, AVG(miles) as averagemiles,...
- Modified
- 5 Jul at 06:57
Firebase 3: creating a custom authentication token using .net and c#
I'm trying to implement Firebase 3 Authentication mechanism using Custom Tokens (as described at https:// firebase.google.com/docs/auth/server/create-custom-tokens). My server is ASP.NET MVC Applicat...
- Modified
- 5 Jul at 16:4
Email attachment with long non-ascii name
I try to send `System.Net.Mail.MailMessage` with `System.Net.Mail.Attachment`. Name of attachment is "Счёт-договор №4321 от 4 июля.pdf" Code for attachment creation: ``` var nameEncoding = Encodin...
- Modified
- 5 Jul at 01:14
PM2 command not found
I installed node.js and npm to my centOS 7 server. But i have problems with pm2. Actually real problem is i don't have experiences in linux and i don't know how to change path. Here is folder structur...
How to add IHttpContextAccessor in the Startup class in the DI in ASP.NET Core 1.0?
In ASP.NET Core RC 1 I used the following code to retrieve the value of context (full address of the page). Then I recorded this value in the configuration. ``` public class Startup { public I...
- Modified
- 20 Jun at 09:12
.net core 1.0 visual studio referencing external dll
with the release of the .net core i have been trying to build a simple project, however whenever i try and add a dll reference in my project i get the following message "" i was getting this messag...
How to automatically populate CreatedDate and ModifiedDate?
I am learning ASP.NET Core MVC and my model is ``` namespace Joukyuu.Models { public class Passage { public int PassageId { get; set; } public string Contents { get; set; } ...
- Modified
- 4 Jul at 10:57
How to resolve un-registered type using standard MVC Core dependency injection
Is there a way to get `IServiceProvider.GetService<T>` to return an instance even if `T` is not explicitly registered with the container? If I know that `T` has dependencies I'd like them to be injec...
- Modified
- 27 Jan at 11:10
Read Json data from text file C#
I have a text file with below format data ``` [ { "SponsorID": 1, "FirstBAID": 7395836 }, { "SponsorID": 2, "FirstBAID": 3509279, "SecondBAID": 29...
Is there any way to debug chrome in any IOS device
Is there any way to debug chrome browser on IOS device? If there is no way, how i can approach to bug in chrome on ios? Searched the web and didn't find sufficient answer.
- Modified
- 4 Jul at 07:48
How to log state transitions in Stateless (.NET state machine library)
I would like to have a log in database of state transitions of my workflow. Where is the best place to trigger logging with [Stateless](https://github.com/dotnet-state-machine/stateless)? Should it b...
- Modified
- 4 Jul at 07:14
Converting bool expression to char in c#
I passed .NET quiz, when I met a question like below one. ``` Char ch = Convert.ToChar('a' | 'e' | 'c' | 'a'); ``` In console we can see that output for `ch` variable is `g`. Can someone describe ...
How can I ensure that appsettings.dev.json gets copied to the output folder?
I have three configuration files, one for each environment: 1. appsettings.json -> production 2. appsettings.dev.json -> development 3. appsettings.stg.json -> staging If I set to , I get a runt...
- Modified
- 12 Sep at 21:35
Javascript Map Array Last Item
I have this: ``` map = ranks.map((row, r) => ( row.map((rank, i) => { return [element(r, i, state, rank, toggled, onClick)]; }) )); ``` It maps through a 2-dimentional array. After each row...
- Modified
- 19 Nov at 21:34