The class nxFileSystemInfo needs to implement the abstract property Exists from the base type FileSystemInfo.
The Exists property is an abstract property of FileSystemInfo, and a subtype has to implement it.
This Pull Request (PR) fixes the following issues
The module nxtools stops working in PowerShell v7.4.x with the following error:
At C:\Users\<user>\Documents\PowerShell\Modules\nxtools\1.4.0\nxtools.psm1:2937 char:1
+ class nxFileSystemInfo : System.IO.FileSystemInfo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error during creation of type 'nxFileSystemInfo'. Error message:
Method 'get_Name' in type 'nxFileSystemInfo' from assembly 'PowerShell Class Assembly, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null' does not have an implementation.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TypeCreationError
The root cause of this error is a bug in PowerShell about IL code emitting for properties of a PowerShell class, which has been there for years. It didn't surface prior to .NET 8 because the older .NET runtime doesn’t do strict validation on the IL code that is dynamically emitted. Obviously, .NET 8 starts to enforce stricter validation and find that the abstract properties defined in FileSystemInfo are not properly implemented.
We will be fixing that bug with https://github.com/PowerShell/PowerShell/pull/21331. However, when testing the fix, we find loading nxtools exposes the same error, but this time, it's about Method get_Exists. It turns out FileSystemInfo has another abstract property Exists and a subtype needs to implement it. Therefore, I'm submitting this PR.
[NOTE] I'm afraid you won't be able to validate this change until after PowerShell v7.4.2 is published later this month.
Task list
[ ] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
Entry should say what was changed and how that affects users (if applicable), and
reference the issue being resolved (if applicable).
[ ] Resource documentation added/updated in README.md.
[ ] Comment-based help added/updated.
[ ] Localization strings added/updated in all localization files as appropriate.
Pull Request (PR) description
The class
nxFileSystemInfo
needs to implement the abstract propertyExists
from the base typeFileSystemInfo
. TheExists
property is an abstract property ofFileSystemInfo
, and a subtype has to implement it.This Pull Request (PR) fixes the following issues
The module
nxtools
stops working in PowerShell v7.4.x with the following error:The root cause of this error is a bug in PowerShell about IL code emitting for properties of a PowerShell class, which has been there for years. It didn't surface prior to .NET 8 because the older .NET runtime doesn’t do strict validation on the IL code that is dynamically emitted. Obviously, .NET 8 starts to enforce stricter validation and find that the abstract properties defined in
FileSystemInfo
are not properly implemented.We will be fixing that bug with https://github.com/PowerShell/PowerShell/pull/21331. However, when testing the fix, we find loading
nxtools
exposes the same error, but this time, it's aboutMethod get_Exists
. It turns outFileSystemInfo
has another abstract propertyExists
and a subtype needs to implement it. Therefore, I'm submitting this PR.[NOTE] I'm afraid you won't be able to validate this change until after PowerShell v7.4.2 is published later this month.
Task list