当我在Powershell中从外部类型调用它时:
Add-Type -Path "$sdk_path\bin\DataProvider.dll"
$queryProcessor = New-Object -Type QuestionAnswering.QueryProcessor($linguisticDB, $index)
$queryProcessor.Process(query)
Run Code Online (Sandbox Code Playgroud)
我可以看到函数调用返回一个int.我收到以下错误消息:
The result type 'System.Int32' of the dynamic binding produced by the object with type
'System.Management.Automation.PSObject' for the binder 'PSInvokeMember: Process ver:0
args:1 constraints:<args: >'
is not compatible with the result type 'System.Object' expected by the call site.
Run Code Online (Sandbox Code Playgroud)
我不需要任何东西的int值,但我似乎无法指示Powershell忽略它.例如,这些仍然返回相同的错误:
[void]$queryProcessor.Process(query)
$queryProcessor.Process(query) | Out-Null
Run Code Online (Sandbox Code Playgroud)
我还能尝试什么?
您正在使用PowerShell中的错误.
请尝试以下解决方法:
$queryProcessor.Process.Invoke(query)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
198 次 |
| 最近记录: |