Stacktraces in static constructors

Benjamin Thaut via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 3 05:31:10 PDT 2016


On Tuesday, 3 May 2016 at 10:52:20 UTC, Nordlöw wrote:
> On Tuesday, 3 May 2016 at 10:48:51 UTC, Nordlöw wrote:
>> AFAICT, stacktraces are not emitted with debug information when
>
> Should be static shared module constructors.
>
>> errors occur in static module constructors. Is this a know bug?
>
> My stacktraces contain no information of the call stack so it's 
> very very tedious work to find the reason for a failing 
> unittest.

I assume this is on windows? Yes its a known issue (I know about 
it). I Don't know if its filed though. As a workaround you can 
import "core.sys.windows.stacktrace" into each of your modules. 
That will force the module system to initialize the stacktracing 
code before the module ctors. The underlying issue is that the 
module system does not know about the implicit dependeny of every 
module on the stacktracing module.

Kind Regards
Benjamin Thaut



More information about the Digitalmars-d-learn mailing list