Questions tagged [.net-4.6]
.NET 4.6 (previously called .NET 4.5.3) is the latest framework release from Microsoft. It is a followup to .NET-4.5.2 which brings new features to both infrastructure (Roslyn, the compiler as a service) and new language features for both VB.net and C#
421
questions
2
votes
2
answers
90
views
Calling an API 20 times to generate a list, best practice?
The case is that I call an API once to get a list of tenants, then for each tenant I must call again to get a list of usages for the tenant. Unfortunately there is no way to get usages for all tenants ...
0
votes
0
answers
40
views
How to configure an httpclient using Autofac and Polly in old 4.6.1 .Net framework
There is a legacy app that uses an httpClient to interact with Web API backend.
I would like to configure several httpClients in Autofac DI container. The configuration must include timeouts, Polly (...
0
votes
1
answer
41
views
How to use DependencyInjection in BenchmarkDotNet?
I'd like to use BenchmarkDotNet on some legacy code I'm working with right now. It is written in C# Net462.
It is a big, old and complex system and I'd like to Benchmark some methods inside some ...
0
votes
0
answers
23
views
Add OpenTelemetry to a .Net Framework 4.6 Console Application
I am trying to add Open Telemetry logging to a .NET Framework 4.6 console application.
I have found many examples for .net core but not .NET Framework 4.6
Are there any examples ?
0
votes
0
answers
44
views
Why does GlobalConfiguration.Configure not apply the authorization attribute to the MVC controllers?
I have a asp.net mvc project (.NET 4.6.1) which also has a web api in the same project.
The api folder has got the web api controllers.
The Controllers folder next to the api has got all mvc ...
0
votes
1
answer
75
views
NServiceBus sending message to one endpoint and waiting for reply in another
I'm using NServiceBus with RabbitMQ in my project. I have two services that don't know about each other and don't share anything. service1 publishes request messages to endpoint1 (queue1) and service2 ...
1
vote
1
answer
32
views
What IIS authentication needs enabling for custom authentication?
I have developed a .NET MVC website with .net identity for authentication. When I deploy this onto IIS, then should I enable only anonymous authentication so that the website handles the ...
0
votes
0
answers
43
views
The client and server cannot communicate, because they do not possess a common algorithm while connecting to mysql database
I have a console application that runs on .Net framework 4.6.2. It's deployed on Windows server 2012 R2. I'm using MySql.Data.MySqlClient,MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data....
0
votes
0
answers
22
views
Dotfuscator Error when integrating into VB winform Application
I am trying to integrate obfuscation into the build of a project. I am using Visual Studio 2019 CE 16.11.5 and the project is a VB winform Application targeting .net 4.6. Windows 10 Pro x64.
As soon ...
1
vote
0
answers
101
views
System.IO.Compression Reference issue
I am working on .NET framework 4.6 Web API application. My app is working on my machine and I was able to build it in my local but when I push it to our Azure Dev OPS CI, I got this build error.
Error ...
0
votes
1
answer
49
views
The type forwarder for type 'System.ComponentModel.INotifyPropertyChanging' in assembly 'System' causes a cycle
I am working on upgrading WPF application which is built using .Net Framework 4.6 to .Net 6. While upgrading a few assemblies, I encountered this strange issue -
The type forwarder for type 'System....
0
votes
0
answers
41
views
Restsharp: Returns 0 content with error "unable to read data from the transport connection"
Background: Console app built in .Net 4.6.2
Dll: Restsharp 106.15.0.0
Mono: Mono JIT compiler version 6.12.0.122
API Endpoint: http server (not https)
At first I thought I was going mad as all was ...
0
votes
0
answers
440
views
Verify JWT Token data with C#
I am trying to verify a JWT token signed with RSA256 in C#. The token was created on the server side in Javascript with the jwt library called Jose-jwt. I am veryfing the token in a WinForms app ...
0
votes
0
answers
62
views
VBC.exe to build standalone dlls in "newer" .net frameworks. (4.6 specifically)
I am working on upgrading an older "compiler" we have, which basically converts a spreadsheet into a .vb file, and then compiles it into a .net library.
It uses vbc.exe to compile the .vb ...
0
votes
0
answers
43
views
Using token generated with Microsoft.Owin.Security.OAuth in .NetFramework4.6 in a .NET5 project
I am working on a project written in .Net Framework 4.6 that is using authentication token generated with Microsoft.Owin.Security.OAuth library. I am now supposed to create a new .Net 5 project in the ...
1
vote
1
answer
76
views
Google Dialogflow does not install for .net v4.6 from nuget
I am trying to install Google DialogFlow from nuget in .net v4.6. But it does not install. And I have to use .net v4.6 coz I have an integration with workflow foundation.
Severity Code ...
0
votes
1
answer
57
views
Exception handling in Always-running tasks
After countless hours of testing,searching, and asking question i'm still stuck on 'always-running' tasks, or does that not exist in async io/ parallell programming?
currently I have a program that ...
0
votes
0
answers
32
views
How to add a list of a custom type to userSettings?
I am sure there is already an answer to my question somewhere on SO but I was only able to find answers for similar questions, but not for the exact question that I have.
If this question was already ...
0
votes
1
answer
264
views
Using System.Management on Linux
I am creating a console .NET 5.0 app to communicate with a KUKA Robot using dll's provided within their WorkVisual software. These dll's were built with .NET Framework 4.6. On Windows everything works ...
0
votes
1
answer
63
views
ServicePointManager.SecurityProtocol multiple protocol performance
Using .net 4.6
When setting multiple protocols to access an api will trying all protocols affect the latency of the call ?
example:
ervicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | ...
0
votes
1
answer
546
views
Url redirect from Web.config in .Net application
I have ASP.Net web application hosted in Azure App service.
I would like to redirect the URL to another URL from Web.config.
For example, the below urls
https://www.example.com/Products
and
...
0
votes
0
answers
82
views
C# Swashbuckle.Net45 didn't show controllers on Swagger UI
I have add Swashbuckle.Net45 (Swagger) to my C# (.NET 4.6) 2 different web projects. on one everything working great on another I don't see any controller on Swagger-UI.
as I know the configuration ...
0
votes
1
answer
52
views
VB.net Navigating Text Adventure Game
I am working on a text adventure game. The goal of this program is to display three options and a textbox. The user can select one of the options by entering the corresponding number into a text box, ...
1
vote
0
answers
322
views
HttpClient - Single Instance across the app or static instance at controller level
In our .NET API, we were creating the HttpClient instances in each controller action. As the application should have a single instance of HttpClient for each HTTP endpoint it consumes.
We have got a ...
1
vote
0
answers
66
views
SqlDataReader doesn`t obey Cancellation requested while reading large row
Please consider this code sample:
const int timeoutInSeconds = 60; // 1 minute
static readonly CancellationTokenSource tokenSource = new CancellationTokenSource();
public ...
0
votes
0
answers
43
views
Avoid controls flickering while resizing them by code (.NET 4.6.1)
I tried searching the site but didn't find any solution to my problem.
I would like to dynamically change my controls size inside the form and see only the final result without flickering issues.
I ...
0
votes
1
answer
41
views
Entity Framework 6.4 supports Second level (L2) result caching?
I would like to know whether EF 6.4 supports second revel caching (result caching - not query caching) without extending with a third-party library like EntityFramework.Cache or NCache.
2
votes
0
answers
160
views
How debug .NET Framework in Visual Studio
I have some problem with dynamic compile C# code. I have some provider property in my class:
static CSharpCodeProvider provider = new CSharpCodeProvider(new Dictionary<string, string>() { { &...
0
votes
1
answer
99
views
Quick search for line in sorted 5 GB file [closed]
I have to determine if a given line (as string) exists in a sorted text file. The data on this file changes every day and, on average, there are 152 million records and the file weighs approximately ...
1
vote
1
answer
585
views
SingalR server build using .Net Core version talking to client build using .NET framework
I have set up a .NET Core SignalR server. It uses Microsoft.AspNetCore.SignalR and Microsoft.AspNetCore.SignalR.Core nuget packages. This application is configured in a startup class as follows.
...
0
votes
2
answers
136
views
LINQ Grouping by [duplicate]
I have list of class objects similar
public class MyClass
{
public int UserId { get; set; }
public int ItemId { get; set; }
public string ItemName { get; set; }
}
I ...
3
votes
0
answers
2k
views
How to make SameSite Cookie Support In ASP.NET 4.6.1 and below version
I have developed a site using asp.net M V C
we did ran a scan on site and it gives a C S R F asking to make the site cookies Same site.
tried below code in web.config but seems its works only from 4....
0
votes
1
answer
446
views
From windows authentication to token based authentication, keeping .net framework 4.6 and active directory in use
My enterprise application is developed in .net framework 4.5 and is using windows authentication. In which case, as we all understand, it is the underlying AD(active directory) that authenticates the ...
0
votes
0
answers
653
views
Setup HttpClient in .Net Class library for Integration Test cases
I have a class library in .Net 4.6 and associated Test class library. The class library makes the call to a 3rd party Rest API using HttpClient, here is the code
public class DemoRepository : ...
0
votes
0
answers
83
views
Project don't see library in GAC
I have console app, and lib project in solution.
After I built solution, I register lib project [dll] to GAC(and checked that it is there) and remove that dll from folder. But my console application ...
0
votes
1
answer
639
views
View final console output when run from Visual Studio, without ReadLine()
I'm debugging my console application with redirected input from a file (Debug / Start Options / Command line arguments < "filename.in"). That means I cannot use the usual ReadLine() / Read() / ...
0
votes
0
answers
50
views
Managing references of .Net executable file by PowerShell
Is there possibility to change path to dlls folder in already existed exe file by powershell script?
I'm using .Net Framework 4.6+ and looking for the way to store ddls separately and set path to ...
3
votes
0
answers
379
views
Visual Studio 2015 Windows Application Form with SQLite
I need to create an application which needs to access basic data in a database in a simple way. So I decided to use SQLite as a database manager and Microsoft Visual Studio 2015 in order to achieve my ...
0
votes
1
answer
902
views
Writing logs in console in a .NET Framework 4.6 Console Application
I tried many ways, but I could not manage to write logs in the console of my .NET Framework 4.6 Console Application. I searched on Stackoverflow and found 2 possible solutions, which did not work:
...
0
votes
1
answer
260
views
Viewstate has value but return System.NullReferenceException on postback
I recently trapped by a new and very odd exception for ViewState on page postback.
I want to set a ViewState once if the page is not postback (first time loading), then use it again on the next ...
-1
votes
1
answer
339
views
Nanoseconds to DateTimeOffset
I am using .Net version 4.6 and I am using DateTimeOffset.FromUnixTimeMilliseconds to convert nanoseconds to DateTimeOffset.
long j = 1580122686878258600;
var X = DateTimeOffset....
0
votes
1
answer
647
views
How can I prevent connections being accepted once a TCP connection is accepted?
I have a simple server that supports a single client at any time. I use code like this to wait for that connection:
Socket AcceptClient(int port){
Socket listener = new Socket(AddressFamily....
3
votes
0
answers
1k
views
C# WEB API project TLS 1.2 setup in IIS express
I have a WEB API project running .net 4.6.1 that I want to get TLS 1.2 working on localhost in IIS express first, and then once I get that setup correctly, I want to deploy it to our dev server ...
1
vote
1
answer
205
views
TelemetryClient.Flush performance issues
We use the Application Insights framework within our application do keep track of events, exceptions etc.
After installing "Security Update Microsoft Windows (KB4515383)" we are experiencing ...
1
vote
1
answer
184
views
If Type.IsGenericParameter == true, will Type.ContainsGenericParameters == true always?
If type.IsGenericParameter == true then is it guaranteed that type.ContainsGenericParameter == true for the same type?
Is there an example where this is NOT the case?
4
votes
0
answers
120
views
Why is the BaseType of a Generic Type Definition not itself a Generic Type Definition when possible?
In the example below, I'm trying to understand why the BaseType is not a generic type definition and more generally, why it isn't just equal to the typeof(List<>)
public class MyList<T> : ...
1
vote
1
answer
71
views
When GC.Collect() is called and frees up more than 3GB of space, is this necessarily a good thing?
I've read many questions on this network in regards to when one should use GC.Collect(), but none address this concern.
If we somehow manage to use it, as such as it frees a large number of memory, ...
9
votes
3
answers
616
views
How to declare a not started Task that will Await for another Task?
I've done this Unit Test and I don't understand why the "await Task.Delay()" doesn't wait !
[TestMethod]
public async Task SimpleTest()
{
bool isOK = false;
Task myTask = ...
108
votes
9
answers
138k
views
Feature 'using declarations' is not available in C# 7.3. Please use language version 8.0 or greater - Error on one machine but works on another
When using Visual Studio Enterprise 16.3.7 on two separate machines, one builds fine and the other machine throws the error:
Feature 'using declarations' is not available in C# 7.3. Please use
...