How to get IOptions in ConfigureServices method?
I have asp.net core application. I want to use `IOptions` pattern to inject values from appsettings.json. So I have a class `SecurityHeaderOptions`, and also have target class `SecurityHeadersBuilder`...
- Modified
- 28 Oct at 11:55
Error CS1056: Unexpected character '$' running the msbuild on a tfs continuous integration process
I have a project that the framework is targeting `.NET Framework 4.6.1`, as part of the continuous integration process on the tfs we created a Build Solution task to ensure that the code compiles corr...
- Modified
- 23 Mar at 21:12
Bind query parameters to a model in ASP.NET Core
I am trying to use model binding from query parameters to an object for searching. My search object is ``` [DataContract] public class Criteria { [DataMember(Name = "first_name")] public string...
- Modified
- 21 Mar at 18:57
How to encapsulate .NET Stateless state machine
I have a project where there is a mostly linear workflow. I'm attempting to use the .NET Stateless [library](https://github.com/dotnet-state-machine/stateless) to act as workflow engine/state machine...
- Modified
- 21 Mar at 13:51
Is it safe to use a static `Serilog.ILogger`
I am using [Serilog](https://serilog.net/). I want to write log entries with a `SourceContext` of the containing class. Is it safe (including thread safe) to do this: ``` using Serilog; ... class ...
convert:not authorized `aaaa` @ error/constitute.c/ReadImage/453
I want to create a captcha pic by use `convert` from ImageMagick. And I follow [this](http://www.grant-trebbin.com/2014/02/generating-captcha-from-linux-command.html), but there are some problem . I...
- Modified
- 11 Oct at 11:33
How to return multiple values in C# 7?
Is it is possible to return multiple values from a method natively?
ServiceStack.Net: Difference between IRedisNativeClient.Eval and EvalCommand
i am new to the ServiceStack.Net Framework and I would like to understand the differences between the following methods: ``` public byte[][] Eval(string luaBody, int numberKeysInArgs, params byte[][]...
- Modified
- 21 Mar at 11:39
Convert list to params C#
I have this following list: ``` var myList = new List<KeyValuePair<string, object>>(); ``` And this function: ``` public void Test(params KeyValuePair<string, object>[] list) ``` How can I do a ...
- Modified
- 21 Mar at 09:50
Custom TFS Check-In Policy in Visual Studio 2017
A while ago I developed a custom TFS check-in policy that was . Now I installed Visual Studio 2017 and wanted to register the check-in policy assembly the same way as I did with VS2015 before. But thi...
- Modified
- 21 Mar at 09:41
What’s the purpose of the HTML "nonce" attribute for script and style elements?
W3C says there is a new attribute in HTML5.1 called `nonce` for `style` and `script` that can be used by the Content Security Policy of a website. I googled about it but finally didn't get it what ac...
- Modified
- 5 Mar at 15:14
C#7: Underscore ( _ ) & Star ( * ) in Out variable
I was reading about new out variable features in C#7 [here](https://blogs.msdn.microsoft.com/dotnet/2017/03/09/new-features-in-c-7-0/). I have two questions: 1. It says We allow "discards" as out pa...
Asp.net Core not Collecting Garbage
I can't seem to understand why Asp.net core is not collecting garbage. Last week I let a web service run for a few of days, and my memory usage reached 20GB. GC doesn't seem to be working. So to test ...
- Modified
- 21 Mar at 04:30
ServiceStack Client Put request and query parameters
I'm using the latest ServiceStack client lib in a .Net project and I'm having some issue making a PUT request. Especially it doesn't seem to take into account the type of parameter defined in the Requ...
- Modified
- 21 Mar at 03:1
Access Visual Studio 2017's private registry hive
Visual Studio uses a private registry hive instead of "polluting" the system registry - typically found somewhere like this: `C:\Users\Abx\AppData\Local\Microsoft\VisualStudio\15.0_4b0ba1c0\privatere...
- Modified
- 21 Mar at 00:18
React-Router External link
Since I'm using React Router to handle my routes in a React app, I'm curious if there is a way to redirect to an external resource. Say someone hits: `example.com/privacy-policy` I would like it to re...
- Modified
- 13 Dec at 00:20
ServiceStack IOC: How to register templated class
I have the following repository classes for Redis databases: ``` public class RedisRepositoryBase<TRedisEntity> : IRedisRepository<TRedisEntity> where TRedisEntity : class, IRedisEntity public class ...
- Modified
- 20 Mar at 20:8
How to create a DB for MongoDB container on start up?
I am working with Docker and I have a stack with PHP, MySQL, Apache and Redis. I need to add MongoDB now so I was checking the [Dockerfile](https://github.com/docker-library/mongo/blob/4a81205a13fefc4...
- Modified
- 20 Mar at 19:57
Is there a way to get the windows default folder icon using C#?
I have a `listView` with a list of documents. To each of them I assigned an icon, using the following method: ``` private void SetDocumentIcon(ListViewItem item, FileInfo file) { Icon iconForFile...
- Modified
- 20 Mar at 17:52
Why is VS 2015 stopping diagnostics session is taking forever?
I am trying to analyze a WPF project (WPF, .NET 4.6.1, EF 6, Moq., on a i5 machine with W10 64 bit) using the performance profiler with only "Timeline" activated. Problem is that on stopping the pro...
- Modified
- 21 Mar at 17:21
How to stop a process from System.Diagnostics.Process and get the statistics in the end
I'm using this code but when i stop the process it not get the ping statistics : ``` System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "ping"; p.StartInfo.Argume...
- Modified
- 1 May at 20:3
Multiple Includes() in EF Core
I have an extension method that lets you generically include data in EF: ``` public static IQueryable<T> IncludeMultiple<T>(this IQueryable<T> query, params Expression<Func<T, object>>[] includes) ...
- Modified
- 20 Mar at 13:6
Azure Keyvault - "Operation "list" is not allowed by vault policy" but all permissions are checked
I am accessing KeyVault with .NET client with an AAD application. Although all permissions under secrets are enabled for this AAD app (screenshot below) I am getting "The operation "List" is not enabl...
- Modified
- 20 Mar at 11:13
RazorEngine templates in VS 2015 - Feature 'implicitly typed local variable' is not available in c# 2
I get the below error when I open RazorEngine cshtml template file in my VS 2015 project. > Feature 'implicitly typed local variable' is not available in c# 2. Please use language version 3 or gre...
- Modified
- 20 Mar at 10:4
Running an EXE from C# using UWP
I have searched and searched and seem to have hit a brick wall here. I am developing an application that generates an audio fingerprint to automatically search an audio database to grab the correct ar...
- Modified
- 20 Mar at 09:55