Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [.net]

The .NET framework is a software framework designed mainly for the Microsoft Windows operating system. It includes an implementation of the Base Class Library, Common Language Runtime (commonly referred to as CLR), Common Type System (commonly referred to as CTS) and Dynamic Language Runtime. It ...

0
votes
0answers
2 views

response.redirect is not waiting for the redirection to complete

I have a small redirection code which redirects the current request to a jsp page and has to wait till the jsp page executes and then resume execution of the main thread which is to load a ...
-3
votes
1answer
56 views

C# While loop not working

New programmer working on a little file mover. Not sure why my while statement is not working. I am trying to have the program check if the file exists in the directory and if so, counter++ until it ...
0
votes
0answers
5 views

WCF IIS service installer file requirements for client machine

I have WCF .svc file I need to bundle up for customer to deploy in IIS. What files need to go in the service folder where the .svc file exists. Do you have to provide the service contract source files,...
0
votes
0answers
14 views

Azure functions - How to access HttpRequest data in a class other than function

I have a Http triggered azure function and I am injecting a custom attribute 'api' using IExtensionConfigProvider public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", ...
0
votes
0answers
9 views

Running processess - Can we check if a running application, windows service or a program uses .Net framework to execute itself

Task Manager - Running processes on the server Can we check if a running application, windows service or a program uses .Net framework to execute itself. windows service - how to get the executable ...
0
votes
0answers
15 views

Run .net core 2 console app in Pre-build event

I have a .net core 2 project where I want to run another .net core 2 project in the pre-build events. All my previous projects were developed using framework 4.x, which upon building generated .exe ...
8
votes
0answers
35 views

Possible .NET JIT call parameter lifetime bug?

I've been chasing down the cause of an intermittent crash in one of our .NET services due to an internal error in the .NET Runtime (exit code 0x80131506). The service in question doesn't perform any ...
-3
votes
0answers
26 views

How can I handle Windows File Explorer with C#?

I mean closing and opening File Explorer windows. For example if the C:\Program Files is opened, and I want to close it programatically, what can I do?
0
votes
0answers
10 views

How to map SQL database results to a domain model in EF Core

I have the following domain models: public class Country { public string ISOAlpha3Code { get; set; } public string NameUS { get; set; } public string NameES { get; set; } public ...
0
votes
1answer
9 views

open mdb file in windows service

When I debug on VS,I can access *mdb databases in my applcation (MS Access) without any troubles. In our old data exchange application, running as windows application it works also fine. Now we ...
0
votes
0answers
13 views

System.Net.Http not found after migrating from .netcore 2.1 to asp.net 4.7.2

I recently migrated my project from .netcore 2.1 to asp.net 4.7.2, because of some 3rd party .dll. The solution builds and runs locally. It also builds on our dev environment in TeamCity. However, it ...
0
votes
1answer
16 views

SignalR unable to receive broadcast when in Microsoft Edge

We have problem getting message from Hub when we're in Microsoft Edge. The connection is established, sending message from Client -> Server works as expected, but we're not receiving any response ...
-6
votes
0answers
20 views

ejecutar una funcion javascript desde un método en una clase en c# (visual studio 2017) [on hold]

Es posible ejecutar una función javascript desde una clase c#? Tengo una función en un script javascript que devuelve un json. Yo quiero guardarme ese json en una variable en una clase c#. Es posible? ...
0
votes
1answer
24 views

dotnet build - get error “could not return the default page '/index.html'”

try to generate my project into exe file, but get error: before: "dotnet build -r win10-x86" is ok after run generated exe, all is ok also: indows DPAPI to encrypt keys at rest. Hosting environment:...
0
votes
1answer
15 views

Incompatibility between .net sdk and .net core when running tests

We use a msbuild-sonar-scanner image to run some tests on a .net application. Within the Dockerfile that builds the sonar-scanner image, at some point we perform: && echo "deb http://...
0
votes
1answer
13 views

Is there a way to download an object from S3 bucket to a file destination using AWS SDK for .NET?

I am trying to find a way to download objects from a S3 bucket to a file destination using AWS SDK for .NET. I can get a list of the objects and delete the objects, but I don't see anywhere that you ...
0
votes
1answer
25 views

.Net Calling NetworkStream.Read() twice caused about 100ms overhead, what's the cause?

I am writing a simple Tcp communication programs using TcpListener and TcpClient , .Net 4.7.1 I designed my own protocol to be: For each "data unit", the first 4 bytes is an int, indicating the ...
0
votes
0answers
8 views

Process.Kill() terminates every other started process

We are using a self developed application for a self-updating mechanism in a .Net-Core application which is hosted in a IIS. The .Net-Core application checks or licensing service and if there is a ...
-1
votes
0answers
7 views

BitmapData.Scan0 returning address outside available memory

I have a System.Drawing.Bitmap (.NET 4.5) and am attempting to get the address of the data to pass to a library. Dim wholeImage as new Rectangle( 0, 0, bmp.Width, bmp.Height ) Dim bmpData as ...
6
votes
3answers
84 views

.NET C# float.Parse returning different result as double.Parse [duplicate]

Can some of more experienced guys explain this strange error I found today? I was getting strange amounts when I was loading table data with my C# script. As it turns out the problem is a different ...
0
votes
0answers
7 views

Build failures with Mono 5.14.0.177, msbuild 15.0, nuget 4.7.1 on Travis CI, not reproducible in VirtualBox

I'm getting build failures with Mono 5.14.0.177, msbuild 15.0, nuget 4.7.1 on Travis CI for both Xenial and Trusty Ubuntu, but not reproducible in VirtualBox, Ubuntu Xenial. Here is successful build ...
-1
votes
0answers
6 views

Generate resx.Designer.cs for netstandard

I want to generate my resx.Designer.cs files. I use the following code: public static String GetResxDesignerCS() { Dictionary<String, String> dic = new Dictionary<string, ...
2
votes
1answer
42 views

nest repeater with list of string

I have an object of the following type: public class TriggerMessage { public List<string> Triggers_EN { get; set; } public List<string> Triggers_FR { get; set; } public string ...
0
votes
0answers
6 views

Creating RunTime Mock: InvalidProgramException after compiling Expression.Throw with Expression.Throw

I am trying to create a run-time mock, which will have a specific behaviour for every method, which will be called. For example this mock should always return null - which is already working - or ...
0
votes
0answers
27 views

How to specify any character except a certain word in Regex match? [duplicate]

What is a regular expression to say "Any Set of characters except a certain sequence?" ".*?" except "abc"? Example: "ll xx abc xx tt" I currently have: "xx.*?tt" However, I wish to return the ...
0
votes
1answer
20 views

C# - Caching individiual keys vs cahcing dictionary of keys in ASP.NET web API

I need to cache information about user roles in ASP.NET Web API. I have decided to use System.Web.Helpers.WebCache class. Role is plain string, which is about 40 character long. Each user may have ...
0
votes
1answer
26 views

Create a way in .NET to determine X,Y locations on a PDF for printing

I have a PDF that is a template I will use to print onto special paper stock in a printer. I want to create a way to use the mouse to capture x,y locations when i click on certain areas of the pdf. ...
0
votes
0answers
15 views

How can I fill and get the PDF output of a Excel spreadsheet programmatically?

I have a Excel workbook that allows me to input the values of some fields, click on a button, and then a PDF report it's generated based on my input. I then have to choose the directory where to save ...
0
votes
1answer
20 views

Error validating ipv6 address .Net

private bool ValidateIpAddress(string ipAddress) { if (IPAddress.TryParse(ipAddress, out IPAddress address) && address.ToString()==ipAddress) { switch (address....
1
vote
1answer
17 views

.NET MAC algorithms and implementing ISO 9797 MAC algorithm 1

I need to implement ISO 9797 MAC algorithm 1 in .NET. Before writing the code I want to understand the concepts so that there's no misunderstandings (thus pardon me if some of the questions are just "...
0
votes
1answer
16 views

Permission Denial: requires android.permission.READ_PHONE_STATE

I'm trying to detect phone calls in my android app but I receive the following message when receiving a call: 08-23 15:16:04.685 Vodafone VFD 600 Warning 850 BroadcastQueue Permission Denial: ...
0
votes
0answers
20 views

.NET Core - FluentValidation inject

I am creating ASP.NET CORE (2.1) project and trying to use FluentValidation library (https://fluentvalidation.net/). Unfortunately I am getting an error when I am sending request to my ApiController. ...
1
vote
0answers
14 views

Excel as inframe in WPF has disabled ExcelWorksheet

I found a solution to setup Excel instance in WPF by using the SetParent() function of Windows. Problem is, that mouse and keyboard is not reacting to the sheet but to the Workbook it does. I also ...
0
votes
0answers
10 views

How to get the UN-impersonated user in .NET 4.0 - or how to un-impersonate?

I need to backport this method to .NET 4.0 public static class foo{ public static void Run(ContextBody callback) { System.Security.Principal.WindowsIdentity.RunImpersonated(Microsoft.Win32....
0
votes
1answer
14 views

MS Build not working with gitlab runner while working locally

I am having problems getting my pipeline to succeed. Obviously the sources are identical (just cloned from master). The strange thing is when I run the same command using cmd it works. What is ...
0
votes
1answer
31 views

How can I get an one to one object without with only one related entities?

I have a Book class that contains an InventoryItem and the InventoryItem contains the Book, so the relationship is One to One. If I want to get the Inventory item it will return the Book that contains ...
2
votes
1answer
21 views

Add custom user controls from a referenced library to the toolbox

In WinForms projects (ie. VS solutions) using .NET4.0 I want to add custom controls to the toolbox which are contained in a library. The library DLLs are installed via NuGet. Individual solutions may ...
1
vote
2answers
69 views

Is it acceptable to throw from IComparable.CompareTo()?

Example (Currency is an enum): public struct MoneyQuantity: IComparable<MoneyQuantity> { public Currency Currency { get; } public decimal Amount { get; } public MoneyQuantity(...
0
votes
2answers
20 views

Fetch XML from database & merge them

I have a table in which a column with xml datatype has many xmls in following format. <Hash HashValue = "9738839398923"> <Element1> <childelement1 attribute1 = "..." ...
0
votes
3answers
38 views

How to send email to multiple recipients separately in one button click

I have a mailer in which I want to send mail to multiple recipients. The recipients can be from a database or an excel worksheet. Here is the code: protected void btnSubmit_Click(object sender, ...
0
votes
0answers
6 views

vsts xunit vstest.console.exe failed with return code: 1

I have a problem running XUnit Tests through VSTS build (private hosted agent), only when a test fails : 2018-08-23T09:44:00.1110631Z ##[warning]Vstest failed with error. Check logs for failures. ...
2
votes
0answers
14 views

.NET Core on Linux - LLDB, SOS plugin - diagnosing memory issue

I have a .NET Core app which uses up to ~150MB on Windows, but ~1-2GB on Linux (not VM size, but actual private bytes). It calls Azure HTTP APIs in a loop to retrieve stats. I'd like to diagnose the ...
0
votes
0answers
7 views

Apply .net core MVC InputFormatter to controller

i'm pretty new to dot net core :( . I'm trying to set up a little MVC application. Where i implemented a controller with a defined Route. [Route("api/ota")] public class OTAController : ...
1
vote
1answer
42 views

Large factorial using BigIntegers losing precision

It'sa me, with another problem. I need to calculate a factorial of a really huge number, lets assume it is 95. So as we all know 95! equals to: ...
1
vote
1answer
44 views

Process.Start() does nothing when called from a C# written service

I have created a service that works good, except for this section that don't do what I want shutdownProcess.StartInfo.RedirectStandardError = true; shutdownProcess.StartInfo.WorkingDirectory = @"C:\...
0
votes
1answer
20 views

Exclude properties for migrations

I have properties on my model that I don't want to generate fields in the tables after a migration. Is it possible to exclude properties for Entity Framework Core migrations? Is there an attribute ...
0
votes
0answers
8 views

System.Net.ServicePointManager.MaxServicePointIdleTime=0 needed?

I implemented a custom ServerCertificateValidationCallback for certificate pinning. We do see however that the custom callback is not called for every request that's being send. This can be solved by ...
1
vote
1answer
28 views

Entity Framework Core - manually assigning id's to linked entities

I've reviewed other related questions on StackOverflow, but I haven't found one that matches my exact question or scenario. I have an JavaScript front-end where I have two entities that are linked, ...
0
votes
0answers
10 views

Visual studio project installer, startup folder, filename

I'm using Microsoft Visual Studio 2017 Installer Projects to make an installer for my application. I have made a shortcut to the primary output in the users startup folder. It is working, and the ...
-1
votes
0answers
9 views

Remove Aero shadow enabled with DwmSetWindowAttribute from a Windows form

I have a WinForms.NET form for which I need to enable/disable the Aero shadow effect. It was easy to find the corresponding bits of code to enable this effect in the Internet: [DllImport("dwmapi.dll")...