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#

The .NET Framework 4.6 is the next version of the .NET Framework. Up until now we have been using .NET Framework 4.5.3, however since the payload includes significant features and improvements, the release number was bumped up the to clearly communicate the magnitude of changes. Note that in the Preview release, you’ll still see instances of “4.5.3” in the .NET Framework and Visual Studio version information. These will be updating these in future releases.

There are many great features in the .NET Framework 4.6 Preview. These range from new WPF features to RyuJIT as well as productivity enhancements in Visual Studio:

.NET Language Innovation

In this release, several new C# and Visual Basic language features help reduce boilerplate and clutter in everyday code, encourage a more declarative style of programming, and bring the two languages even closer together. The features listed below will be available to both languages in the final release. A few highlights are shared below. Checkout the C# and VB Team blogs for all the details.

  • Methods, getter-only properties etc. can now have a single expression as their body, just like lambdas.
  • Nameof provides a refactoring-safe way of getting the name of e.g. a parameter, member or type as a string.
  • Auto-properties can have initializers and no longer require setters.
  • Index initializers Inside an object initializer you can now initialize a specific index of the new object. C# only.
  • Exception filters let you look at an exception and decide whether to catch it with a given catch block.
  • Using null-conditional operators you can get a built-in null check while accessing and invoking members and indexers.
  • Using clauses for static classes bring their static members directly into scope, so you can. call e.g WriteLine() or Sqrt() without prefixing with the class name.
  • Await now works in catch and finally blocks, obviating some very tricky workarounds.
  • String interpolation: String interpolation provides a concise way of describing string templates that insert expressions into format strings (C# only at Preview, both VB and C# at RTM).

WPF Improvements and Roadmap

WPF has key improvements in this release:

  • Transparent child windows
  • Multi-image cursor files
  • Re-designed Blend experience
  • New set of Visual Diagnostics tools
  • Timeline tool in the Performance and Diagnostics hub

Windows Forms High DPI

Windows Forms High DPI support has been updated to include more controls. The .NET Framework 4.5.2 included high DPI support an initial set of controls.

This feature has been expanded to include: DataGridView, ComboBox, ToolStripComboBox, ToolStripMenuItem, Cursor, DomainUpDown, NumericUpDown, DataGridViewComboBoxColumn, DataGridViewColumn and ToolStripSplitButton types.

This is an opt-in feature. To enable it, set the EnableWindowsFormsHighDpiAutoResizing element to true in the application configuration (app.config) file:

<appSettings>
   <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>

Next Generation JIT Compiler -- RyuJIT

This release includes a new version of RyuJIT, the 64-bit JIT Compiler. It is enabled by default for 64-bit processes.

  • Correctness – We’ve been focusing on fixing correctness bugs, using various Microsoft cloud workloads to validate RyuJIT. This approach has been working well, since the Microsoft cloud is a very heavy user of .NET.
  • Real-World Throughput – The Bing team recently started using RyuJIT on some of their search-related workloads. Based on their initial experiments, they have seen a 25% improvement in startup time, which is a significant win.
  • SIMD Improvements – We created the SIMD .NET library in unison with RyuJIT so that RyuJIT could optimize the SIMD types. Lately, we’ve been tuning our use of registers in the RyuJIT SIMD optimizations. CPUs can crunch numbers much faster in registers, since they are effectively memory on the CPU.

While the attempt to transition to the new JIT compiler as transparent as possible, there still may be compatibility issues. If your application produces an undesired behavior on RyuJIT, you can try disabling RyuJIT, which switches your application back to using the previous JIT to determine if the problems you are seeing are caused by RyuJIT.


CLR Performance Improvements

The assembly loader now uses memory more efficiency by unloading IL assemblies after a corresponding NGEN image is loaded. This change is a major benefit for virtual memory for large 32-bit apps (such as Visual Studio) and also saves physical memory.


Support for converting DateTime to or from Unix time

New methods have been added to support converting DateTime to or from Unix time. This can be necessary, for example, when converting time values between a JavaScript client and .NET server. The following APIs have been added to DateTimeOffset.

static DateTimeOffset FromUnixTimeSeconds(long seconds)
static DateTimeOffset FromUnixTimeMilliseconds(long milliseconds)
long ToUnixTimeSeconds()
long ToUnixTimeMilliseconds()

ASP.NET Model Binding supports Task returning methods

ASP.NET Model Binding methods that were previously returning Task were not supported and threw an exception at runtime. With .NET Framework 4.6, if applications are deployed with such methods, these methods will now be executed correctly.0


Channel support for managed EventSource instrumentation

You now can use .NET EventSource instrumentation to log significant administrative or operational messages to the event log, in addition to any existing ETW sessions created on the machine

438 questions
5
votes
0 answers

Does cspack.exe support .NET 4.6*?

According to Support and Retirement Information for the Azure SDK for .NET and APIs, SDK 2.6 introduced support for .NET 4.6. None of the listed SDKs explicitly mention 4.6.2 though the sister article Install .NET on a Cloud Service Role includes an…
David Peden
  • 17,596
  • 6
  • 52
  • 72
5
votes
2 answers

OwinMiddleware doesn't preserve culture change in .net 4.6.*

I have an owin culture middle ware running very nice. It just changes the culture according to the url. This works in 4.5.* perfectly. Now when the runtiome is changed to 4.6.1, the culture isn't preserved anymore and as a result it just doesn't…
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
5
votes
1 answer

Why does AutoMapping from Fluent's NHibernate ignore an enum type?

I have the following enumeration type: public enum EnumType { E1, E2 } used in the following class: public class X { public virtual int? Id { get; set; } public virtual EnumType EnumProperty { get; set; } public virtual string…
BartoszKP
  • 34,786
  • 15
  • 102
  • 130
5
votes
1 answer

.NET 4.6 - monodevelop on linux

I have mono installed from beta channel (http://www.mono-project.com/docs/getting-started/install/linux/) - version 4.0.4 I can't compile Visual Studio 2015 project. In project options under Build->General the Target framework is .NETFramework 4.6…
smokeing
  • 259
  • 1
  • 3
  • 13
5
votes
1 answer

Handedness of Matrix4x4 camera methods

.NET framework 4.6 instroduced new classes in System.Numerics namespace including Matrix4x4. It also introduced new static helper methods for 3D computer graphics like CreateLookAt or CreatePerspectiveFieldOfView. Since DirectX and OpenGL differ in…
ghord
  • 13,260
  • 6
  • 44
  • 69
4
votes
1 answer

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 specific class. Those classes use dependency injection…
cicerosf
  • 75
  • 8
4
votes
1 answer

Visual Studio suggests C# 8.0 features, but compiler yields error

In my projects Visual Studio gives me recommendations to use C# 8.0 features for Framework 4.6 projects, even though the default is specified on the Microsoft documentations to be 7.3. An example of one of the suggestions: var i1 = ""; var i2 =…
NotFound
  • 5,005
  • 2
  • 13
  • 33
4
votes
1 answer

ASP.NET 4.6 MVC How to return a Json result including datetime data with correct timezone?

I wish to return a Json Result containing the datetime queried from database. The testing on my local machine is without any problem, however, after publishing to production server, all datetime show 3 hours ahead. I assume it is due to the server…
Lei.L
  • 111
  • 1
  • 12
4
votes
2 answers

How to achieve sequence of timeouts with RX?

The scenario is as follows: a device communicating over is considered connected if it makes a callback to the server within a short period of time. I want to create a class that encapsulates the functionality of keeping track of this status. On call…
ZorgoZ
  • 2,974
  • 1
  • 12
  • 34
4
votes
4 answers

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); connection.Open(); I'm getting the following exception…
Rafael
  • 1,099
  • 5
  • 23
  • 47
4
votes
1 answer

Error targeting .net core RC2 and .net4.6.1

I have the following project.json: { "version": "1.0.0-*", "dependencies": { "NETStandard.Library": "1.5.0-rc2-24027", "Dapper": "1.50.0-rc2b", "Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final", …
gilmishal
  • 1,884
  • 1
  • 22
  • 37
4
votes
2 answers

.NET 4.6 required for .NET 4.5.2 compiled application

After upgrading from building our product in Visual Studio 2010 and .NET 4.0 to Visual Studio 2015 and .NET 4.5.2 we have seen issues running the product on a customers machine. The error we see is a System.MissingMethodException being thrown when…
Bijington
  • 3,661
  • 5
  • 35
  • 52
4
votes
1 answer

Enumerable class missing XML Documentation Comments in .net 4.6 project

I'm having this problem only when I target .Net 4.6 framework under both Visual Studio 2015 or 2013. There is no XML Documentation Comments present in the Enumerable class (System.Linq.Enumerable, \Reference…
John Titor
  • 381
  • 1
  • 3
  • 13
4
votes
4 answers

CI Build Error with Visual Studio Test step after .Net 4.6 upgrade - Executor process exited; There was no endpoint listening at net.pipe

I just upgraded all of the projects in my solution to point to .Net 4.6 (There is a web app, some class libraries, a database project, etc.). I have a CI build set up in Visual Studio Team Services (using the new build system, not XAML) which was…
4
votes
1 answer

ASP.NET 5 Empty App IRuntimeEnvironment Error

I have an ASP.NET 5 Beta 7 Application and it uses MVC but even when I comment everything out the appication throws this error. It worked fine one day and started displying this error the next. Any help or even pointers on where to look would be…
Lukasz
  • 8,710
  • 12
  • 44
  • 72