Fix threading issue in cmdlets

- Fixed threading issue in cmdlets that was causing 'WriteObject and WriteError methods cannot be called from outside the overrides' error
- Changed module structure to use DLL as root module instead of nested module
- Updated configuration cmdlets to properly handle async operations
This commit is contained in:
GraceSolutions
2025-04-15 09:24:51 -04:00
parent 68e6819131
commit 7535135bfd
19 changed files with 229 additions and 30 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
@{
# Script module or binary module file associated with this manifest.
RootModule = 'PSOPNSenseAPI.psm1'
RootModule = 'lib\PSOPNSenseAPI.dll'
# Version number of this module.
ModuleVersion = '2025.04.15.1143'
@@ -57,7 +57,7 @@
# FormatsToProcess = @()
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @('lib\PSOPNSenseAPI.dll')
# NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @()
-13
View File
@@ -1,13 +0,0 @@
# Load the main assembly directly
$mainDllPath = Join-Path $PSScriptRoot "lib\PSOPNSenseAPI.dll"
Write-Verbose "Loading assembly from $mainDllPath"
try {
Add-Type -Path $mainDllPath
Write-Verbose "Successfully loaded assembly from $mainDllPath"
} catch {
$errorMessage = $_.Exception.Message
Write-Error "Failed to load assembly from $($mainDllPath): $($errorMessage)"
throw
}
Binary file not shown.