为什么Powershell的Write-Errorcmdlet 不能为我工作?我的输出看起来不像文档中的示例:
PS C:\> Write-Error "This is an error"
Write-Error "This is an error" : This is an error
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Run Code Online (Sandbox Code Playgroud)
我一直期待输出类似于Write-Warning:
PS H:\> Write-Warning "This is a warning"
WARNING: This is a warning
Run Code Online (Sandbox Code Playgroud)
从Write-Error和about_preference_variables文档我认为我不应该看到任何例外?
PS H:\> Get-Help About_Preference_Variables
$ErrorActionPreference
----------------------
...
PS> $erroractionpreference
Continue # Display the value of the preference.
PS> write-error "Hello, World"
# Generate a non-terminating error.
write-error "Hello, …Run Code Online (Sandbox Code Playgroud) 我有一个相对较大的类,我正在使用它,到目前为止一切正常(注意:我实际上没有编写类,我只是添加了一些功能).但是,在头文件中再声明一个字符串后,现在一切都崩溃了(我得到了内存访问错误).如果我删除该字符串并重建,一切正常.
我实际上并没有使用该字符串做任何事情....只是声明它的行为导致了一些奇怪的内存错误.
我无法详细解释这个问题,因为尝试解释每个功能都是浪费.我应该在这里寻找什么样的东西才能找到问题?什么可能导致这种奇怪的行为?
错误本身是:
Unhandled exception at 0x65fd17fd (msvcp80d.dll) in myFile.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
基本上.h文件中的所有更改都是:
StringType string1;
Run Code Online (Sandbox Code Playgroud)
转换成:
StringType string1;
StringType string2;
Run Code Online (Sandbox Code Playgroud)
StringType是basic_string的扩展
c++ visual-studio-2005 unhandled-exception undefined-behavior write-error