Commit cc5a14a
v3.0.0 (#3)
* Upgrade to .NET 9 and update dependencies
- 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.
* Add new references and implement read-only collections
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`.
* Add StructLayout and Enumerator for SingleValueReadOnlySet
- 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.
* Enhance null handling and type safety across modules
- 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.
* Add performance improvements and new features
- 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.
* Remove ZLinq references and add EnumerableExtensions
- 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.
* Update string comparison and streamline imports
- 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`.
* Add support for unsafe code and enhance list handling
- 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>`.
* Enhance InputObject handling and enable nullable types
- 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`.
* Add dictionary conversion features and nullable types
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.
* Enhance ConvertToDictionaryCmdlet and add extensions
- 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.
* Enhance ValuePropertyName type and refactor ReplaceWithArgsZero
- 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.
* Add nullable types and improve documentation
- 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.
* Add ListPool and refactor ListFunctions classes
- 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.
* Refactor FindIndexCmdlet and enhance object pooling
- 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.
* Enhance nullability support and pooling mechanisms
- 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.
* Bump version to 3.0.0 and refactor codebase
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.
* Refactor case sensitivity handling in EqualityConstructingCmdlet
- 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`.
* Refactor cmdlets for improved structure and error handling
- 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.
* Remove commented-out EndProcessing method
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.
* Remove ScriptBlockFilterOld and related classes
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.
* Update handling of Debug.ps1 in project files
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.
* Update ListFunctions module to version 3.0.0
- 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`.
* Update ListFunctions module for PowerShell 5.1 support
- 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.
---------
Co-authored-by: Mike Garvey <mgarvey@dgrsystems.com>1 parent f71f66f commit cc5a14a
File tree
78 files changed
+1816
-888
lines changed- ListFunctions
- Core
- Desk
- src/engine
- LFPublish
- ListFunctions-NETFramework
- Properties
- ListFunctions-Next
- Cmdlets
- Assertions
- Constructs
- Finds
- Exceptions
- Validation
- ListFunctions.Engine
- Extensions
- Internal
- Legacy
- Modern
- Constructors
- Exceptions
- Pools
- Variables
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
78 files changed
+1816
-888
lines changedBinary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 104 | + | |
108 | 105 | | |
109 | 106 | | |
110 | 107 | | |
| |||
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | | - | |
| 115 | + | |
119 | 116 | | |
120 | 117 | | |
121 | 118 | | |
| |||
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | | - | |
| 129 | + | |
133 | 130 | | |
134 | 131 | | |
135 | 132 | | |
| |||
0 commit comments