What is dotnet5.4 and net451 in class library? - asp.net

In aspnet 5 I created a project which came with dotnet5.4 and net451. Since it's a class library I assume it does not need the runtime so uses net451 instead of dnx451 (my wild guess). But what about dotnet5.4 what exactly is that for ?

UPDATE: With this announcement, the monikers will probably change again. This answer is only scoped to the release of RC1. Any release further than RC2 won't apply here.
Basically, dnxcore50 became dotnet5.4 and dnx451 became net451.
Those were temporary to begin with and were bound to change prior to the final release.
Most of this information can be found here:
https://github.com/aspnet/Announcements/issues/98

But what about dotnet5.4 what exactly is that for ?
From Announcing ASP.NET 5 Release Candidate 1:
With this version of ASP.NET 5 templates, the “Class Library (package)” project template will target “dotnet5.4” which has binary compatibility with .NET 4.6, .NET Core 5, and Mono.

Related

Dotpeek or dnSpy filter for .NET Core Assemblage

I am working in the context of a .NET Core application, windows service, and I have a compiler error telling me I've got a type that has moved assemblies. I cannot find said type and I have gone all over looking for it. So far, I have tried using a combination of dnSpy, Dotpeek, and try.dot.net to reference pertinent nuget packages or .dlls' local to my machine to find the System.Security type(s) I'm looking for. Error for the Type is as follows and afaik an assemblage with that version does not exist...anywhere!
The type name 'DirectorySecurity' could not be found in the namespace
'System.Security.AccessControl'. This type has been forwarded to
assembly 'System.IO.FileSystem.AccessControl, Version=4.0.4.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a
reference to that assembly.
Is there a way I can use external tooling to filter or find a type on my machine that the compiler is asking for? I have referenced all manner of dependencies (individually) in Visual Studio then subsequently removed them if that did not satisfy the compiler.
In any event, any help would be appreciated - thanks!
Upon further inspection of the the nuget-package the version of the specific library (and subsequent type) is .NET Standard compliant only with NET Core 2.0 and under; not 3.0 yet...so I have to downgrade the project, find a different workaround, or wait until the System.Security.AccessControl library is compliant with 3.0+.

Difference between Newtonsoft Json DynamicValueProvider and ReflectionValueProvider?

I'm in the process of porting a Asp.Net Core Website targeting the full framework to a website that targets Asp.Net Core 3.
In that process I have hit a snag. The website references the Newtonsoft 11.0.3 NuGet package and among other things uses the Newtonsoft.Json.Serialization.DynamicValueProvider class.
Interestingly that class exists when targeting the full framework but does not exist when targeting netcoreapp3.1 and so Visual Studio is producing compilation errors stating that the class doesn't exist. At first that seemed crazy to me, but I checked the source code for the class and sure enough it contains the following conditional compilation statement wrapped around the whole class
#if HAVE_REFLECTION_EMIT
Apparently the netStandard 2.0 dll in the NuGet package that my netcoreapp3.1 project would use causes the conditional compilation statement to not include the DynamicValueProvider class.
So I did some poking around in the Newtonsoft.Json.Serialization namespace and I see that there is a ReflectionValueProvider class available that does not contain such conditional compilation and is available when targeting netcoreapp3.1
I've looked at the source code for both the DynamicValueProvider class and the ReflectionValueProvider class and I'm unclear on the difference. Both appear to get or set the value of a property or member type based on the MemberInfo passed in into the constructor. Both appear to use reflection to accomplish their work. As I mentioned, apparently DynamicValueProvider needs reflection Emit ability and ReflectionValueProvider does not. Emit ability apparently is used to Emit IL as best I can tell.
So I wonder if perhaps the two are drop in replacements for each other except that maybe DynamicValueProvider might be faster since it apparently leverages IL Emitting. But that's just a hunch. I'd prefer to have a more concrete understanding of the differences between the two classes before I start swapping the one for the other in this existing codebase as a way to get to .Net Core 3.
Can you provide me with better insight into the differences between the DynamicValueProvider
class and the ReflectionValueProvider class, or at least confirm my hunch?
We had updated Newtonsoft.Json from 9.* to 12.0.3 version, and observed performance degradation on paths that includes json serialization. All paths lead to DynamicValueProvider. Fortunately, we had global descendant for DefaultContractResolver, and I was able to overload CreateMemberValueProvider method to return ReflectionValueProvider.
For now we are continue testing the new version, but I can say that from performance perspective ReflectionValueProvider works faster than DynamicValueProvider.
I think there is a correlation with the fact that NetStandard 2.0 is also used to build Xamarin.Forms applications for iOS which require an AOT compilation.
As written here:
Limitations of Xamarin.iOS
"Since applications using Xamarin.iOS are compiled to static code, it is not possible to use any facilities that require code generation at runtime."
and
"No Dynamic Code Generation.
The System.Reflection.Emit is not available"
For example, this is a System.Text.Json limitation that actually cannot be used in Xamarin.Forms projects for iOS. More info here.
System.Text.Json Serializer does not appear to work on Xamarin iOS

Setup NodaTime under Asp.Net vnext

I've installed VS2015 CTP, created a vNext ConsoleApplication and would like to use NodaTime.
I've added the dependency like so:
"dependencies": {
"NodaTime": "1.3.1"
},
The package gets restored, but when I try to compile the solution, a warning arises:
Type NodaTime.Instant exists in the package: NodaTime 1.3.1, Supported frameworks: .NETFramework 3.5-Client;.NETPortable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10+xamarinios10
The type is then simply not found by the compiler, telling me:
The type or namespace name 'NodaTime' could not be found (are you missing a using directive or an assembly reference?)
Any ideas on how to fix that? Could I also just add it as an dependency of the framework that it exists for?
Most existing packages will not support ASP.NET Core 5 yet; because of the significant differences, they need to be manually updated. If you're wanting to use NodaTime, you'll either need to stick to ASP.NET 5 (not Core) or wait for Jon Skeet to release a Core version.
ASP.NET 5 (not Core) will still let you use all the new functionality, though... except not cross platform.

Best strategy for upgrading application from Symfony 2.0 to Symfony 2.4?

I need to upgrade an existing rather large application from Symfony 2.0.15 to Symfony 2.4.x (replace with current version).
I'm not quite sure what would be the best strategy to do so. Migration critical features like forms or esi are used, of course :)
Upgrade "step by step" from one major version to another (2.1, 2.2, 2.3, 2.4)
Upgrade directly from 2.0.x to 2.4
Do you have any tips / experience to share ? Would appreciate it :)
Thanks,
Stephan
Each new version comes with an update UPGRADE-2.x.md file containing all intructions to convert your application from the immediately previous version.
I had to do that on my project as well, and I found the step-by-step method more natural and easier to manage. Fact is, there is no file such file as UPGRADE-2.0-to-2.4.md that would help you out for a direct conversion to 2.4.
I shall first recommend to make sure that none of your code uses obsolete functionnalities of Symfony 2.0 (not sure if there are deprecated parts in this version, though), because these can be removed in ulterior versions and will not be included in the UPGRADE file.
If you have done indeep modifications of the core Symfony code, you may find that some undocumented modifications are needed. For instance, there is a custom error handler in my project, extending the Symfony error handler. Well, although it was not documented in the UPGRADE file, the signature of ErrorHandler::handle() was modified and needed to be updated in my custom handler.
Similarly, I had to modify some namespaces because files had been moved in the framework code.
The conversion is still ongoing and I'm currently experiencing a weird error I'm trying to get rid of: The 'request' scope on services registered on custom events generates errors in the logs.

MVC2 with Ninject.Web.Mvc 2.2 and Ninject 2.2 runtime version 4.0 always asks for parameterless constructor for controllers

I have a previous project running Ninject 2.0 runtime version 2.0 and now I am using Ninject in a new project and using the new Ninject, ninject web.mvc version 2.2 for runtime version 4.0.
Every single time I get the error no parameterless constructor
Invalid Operation exception
An error occurred when trying to create a controller of type HomeController'. Make sure that the controller has a parameterless public constructor.
What am I missing. All the bindings are registered.
Do I need to now define interfaces for Controllers as well such as HomeController as IHomeController as I have seen in some examples, Or do I get back to using the older version
There is one version that does not show activation exceptions properly but show this exception instead. Most likely the problem is a duplicated binding.
In addition to what Remo Gloor said, you might want to check that MVC is set up to use Ninject correctly. I was doing some things manually on an older version of the MVC plugin and ended up needing to just bite the bullet and make Global extend the NinjectHttpApplication class, which I had previously been avoiding.
The error you're getting is the error you would get if MVC tries using its built-in controller factory to produce controllers. So you may want to create a custom method binding on your controller class and put a breakpoint inside to make sure it's even being invoked.
You may also want to switch to version 2.3. You can pick up the latest builds of Ninject and all its extensions here.
I have seen this issue mentioned couple of times on forums where there is no direct answer, here is the solution to the above problem, i.e., working with latest ninject
Download the latest Ninject from github.
The ninject I got for MVC2 is named as Ninject.Web.Mvc2-2.2.0.0-release-net-4.0 (runtime version 4)
Now during adding reference add Ninject.Web.Mvc.dll(check the version is same as above by right click properties in VS)
Now Add Ninject.dll from the lib folder in same parent folder (check the version as above)
Now Add CommonServiceLocator.NinjectAdapter.dll from the extensions folder in lib parent folder (check the version as above.)
The missing link in all these have been the commonserviceLocator.dll and the correct version should match. This should be tried if you are sure your bindings are correct as mine were and check to see if your project work with older version.
Thanks to everyone, and good luck :)

Resources