Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 427

PowerShell • Help with Error on System.Text.Json when loading Oracle Managed DLL

$
0
0
To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***


Product: PowerShell Studio 2024 (64 Bit)
Build: v5.8.248
OS: Windows 11.0.22621
PS Version(s): 5.1.22621.1
*** Please add details and screenshots as needed below. ***


I am trying to load the latest version of the Oracle managed Data Acces DLL ( Oracle.ManagedDataAccess.dll v4.122.22.1) in my app but get the following error which I cannot seem to resolve

Code snippet used for loading the DLL

Code:

#Load custom DLL's and types$OracleDLLPath = $CorePath + '\Oracle.ManagedDataAccess.dll'If (Test-Path $OracleDLLPath){try{Add-Type -Path $OracleDLLPath}#catch [Exception]catch [System.Reflection.ReflectionTypeLoadException]{logexception ($_)$errMsg = "ERROR in loading oracle types [$OracleDLLPath]: $($_.Exception.Message)"#[void][System.Windows.Forms.MessageBox]::Show($errMsg, $MsgTitle, 'OK', 'Error')logerror($errMsg)usrlogerror($errMsg)$errMsg1 = "Message: $($_.Exception.Message)"$errMsg2 = "StackTrace: $($_.Exception.StackTrace)"$errMsg3 = "LoaderExceptions: $($_.Exception.LoaderExceptions)"logerror($errMsg1)usrlogerror($errMsg1)logerror($errMsg2)usrlogerror($errMsg2)logerror($errMsg3)usrlogerror($errMsg3)#$_.Exception.LoaderExceptions | ForEach-Object {#logerror($_.Message)#usrlogerror($_.Message)##Write-Error $_.Message#}$script:ExitCode = 0exit  # terminate processing if Oracle DLL cannot be loaded}} # Load Oracle typeelse{$errMsg = "Problem finding Oracle Dll $OracleDLLPath"[void][System.Windows.Forms.MessageBox]::Show($errMsg, $MsgTitle, 'OK', 'Error')logerror($errMsg)usrlogerror($errMsg)$script:ExitCode = 0 #Set the exit code for the Packagerexit}
Error generated

Code:

2024-09-17 12:02:54 -  [hammondn] EXCEPTION::   Add-Type : At C:\SAPIEN\Projects\GSDTools 2AZ\GSDTools.Run.ps1:186 char:4+             Add-Type -Path $OracleDLLPath+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     CategoryInfo          : NotSpecified: (:) [Add-Type], ReflectionTypeLoadException    FullyQualifiedErrorId : System.Reflection.ReflectionTypeLoadException,Microsoft.PowerShell.Commands.AddTypeCommand 2024-09-17 12:02:54 -  [hammondn] ERROR:: ERROR in loading oracle types [C:\Scripts\Oracle.ManagedDataAccess.dll]: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.2024-09-17 12:02:58 -  [hammondn] ERROR:: Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.2024-09-17 12:03:02 -  [hammondn] ERROR:: StackTrace:    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)   at System.Reflection.RuntimeModule.GetTypes()   at System.Reflection.Assembly.GetTypes()   at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)   at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()   at System.Management.Automation.CommandProcessorBase.Complete()2024-09-17 12:03:06 -  [hammondn] ERROR:: LoaderExceptions: System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.File name: 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.File name: 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
The previous version of this dll v4.122.19.1 loaded perfectly witout any problem

Could you provide any help in resolving this issue?


DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

Statistics: Posted by WHO-WCSTeam — Tue Sep 17, 2024 7:08 am



Viewing all articles
Browse latest Browse all 427

Trending Articles