Questions tagged [c#]
C# (pronounced "see sharp") is a high-level, statically typed, multi-paradigm programming language developed by Microsoft. C# code usually targets Microsoft's .NET ecosystem, which include .NET, .NET Framework, .NET MAUI, and Xamarin among others. Use this tag for questions about code written in C# or about C#'s formal specification.
93
questions
0
votes
0
answers
4
views
WPF Canvas using all screens
I've the following setup on my monitors:
Monitors
I'm working on a screenshot app with C# - WPF and when i try to place the canvas on the monitor 3, it still loads in primary windows (monitor 2).
I ...
0
votes
0
answers
7
views
Content being duplicated in asp.net web forms page
Can anyone help with the following problem
I am building a nested template website using Web Forms and C# (.Net 4.8) and I keep getting issues with content being duplicated in asp controls e.g the ...
-1
votes
0
answers
12
views
image display above cell issue how to solve issue using itextcharp?
I work on asp.net I export grid view to pdf and I success on that
issue happen when add image logo to pdf it display above logoCell not inside cell .
so issue logo image display above logo cell .
and ...
0
votes
0
answers
6
views
Monitor progress of python from within c# using python.net
From within c#, I am executing python.net to build a RandomForestClassifier. After I have loaded the data and put it in a format for the classifier, using python.net I execute:
scope.Exec("...
0
votes
0
answers
12
views
Coverlet doesnt calculate code coverage for tests until another test is added
we have 700 tests in our solution and we use the latest .net and latest coverlet.
3 test files in 1 (out of 30) test solutions are not calculated correctly:
But the tests are executed:
The ...
0
votes
0
answers
10
views
Service Bus Output in the Isolated Worker Model - .NET8 Function App
I have a function app that we are upgrading from the In-Process Model to the Isolated Worker Model.
Below I have a dumbed-down, pseudocode version of what I am working on with the relevant method ...
0
votes
0
answers
8
views
Adding global attributes to OpenTelemetry metrics
I am using OpenTelemetry's Metrics to get information about my environment.
I have several tenants that will use OpenTelemetry and will all be ingested into Prometheus and then Grafana.
I would like ...
0
votes
0
answers
5
views
Decreasing Unity resource usage when sitting in a menu
I was wondering if there is any way to lower the amount of resources that Unity uses when its ostensibly not doing anything - such as sitting in a menu that isn't animated. This is something that ...
0
votes
0
answers
23
views
How to add substrings to an array?
I want to add to an array the substrings that this loop creates
foreach (char c in chars)
{
do
{
sb.Append(chars[i]);
choice = sb.ToString();
} while (c == chars[i]);
}...
-1
votes
0
answers
19
views
How to hide tabpage in C#, you can't, but you can
OK You can't hide a TabPage in .NET as there is no visible property. However, you can have a MISC Tab and have several GroupBoxes on it which do have the Visible Property.
Your MISC tab would have ...
0
votes
1
answer
8
views
Error Factory.Domain.FetchInstance(connection, null, null) in c# not connect
I am trying to connect to the FileNet server with Factory.Domain.FetchInstance(connection, null, null) and it generates an error:
Por favor me pueden colaborar.
The program runs fine, but when it ...
0
votes
1
answer
20
views
.NET Integration Test Singleton Service instantiated twice
I am working on a .NET SQL Server based application for which I need to write Integration tests.
I am using CustomWebApplicationFactory to overide DbContextFactory to use an in-memory SQLite DB in ...
0
votes
0
answers
9
views
How can i decrypt a pushbullet message with C#?
Good day, i want to decrypt the messages i receive through the API https://api.pushbullet.com/v2/permanents/%7Biden%7D_threads but when using my E2E key in C# and generating a desencryption key it ...
0
votes
0
answers
3
views
C#, BluetoothLEAdvertisementWatcher hangs unexpectedly
I have created a hardware product that does a specific thing and sends data within a Manufacturer chunk of an advertisement packet. I've already written a fully functional app for iOs/Android for this ...
0
votes
0
answers
6
views
UWP ExpandoObject PropertyChangedEvents are not Updating UI
My task is to implement a UWP DataGrid with dynamic columns. As the user adds and remove columns, I need to add and remove the corresponding properties during runtime from the ObservableCollection of ...
0
votes
0
answers
8
views
C# .net core 6.0 - IQueryable, odata, and mapped function called from LINQ statement can't be translated
I'm having issues with odata, IQueryable's and mapped functions called from LINQ statements:
this is in a function (creating an IQueryable):
IQueryable<AvailableView> queryable = _aContext.AView....
-1
votes
1
answer
19
views
Entity Framework Core : Select() - change a column name
I have the following select:
var allUsers = await dbContext.AppUsers
.Where(u => allUserIds.Contains(u.IdentityUsersId))
.Include(u => u.Following)
.Select(u => new
{
...
-3
votes
1
answer
25
views
Entity Framework Core : Select() - turn an IList<> property into a joined string?
I have the following select which returns the 4 columns I want:
var allUsers = await dbContext.AppUsers
.Where(u => allUserIds.Contains(u.IdentityUsersId))
.Include(u => u.Following)
...
0
votes
0
answers
13
views
Retrieve iProduct and iSerialNumber from connected USB device
I have a PCB with an MCU that has a USB peripheral on it connected to a PC and I'm writing a UI to work with it. The USB port is configured in the device as a Comm port, so it looks like "COMx&...
0
votes
0
answers
8
views
How to test IObservable with rx.net
I have method like:
public IObservable<int> Move()
{
byte[] header = { <some data> };
return _joystickService.JoystickXY()
.Sample(TimeSpan.FromMilliseconds(200))
....
0
votes
1
answer
24
views
Can you have init-once variables in C# extension methods?
Extension methods operate on an instance of a class, but they are implemented as static methods inside a static class. It seems that they don't allow declaring any variables static or readonly.
Here ...
0
votes
0
answers
14
views
My character does not do what I expected him to do and I dont know why
I am making a 2d game in unity and I haven't touched a game engine in months but I found this movement script I had saved which I wrote a while ago, I set everything up and when I was going to try, my ...
1
vote
0
answers
17
views
SHOpenFolderAndSelectItems Win32 API doesn't work on Go, but works on C#
I am trying to open a Windows Explorer window with specified items in a particular folder selected.
I tried to implement the program using SHOpenFolderAndSelectItems Win32 API with C#. Following the ...
0
votes
0
answers
20
views
How can I get the values from Shell Property 'System.ItemAuthors' as a string array in C#?
I’m at a complete loss on how to do this. I’ll preface by saying I’m able to get many shell properties for a file when they are of type uint64, uint32, DateTime, string, etc. as the example code shows....
0
votes
0
answers
16
views
How to send/receive text messages in Blazor App
For fun, I wanted to make my own default texting app and make it compatible for both IOS and Android. As far as I can figure, Blazor doesn't support it. I was wondering if there was a good API for ...
0
votes
0
answers
27
views
DLL Injection Hook Not Working in WPF Application
i am student studying reverse engineering.
These days, I am learning API Hook using DLL Injector
I made personal DLL Injector using C# WPF and C++/CLI
also i have created a DLL that hooks the send ...
0
votes
0
answers
18
views
Get a list of Computers on the network, their IP Addresses, and UNC Paths
I have been working on this for the last week and I've tried a ton of different approaches and haven't found anything that works consistently.
Essentially, I am trying to build my own FolderDialog and ...
0
votes
0
answers
13
views
Entity Framework Core 8.0.7 DB-first Scaffold-DbContext database with custom namespace
I'm using EF Core 8.0.7 and a database-first approach.
When I'm running Scaffold-DbContext on the database with the command shown here, I'm getting semicolon after namespace and class is not any name ...
1
vote
0
answers
24
views
Adding an embedded font to a datagridview
I want to put a custom font to a datagridview but it is not applied, it only applies to other elements such as labels.
I originally tried this and it worked as expected.
fontCollection.AddFontFile(&...
0
votes
0
answers
9
views
How to add new column to existing abp table __core_EntityPropertyChange
I am using abp(aspnet boilerplate) framework. There is framework build table __core_EntityPropertyChange for auditing purpose.
Since this is framework build table so I am unable to add new column to ...
-1
votes
0
answers
17
views
Replacing a sentence that has citations in a DOCX file as Track Changes
I trying to replace a sentence instead of old one (which has citations) in a DOCX document using OpenXmlRegex.Replace method.
The thing is creating the regex of old sentence and using it for replace ...
0
votes
1
answer
13
views
What are the possible ways we can handle the case when the setup code of a test fixture requires to be tested itself without violating best practices? [closed]
What are the possible ways we can handle the case when the setup code of a test fixture requires to be tested itself without violating best practices? Consider the following code in C# 12.0/.NET 8.0 ...
2
votes
1
answer
34
views
Read CSV using LINQ - Index out of Bounds
My .csv is in the format -
Group No,Group Name,Type,Class,Category,Description,Product,Quantity,Stock,Id,Name
1,B,X,Y,Table,Wooden Table,Table,12,50,123,XYZ
I am trying to read this .csv using the ...
-3
votes
0
answers
24
views
Asking for help converting SQL query to EF Core [closed]
I have a working program that uses SQL queries to collect data. I'm working on converting it to EF Core 8.
I found an online convert but the result will not compile in my C# project. Can someone ...
0
votes
0
answers
17
views
Own job scheduler using .NET Core [closed]
I have asked to create POC for our own job scheduler using following tech stack, which should replace the onpremimse AutoSys to cloud based solution.
Tech Stack:
Angular
C#, .NET 8.0
Azure PaaS (ex: ...
0
votes
0
answers
12
views
How to move a sprite independently of its parent node in Godot C#?
I am trying to make my sprite move/rotate independently of its parent node, so that the hitbox does not follow the sprite. I am trying to make the sprite smoothly sway side to side whilst the player ...
0
votes
0
answers
3
views
Reference to IExceptionHandler interface not being resolved from Microsoft.AspNetCore.Diagnostics
I am adding a global exception handling project to my solution and have installed the Microsoft.AspNetCore.Diagnostics NuGet package. Although the package is recognized and listed in the project's ...
0
votes
0
answers
20
views
ASP.NET Core MVC: Comment Replies Not Working After Refactoring
I am working on an ASP.NET Core MVC project that involves posts and comments. Users can leave comments on posts, and they can also reply to other comments. The initial implementation was working (...
-2
votes
0
answers
47
views
How can we update decimal precision for two places in c#? [closed]
I have a model class with a decimal? amount column. This has value from database is 35.00 but when passing from API It has 35.0. I'm trying to update decimal precision by two digit. something like 35....
0
votes
0
answers
17
views
Multi-Collection Views - Display .NET MAUI CollectionView within a CollectionView
I am developing a c# .NET Maui application that creates a bowling app that maintains a recap of scores for bowling team. The requirements are that it is a general application that supports leagues ...
0
votes
0
answers
48
views
Passing an array of objects from C# to VBA Excel
I have a C# console application and Dll. I registered the dll as COM via interop. I used the
COM Visible property, GUID etc
Set Assembly Information, Build information to register it to COM
I ...
0
votes
0
answers
6
views
Converting Word Document to PDF with Winnovative - Form Fields
I have a word document, that I want to convert to PDF via Winnovative. The basics work, as done with the following function.
public byte[] ConvertWordToPdf(Stream fileStream)
{
var ...
0
votes
0
answers
17
views
Generic way of handling call to multiple api endpoints that use JWT
Setting up an application to call one of a handful of different client api endpoints, each of which use JWT. However, as of now I dont know the specifics of how the specific client might implement ...
0
votes
0
answers
23
views
I created a c# Roslyn source generator and a test, the generator works but the test doesn't find the same source
I created a simple source generator that works fine
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
...
0
votes
0
answers
10
views
C# .Net Core Compile only one appsettings.json [duplicate]
In my application often I have three files of settings:
appsettings.json
appsettings.Development.json
appsettings.Production.json
When I publish, all three files are brought into the publish folder. ...
0
votes
0
answers
37
views
Access denied trying to execute c# console application
First up, I'll admit I'm a total noob at this. I'm just trying to learn, but it gets hard when I hit this kind of problem. Google hasn't provided any answers so I thought I'd ask here.
I built my ...
-1
votes
1
answer
47
views
Get all keys in a dictionary [closed]
I have a collection of objects that contain a dictionary, and would like to extract only the keys and not the values in the dictionary (which are much larger than the keys, unlike in the example below)...
0
votes
0
answers
12
views
How to show debug logs while running blazor hybrid app on local android device?
I am using VS2022 Community Edition on Windows 10. I have followed this tutorial https://learn.microsoft.com/en-us/dotnet/maui/android/device/setup?view=net-maui-8.0 and have gotten my blazor hybrid ...
0
votes
0
answers
20
views
Differences between dotnet build -r and dotnet publish -r
With the following project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
</PropertyGroup>...
0
votes
0
answers
13
views
Data resolution are not changing when try to minimize the resolution
In Firefox browser, when opened in normal form all data moves towards right, while it appears correctly in Chrome and Edge. Also when I tried to minimize the resolution in edge or chrome all data ...