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.

86 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
285 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
188 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
1answer
80 views

Minimum number of copies of an application a company needs to purchase

Some applications from vendors are allowed to be installed on multiple computers per user with specific restrictions. In our scenario, each copy of the application (ID 374) allows the user to install ...
4
votes
0answers
5k 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 ...
4
votes
0answers
143 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
116 views

Console Password Manager in C# in 370 lines

This is a console password manager in C# script. It has 370 lines of code, from shebang to the last }. Are there any ways to make it even smaller without inlining ...
3
votes
1answer
149 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
822 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: ...
3
votes
0answers
241 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
75 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 ...
3
votes
0answers
318 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
263 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
233 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
377 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
775 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
65 views

Enabling parents and dependencies of selected items recursively

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

Event-driven UDP listener wrapper

I wrote this wrapper around the UdpClient,using events for new datagrams: ...
3
votes
0answers
226 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
93 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
1answer
18 views

ForEachAsyncSemaphore asynchronously processing tasks but enable fast fail

I know this has been done many times before, but this is my existing code taken from a sample I found to async process a list of tasks. I've seen Task.Run in use before in many examples, but I'm ...
2
votes
0answers
60 views

How to make a good session handling with NHibernate?

here I leave my code for a repository pattern with NHibernate and Autofac. I would like to receive some feedback about it. Especially about the session handling with NHibernate. By now I don't like ...
2
votes
0answers
107 views

Simple Sqlite-driven WinForms app in C# 7.0 - database interaction code

Description This is a simple "demo" app designed to help gain familiarity with interacting with an Sqlite database from C#, particularly storing images as blobs. The database has a single ...
2
votes
0answers
325 views

C# class to dump the memory of a process in several formats

I made this because I couldn't find any good C# classes/libraries that allow you to dump the contents of a process' memory into a file or a byte array. I haven't tested this on 32 bit systems but it ...
2
votes
0answers
33 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
518 views

Reactive Extensions wrapper around Confluent.Kafka for .NET

Just an Rx wrapper around Kafka to represent topic consumption as IObservable<T>: ...
2
votes
0answers
449 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
2
votes
0answers
213 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
906 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
235 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
951 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
682 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
57 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
820 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
74 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
199 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
485 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
43 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
28 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
408 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
598 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
61 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
1k 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
147 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
59 views

How to make this algorithm faster. Calculates and searches through large arrays

Ive got this algoritm thats "complex". The comments in code give examples of how large the various data types could be. My cpu usage is less than 10% when running this and ram usage is good. ...