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#

.net-4.6
Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

GitHub Action with .NET Framework 4

Is it possible to create a GitHub Action for building an old .NET 4 based app? I've created such pipeline: name: EZRep Build on: push: branches: master jobs: build: runs-on: windows-...
0 votes
0 answers
21 views

Why is my Multipart Form not working when sent from .NET Framework 4.6.2?

I currently have 2 APIs. One is in .NET Framework 4.6.2 and one is in .NET 8. I'm trying to upload files and metadata as form-data though the .NET Framework API to the .NET 8 API. When uploading form-...
80 votes
5 answers
89k views

HttpClientFactory.Create vs new HttpClient

I am curious what is the purpose of the HttpClientFactory class. There is no description of why it exists on MSDN (see link). There are Create methods with more specialized arguments, but mostly I ...
1 vote
2 answers
628 views

How can I setup .NET Framework 4.6.1 for MSBuild on GitHub Actions?

When I use the latest setup-dotnet, I get an error: MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) ...
2 votes
1 answer
8k views

Azure App Service app settings are not available through ConfigurationManager

I am using Azure App Service. I am trying to add several parameters in section Application settings -> App settings and Connection strings to override values from web.config I cannot get access to ...
0 votes
1 answer
165 views

Equivalent encryption with method CryptoJS.AES.encrypt in c#

I want to encrypt in c# exactly like in Node.Js which this method in Node.js does: let encrypted = CryptoJS.AES.encrypt(JSON.stringify(text), passPhrase).toString() So I could encrypt in c# and be ...
1 vote
3 answers
3k views

What changes are needed for .NET framework upgrade from 4.6 to 4.8

I am working on project upgrade for the 1st time. I have a solution built upon 4.6 version of .NET framework. When I opened it very first time in VS 2022, I got a dialog box saying upgrade to 4.8 and ...
0 votes
1 answer
25 views

LibVLCSharp - Play file from zip archive

I'm trying to improve some of my already-existing app in WinForms, that uses libvlcsharp to play locally storaged files. I need to add support for playing file (usually h264 mp4) inside zip. I can ...
15 votes
3 answers
7k views

.Net 4.6 AppContextSwitchOverrides not setting switches declared in config

I am trying to set the compatibility switch "Switch.System.Xml.IgnoreEmptyKeySequences" from an entry in an app.config (or web.config) file, but the override appears to be ignored. To remove ...
1 vote
1 answer
147 views

What is the lifetime/scope of ClientInterceptorContext in .NET?

I have a .NET gRPC client on .net 4.6.2 using Grpc.Core library. I've registered gRPC channel as singleton to reuse it following [this recommendation].(https://learn.microsoft.com/en-us/aspnet/core/...
0 votes
0 answers
88 views

After migrating .NET 4.6x to .NET Core 6. same code is producing "Padding is invalid and cannot be removed .net core migration."

After migrating our encryption project (library) from .NET Framework 4.6x to .NET Core 6, we are getting the error Padding is invalid and cannot be removed.. The code is the same, with the same ...
0 votes
1 answer
31 views

Dictionary input parameter of a WCF method not receiving the value

I declared a method like this: public int MyFunc(int x1, Dictionary<string, string> x2 , string x3 , Guid x4) and I sended a request from Postman with this body: { "x1" : "1&...
0 votes
0 answers
90 views

DbSet query with AsExpandable() and async throws InvalidOperationException (IDbAsyncEnumerable)

I'm trying to run an async query based on an Expression<Func<>>: Expression<Func<IDbUserRightsInfo, bool>> expression = u => u.MarketingType == eUserMarketingType.Internal; ...
2 votes
0 answers
151 views

Error 500.19 in server with IIS 10 after deployment a new version of a web services

I had a Web Service running in net 3.5 (I know, so old) and I migrate it to Net 4.6. I completed the migration in local, but when I deploy the web services in the server I get an 500.19 error. I ...
0 votes
2 answers
121 views

Is it possible to use ROPC to update profile if sign-in was done using Authorization Code with MFA?

We're in the process of migrating our authentication process from ROPC to Authorization Code with MFA. We currently use ROPC for Sign Up, Sign In, Reset Password, Forgot Password, and Profile Edit. ...
1 vote
1 answer
115 views

Uncaught ReferenceError: mozRTCSessionDescription is not defined

I have an ASP.NET MVC app (.NET Framework 4.6.2) which has a front end on Knockout.js it also uses signalR. The app was working fine until we upgraded Firefox to version 113.0 and 113.0.1. The app ...
1 vote
1 answer
127 views

Binding named tuple to XAML DataGrid

In my WPF application, I have a lot of view models that, now, require a "property-value" like grid. I'm trying to build a generic purpose view model that can be "injected" in ...
9 votes
4 answers
9k views

Can MS .NET 4.6 be used with Visual Studio 2010

We are still using VS 2010 SP1 to develop a large scale LOB ASP.NET web application. The infrastructure folks are looking at pushing .NET 4.6 (and the targeting pack to devs) to the desktop and I am ...
34 votes
3 answers
6k views

Garbage Collection and Parallel.ForEach Issue After VS2015 Upgrade

I have some code to process several million data rows in my own R-like C# DataFrame class. There's a number of Parallel.ForEach calls for iterating over the data rows in parallel. This code has been ...
0 votes
1 answer
288 views

Microsoft interop to Word does not work after uprade to Office 365

I had Word templates in my database that are used for mail merge. I used Office 2013 when I created this code with .Net 4.6: Object theTemplateFile = theWordFileName = Path.Combine(Path.GetTempPath()...
0 votes
0 answers
161 views

How to get DebugDiag to show method names in the stack trace?

I am trying to get to the bottom of a crash in a .NET 4.61 web application running under IIS. I got Windows to generate memory dump on crash. I then loaded the .dmp file into DebugDiag and added ...
1 vote
0 answers
22 views

From .NET 4.0 add reference to assembly in .NET 4.6

Visual Studio 2019 allows in the .NET 4.0 project Tests.Test_4_0.vbproj to add a reference to the .NET 4.6 assembly Tests.Test_4_6.dll. The editor allows to call methods of class Test1 in the .NET 4.6 ...
10 votes
5 answers
16k views

Unity Coroutine yield return null EQUIVALENT with Task async await

What is the equivalent of yield return null; in Coroutine (that run each frame at Update) in an async method ? The nearest I got to find is await Task.Delay(1);, but it DO NOT run every frame. ...
143 votes
10 answers
219k 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 ...
0 votes
1 answer
2k views

Which Rest sharp version should I use to support a legacy .Net framework application built on version 4.6.1

I have and application that is build using .net framework 4.6.1.0. I can't upgrade it. I have to create an assembly file for this application that gets loaded dynamically. This assembly must be able ...
4 votes
4 answers
4k views

MySQL The client and server cannot communicate, because they do not possess a common algorithm

I'm running the following code on a AWS server, trying to connect to a mysql service provided by AWS: String conn = buildConnString(dc); MySqlConnection connection = new MySqlConnection(conn); ...
1 vote
0 answers
117 views

net 6 load assemblies at runtim to AppDomain.CurrentDomain

The goal is to migrate a .net 4.6 FullFramework lib to .netStandard /.net6. There is one app that is using a typegrabber, so it is looking in its executing folder for *.dll and tries to load them into ...
64 votes
3 answers
34k views

What is the point of .NET 4.6's Task.CompletedTask?

This blog post mentions the new Task APIs, including a new Task.CompletedTask property introduced in .NET 4.6. Why was this added? How is this better than, say, Task.FromResult(whatever)?
92 votes
6 answers
83k views

Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default

I am trying to target .NET 4.6 and also take advantage of the latest C# version by changing the C# language version to 6. However during compilation I got this error: Error Invalid option '6' for /...
1 vote
1 answer
233 views

How do I fix missing NuGet references?

I'm using Visual Studio Professional 2017, version 15.6.6. A co-worker gave me a solution which he says I should be able to open and rebuild without any problems. There seems to be something wrong ...
0 votes
1 answer
435 views

Passing the servername/Ldap inside "DirectoryEntry" Vs "PrincipalContext"

I have this action method inside my ASP.NET MVC-5 .net 4.6:- public ActionResult UsersInfo2() { List<DomainContext> results = new List<DomainContext>(); ...
1 vote
0 answers
1k views

Memory leak when using async/await with CancellationTokenSource

I have inherited an app and investigating it for memory leak issues. It's a C# .NET Framework 4.6 application that uses a lot of async/await. I think the issue is because of the thread is not being ...
0 votes
1 answer
101 views

What is the DI equivalent for NInject DI?

I am currently migrating from .net4.6 which uses NInject modules. My target is to use .net6 core and its native DI. While doing so I came across a statement from NInject for which I am wondering if ...
0 votes
1 answer
360 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 ...
1 vote
1 answer
657 views

Dependency Injection Involving Struct types

I have a class as shown below, public class AccessToken : IAuthToken { /// <summary> /// Initializes a new instance of the <see cref="AccessToken"/> class. /// </...
0 votes
0 answers
88 views

The relative virtual path is not allowed here C#

I'm having issues with this piece of C# code var localPath = $"Images\\AgencyWatermarkPaid\\watermarkpaid{invoice.AgencyId}.png"; string targetOutputFile = Path.Combine(...
32 votes
5 answers
118k views

How to install .NET 4 Framework in Windows 10

How can I install the .NET 4.0 Framework in Windows 10? .NET 4.6 is already installed but I want to have .NET 4 Framework (without modifying the registry). Turning on and off Windows features in ...
1 vote
0 answers
37 views

Reference type in EF query causing strange OR (1 = 0) in WHERE clause

I have the following setup: private IQueryable<ManagementCreditorEntity> CreateQuery(ExternalId creditorId) { //_creditorManagedPropertyDbContext is of type ICreditorManagedPropertyDbContext ...
26 votes
3 answers
11k views

How to run Roslyn instead csc.exe from command line?

After installing VS 2015, running csc.exe from command line causes this message to be displayed to console: This compiler is provided as part of the Microsoft (R) .NET Framework, but only ...
2 votes
0 answers
941 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 (...
2 votes
2 answers
438 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 ...
6 votes
1 answer
4k 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 ...
1 vote
0 answers
270 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
245 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
660 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
110 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
1 answer
2k 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
394 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....
1 vote
0 answers
746 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
1k views

special character in folder string here @

I have been searching intensively, but the returning results are not quite what I am trying to achieve. I want to access a remote folder on a server. The pain point comes (I assume) from the @ in the ...

1
2 3 4 5
9