View Component as a Tag Helper does not get Invoked
Invoking a View Component as a Tag Helper was introduced in ASP.NET Core 1.1. (See [“Invoking a view component as a Tag Helper”][1]). But the following only returns the _Test for VC_ part of the view....
- Modified
- 3 May at 05:12
Pass through authentication with ASP Core MVC, Web API and IdentityServer4?
I have been working on migrating a monolithic ASP Core MVC application to use an service architecture design. The MVC front-end website uses an `HttpClient` to load necessary data from the ASP Core W...
- Modified
- 19 May at 19:34
How do I set a default User Agent on an HttpClient?
It's easy to [set a user agent](https://stackoverflow.com/questions/33659663/how-to-set-user-agent-with-system-net-webrequest-in-c-sharp) on an HttpRequest, but often I want to use a single HttpClient...
`PrintQueue.AddJob` does not finish
I tried following code on some PCs. ``` using (var lps = new LocalPrintServer()) using(var pqueue = lps.GetPrintQueue("PRINTER-NAME")) { pqueue.AddJob("job-name", @"C:\example.xps", false, pticke...
- Modified
- 19 May at 16:16
How to create MongoDB MultiKey index on attribute of items in an array .NET Driver
I have a MongoDB collection "foos" containing items which each have an array of "bars". That is, "foo" has the following schema: ``` { "id": UUID "name": string ... "bars": [ ...
- Modified
- 19 May at 12:56
Can the Virtual File System In Service Stack Be configured not not treat files with multiiple dots as directories?
I'm attempting to serve an angular spa from embedded resources using the ServiceStack Virtual file system. This appears to be mostly working, however many of my generated files include two dots in th...
- Modified
- 19 May at 06:25
Why does SyntaxNode.ReplaceNode change the SyntaxTree options?
I'm trying to replace nodes within a syntax tree in Roslyn, and it's just about working, but with an annoyance which feels it be a problem. The syntax tree is generated from a script, and I want the...
How can I detect unused imports in a Script (rather than a Document) with Roslyn?
I'm writing a system to process snippets written as unit tests for Noda Time, so I can include the snippets in the documentation. I've got a [first pass](https://github.com/nodatime/nodatime/commit/8e...
- Modified
- 18 May at 21:54
Resolving Hangfire dependencies/HttpContext in .NET Core Startup
I've installed and configured Hangfire in my .NET Core web application's Startup class as follows (with a lot of the non-Hangfire code removed): ``` public class Startup { public void Configurati...
- Modified
- 30 May at 17:37
'Cannot find the requested object' exception while creating X509Certificate2 from string
I am trying to create `X509Certificate2` from string. Let me show an example: ``` string keyBase64String = Convert.ToBase64String(file.PKCS7); var cert = new X509Certificate2(Convert.FromBase64String...
- Modified
- 19 May at 06:37
Entity framework core: Cannot insert explicit value for identity column in table 'Relation' when IDENTITY_INSERT is set to OFF
I'm bulding an application and when I want to insert a form into my form table I get the following error: > Cannot insert explicit value for identity column in table 'Relation' when IDENTITY_INSER...
- Modified
- 23 May at 06:47
ResolutionException - Getting "Required dependency of type *********** could not be resolved"
Following is the exact scenario in my application. I have used ServiceStack 3.9.48 and AutoFac 4.6.0 to develop a REST service. Following is the code of AppHost which is inherited from AppHostBase ...
- Modified
- 18 May at 13:7
Visual Studio Shows code errors that don't exist
I'm not sure if anyone else has encountered this but often, when I open this particular solution, I see a whole list of errors (see below). [](https://i.stack.imgur.com/DWV60.png) If I double click...
- Modified
- 18 May at 10:30
Expression-bodied properties vs. {get; set;}
When I have Visual Studio 2017 generate properties for me, it will always use the new expression-bodied properties, for example: ``` private static string username; internal static string Username { ...
- Modified
- 18 May at 10:35
ASP.NET: Check if run from migration
I have some code in my `ConfigureServices` that fails when running a migration: ``` dotnet ef migrations list ``` I'm trying to add a Certificate but it can't find the file (it works when starting ...
- Modified
- 18 May at 08:45
Is it possible to use the c# "interactive window" instead of the immediate window in VS2017
The C# " " is more fully featured than the " ". Is it possible to load the debug context into it during a debug session?
- Modified
- 18 May at 06:41
Automapper, Mapper Not initialized. Call initialize with proper configuration
When I try to submit data into database i get following error: > {"Success":false,"Error":true,"ErrorType":2,"Message":"System.InvalidOperationException: Mapper not initialized. Call Initialize with ...
- Modified
- 18 May at 08:0
Servicestack ORM db.Close() does not terminate the connection process
I have a code which demonstrates simple mysql database connection with ServiceStack ORM ``` var dbFactory = new OrmLiteConnectionFactory(DB_CONNECTION_STRING, MySqlDialect.Provider); var db = dbFacto...
- Modified
- 17 May at 22:3
How can I enable Server GC in .NET Core?
I have a .NET Core app () developed in running on the version of the . I have tried adding an `App.config` with the following entries: ``` <?xml version="1.0" encoding="utf-8" ?> <configuration> ...
- Modified
- 17 May at 21:47
.NET Core: Finally block not called on unhandled exception on Linux
I have created the following C# program: ``` namespace dispose_test { class Program { static void Main(string[] args) { using (var disp = new MyDisposable()) ...
ASP.NET Core WebAPI Security Considerations
My WebAPI is, just that, an API backend for my UI to consume. In fact, I will have perhaps 10's of WebAPI services that my UI will use. I'm having difficulty understanding what I need to consider in ...
- Modified
- 17 May at 22:10
Set Asp.Net Core MVC Json options
One of the classes that I have in my project called, say, `AC`, has a property `Address` that is of type `IPEndPoint`. This type, as well as `IPAddress`, are notorious for not being serializable to J...
- Modified
- 17 Jul at 16:33
How do I mock the FileInfo information for a file?
I have a scenario in which I need much of the information from the FileInfo structure -- creation time, last write time, file size, etc. I need to be able to get this information cleanly, but also be ...
- Modified
- 16 Oct at 19:42
Why are so many simple types in the .Net framework not marked as serializable?
I find it a recurring inconvenience that a lot of simple types in the .Net framework are not marked as serializable. For example: `System.Drawing.Point` or `Rectangle`. Both those structs only consis...
- Modified
- 17 May at 14:17