Using an array as argument for string.Format()
When trying to use an array as an argument for the `string.Format()` method, I get the following error: > FormatException: Index (zero based) must be greater than or equal to zero and less than the s...
- Modified
- 30 Nov at 11:0
ServiceStack.Redis deserialization issue - sometimes JSON is corrupted
I got a service that uses ServiceStack.Redis for storing objects (serialized with JSON). There's a key that's updated with each HTTP request - the flow is simple: get value for the key, deserialize it...
- Modified
- 30 Nov at 10:12
Configuring Serilog RollingFile with appsettings.json
I'm trying to configure Serilog for a .NET Core project. Here's what I have in my `appsettings.json`: ``` "Serilog": { "MinimumLevel": "Verbose", "Enrich": ["FromLogContext", "WithMachineName...
.NET Core Unit Testing - Mock IOptions<T>
I feel like I'm missing something really obvious here. I have classes that require injecting of options using the .NET Core `IOptions` pattern(?). When I unit test that class, I want to mock various v...
- Modified
- 4 Nov at 00:30
ServiceStack DateTime Deserialize Issue
It looks like ServiceStack doesn't like me using a DateTime property as an argument in my request. I'm getting a "Bad Request" message... no other helpful detail in the exception. The inner exception ...
- Modified
- 30 Nov at 18:53
How to change object's layer at runtime in Unity?
I've got WallCreator script to place walls in Unity, and another one, WallCreatorSwitcher to turn WallCreator ON/OFF by checking the toggle. I also wanted to change wallPrefab's layer there by using `...
Routes in ASP.net Core API
I read lot of topic about routes for API in Asp.net core but I cannot make it work. First, this is my controller : ``` Public class BXLogsController : Controller { //[HttpGet("api/[controller]/I...
- Modified
- 17 Jul at 16:2
Dependency Injection into Entity Framework seed method?
Is it possible to inject dependencies into Configuration class of Entity Framework 6? For example, like this: ``` internal sealed class Configuration : DbMigrationsConfiguration<MyBaseContext> { ...
- Modified
- 1 Dec at 21:48
How to get title tag using HTML Agility Pack
I'm parsing an HTML file using HTML Agility Pack. I want to get: Some title As you see, title doesn't have a class. So I couldn't catch it no matter what I have tried. I couldn't find the solution o...
- Modified
- 6 May at 18:50
Unit testing fileupload with Moq .net Core
I have a method in WebApi controller that I want to write unit tests for. This is how my controller method looks: ``` public async Task<FileUploadDto> UploadGoalDocument(Guid id) { var ...
- Modified
- 29 Nov at 14:24
Open a new window of Google Chrome from C#
It is possible to open a new of Chrome from C#? By I mean a new separate tab, not contained in an existing chrome window. I've tried the following solutions but of them create a in an chrome ...
- Modified
- 29 Nov at 07:39
How to get rid of Naming rule violation messages in Visual Studio?
I just installed Visual Studio 2017. When I open an existing website, I get all sorts of warning messages such as this one: > IDE1006 Naming rule violation: These words must begin with upper case c...
- Modified
- 10 Apr at 16:22
How to use nameof to get the fully qualified name of a property in a class in C# Attributes?
I am using Foolproof library in ASP.Net MVC project and in some cases I need to check a property within a member class of my model using attribues . For example I have a user class which has a proper...
- Modified
- 27 Oct at 19:12
Using connection string from appsettings.json to startup.cs
Currently in Startup, I have my sql server string looking like this: ``` public void ConfigureServices(IServiceCollection services) { var connection = @"Server=servername;Database=database;Truste...
- Modified
- 16 Aug at 11:5
FromBody string parameter is giving null
This is probably something very basic, but I am having trouble figuring out where I am going wrong. I am trying to grab a string from the body of a POST, but "jsonString" only shows as null. I also ...
- Modified
- 6 Dec at 10:43
How can I change a PCL into a .net Platform Standard Library in Visual Studio 2017?
I am trying to figure out how to change a portable .net class library into a .net platform standard library. There is a clickable link in the project settings that looks right it says "Target .net pla...
- Modified
- 20 Jun at 09:12
What is deps.json, and how do I make it use relative paths?
I'm setting up an ASP.NET Core project on TeamCity. The binaries it builds crash on startup on other machines. The error message shows that it is looking for dlls in paths that only exist on the build...
- Modified
- 5 Dec at 10:28
What is the best way to create a new field for UserAuth?
I would like to create a `DefaultPrinterId` property (field) attached on `UserAuth` table. This `DefaultPrinterId` field is a foreign key on a `Printer.Id` field (`Printer` is a custom table). My que...
- Modified
- 28 Nov at 16:56
Failure of delegation of Google Drive access to a service account
I've been involved with building an internal-use application through which users may upload files, to be stored within Google Drive. As it is recommended not to use service accounts as file owners, I ...
- Modified
- 2 Dec at 09:44
ServiceStack.Api.Swagger SwaggerResourcesService excluding Routes begining with Route Parameter
I am using Servicestack version 4.0.52.0 and ServiceStack.Api.Swagger 4.0.0.0 I have defined all routes with variable route parameter in serviceStack application host derived class(AppHostBase):Conf...
- Modified
- 28 Nov at 16:59
How to read a connectionString WITH PROVIDER in .NET Core?
I added ``` .AddJsonFile("Connections.json", optional: true, reloadOnChange: true) ``` in ``` public Startup(IHostingEnvironment env) ``` Connections.json contains: ``` { "ConnectionStrings...
- Modified
- 28 Nov at 17:11
Servicestack convert IServiceCollection into Funq entries
Does the servicestack.core package contain a [https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection#replacing-the-default-services-container](https://learn.microsoft.com/en-u...
- Modified
- 28 Nov at 13:26
"if (object is (string, Color))" c# 7.0 tuple usage doesn't work
I'm using Visual Studio 2017 RC and I have installed the `System.ValueTuple` package which enables the new c# 7.0 tuple usage, but I can't make it work in this specific case: [](https://i.stack.imgur...
- Modified
- 27 Nov at 18:37
VSTO Word 2016: Squiggly underline without affecting undo
I am working on a real-time language analysis tool that needs to highlight words to draw attention from the writer in Word 2016 using a VSTO add-in, written in .NET4.6.1 with C#. Think of the grammar/...
ASP.NET Core Model Binding Error Messages Localization
I'm using ASP.NET Core, and trying to localize the application. I managed to use asp .net core resources to localize controllers and views, and resources to localize error messages for model validat...
- Modified
- 16 Jan at 04:56