dotnet core 2.0 - and devart throws exception

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
mrbig
Posts: 9
Joined: Fri 31 Oct 2008 23:01

dotnet core 2.0 - and devart throws exception

Post by mrbig » Mon 28 Aug 2017 08:36

I'm am working with the new release of dotnet Core 2.0, and need dotConnect for Oracle (9.4.326) to provide an connection to my database.

I have the following code :

Code: Select all

var OracleConnectionStringBuilder oraCsb =
                new OracleConnectionStringBuilder
                {
                    ConnectionString = ConnectionString,
                    Direct = true,
                    InitializationCommand =
                        "ALTER SESSION SET NLS_TERRITORY='DENMARK' NLS_LANGUAGE='DANISH' NLS_DATE_LANGUAGE='DANISH' NLS_CURRENCY='kr.' NLS_DATE_FORMAT='DD-MM-YYYY' NLS_ISO_CURRENCY='DENMARK' NLS_NUMERIC_CHARACTERS=',.' NLS_DUAL_CURRENCY='kr.' NLS_NCHAR_CONV_EXCP='True' NLS_TIMESTAMP_FORMAT='DD-MM-YYYY HH24:MI:SS' NLS_TIMESTAMP_TZ_FORMAT='DD-MM-YYYY HH24:MI:SS TZH:TZM' TIME_ZONE='Europe/Copenhagen'" };
Returned connectionstring is...:

User Id=xxx;Password=xxx;Server=10.1.1.101;Direct=True;Sid=orcl;Persist Security Info=True;Initialization Command="ALTER SESSION SET NLS_TERRITORY='DENMARK' NLS_LANGUAGE='DANISH' NLS_DATE_LANGUAGE='DANISH' NLS_CURRENCY='kr.' NLS_DATE_FORMAT='DD-MM-YYYY' NLS_ISO_CURRENCY='DENMARK' NLS_NUMERIC_CHARACTERS=',.' NLS_DUAL_CURRENCY='kr.' NLS_NCHAR_CONV_EXCP='True' NLS_TIMESTAMP_FORMAT='DD-MM-YYYY HH24:MI:SS' NLS_TIMESTAMP_TZ_FORMAT='DD-MM-YYYY HH24:MI:SS TZH:TZM' TIME_ZONE='Europe/Copenhagen'"

That is OK. But when the following is executed

Code: Select all

var InnerOracleConnection = new OracleConnection();
InnerOracleConnection.ConnectionString = oraCsb.ConnectionString;
last line throws an exception:

{System.TypeInitializationException: The type initializer for 'LeanfidsModel.CacheLayer' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.PerformanceCounterType' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at Devart.Common.DbConnectionPoolGroup.a(n A_0)
at Devart.Common.DbConnectionFactory.a(String A_0, n& A_1)
at Devart.Common.DbConnectionBase.set_ConnectionString(String value)
at LeanfidsModel.OracleTrackedConnection..ctor(OracleTrackedConnection baseConnection, Boolean isContext) in C:\Users\klaus\documents\visual studio 2017\Projects\FirstWebapplication\LeanfidsModel\OracleTrackedConnection.cs:line 69
at LeanfidsModel.CachedList`1.LoadCache() in C:\Users\klaus\documents\visual studio 2017\Projects\FirstWebapplication\LeanfidsModel\CachedList.cs:line 68
at LeanfidsModel.CachedList`1..ctor() in C:\Users\klaus\documents\visual studio 2017\Projects\FirstWebapplication\LeanfidsModel\CachedList.cs:line 25
at LeanfidsModel.CacheLayer..cctor() in C:\Users\klaus\documents\visual studio 2017\Projects\FirstWebapplication\LeanfidsModel\CacheLayer.cs:line 12
--- End of inner exception stack trace ---}

What do I do wrong ?

Regards
//Klaus

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: dotnet core 2.0 - and devart throws exception

Post by Shalex » Tue 29 Aug 2017 11:25

The Performance Counters functionality is not available in .NET Core: https://www.devart.com/dotconnect/oracl ... ility.html.

Referencing .NET Framework assemblies from .NET Standard project will not solve the issue as well because this allows to only use types within the .NET Standard API set. Refer to https://blogs.msdn.microsoft.com/dotnet ... -core-2-0/ > the "Reference .NET Framework libraries from .NET Standard" section.

Post Reply