Reducing Build Failures with DustMite
Every now and then, you might run into a build problem that might look like a compiler issue. Your first step should be to search D's bug tracking system at https://issues.dlang.org/. If that doesn't help you, you should consider filing a bug report yourself. This should include a reduced test case, so the people working on improving the compiler don't have to work through all your source code (if you can release it to the public to begin with).
Starting with dmd 2.065, the DMD installation comes with a tool called DustMite that can help you minimize your source code to create the reduced test case. Setting up the environment to run DustMite can be tedious, so Visual D can help you for some use cases.
If your build has failed with an unexpected error message or even internal compiler error, you can select the relevant error messsage in the Visual Studio build output window or focus the respective issue in the error list. Then select "DustMite Build Failure" from the Visual D menu. This will create a clean copy of the startup project alongside the project folder (so make sure that all files necessary for the build are actually referenced in the project). In addition the generated build script is added.
DustMite will be run against this folder in a new console window, trying to find a minimal source code that still reproduces the error message. For larger code bases this process can take several hours. On success it will report the directory with the reduced source code.
Limitations
- The DustMite integration does not work with single file compilation as well as compilation of non D files.
- A crashing compiler might cause messages to popup that have to be closed manually. See https://github.com/CyberShadow/DustMite/wiki/Useful-test-scripts for some ideas how to deal with this.