Questions tagged [.net]

.NET is a software framework supporting a multi-language paradigm and supporting language interoperability. .NET applications are executed in a virtual machine (CLR) which provides a few important services: security, memory management and exception handling.

74 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13
votes
0answers
153 views

Open source project to ease the Assert part from the functional tests of .Net Core Web APIs

I have built an open-source project based on FluentAssertions in order to solve some recurring tasks I was doing while testing the .Net Core APIs I'm developing. I find the capability of doing in ...
8
votes
0answers
259 views

.NET DLL Injector in C++

I built a DLL Injector with User-Interface. The program lists all processes, the user chooses one of them and a DLL, and inject it. It's my first project in C++, and I know it's not exactly C++ ...
5
votes
0answers
183 views

WebPage LogReader class - Parallel DNS w/timeout for computer IP's and domains from log scrape

This is a namespace to read a bunch of events from a log file and display them in a table on a webpage, some additional data (computer domain and IP address) is also pulled in from DNS. I am mostly ...
4
votes
0answers
141 views

Comparing two instances of a class

I have a Calculation class. It is persisted in the DB and users can modify it. The aim of the CompareWith function is to ...
4
votes
0answers
36 views

Validating a collection of proxy servers with maximum possible throughput

I am validating a collection of proxy servers and trying to achieve the maximum possible throughput. I've tested a few different methods, such as Task.WhenAll, TPL ...
3
votes
0answers
18 views

In Memory Database in Unit tests, isolate the tests

I have stumbled across these unit tests in a code review that are using in memory db: ...
3
votes
0answers
67 views

Creating SQL Server Database Users Dynamically from User Input

The Application I have an application in testing that runs off of an MS SQL Server database. The app allows users to authenticate using Windows authentication (that is, using the Windows username the ...
3
votes
0answers
150 views

Java code to convert BigDecimal to/from .NET decimal

Background In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
3
votes
0answers
3k views

Deserializing JSON with Utf8JsonReader

Path of Exile is a PC game where players can list their items for sale. The game has a public API that serves JSON which contains all of these items. My application consumes that JSON and indexes the ...
3
votes
0answers
126 views

Generic object-to-XML mapper

This code is part of a larger mapping library I'm working on to address some business concerns of transforming data. I was inspired by mapstruct in Java, but opted for users to annotate / add ...
3
votes
0answers
193 views

Object pooling in WPF

In a WPF project I'm working on, often multiple objects reuse the same AnimationTimeline, to smooth that out I made an ...
3
votes
0answers
2k views

Cancel running Task on Dispose and race condition

I'm building a wrapper around NamedPipeServerStream and NamedPipeClientStream. Currently my ...
3
votes
0answers
354 views

Extension methods with reusable logic - passing Action to Func<TResponse>

I have several extension methods for interacting with the Google Calendar API, and these all use an ExecuteWithRetry function for wrapping API calls within retry ...
3
votes
0answers
759 views

Navigate to three pages in parallel with Selenium, ChromeDriver, and NUnit

As an experiment, I've created an NUnit test project that should, when running all tests, open three browser windows simultaneously, and each should load a particular page before closing. My question ...
3
votes
0answers
64 views

Enabling parents and dependencies of selected items recursively

I have a class Feature as such: ...
3
votes
0answers
457 views

Event-driven UDP listener wrapper

I wrote this wrapper around the UdpClient,using events for new datagrams: ...
3
votes
0answers
208 views

Safely aborting thrid-party code using TPL

I'm using some third-party libraries in my project. Once in a while the code in these libraries freaks out and produces infinite loops and other nasty things. My goal is to write a wrapper that allows ...
3
votes
0answers
92 views

Calculate compilation time from AssemblyVersion attribute

In my program, I display the compilation time which is calculated from the AssemblyVersion attribute. The attribute is set to automatically generate a version ...
2
votes
0answers
28 views

Email Service - Sending an email with azure blob storage Version 2.0

Now implemented changes suggested in my previous post and now am back again for the internet to tear me and my shitty code down. PatchNotes Extracted templateRetriever class from the email service ...
2
votes
0answers
97 views

Generic CQRS Query handler with custom return type

I am trying to build a generic query handler using the MediatR (v8) library. Let's jump to the code: First of all I have an abstract query class like this: ...
2
votes
0answers
177 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
2
votes
0answers
196 views

Server app: pinging up to 500 clients asynchronyosly

TCP/IP server which controls up to 500 clients. There's a list of added computers and the server gets this list, selects computers which are not already connected and ping them using host name. ...
2
votes
0answers
850 views

Parsing XML file from the REST API

Please suggest how I can improve my code (like memory leakage, which pattern to use etc.). I have to parse a book XML in two ways: first from an FTP file and second from the REST API. I implemented ...
2
votes
0answers
1k views

Entity Framework with two databases (with UoW, Repository and Service Layer)

I have two databases: one for a warehouse, second for the office (The db design is out of the scope of this question). There are MANY cross-database funtions. One of those functions is ...
2
votes
0answers
84 views

C#: Foreach vs Seperate Threads?

Each 'Room' class instance needs to call the method 'ProcessRoom'. I am currently overthinking something and would like another persons opinion. One of the constant things here is ProcessRoom gets ...
2
votes
0answers
232 views

Customizable Blockchain's block structure

I'm creating a new open-source blockchain framework for .NET Core and .NET Standard. But I have some questions about how to make block structure to be customizable and look beautiful. Let's begin ...
2
votes
0answers
948 views

Adding support of HTTP PATCH

I have an API endpoint to modify a race car, which supports the PUT method: PUT /api/racecars/{racecarId} Since PUT must be ...
2
votes
0answers
592 views

C# FileSystemWatcher Manager with Debounce

For a class last fall I was working on a "cloud backup" system. Originally in Pascal, I decided to rewrite it in C# and expand the feature set. Below is the FileSystemWatcher "manager" class which ...
2
votes
0answers
71 views

REST API design to handle status migrations

I have a requirement to provide an API which would allow to change status of Order. The API is supposed to follow REST principles, so I have designed an endpoint ...
2
votes
0answers
55 views

Updating Excel sheet with information from a DataTable

Basically, I'm trying to update an excel sheet using a DataTable (The columns structure between the two are not the same) with respect to the following rules: ...
2
votes
0answers
680 views

Hashing a SecureString in C#

In .NET, the SecureString type exists to prevent leaking secrets in memory. I want to create a hash from the contents of a SecureString, without putting the contents in memory in a place where I can't ...
2
votes
0answers
72 views

LightsOut - A homework framework for teaching CS to non-engineers

This provides a fill-in-the-blanks homework framework to implement the game "LightsOut". LightsOut is a game with a grid of lights. When you touch a light, it toggles it’s state; it ALSO toggles the ...
2
votes
0answers
196 views

Estimate π using an infinite series

Looking for style and speed review π PI An estimate is \$\frac{4}{1} - \frac{4}{3} + \frac{4}{5} - \frac{4}{7} + \frac{4}{9} - \frac{4}{11} + \frac{4}{13} - \frac{4}{15} + \frac{4}{17} \$... The ...
2
votes
0answers
72 views

Script testing a PDF making server

The script tests a server rendering PDFs. The server is running as a Windows service. The script does the following: Prepare the test configure server export script variables to xml copy input Run ...
2
votes
0answers
437 views

Copy directories using BackgroundWorker

I am writing an app to copy the contents of a directory to a removable drive. I'd like to know if there is a better way of structuring this. The UI layout is a ...
2
votes
0answers
42 views

Creating an Excel sheet and appending namings for a matrix

I'm working on some VB.Net code to generate data sheets for giving user rights on a per folder level. I came up with this code but it's very slow and I feel like it could be improved. ...
2
votes
0answers
27 views

Validate User By Comparing against SQL Data

I'm currently building a Windows Form Application using Visual Studio 2015 and the Visual Basic.NET programming language. On the main form there is a Tab Control and an ActiveX PDf viewer control. ...
2
votes
0answers
404 views

Implementation of custom config section

i recently wrote my first custom config section. I have a collection of index files, each has a path and a savetime: ...
2
votes
0answers
550 views

Add transactional Units of Work to incorrect NHibernate usage (microsessions, single object actions)

This code is part of a quite huge repository using NHibernate in a wrong way: no units of work, but microsessions for every object loading and saving (ignorant of Persistence Ignorance, coded like ...
2
votes
0answers
60 views

UI code-behind for managing employees

I have a form code behind and it has what are called "Common Utilities". Basically the original author made a super class that is embedded into the main form code behind. What is the best way to ...
2
votes
0answers
968 views

Update Virtual Property in a Code First Model using Independent Association in Entity Framework 6

I have a Model that looks like this: ...
2
votes
0answers
146 views

Improving class for parallelising parts of main codebase

This is a class I wrote for parallelising certain parts of my main codebase. How could this code be improved in terms of making it shorter, more secure, and more efficient? ...
1
vote
0answers
35 views

Handle login method with external users and LDAP users

I'm working with a ASP.NET Core (v2.2) Web Api project and implemented some APIs. However, I'm facing performance issues, hence trying to optimizing the code. Here is the login API code. ...
1
vote
0answers
52 views

Extension method: Task<T>.CoalesceAwait

There has been ongoing concern about the question of awaiting a task that could possibly be null, as when using null-coalescing operators. Consider the following: ...
1
vote
0answers
126 views

Reactive Extensions wrapper around Confluent.Kafka for .NET

Just an Rx wrapper around Kafka to represent topic consumption as IObservable<T>: ...
1
vote
0answers
104 views

Accurately measure ASP.NET Core 3.x actions execution times (Web API project)?

I want to be able to log the time spent by a certain Web API action in an ASP.NET Core 3.x application. This is a very old question from ASP.NET which relies on global action filters, but in ASP.NET ...
1
vote
0answers
50 views

PowerShell script to execute Docker maintenance, optionally non-interactively

Problem Developers in my team are new to Docker. I wanted to provide a way to accomplish general Docker housekeeping tasks (like pruning unused images and compacting the Hyper-V volume) largely ...
1
vote
0answers
71 views

Running some code every day at certain times

I am currently developing a windows service in C# which is supposed to run a data import every day at configurable times. For this purpose I have created a class "ExecutionTime" which contains the ...
1
vote
0answers
37 views

string.To2DCharArray extension method implementation

I would like to ask a code review for the class below. I am asking this because VS showed a quite low Maintainability Index of 54 and I am wondering if it is good code. I know I could have extracted ...
1
vote
0answers
83 views

An arithmetic operation app in C#

One of my friends was creating an app with following requirements and having been someone with slightly more coding experience, I wanted to help: Create a calculator that does one arithmetic ...