Issue
After upgrading one or more products to v21 the installed v20 products do not work anymore. The consequences are different depending on the products. The issue affects several products.
- When using powerVault v21.0.2 and powerEvents v20 importing the powerEvents module fails with the following error:
2020-05-11 02:47:57,822 [6] ERROR coolOrange.Powershell.Hosting.Extensions.PowerShellExtension - Error occurred when importing powerEvents module
System.InvalidCastException: [A]PostSharp.Patterns.Diagnostics.Backends.Log4Net.Log4NetLoggingTypeSource cannot be cast to [B]PostSharp.Patterns.Diagnostics.Backends.Log4Net.Log4NetLoggingTypeSource. Type A originates from 'coolOrange.Logging, Version=2.0.8.20682, Culture=neutral, PublicKeyToken=cbffcaf3c8b9278c' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\coolOrange.Logging\v4.0_2.0.8.20682__cbffcaf3c8b9278c\coolOrange.Logging.dll'. Type B originates from 'coolOrange.Logging, Version=3.0.1.25692, Culture=neutral, PublicKeyToken=cbffcaf3c8b9278c' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\coolOrange.Logging\v4.0_3.0.1.25692__cbffcaf3c8b9278c\coolOrange.Logging.dll'.
- When using powerVault v21 and powerJobs Processor v20 the powerVault logs are not written in the powerJobs Processor logfile. Instead they can be found in the powerVault logfile.
- hen using powerFLC v21 and powerJobs Processor v20, importing the powerJobs module into PowerShell fails with the following errors:
PS C:\Users\coolOrange> Import-Module powerjobs
Vault directory: C:\Program Files\Autodesk\Vault Professional 2020\Explorer
Initializing VDF for application without UI...
Importing module: powerVault 20.0
Importing module: powerJobs 20.0
Importing module: +-- coolOrange.Applications.psm1
Unable to find type [coolOrange.GenerateEngine.Inventor.Application].
...
Unable to find type [coolOrange.GenerateEngine.Inventor.Server.Application].
...
Get-PowerJobs : Could not load file or assembly 'powerJobs.Common, Version=20.0.8.24388, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
...
You cannot call a method on a null-valued expression.
...
New-Object : Exception calling ".ctor" with "0" argument(s): "Could not load file or assembly 'powerJobs.Common, Version=20.0.8.24388, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the
file specified."
...
You cannot call a method on a null-valued expression.
...
Importing module: +-- coolOrange.FileSystem.psm1
Importing module: +-- DEPRECATED.coolOrange.UpdateCompatibility.psm1
powerJobs\Get-PowerJobs : Could not load file or assembly 'powerJobs.Common, Version=20.0.8.24388, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
...
Add-Member : Cannot bind argument to parameter 'InputObject' because it is null.
...
Registered application: - When using powerFLC v21 and powerEvents v20 the Open-VaultConnection cmdlet from powerVault shows the following log4net error but still works:
log4net:ERROR Failed to alias repository [coolOrange.VaultServices.Logging]
System.InvalidOperationException: Repository [coolOrange.VaultServices.Logging] is already aliased to repository [coolOrange.powerVault]. Aliases cannot be redefined.
bei log4net.Core.DefaultRepositorySelector.AliasRepository(String repositoryAlias, ILoggerRepository repositoryTarget)
bei log4net.Core.DefaultRepositorySelector.LoadAliases(Assembly assembly, ILoggerRepository repository)
log4net:ERROR Failed to alias repository [coolOrange.powerVault]
System.InvalidOperationException: Repository [coolOrange.powerVault] already exists and cannot be aliased to repository [coolOrange.powerEvents].
bei log4net.Core.DefaultRepositorySelector.AliasRepository(String repositoryAlias, ILoggerRepository repositoryTarget)
bei log4net.Core.DefaultRepositorySelector.LoadAliases(Assembly assembly, ILoggerRepository repository)
Cause
The issue is caused by an incompatibility between the old coolOrange.Logging library (v2.0) used in v20 products and the newer version of the coolOrange.Logging library (v3.1) used in v21 products.
Solution
Upgrade your installed v21 products to at least the following versions:
- powerVault v21.0.3
- powerEvents v21.0.3
- powerGate v21.0.2
- powerJobs Client v21.0.4
- powerJobs Processor v21.0.5
- powerFLC v21.0.4
Solution for powerEvents
If you can not update powerEvents to v21 you can also disable the PowerShell logger:
- Open the powerEvents log4net file located in C:\Program Files\coolOrange\Modules\powerEvents\powerEvents.log4net with a text editor.
- Search the Logger "coolOrange.Powershell" and disable it by adding "<level value="OFF">":
<logger name="coolOrange.Powershell">
<level value="OFF" />
</logger> -
Save the file.