340,750 questions
2
votes
1
answer
164
views
C# Project using Spinnaker SDK (for win-x64 and linux-arm64)
I am currently trying to utilize the Spinnaker SDK in a C# .NET8.0 application.
My goal is to make a cross-platform application that runs on both Windows-x64 and NVIDIA Jetson Orin (Linux ARM64)
I ...
1
vote
0
answers
135
views
Send array of objects to .NET controller action
I am trying to pass a javascript array of objects to a .NET controller action List<> parameter. Below is my C#
public bool ImportACE([FromBody] List<Element> elements)
{
foreach(...
2
votes
0
answers
127
views
In case of large number of items Context Menu is slowing down WPF application view rendering
I have following context menu defined as a part of the DataTemplate in xaml:
<DataTemplate DataType="{x:Type viewModel:OverviewAnnotationItemViewModel}">
<views:...
1
vote
0
answers
165
views
Strange hanging request in a .NET / Core application
I have two applications running, a web app on .NET 4.7.2 (versioning is not under my control...), and another on .NET 9 (LLM proxy service). The proxy service takes a request, routes it and uses ...
0
votes
0
answers
243
views
C# Dev Kit on an Air Gapped Network
I am on an air gapped network trying to run a C++ project that uses solution files from Visual Studio, because that is what the rest of my team uses.
I have:
C# Dev Kit 1.61.22
C# 2.93.21
.NET ...
1
vote
0
answers
90
views
PowerShell hosting in C#: implicit remoting
I want to use the PowerShell 7 cmdlet Get-ClusterResource in C# under Windows 11, like this:
using System.Collections.ObjectModel;
using System.Management.Automation;
namespace PSHosting;
class ...
2
votes
2
answers
77
views
MongoDB .NET - Updating embedded document in list with filters based on Parent and Child
Each Team document contains a list of Player documents. Each Player contains a list of strings named PlayerColors.
The need is to update the PlayerColors of a specific Player within the specific team. ...
1
vote
1
answer
53
views
Unable to create MSBuild API's Project object when custom SDK needs to be downloaded from nuget.org
I have an SDK style project using MSBuild.SDK.SystemWeb/4.0.104 SDK. It builds fine, all works OK.
Now I have a tool which wants to analyze the project by first creating the Microsoft.Build.Evaluation....
0
votes
0
answers
27
views
System.EntryPointNotFoundException: Unable to find an entry point named 'FPDF_InitEx' in shared library 'pdfium'
I am trying to use this library on a Linux machine:
https://pdfium.patagames.com/
https://www.nuget.org/packages/Pdfium.Net.SDK/
At first, when I ran it on Linux, I got:
Unable to load shared library '...
0
votes
2
answers
71
views
.NET 4.6 to 4.8 update - package and updated file location under references
I am trying to update a legacy ASP.NET 4.6 app to .NET 4.8. The app contains 2 class library projects as well.
I'm now using VS2022 for the updating instead of VS2017/2019 that I was using before.
For ...
1
vote
0
answers
211
views
C# array[i] where i is IBinaryInteger<T>?
A BinaryInteger<T> is an integer of some bit-length. I'd like to use it to index an array.
Casting to an int isn't possible - I have to use int.CreateTruncating(i) (or similar) at run-time to ...
0
votes
0
answers
48
views
Problem with populating Fast Report via .NET code
I am trying to populate my fast report with dummy data using .NET code
DataTable dt = new DataTable();
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("days", typeof(string))...
1
vote
1
answer
76
views
Is there any way to setup Azure Function/triggers programatically without the Function/Trigger attributes?
I have been given a project that uses Durable Functions to run a few sequential logic steps with some triggers for timers/http etc.
Problem is there is sooooo much boilerplate code here, there is ...
1
vote
1
answer
100
views
Calculate specific app's memory usage on C# [duplicate]
I’m trying to measure the RAM usage of a specific application using C# (.NET Framework 4.6.2).
I’ve already done some research and managed to get a result using Process.WorkingSet64,
but the value ...
1
vote
2
answers
244
views
Why let with where clause can't translate to SQL?
I have a code snippet that uses let with a where clause.
private List<string> Example2()
{
var query1 =
from c in _context.Customers
let custPurchases = _context.Purchases....
2
votes
1
answer
113
views
MongoDB C# Driver: Update only provided fields, including setting some fields to null
I am using MongoDB with C# (MongoDB.Driver) and I want to update only the fields provided in my API model. My current approach works for updating values, but I cannot set a field (string, number, or ...
1
vote
1
answer
74
views
Does reading one stream that is a copy of another stream affect the original stream position
I'm checking the file signature of an IFormFile and I'm curious if I can avoid resetting to the beginning of the stream after my check is done. I intend to dispose the copy of the original stream and ...
0
votes
1
answer
136
views
APS Design Automation: PackageContents.xml not being read from AppBundle in AutoCAD+25_1
I'm experiencing an issue with APS Design Automation (formerly Forge) where my AppBundle's PackageContents.xml is not being read/processed by AutoCAD Core Console, preventing my custom .NET DLL from ...
0
votes
0
answers
71
views
Node version mismatch when running npm programmatically on Azure App Service, but works manually
I am facing a confusing issue while trying to run npm commands programmatically in a React project deployed to Azure App Service.
What works:
Running npm commands locally via my Node.js script works ...
1
vote
0
answers
30
views
"error NU1301: Unable to load the service index for source" with private nuget feed
I've got a build pipeline in TeamCity and a private nuget feed hosted in aws codeartifact.
The first step in the pipeline calls aws codeartifact login with the appropriate parameters.
It works when I ...
1
vote
0
answers
105
views
PdfSharpCore - fields that are completed are not being shown their content in Adobe Acrobat but work on Firefox, Edge, etc
As the title says, I have this class which is based on PdfSharpCore.
I have a PDF file which is AcroForm (doesn't seem to be XFA, although I'm not 100% as I don't have much experience with PDFs - but ...
0
votes
0
answers
74
views
How to return data annotations error message in one string?
I'm using data annotations from System.ComponentModel.DataAnnotations in my ASP.NET project. I get an error message where you can describe the requirements such as "Name is required" and etc....
1
vote
0
answers
70
views
Server Side pages in Blazor WASM project
I am trying to integrate some server side pages in a Blazor Web App using Webassembly. I have a few pages in the client project, but I want some pages to run on the server. As such, I have added a ...
0
votes
0
answers
74
views
ASP.NET Core SSE works locally but not on Azure App Service (events not flushing)
I have a simple ASP.NET Core API that streams events using Server-Sent Events (SSE).
Locally (Kestrel) it works fine: every WriteAsync + FlushAsync sends data to the client immediately.The endpoint ...
3
votes
1
answer
131
views
Powershell captures array function result with single element as just the element
I'm working on some code that still needs Powershell 5, and I'm making use of some .NET tools, including [System.BitConverter]::GetBytes(). This function always returns a byte array... it has to, as ....
2
votes
1
answer
245
views
Correct way to handle appsettings.json on console app
I have a C# console app that is pushed to Azure DevOps and then deployed to a specific server. The app uses an appsettings.json file like this:
IConfiguration _configuration = new ConfigurationBuilder(...
0
votes
0
answers
84
views
MAUI Transparent background
I downloaded .NET MAUI Community Toolkit example project. I really liked the look of the transparent style and I wanted to replicate it.
I copy Styles.xaml, where defined BackgroundColor for Page and ...
1
vote
2
answers
126
views
How to fake a second function call using FakeItEasy?
I have a class that looks like this:
public int DoWork(int value)
{
return value + GetDataFromDB();
}
public int GetDataFromDB()
{
return 10;
}
In the real world the second function goes ...
0
votes
1
answer
72
views
System.Net.Http.MutlipartFormDataContent error in client running in .NET Framework 4.8 when connecting to Apache Tomcat server
This is my .NET Http Client minimal reproducible example, which connects to a server running on a CNC machine edge device and uploads a local JSON configuration file:
using System;
using System.IO;
...
0
votes
0
answers
56
views
Moq.Of<T> setup for Action<T> with a callback and capturing method parameter
Lets say we have the following interface:
public interface IGetRandomString
{
void Init();
bool IsInited { get; }
//returns random string of length chars
string GetRandomString(int ...
2
votes
2
answers
103
views
how is the ref-safe-context determined in c# when ref assigning to local variables
I am a beginner in C# trying to figure out how ref-safe-context is defined in C#. I declared a function Foo which didn't work since it tries to ref assign a variable with declaration-block to a ref ...
1
vote
0
answers
62
views
Dockerizing ASP.NET MVC application on .NET 4.5.2 - 404 from ManagedPipelineHandler on hitting an action method
I am trying to dockerize an existing ASP.NET MVC application running on .NET 4.5.2. I am using mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 as the base image (the base ...
1
vote
1
answer
55
views
Sentry context in .NET MAUI - restrict
I want to not collect all the user/device context, like location, remaining battery and so on. Can I configure it somehow?
Here's my config:
.UseSentry(options => {
options.Dsn = "..."...
3
votes
2
answers
218
views
How to log "who did what" without adding userId in every method?
I'm implementing a DDD app where my entities emit DomainEvents for auditing purposes. Every action that occurs in my board should log something to the DB. In the example bellow, I'm logging that ...
2
votes
2
answers
280
views
C#, PowerShell hosting: how to process return variable
I want to use PowerShell in C#. Example:
using System.Management.Automation;
namespace PSTest;
class Program
{
static void Main()
{
using (var powerShell = PowerShell.Create())
...
3
votes
0
answers
148
views
C# service doesn't run on Windows Server, but runs on Windows 10
I'm trying to build a background service with autostart in the background.
Core logic in console app executing from OnStart, however after several failures at debugging root cause - modified code by ...
1
vote
0
answers
61
views
Unable to publish .NET MAUI iOS application – "No iOS signing identities match the specified provisioning profile"
I am working on a .NET MAUI project targeting .NET 8 for both Android and iOS. The app builds and runs fine in debug mode on both platforms, and I can test it locally in the simulators without issues.
...
4
votes
2
answers
103
views
Why does dotnet restore on a .sln ignore `DownloadContentFiles` tasks in .csproj projects?
I have an .sln referencing a single .csproj. Inside the .csproj I download static dependencies into ASP.NET's wwwroot:
<Target Name="DownloadContentFiles" BeforeTargets="Restore&...
0
votes
0
answers
27
views
SMTP Error: server does not support secure connection [duplicate]
Try
' Force TLS 1.2 (needed for .NET 4.0/4.5)
System.Net.ServicePointManager.SecurityProtocol = DirectCast(3072, Net.SecurityProtocolType)
' Create mail
Dim mail As New MailMessage()
...
2
votes
0
answers
88
views
VS Setup Project Change to Non-advertised Shortcut
I have a Visual Studio 2022 installer project I made and it currently has a primary output which creates an advertised shortcut automatically when the project is installed. However, since its ...
2
votes
1
answer
178
views
How can I edit text inside Avalonia DataGrid cell and take the new text value of that cell to make a query?
I'm developing an Avalonia Application and I'm trying to figure out how can I make a DataGrid cell editable, here's my DataGrid to make it more clear:
<DataGrid IsReadOnly="False" ...
3
votes
0
answers
92
views
How to synchronize blob names stored in the database with the actual blobs in Azure Blob Storage
Current problem: when we store files in Azure Blob Storage, we create a folder per entity (company/user).
The name of the folder includes:
Entity ID (required to guarantee that the folder name will ...
2
votes
1
answer
62
views
How to set ASP.NET configuration keys with dots using environment variables on Linux
In .NET you sometimes need configuration keys with dots. For example in logging configuration. .NET itself creates a sample like this (Microsoft.AspNetCore):
"Logging": {
"LogLevel&...
0
votes
0
answers
68
views
How to bind to a listbox item's automation ID?
I have a listbox defined as follows:
<ListBox Name="MyListBox"
AutomationProperties.AutomationId="MyWindow_MyListBox"
ItemsSource="{Binding MyItems}"
...
0
votes
1
answer
115
views
Blazor virtualization for items with different sizes
Blazor supports virtualization but items need to have same height. For most cases it's okay, but for example for chats where amount of messages can be high and messages have different heights due to ...
0
votes
0
answers
69
views
Force explicit BLE disconnect with Windows.Devices.Bluetooth BluetoothLEDevice
I am using the C# Windows.Devices.Bluetooth APIs to communicate with a device via BLE.
The BluetoothLEDevice class does not expose connect or disconnect methods but at least the connect can be forced ...
3
votes
1
answer
81
views
Why does my .NET MAUI image cross grid cell boundaries?
Here is a simple code snippet to show the problem I am seeing:
MainPage.xaml:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250" />
<...
0
votes
2
answers
100
views
Is there a way to make AddUserSecrets take precedence over Configuration.AddAzureKeyVault?
For the life of me I cannot find much official information on the load order or precedence of configuration file load order.
I have a situation where I am provided configuration via AddAzureKeyVault ...
2
votes
1
answer
128
views
Create folder structure in Fabric Lakehouse
I have an empty lakehouse in my Fabric workspace.
I'm trying to create a folder under /Files with the Fabric api.
When I use the Microsoft.Fabric.Api.FabricClient folders abstraction, the folders are ...
0
votes
1
answer
59
views
Mono: can't access API with self-signed certificate - MonoBtlsException: Ssl error:1000007d:SSL
I have a Mono container (mono:6.12.0.182) and it has some host.testcontainers.internal:[PORT] exposed to it.
I will be using this to integration test a legacy .NET client application against a new API(...