Programmatically turn on/off Action Center
Is there a way to programmatically turn on/off the Action Center? Additionally, I'd like to know if there is a way to programmatically turn on/off specific notifications? In manufacturing we use a b...
- Modified
- 25 May at 14:23
Aggregate $lookup with C#
I have the following MongoDb query working: ``` db.Entity.aggregate( [ { "$match":{"Id": "12345"} }, { "$lookup": { "from": "OtherC...
- Modified
- 26 May at 06:39
EF Core Migrations with multiple DbContexts on single database
I have an issue attempting to use Migrations in a ASP.NET Core solution using EF Core where there are multiple `DbContext` that share the same SQL database. In my application startup method I'm getti...
- Modified
- 25 May at 10:30
How to mock rows in a Excel VSTO plugin?
I am trying to put a mocked `Range` (which contains cells with values) inside the rows of a new `Range`. But when I try to access a specific element from the `Range`, a exception is thrown. I've trie...
- Modified
- 1 Jun at 22:12
Issue Moq'ing HttpResponseMessage
I have the following Method: ``` public async Task<SecurityRoleDeleteResult> DeleteSecurityRoleByRoleId(int securityRoleId) { string url = $"{_housingDataSecurityConfiguration.HousingDataSecurity...
- Modified
- 25 May at 09:45
How to register two implementations then get one in .Net Core dependency injection
I have parts of my code which depend on more than one implementation of the same interface, and other parts which depend on one of the implementations. I am registering implementations like: ``` ser...
- Modified
- 29 May at 10:14
Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference
When trying to use .net core 2.1 rc1 to add a service reference for WCF, I am experiencing the following error: ``` Error:An unknown error occurred while invoking the service metadata component. Fai...
UWP VisualTreeHelper.GetParent() returns null
I have a `ContentDialog` which has a `ListView`. This `ListView's` DataTemplate Contains a `Grid` and this `Grid` has a `Button`. The code goes like this: ``` <ContentDialog x:Name="DownloadListDialo...
Updating .NET framework resulting in SQL timeouts
We have an app which targets .NET 4.5.1, and this has remained unchanged. However when we upgraded the .NET framework on the server from 4.5.1 -> 4.7.1, we started experiencing SQL timeouts several h...
- Modified
- 29 May at 08:47
Authentication in WebApi with AllowAnonymous attribute
I have implemented a JWT-based authentication by inheriting `DelegatingHandler` and adding the class as `configuration.MessageHandlers.Add(new MyDelegatingHandler())`. When implementing `DelegatingHan...
- Modified
- 22 May at 04:20
Cannot create commands from unopened database
I've searched around quite a lot and I cannot find any answers to this. I am writing a Xamarin Forms Mobile application, it seems when I minimise the application and then reopen it or one of my activ...
- Modified
- 30 May at 19:59
How to set NLog max file size?
Is there any option/configuration in `NLog` to set the max log file size (for example 5MB)? What I need is, that when the log file exceeds the max size (which I define), It will backup the old one (w...
C# Clearing list before nulling
Today I have seen a piece of code that first seemed odd to me at first glance and made me reconsider. Here is a shortened version of the code: ``` if(list != null){ list.Clear(); list = null;...
- Modified
- 24 May at 03:46
Caching an HttpResult/memorystream using newer CacheControl attribute
I just discovered the new CacheControl Attribute and it's working well for standard POCOs - I was wondering if something different was required to cache a service that returned an HttpResult as a PDF....
- Modified
- 23 May at 18:20
WinForms TreeView checking/unchecking hierarchy
The following code is intended to recursively check or un-check parent or child nodes as required. [](https://i.stack.imgur.com/EZ1wZ.png) For instance, at this position, , , , and nodes must be un...
How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET
How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET? I found I can do it in like this: ``` public static class JsonExtensions { public static string JsonValue(string...
- Modified
- 15 Nov at 08:46
Why can't a C# struct method return a reference to a field, but a non-member method can?
Here's an example of an instance method of struct attempting to return a readonly ref to an instance field of the struct: ``` struct Foo { internal int _x; public ref readonly int MemberGetX...
- Modified
- 23 May at 14:43
ServiceStack AutoQuery join use
After reading the documentation, I am not sure but I have come to the conclusion that when creating QueryDb, you cannot choose the columns to join by? And I am under the impression, you must have DTO ...
- Modified
- 29 May at 19:24
AuthorizeRequestValidator: Error: Invalid grant type for client: implicit
I am trying to setting up Identity Server 4 `HybridAndClientCredentials` on .NET Core 2.0 MVC. I'm struggling with the error: > Invalid grant type for client: implicit Even though I have in my code...
- Modified
- 29 Apr at 08:59
Entity Framework Core: Fail to update Entity with nested value objects
I have an entity that has a value object and this value object has another value object. My issue is that when updating the entity along with the value objects, the entity with the parent value object...
- Modified
- 17 Sep at 12:4
Visual Studio 2017 only has offline Nuget Packages for .NET Core 2.x. How to get online packages?
I want to get NuGet Packages from Nuget online, but Visual Studio is only giving me 'Microsoft Visual Studio Offline Packages' as an option. [](https://i.stack.imgur.com/qGEWY.jpg) I have tried add...
- Modified
- 23 May at 09:26
Casting sbyte[] to bool[] and a char[] to short[]
Is there anyway to explicitly cast/coerce - `sbyte[]``byte[]``bool[]`- `char[]``short[]``ushort[]` In CIL you regularly see something such as ``` stelem Type sbyte (ldloc pArray) ldc_i4 1 ldc_i4 ...
What does own coverage mean in dotCover?
As the title says in some classes there's an line included as example: [](https://i.stack.imgur.com/hr5Hq.png) What does this mean?
How to do model validation in every method in ASP.NET Core Web API?
I am getting into ASP.NET Core 2.0 with Web API. One of my first methods are my login: ``` /// <summary> /// API endpoint to login a user /// </summary> /// <param name="data">The login data</param> /...
- Modified
- 17 Sep at 02:21
error when url resource contains ampersand
We have a web api with the following resource url. ``` http://www.example.com/book/bookid/name/bookname ``` now there are some books which contains names with ampersand '&' and when a request is ma...
- Modified
- 22 May at 20:6