.Net 6 - Validator.TryValidateProperty no more throw ArgumentException - validation

I noticed that since I have migrated from .Net 5.0 to .Net 6.0 My Validator.TryValidateProperty() no more throw ArgumentException when it was a case on .Net 5.0.
It seems that the Exception is now caught and not more populated when in .Net 5 it was Populated.
I found the issue as now my Unit test are failing when I submit a null property value.
Any idea ?

Related

.NET 5.0 and ADO.NET model

I read somewhere that .NET 5.0 supported ADO.NET EF model (.edmx file) (as the earlier Core versions did not).
In a .NET 5.0 project the item template is present, but when I choose it I get an error stating that the EF runtime assemblires are not found for this target framework.
Does anyone know if this is supported or not?

Kendo for .net Core 3.1

I try to use Kendo in my Razor Pages app, I followed this doc https://docs.telerik.com/aspnet-core/getting-started/first-steps, but I have error:
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Kendo.Mvc.Rendering.IKendoHtmlGenerator Lifetime: Transient ImplementationType: Kendo.Mvc.Rendering.KendoHtmlGenerator': Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)'
I'm using Telerik.UI.for.AspNet.Core, version 2019.1.220.
I'm going to add my comment as an answer, because this Telerik thread confirms (and references the same error you are encountering) that you'll need a later version of Kendo to have support for .NET Core 3.1.
This quote here from the thread linked above - about .NET Core 3.0 requiring a later version than you are using:
Artem, that is correct. Only the latest version of the UI for ASP.NET
Core suite (2019.3.1023) offers official support for .Net Core 3.0.
Jerry, feel free to contact us if you have any further questions on
the .Net Core 3.0 integration.
Regards, Veselin Tsvetanov
R3 2019 is the first release that mentions full support for .NET Core 3.1.

How to run odp.net application in both .net 3.5 and .net 4

I am working on an internal tool for our product. Our product uses oracle database and have evolved over time from .net framework 2.0 to 4.5 and Oracle 10 to 12.2.
The aim of the tool is to write a single application which works across different versions of the product.
I have solved the problem of multiple .net framework versions by using the following entries in app.config
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
As the oracle managed .net driver is supported for framework >=4.0, I can not use this as I have to support .net framework 3.5 also.
As I have to use unmanaged odp.net driver, I was thinking about the following scenario
My tool would use the lowest version of oracle.dataaccess.dll and target .net 3.5.
Following #1 above makes me refer to 2.xx.... version of the oracle.dataaccess.dll.
When I run this application on a machine with only .net framework 4 installed, what would be the behavior? Would it load 4.xx... version of oracle.dataaccess dll when running under the context of .net framework 4?
The best solution for this would have been availability of oracle managed driver for .net 3.5 version but I found that it is not available.
Please provide your valuable inputs.
Satish
UPDATE :
I have written a sample application targeting .net framework 3.5. In this sample app, I will build a connection string and just open a connection and close it.
This application runs successfully when there are no <supportedRuntime> tags in the app.config.
When we add any <supportedRuntime> tags in the app.config, I am getting a type initializer exception for oracle related types. I have tried this with the supported run time tags
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
individually and both combined. But I am still getting the issue. Can anyone suggest how to resolve this issue?
ODP.NET unmanaged driver exist in following versions:
1.x (.NET Framework 1.0.3705/1.1.4322), available up to Oracle Client 11.1.
2.0 (.NET Framework 2.0.50727), introduced with Oracle Client 10.2
4.0 (.NET Framework 4.0.30319), introduced with Oracle Client 11.2
If your compile target is .NET version 3 or 3.5 then the application will try to load ODP.NET version 2.0 (and will raise an exception if it is not found on the machine). Actually I am not sure if it would also accept ODP.NET version 4.0.
If your compile target is .NET version 4 or higher then the application will try to load ODP.NET version 4.0 (and will raise an exception if it is not found on the machine).
You can do several solutions:
Provide a copy of Oracle.DataAccess.dll which matches your version and put it in your application directory.
Use late binding, i.e. instead of
var con = new Oracle.DataAccess.Client.OracleConnection();
use
var DLL = Assembly.Load(String.Format("Oracle.DataAccess, Version={0}.{1}.*.*, Culture=neutral, PublicKeyToken=89b483f429c47342", frameworkVersion, oracleVersion));
var type = DLL.GetType("Oracle.DataAccess.Client.OracleConnection", true, false);
dynamic con = Activator.CreateInstance(type)
However, this syntax is only available from .NET Framework version 4.0 on, I do not know how to write this in version 3.0/3.5.
Note, use con.GetType().Assembly.FullName and con.GetType().Assembly.Location in order to see which DLL was really loaded.

WCF: .NET 2.0 incomplete web reference

I've built a set of WCF web services on .NET 4.0 and now need to consume them in an ASP.NET 2.0 website. I've been able to get the web reference in VS 2005, however I'm having a problem:
The service reference is incomplete.
The service defines two types of faults. These faults are being read by VS2010 and .NET 4 correctly, but not by VS 2005 and .NET 2, resulting in an incomplete web reference.
What could be causing this? Is there any way to solve this, or should I resort to not using a reference and just post the XML myself?
Web References (and the ASMX technology in general) do not support faults. This is not just a problem in referencing WCF services, but rather services in general.
The best you can do is catch the SoapException exception and look at the Detail property to see what kind of fault was sent. But you cannot catch individual exceptions per fault.
Similarly, if you were writing an ASMX service, you would find that the auto-generated WSDL cannot describe faults that your service returns; in fact, there is no way to indicate that your service returns faults.
There is a fix for this problem - WCF. Unfortunately, if you're stuck at .NET 2.0, then you're out of luck.
You should be aware, however, that .NET 3.5 is nothing more than .NET 2.0 SP2 plus some new assemblies. It's safe to upgrade.

getting error while converting target framework of an asp.net web application from 2.0 to 3.5

While converting the taget framework of an asp.net web application from 2.0 to 3.5 in visual studio 2008, i am getting the error : Exception of type 'System.Runtime.InteropServices.ExternalException' was thrown
I solved the issue, my web application didn't have a web.config.I added a deafult web.config and then converted it.It worked fine.
I recently upgraded the target framework in the my web project's (Asp.NET web forms) properties from 4.8 to 4.8.1.
I searched the web.config for any "targetFramework" where it was referencing older versions and changed them to "4.8.1". Save. Recompile.

Resources