-
Notifications
You must be signed in to change notification settings - Fork 0
v3.0.0 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Updated target framework in `LFPublish.csproj` and `ListFunctions-Next.csproj` to `net9.0`. - Upgraded `System.Management.Automation` package from `7.4.0` to `7.5.2` in both projects. - Changed `ImplicitUsings` from `disable` to `enable` in `ListFunctions-Next.csproj`. - Added `AllowUnsafeBlocks` property to `ListFunctions.Engine.csproj`. - Introduced new `PackageReference` for `System.Management.Automation` specific to `net9.0` in `ListFunctions.Engine.csproj`. - Updated `LangVersion` for `ListFunctions.Engine.csproj` to `latest` for `net6.0` and `net8.0`, and set to `preview` for `net9.0`. - Improved null handling and type safety in `HashCodeBlock.cs`. - Modified `PSThisVariable` to use `HashSet<string>` instead of `IReadOnlySet<string>` for better performance. - Cleaned up using directives across various files to enhance code readability and maintainability.
Updated `ListFunctions-NETFramework.csproj` to remove `MG.Collections` and add references for `Microsoft.Bcl.Memory`, `System.Buffers`, `System.Memory`, `System.Numerics.Vectors`, `System.Runtime.CompilerServices.Unsafe`, `System.ValueTuple`, and `ZLinq`. Added `app.config` and `packages.config` with necessary binding redirects and package dependencies. Introduced `ReadOnlySet.cs` to define the `IReadOnlySet` interface and its implementation, providing a read-only collection that supports set operations. Added `SingleValueReadOnlySet.cs` for creating read-only sets containing a single value. Significant changes in `Empty.cs` include the removal of generic parameters and the introduction of `EmptyHolder`, along with modifications to use `Array.Empty` for improved functionality. Updated `EnumerableExtensions.cs` to replace the original `TryGetCount` method with a new implementation using pattern matching for better handling of collection types. Enhanced `ScriptBlockFilter.cs` to improve instance creation and utilize the new `SingleValueReadOnlySet` and `ReadOnlySet` for managing collections of `PSVariable`.
- Introduced a new `using` directive for `System.Runtime.InteropServices`. - Added a `StructLayout` attribute to `SingleValueReadOnlySet<T>` for sequential memory layout. - Removed the `_isNotEmpty` field; modified `IsEmpty` to check if `_value` is null. - Updated the `Contains` method to return false if the set is empty or the item is null. - Modified `IsProperSubsetOf`, `IsSubsetOf`, `IsSupersetOf`, and `SetEquals` methods to use `AsValueEnumerable()` for improved performance. - Changed `GetEnumerator` to return a custom `Enumerator` struct instead of yielding the value directly. - Defined a new `Enumerator` struct implementing `IEnumerator<T>` for iterating over the single value in the set.
- Improved null handling and type safety in various methods. - Updated collection checks in `PSVariableCollectionExtensions.cs` for explicit `PSObject` type handling. - Simplified statement count check in `ScriptBlockExtensions.cs`. - Modified `Compare` method in `ComparingBlock.cs` to accept nullable types. - Changed string comparison logic in `DictionaryCtor.cs` to use `StringComparer.CurrentCulture`. - Added nullability annotations in several methods in `EqualityBlock.cs`. - Implemented error handling for method resolution failures in `EqualityBlock.cs`. - Added similar error handling for method retrieval in `ReflectionResolver.cs`. - Updated iteration in `ScriptBlockFilter.cs` to use `AsValueEnumerable()` for improved performance.
- Changed `EnumerateVariables` in `AssertAllObjectsCmdlet.cs` to return a `PSVariable[]` for better performance. - Updated `_condition` in `AssertAnyObjectCmdlet.cs` to be non-nullable and added nullability attributes to `InputObject`. - Modified `ProcessWhenNoCondition` to handle nullable arrays and ensure only non-null objects are processed. - Removed a parameter from the `$CopyToOutput` array in `Debug.ps1`. - Disabled implicit usings and nullable reference types in `ListFunctions-Next.csproj`. - Replaced `using System;` with `using ListFunctions.Extensions;` in `ValidateScriptVariableAttribute.cs` and enhanced `EnumerateAllVariablesInBlock` return type. - Added `SetExtensions` class in `SetExtensions.cs` with `UnionWithRef` method for improved performance. - Updated serialization constructor in `HashCodeScriptException.cs` for .NET 8 compatibility. - Improved `ToDictionary` method in `ScriptBlockInvocationException.cs` for clarity and performance. - Changed iteration in `ScriptBlockFilter.cs` to use `AsValueEnumerable()` for better performance.
- Removed `ZLinq` library reference from `ListFunctions-NETFramework.csproj` and its entry in `packages.config`. - Eliminated `using ZLinq.Linq;` from `ValidateScriptVariableAttribute.cs` and modified `EnumerateAllVariablesInBlock` to conditionally use `ZLinq` types. - Added new file `EnumerableExtensions.cs` with an `AsValueEnumerable` extension method for `IEnumerable<T>`. - Updated `PSVariableCollectionExtensions.cs` to access the last element of a collection using `collection.Count - 1`. - Included a conditional `using ZLinq.Linq;` directive in `SetExtensions.cs` based on the target framework. - Moved `ZLinq` package reference to a conditional item group in `ListFunctions.Engine.csproj`. - Enhanced methods in `Guard.cs` with `MethodImpl` attributes for aggressive inlining and conditional exception throwing based on the target framework.
- Changed string comparison in `ArgumentToTypeNameTransformAttribute.cs` from `InvariantCultureIgnoreCase` to `OrdinalIgnoreCase` for module name checks, affecting cultural behavior. - Removed `ListFunctions.Extensions` import in `ValidateScriptVariableAttribute.cs` and consolidated `System` imports to include additional namespaces: `System.Collections.Generic`, `System.Linq`, `System.Management.Automation`, `System.Management.Automation.Language`, and `ZLinq`.
- Updated project files to allow unsafe code blocks. - Introduced `_genericType` in `NewListCmdlet.cs` for better generic type management. - Changed `InputObject` from an array to `IList?` for flexible input handling. - Modified `BeginProcessing` to initialize lists based on generic type and capacity. - Added methods to set object type and handle null elements. - Updated `ProcessRecord` to use `Count` for null/empty list checks. - Refactored item addition logic into `AddItemsToList` and `AddTypedItemsToList`. - Added `AsValueEnumerable` method in `EnumerableExtensions.cs` for casting `IEnumerable` to `IEnumerable<object>`.
- Changed `InputObject` type from `IList?` to `object?[]?` for improved flexibility. - Updated `ProcessRecord` method to check `InputObject.Length` instead of `Count`. - Modified `AddItemsToList` to accept `object?[]` parameter for item addition. - Updated `AddTypedItemsToList` to use the new `object?[]` parameter for type conversion. - Added `#nullable enable` directive in `ArgumentToTypeNameTransformAttribute.cs` for enhanced type safety. - Changed namespace in `SetExtensions.cs` from `ListFunctions.Extensions` to `ZLinq`.
Enhanced `ConvertToDictionaryCmdlet.cs` with new properties for key and value selectors, improved error handling, and a method to determine input object types, supporting both property-based and script-based extraction. Updated `NewDictionaryCmdlet.cs` to include nullable reference types for `KeyType` and `ValueType`, allowing better handling of undefined types. The `Capacity` property now includes an alias for "Size" to improve usability.
- Made `ValueSelector` nullable for better optional handling. - Introduced `ScriptBlockExtensions.cs` with `ReplaceWithArgsZero()` method to enhance script block flexibility. - Updated `_dictionary` instantiation to use an array for constructor parameters. - Modified `ValueSelector` invocation to use null-conditional operator for safer code. - Changed implicit conversion in `DoubleBool` from logical AND (`&&`) to bitwise AND (`&`). - Improved error handling in `SortingCollectorCtor` with null check on generic method invocation. - Added `#nullable enable` directive to several files to support nullable reference types.
- Changed `ValuePropertyName` from `string` to `object?` for increased flexibility. - Updated logic to check if `ValuePropertyName` is a string before string operations. - Modified handling of `ValueSelector` to accommodate the new `ValuePropertyName` type. - Refactored `ReplaceWithArgsZero` in `ScriptBlockExtensions.cs` to use a new `ReplaceString` method for improved string replacement logic. - Simplified string replacement logic and ensured compatibility across different frameworks.
- Introduced nullable reference types in `AssertAnyObjectCmdlet.cs` for properties. - Enhanced XML documentation in `ArgumentToTypeNameTransformAttribute.cs` and `ListTransformAttribute.cs`. - Clarified validation logic and variable handling in `ValidateScriptVariableAttribute.cs`. - Improved structure and added enumerators in `PipelineItem.cs`. - Updated exception handling in `Guard.cs` for better efficiency based on .NET version.
- Introduced a new `ListPool` class for efficient list management with methods for renting and returning lists. - Updated `FindIndexCmdletBase.cs` to use nullable reference types, changing `IList InputObject` to `object?[]? InputObject`. - Simplified `ComparingBase` and derived classes by removing generic type parameters. - Enhanced `ScriptBlockFilter` to handle collections more generically, improving type safety. - Refactored variable handling in `PSComparingVariable` and `PSThisVariable` for better performance using `MemoryMarshal` and `Unsafe`. - Removed conditional compilation directives for .NET version checks, streamlining the codebase.
- Added nullable reference types with `#nullable enable`. - Updated `InputObject` to use an array of objects. - Commented out several methods related to index finding. - Introduced a generic `ListPool` class for efficient list management. - Added `IPoolable` and `IResettable` interfaces for object pooling. - Updated `PSThisVariable` to implement `IResettable`. - Overall improvements for type safety, performance, and list handling in cmdlets.
- Updated `InputObject` in `FindIndexCmdletBase.cs` to support nullable arrays and explicitly rent lists as `ListPool<object?>`. - Added a new virtual method `Stop(List<object?> list)` in `FindIndexCmdletBase.cs` for future implementation. - Modified `ListPool<T>` in `ListPool.cs` to allow nullable reference types. - Enhanced `ObjPool` in `ObjPool.cs` with generic constraints and methods for renting and returning items. - Implemented `IPoolable` interface in `PSComparingVariable` and added lifecycle management methods.
Updated project version to 3.0.0 across multiple files. Removed several external library references in favor of modern alternatives. Added new source file inclusion from `ListFunctions-Next`. Updated `AssemblyInfo.cs` and `packages.config` for compatibility. Introduced nullable reference types in `AssertAllObjectsCmdlet.cs`. Refactored `AssertAnyObjectCmdlet.cs` to improve class hierarchy. Significant redesign of `ScriptBlockFilter` with backward compatibility. Modified `PSThisVariable` to implement `IPoolable` for better memory management. Updated `Debug.ps1` to ensure module imports are forced.
- Introduced nullable reference types with `#nullable enable`. - Updated `CaseSensitive` property to use `IsParameterValueCaseSensitive`. - Modified `GetCustomEqualityComparer` to return appropriate `StringComparer`. - Renamed `RetrieveCaseSensitiveSetting` to `IsParameterValueCaseSensitive` and changed its implementation to use `LanguagePrimitives.IsTrue`.
- Refactored `AssertAllObjectsCmdlet` and `AssertAnyObjectCmdlet` to inherit from `AssertObjectCmdlet`, enhancing their processing logic and allowing nullable collections. - Updated `AssertObjectCmdlet` with a new `HasCondition` property and improved error handling in processing methods. - Enhanced `ConvertToDictionaryCmdlet`, `EqualityConstructingCmdlet`, and collection cmdlets (`NewDictionaryCmdlet`, `NewHashSetCmdlet`, `NewListCmdlet`, `NewSortedSetCmdlet`) for better type handling and error reporting. - Refactored `FindIndexCmdlet` and `FindLastIndexCmdlet` to inherit from `ListFunctionCmdletBase`, improving input handling. - Improved error handling and processing flow in `ListFunctionCmdletBase` with a new `_wantsToStop` flag. - Updated project file for assembly visibility changes and modified `ListPool` and `ObjPool` for better framework compatibility.
This commit removes the unused and commented-out `EndProcessing` method in the `AssertAnyObjectCmdlet.cs` file. The method previously contained logic for condition checking and outputting based on `_hasNonNull` and `_stop`. The existing `End` method, which writes the script result, remains unchanged.
This commit removes the entire `ScriptBlockFilterOld.cs` file, including the `ScriptBlockFilterOld` abstract class and its derived class `ScriptBlockFilterOld<T>`. All associated methods, properties, namespaces, and using directives have also been deleted.
Refactor `ListFunctions-NETFramework.csproj` and `ListFunctions-Next.csproj` to conditionally manage the inclusion of `Debug.ps1`. In non-Release configurations, it will be copied to the output directory, while in Release configurations, it will not be copied to either the output or publish directories. Previous entries for `Debug.ps1` have been removed to implement this logic.
- Updated version number in `ListFunctions.psd1` from `2.0.0` to `3.0.0`. - Changed copyright year in `ListFunctions.psd1` from `2024` to `2025`. - Modified minimum PowerShell version requirement in `ListFunctions.psd1` from `5.1` to `5.0`. - Adjusted assembly loading in `ListFunctions.psm1`, commenting out certain modules. - Inverted logic in `ProcessCore` method of `AssertObjectCmdlet.cs`. - Added `ZLinq.dll` and deleted `MG.Collections.Resources.dll` and `MG.Collections.dll`.
- Updated PowerShell version requirement to 5.1. - Added `New-SortedSet` to exported cmdlets. - Modified file list to include `Core\ZLinq.dll` and retain `Desk\ListFunctions.NETFramework.dll`, removing `Core\MG.Collections.dll` and `Core\MG.Collections.Resources.dll`. - Expanded tags in `PrivateData` to include 'Convert' and 'ConvertTo'. - Updated release notes to reflect performance improvements and ZLinq library utilization for PowerShell 7.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major version update for the ListFunctions module, refactoring its PowerShell and .NET components for improved performance and maintainability. The changes include switching to the ZLinq library for PowerShell 7, updating dependencies and target frameworks, and enhancing assertion cmdlets for better null handling and code reuse.
Module and Dependency Updates:
3.0.0and updated copyright to 2025 inListFunctions.psd1. The release notes now highlight refactoring for performance and the adoption of ZLinq for PowerShell 7. [1] [2] [3]MG.Collections.dlland related resource files from the module, addedZLinq.dllfor improved performance, and updated supported tags and exported cmdlets (including the newConvertTo-Dictionary). [1] [2] [3].NET Project Changes:
LFPublish.csprojto.NET 9.0and bumpedSystem.Management.Automationto version7.5.2. [1] [2]ListFunctions.NETFrameworkto version3.0.0, enabled unsafe blocks, removed references toMG.Collections, and added new dependencies (System.Memory,System.Buffers, etc.) for compatibility and performance. Also added anapp.configfor assembly binding redirects. [1] [2] [3] [4] [5] [6]Cmdlet Refactoring:
AssertAllObjectsCmdletandAssertAnyObjectCmdletto inherit from a common base (AssertObjectCmdlet), improving code reuse and null/empty handling. Enhanced parameter validation and streamlined logic for condition processing. [1] [2]PowerShell Module Loader:
ListFunctions.psm1by removing explicit DLL imports forMG.Collectionsand relying on the main DLL import, reflecting the move to ZLinq.