无法在listenTCP函数调用的委托中抛出异常

时间:2015-11-03 22:36:30

标签: exception exception-handling d vibed

从以下代码生成的二进制文件在一台计算机(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"]
}

1 个答案:

答案 0 :(得分:2)

由于discussion在vibe.d官方论坛上,似乎这种行为与DMD已经打开的issue有关。

相关问题