无法在 listenTCP 函数调用的委托中抛出异常
Unable to throw exceptions in the delegate called by listenTCP function
由以下代码生成的二进制文件在一台计算机 (Windows 8 x64) 上完美运行,但在另一台计算机 (Windows Server 2012 R2 Standard x64) 上崩溃:
import std.stdio;
import vibe.vibe;
void new_request(TCPConnection conn)
{
writeln("before");
try
{
throw new Exception("Exception");
}
catch (Throwable ex)
{
writeln(ex.msg);
}
writeln("after");
}
void main()
{
auto f = toDelegate(&new_request);
listenTCP(1605, f);
runEventLoop();
}
输出 Windows 8 x64
before
Exception
after
在 Windows Server 2012 R2 Standard x64 上的输出
before
然后崩溃。
在某些计算机上,listenTCP
函数调用的委托中似乎无法抛出任何异常。
这是众所周知的行为吗?这是一个错误吗?我应该将其报告到 vibe.d 论坛还是其他地方?
我正在使用 DMD 2.068.2、DUB 0.9.24 和 vibe.d 0.7.24。
dub.json 看起来像这样:
{
"name": "vibe_helper",
"dependencies": {
"vibe-d": "==0.7.24"
},
"versions": ["VibeCustomMain"]
}
DMD discussion on vibe.d official forum, it seems that this behavior related to the already opened issue 的结果。
由以下代码生成的二进制文件在一台计算机 (Windows 8 x64) 上完美运行,但在另一台计算机 (Windows Server 2012 R2 Standard x64) 上崩溃:
import std.stdio;
import vibe.vibe;
void new_request(TCPConnection conn)
{
writeln("before");
try
{
throw new Exception("Exception");
}
catch (Throwable ex)
{
writeln(ex.msg);
}
writeln("after");
}
void main()
{
auto f = toDelegate(&new_request);
listenTCP(1605, f);
runEventLoop();
}
输出 Windows 8 x64
before
Exception
after
在 Windows Server 2012 R2 Standard x64 上的输出
before
然后崩溃。
在某些计算机上,listenTCP
函数调用的委托中似乎无法抛出任何异常。
这是众所周知的行为吗?这是一个错误吗?我应该将其报告到 vibe.d 论坛还是其他地方?
我正在使用 DMD 2.068.2、DUB 0.9.24 和 vibe.d 0.7.24。
dub.json 看起来像这样:
{
"name": "vibe_helper",
"dependencies": {
"vibe-d": "==0.7.24"
},
"versions": ["VibeCustomMain"]
}
DMD discussion on vibe.d official forum, it seems that this behavior related to the already opened issue 的结果。