Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [.net]

Do NOT use for questions about .NET Core - use [.net-core] instead. 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 supports many programming languages, including C#, VB.NET, F# and C++/CLI.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

Deserializing DateTimeFormatInfo throwing “Not a valid calendar for the given culture.”

I am serializing DateTimeFormatInfo and getting an exception "Not a valid calendar for the given culture." when I deserialize it. From inspecting the .net source it seems the root issue is since the ...
0
votes
0answers
20 views

Connection string property has not been initialized EntityFramework Core

Facing this exception message in my GenericRepository The ConnectionString property has not been initialized. I have already configured my connection in Startup.cs as such services.AddDbContext<...
-2
votes
1answer
29 views

How To Add-Onto For Loop Without Looping From The Beginning?

I'm trying to get a list to display into my combo box, each time a user inputs a new boat name & a boat license, they both get added to the combobox. I've tried doing this with for loops but it'...
0
votes
1answer
14 views

Azure VM Server IIS 10 500.19 internal error, tried all the solutions given in previous posts

So I developed a Virtual Machine Server 2016 in Azure, configured everything by MS documentation and I'm stuck with this error for hours. I have published my code to VM successfully, it works on ...
1
vote
0answers
20 views

Binding redirect for non-strongly named assembly in .NET 4.5.1?

So I'm banging my head against binding redirects in .NET 4.5.1 Is there any trick to allow binding redirect for an assembly that isn’t strongly named ? My service has a dependency on some ancient ...
-1
votes
0answers
45 views

The performance between Dictionary and DataTable.Find() in C# why Dictionary is better

The test result told me Dictionary is slightly faster than DataTable.Find, anyone knows why? --Original Question: I am curious which way will be more efficient. I have a DataTable (wpf) got from SQL ...
1
vote
1answer
11 views

DataService in Test env always return null when fetching InMemoryDb data

public class TestStartup : Startup { private readonly Mock<ICarService> _carServiceMock; public TestStartup(IConfiguration configuration) : base(configuration) { ...
-2
votes
3answers
40 views

How to truncate a decimal to 2 places? [duplicate]

I have a value 100.0000. I need truncate it to only two decimal places like 100.00 I need to do it when it have 00's in 3rd and 4 places. How to do it??
0
votes
0answers
10 views

EPPlus Load CSV and Format All Cells as Text

I am trying to import a CSV and have all cells show exactly how they were sent in via the CSV. Everything actually works great with the converting of the csv to the excel file and I email the ...
1
vote
0answers
19 views

How to Run C# on Sublime Text 3 on macOS?

I'm trying to run C# on macOS, using Sublime Text 3 on Automatic mode under: > Tools > Build System > Automatic and have built a system: { "cmd": ["csc $file && $file_base_name"...
0
votes
0answers
28 views

How to use \u or \x in regular expression matching? (C#) [duplicate]

I couldn't figure this out after spending 2 days of Google search and trials. Question: Is there any way to use a regular expression that includes \u or \x? What I want to do: I am reading a long ...
0
votes
0answers
10 views

Having trouble including double quotes with RegularExpressionAttribute [duplicate]

Having trouble including double quotes in a group of acceptable characters in a Regular Expression. I have a Asp.Net MVC project with a model that has some string properties that I want to only allow ...
1
vote
3answers
30 views

Is there a general Logging service on Azure?

Maybe SO isn't the right place for this question. If there is a better platform, please let me know and I will post it there. Within a single product/domain, we have multiple Azure-hosted ...
0
votes
0answers
5 views

ClickOnce does not unregister/re-register VSTO solutions when running from Windows 10

Release an HelloWorld add-in for Ms Word. Sign and publish via ClickOnce, with the installation folder being set to an online directory. Routine to follow Run the add-in setup.exe to install via ...
1
vote
0answers
10 views

Concurrent calls to web service to COM application (Primavera ERP)

I have a web service that calls a function and creates a sale in ERP PRIMAVERA, it does work if i call it sequentially, but if i call it concurrently, because ERP does not support Threads and can only ...
1
vote
0answers
37 views

Memory leaks while using powershell runspace in .NET

I found a huge memory leak in project which appears after execution PS command. Here I create example that represent my problem: using System; using System.Collections.Generic; using System....
0
votes
0answers
13 views

Can't connect to Connected Services Authentication with Azure Active Directory

I'm trying to connect to the Connected Service "Authentication with Azure Active Directory" but Visual Studio throws an error when I click it. Connected Services The Connected Services component '...
-1
votes
1answer
28 views

How to catch an unhandled exception in c#.net wpf?

I have a WPF C# Application and I have included try catch in all the procedures, functions, event handlers, etc. But my application crashes and restarts at some point. When application crashes, it ...
0
votes
0answers
8 views

Dialogflow WebhookRequest parameter list empty in C# .NET

I use @sys.geo-city for a parameter, but the request doesn't pick it up: { "responseId": "bd9ad2dd-9a8b-4c66-a1c1-4731dc5a66d2-d5ae01f3", "queryResult": { "queryText": "weather", "...
-1
votes
0answers
12 views

.net Windows Workflow Fundation VS2017 error in designer “an exception occurred in the invocation destination”

im following the instuccion (https://docs.microsoft.com/en-us/dotnet/framework/windows-workflow-foundation/how-to-create-an-activity) about how to create a WF (Workflow Foundation) but im stuck in ...
0
votes
0answers
32 views

Need help converting custom C# Windows forms controls to custom C# Universal Windows Platform controls

I am converting a C# windows forms app to a C# universal windows platform (UWP) app. In this app, there are custom controls that use the Paint event to add a handler method. In this handler you get a ...
0
votes
1answer
71 views

Pass method as argument without Delegate

Does the C# compiler require a function delegate to pass a function as an argument to another function? In Visual Basic .Net I can pass a function whose return value is of the same type as a method ...
0
votes
0answers
14 views

How to shrink a PDF in .NET using iText

My goal is to transform a PDF containing an img at the center, to a pdf containing only this image. Basically, just by reproducing this example i should be okay, but i can't reproduce it in .NET. What ...
1
vote
0answers
14 views

Mention user in Microsoft Teams get exception of 'BadRequest', Ms teams channel of Bot Service shows error 'Mention entity does not match text'

I downloaded sample code from Mention sample; var mention = new Mention { Mentioned = turnContext.Activity.From, Text = $"<at>{turnContext.Activity.From.Name}</at>" }; var ...
0
votes
0answers
6 views

Could not load file or assembly 'Google.OrTools' or one of its dependencies.Strong name signature could not be verified

Server Error in '/' Application. Could not load file or assembly 'Google.OrTools' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, ...
0
votes
2answers
33 views

Providing sync and async methods

With any new library project, I am torn between providing async methods, normal synchronized methods, or both. In this example, I'm attempting to provide both a sync and an async method to produce the ...
-2
votes
0answers
31 views

Launch an external process on a server using ProcessStartInfo in a c# application

I am trying to launch an external process with a .net application using ProcessStartInfo. Where can I pass the login and password of the server that I want the process to be launched on? ...
0
votes
2answers
18 views

How to retrieve Cookies with System.Net.Http.HttpRequestMessage

I have this function: [HttpPost] [Route("api/authenticate")] public async Task<HttpResponseMessage> Authenticate(Auth a) { var cookies = Request.Headers.GetCookies() } ...
0
votes
0answers
11 views

Oracle connectivity issues with dotnet on linux

I'm trying to connect to an Oracle DB from a C# dotnet 2.2 microservice on a Linux box. It's throwing an "Unable to resolve connect hostname" error, ORA-12545. I'm trying to avoid using IP address ...
0
votes
0answers
16 views

File type of a Zip file is changing while copying to AWS S3

I am trying to copy a zipfile from my local machine into AWS S3 bucket. I am successfully able to copy the file, however the file type changes to file instead of {.zip} I am new to AWS and hence not ...
2
votes
2answers
28 views

How to add the properties tab to a class library project in Visual Studio 2019?

I have a Visual Studio 2019 solution which has several Class Library projects targeting .NET Standard 2. Every one of these projects has a properties tab like the one described in the below image: ...
0
votes
0answers
15 views

How to use A token received from an API in my webapp

The context is: API developed in C# Asp.net Web API. Web application developed in C# Asp.net Core 3.0. I have created an API that implements Owin Token Authentication, it works like a Charm and the ...
0
votes
0answers
10 views

Can JsonPatchDocument use Attributes

Can I use Attributes on my objects and still use JsonPatchDocument? Currently, if I have this object: public class Test { public float FloatTest { get; set; } } I can only send in float, ...
0
votes
0answers
12 views

Init HalconWindow/HSmartWindowControlWPF in Background in C#

Is there any way to initialize a HalconWindow or a HSmartWindowControlWPF in C#? I am having multiple HSmartWindowControlWPFs in a TabView but only those that were visible before are updated. So if I ...
0
votes
4answers
27 views

Automatic insertion of rows to DataGrid View without using a timer in Winforms

A row is to be automatically added in a datagridView of Winforms according to value changes in a text box. A text box (textBox1) is used in the form to input the value. With the change in the value a ...
0
votes
0answers
18 views

SpecFlow Parameter Bindings Using Examples

I have the following in my SpecFlow .feature file. Scenario: Signout Given I am signed in with an <userAccountType> account When I sign out Then I should see the signin page ...
-1
votes
1answer
29 views

How to access Dictionary Model Property value from View - ASP.Net MVC

I want to get value of Dictionary from View. In the view, I have a main/first foreach loop that retrieve data from Model, and inside the main/first loop, I need to retrieve the ListAttribute value ...
0
votes
0answers
37 views

Access SignalR Performance Counters in C# .NET Core

I have trouble accessing the SignalR Performance Counters; How can I access the performance counters for SignalR in .NET Core using C#? I've sucessfully installed them via signalr.exe ipc But I ...
0
votes
0answers
7 views

How to get access token and Id token in Asp.Net (Owin Mvc) Openid Connect

When login performs it will hit the Identity Provider and after entering credentials(username,password) it will redirect to the application. Am following grant types are hybrid, authorization_code ...
0
votes
0answers
31 views

Buffer overrun error on processing windows form message

I am using winform application to process the document files in visual studio 2017. The application works on processing different files such as word document, excel document, email message file. I am ...
2
votes
0answers
18 views

Load Captcha Site Key from Data Base

I need to get the Site Key from the DB.(instead of setting it directly on the project or web.config) How can I load the JavaScript api and perform a POST request with my sitekey from the DB? <...
0
votes
2answers
37 views

Azure Functions: Function started lag time on App Service plan

We are experiencing a performance issue on Azure functions under load where there is a lag time between the call to the Azure function and the code in the function executing. The first log entry for ...
1
vote
1answer
22 views

what the difference between RegisterInstance and RegisterType in DI Autofac

I am new in Autofac and i am trying to understand the difference between RegisterInstance and RegisterType in a web api 2 (.Net framework). Here in his doc have a simple example var builder = new ...
0
votes
0answers
33 views

handle insert actions of entities using a Base class in EF code-first

I'm using Entity Framework Code-First approach and use a base class to handel insert and update actions of my all entities using Save() method. I have a code like this: public class BaseClass { ...
0
votes
0answers
19 views

how to set report height depends total lines or data by using Crystal report

for example i selected a A5 page size in report design and ​i don't want to print full page size but only want to print the data's or line because in that report contains only one or three lines in ...
0
votes
0answers
37 views

Using “Microsoft Print to PDF” printer without showing dialog

I have a FixedDocument that I allow the user to preview in a WPF GUI and then print to paper without showing any Windows printing dialogue, like so: private void Print() { PrintQueueCollection ...
0
votes
0answers
11 views

Read nested array as whole with Utf8JsonReader

I'm trying to parse GeoJSON geometry definition using System.Text.Json's Utf8JsonReader. My problem is that the coordinates property of the geometry definition might be positioned prior to the ...
0
votes
0answers
35 views

Merging overlapping time ranges with their weights

I have a DateRange Model which is in the following: public class DateRange { public DateTime start { get; set; } public DateTime end { get; set; } public int weight { get; set; } } Here ...
0
votes
1answer
26 views

how to map slightly complicated scenario then from -> to member scenario

I have a CarDto and Car domain object. Car has list of Drivers. public class Car { public int Id {get; set; } public int Name {get; set; } public ICollection<Driver> Drivers {get; ...
0
votes
4answers
70 views

How to add where statements dynamically by linq

I want to write where statement dynamically. ex. public class MyClass { public int id {get; set;} public string name {get; set;} } List<MyClass> myClasses = GetMyClass(); List<int> ...