100 questions from the last 7 days
9
votes
2
answers
251
views
Nullable warning when upgrading to extension-members syntax
I have two versions of helper methods for logging on ILogger. The first (classic extension methods) compiles fine; the second using extension members results in a compiler warning/error code.
CS8620: ...
1
vote
0
answers
39
views
Required data annotations returning namespace rather than error message value?
I have an ASP.NET Core 8 MVC application, using the bog standard [Required] attribute on a class property. I expected to see the defined error message in my HTML, in the data-val-required attribute on ...
Best practices
0
votes
4
replies
62
views
Upgrading from .NET framework 4.8 VB.NET project to .NET 10
I have an application which was written years ago in VB.NET. Recently I migrated it to .NET framework 4.8. This change was smooth.
Now I am planning to migrate it to an ASP.NET Core 10 Web API using C#...
0
votes
0
answers
61
views
.NET is not recognized
In a .NET Core C# project, I get many errors like this:
Predefined type 'System.Object' is not defined or imported
Primary variables such as int and string are not recognized.
I have tried the ...
-1
votes
0
answers
30
views
Casting from list of VirtualKey objects to RegisterHotKey
I'm using DevWinUI's shortcut control but I'm confused on how to get the key and modifiers from it and then casting it to the proper types for RegisterHotKey.
The shortcut control returns public new ...
Best practices
0
votes
1
replies
50
views
Filling the `entityIds` property in EF Core
I am currently developing a module for an ASP.NET Core Web API that uses EF Core to talk to MySQL. The problem is I have no idea how to make EF Core fill the entityId property.
Here is the example ...
-8
votes
0
answers
95
views
Array of pointer to objects [closed]
I'm using C#. I have a certain number of Newtonsoft.Json.Linq.JArray, let's say A123, A124, A125, and so on.
I need to create an array or something similar of this objects in a way that, if I do ...
Advice
0
votes
2
replies
34
views
ASP.NET Core 10 integration tests using multiple web projects/entry points
When creating integration tests for ASP.NET Core 10 web apps, we use the WebApplicationFactory<TEntryPoint> class. When a single ASP.NET Core web project is used as SUT, it's simple and it works:...
0
votes
1
answer
41
views
editorconfig rule to enforce that namespace is set in all C# files
I want to set a rule in .editorconfig so that all C# files where namespace is not explicitly set should render an error.
I've added these:
dotnet_diagnostic.IDE0130.severity = error # Namespace does ...
0
votes
0
answers
25
views
Issue with Template.Json not excluding files
I have built a template project with a Template.json and this will generate the template fine ( no errors at all )
ive also managed to add some choices to the symbols that will add or hide code ...
5
votes
6
answers
173
views
DistinctBy, but preserve the last element of each group of duplicates
I have a list of items that contains duplicates, and I want to keep the last item of each group of duplicates. The native DistinctBy LINQ operator keeps the first item from each group, so it doesn't ...
Tooling
0
votes
1
replies
41
views
How to programmatically insert Plant 3D catalog parts into a drawing using C# API?
I’m working on automating the insertion of parts from a custom Plant 3D catalog into project drawings using a C# plugin.
What I have so far:
A custom catalog (.pspx, .acat, .pspc) with supports and ...
0
votes
0
answers
36
views
How to write Custom Dimension?
In my CRM 365 Plugin I have requirement to write log to Application Insight, I'm able to achieve this using ILogger and Microsoft.Xrm.Sdk.PluginTelemetry library. But I have struggled to write log ...
0
votes
0
answers
20
views
MediatR Nuget package versions creating problems
I am getting a version mismatch error when using MediatR in my .NET project.
What happened:
Yesterday my project worked correctly with no errors.
Today I updated some NuGet packages by mistake.
After ...
1
vote
1
answer
69
views
How to conditionally compose the EF from parts?
I have two tables Products and CustomerProduct. I need to compose an Entity Framework Core object that returns the result based on arguments of the Web API endpoint method.
The method roughly works ...
-1
votes
0
answers
48
views
Why can PropertyColumns not infer their type parameters when passed to a wrapper? [duplicate]
I am using MudBlazor's MudDataGrid, which functions very similarly to Blazor's QuickGrid. The grid's contents are determined by a RenderFragment parameter called Columns, which contains a list of ...
-3
votes
0
answers
26
views
D365 C# Plugin sporadically stop processing [closed]
I have created a C# plugin that has a method that runs AfterInsert of record. The issue I am running into is it sporadically inserting a record into the sharepointdocumentlocation table/entity. There ...
-7
votes
0
answers
82
views
Whenever I try to compile my MAUI project I get CS0246 Error
I'm trying to build a three piece Streaming Project in which I need to build an API that is already working, a Java App for Android that I haven't even started and this .NET MAUI using C# that is ...
5
votes
4
answers
253
views
How to force the Application.Run to wait for all async void handlers?
I have a Windows Forms application and a Form with many async void event handlers. This form can be closed by the user at any moment. After closing the form I want to delete a temporary file, and my ...
-1
votes
2
answers
73
views
How to mock ILogger and invoke via callback Console.Writeline to have invocations in test explorer?
I need to have every invocation from the ILogger interface of a test,
but I mock the ILogger interface in the class that is going to be tested, so it won't write to console and therefore the ILogger ...
-1
votes
0
answers
116
views
How to debug the C# COM class? [closed]
I have a simple C++ project which uses the CoCreateInstance to access and use some C# code (com-exposed class). The simple code looks like:
// ...
hr = CoCreateInstance(
CLSID_rclsid,
NULL, ...
0
votes
0
answers
44
views
WPF "View Source" in Live Visual Tree stopped working - can't open XAML or code-behind
I'm learning how the back end and front end work together by reviewing WPF (Window Presentation Foundation) code.
The project runs locally on my machine. I copied it from my team's shared folder.
My ...
0
votes
0
answers
70
views
EF Core 9 migration fails on production database copy with "Cannot release the application lock" error
I'm using EF Core 9 and I'm trying to run a migration against a copy of our production database.
On our local development databases everything works, but on the production copy the migration fails ...
4
votes
1
answer
103
views
Casting Func<T1, T2> to Func<T1, object> doesn't work with double but works with classes
I have a simple question about covariance/contravariance here.
Below, I have a Func<T1, T2> that I need to be casted to Func<T1, object>.
In theory, this should be possible, but in ...
-2
votes
0
answers
61
views
Cannot set control height or width [closed]
I am working with Microsoft Visual Studio Professional 2022, C#. Using System.Windows.Forms I have a dialog with an instance of TableLayoutPanel, in the table I am creating a Label following by a ...