[Solved] Plugin build hangs on VS2019

My VST3 plugin build hangs in Visual Studio 2019. There are no errors and the moduleinfo.json seems to have something to do with it. The project is managed by Projucer (7.0.9 master) VS version is 16.11.33.

The build log ends in:

1>Kairatune_SharedCode.vcxproj -> C:\Users\matti\Code\git\Kairatune\Builds\VisualStudio2019\x64\Debug\Shared Code\Kairatune.lib
1>        1 file(s) copied.
1>Done building project "Kairatune_SharedCode.vcxproj".
2>------ Build started: Project: Kairatune_VST3, Configuration: Debug x64 ------
2>include_juce_audio_plugin_client_VST3.cpp
2>   Creating library C:\Users\matti\Code\git\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.lib and object C:\Users\matti\Code\git\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.exp
2>Kairatune_VST3.vcxproj -> C:\Users\matti\Code\git\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.dll
2>        1 file(s) copied.
2>        1 file(s) copied.
2>Deleted file - C:\Users\matti\Code\git\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\Resources\moduleinfo.json

like it’s trying to delete the moduleinfo.json without ever completing.

The plugin itself seems to have been built and i could open it by dragging the .vst3 folder directly to AudioPluginHost as suggested somewhere here in the forums (regarding some other but similar build problem). However i don’t see the plugin crashing. AFAIK it works fine.

I tried to build a fresh empty VST3 plugin project created in Projucer and it builds fine. Here’s the log FWIW:

1>TestPlugin_SharedCode.vcxproj -> C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\Shared Code\TestPlugin.lib
1>Done building project "TestPlugin_SharedCode.vcxproj".
3>------ Rebuild All started: Project: TestPlugin_StandalonePlugin, Configuration: Debug x64 ------
4>------ Rebuild All started: Project: TestPlugin_VST3, Configuration: Debug x64 ------
3>include_juce_audio_plugin_client_Standalone.cpp
4>include_juce_audio_plugin_client_VST3.cpp
4>   Creating library C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\VST3\TestPlugin.lib and object C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\VST3\TestPlugin.exp
3>TestPlugin_StandalonePlugin.vcxproj -> C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\Standalone Plugin\TestPlugin.exe
4>TestPlugin_VST3.vcxproj -> C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\VST3\TestPlugin.dll
4>        1 file(s) copied.
4>Deleted file - C:\Users\matti\Code\TestPlugin\Builds\VisualStudio2019\x64\Debug\VST3\TestPlugin.vst3\Contents\Resources\moduleinfo.json
========== Rebuild All: 4 succeeded, 0 failed, 0 skipped ==========
1 Like

I tried recreating the entire project in Projucer and it still hangs with the log ending:

1>Kairatune_SharedCode.vcxproj -> C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\Shared Code\Kairatune.lib
1>Done building project "Kairatune_SharedCode.vcxproj".
3>------ Rebuild All started: Project: Kairatune_VST3, Configuration: Debug x64 ------
3>include_juce_audio_plugin_client_VST3.cpp
3>   Creating library C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.lib and object C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.exp
3>Kairatune_VST3.vcxproj -> C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.dll
3>        1 file(s) copied.
3>Could Not Find C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\moduleinfo.json
3>Could Not Find C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\Resources

I have these defined

JUCE_MODAL_LOOPS_PERMITTED=1
JUCE_FORCE_USE_LEGACY_PARAM_IDS=1

I’m also unable to manually delete the .vst3 file within the .vst3 folder in the Build directory.

PS C:\Users\matti\Code\test\Kairatune> del .\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\x86_64-win\Kairatune.vst3
del : Cannot remove item C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Conte
nts\x86_64-win\Kairatune.vst3: Access to the path 'C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug
\VST3\Kairatune.vst3\Contents\x86_64-win\Kairatune.vst3' is denied.
At line:1 char:1
+ del .\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\matti\...\Kairatune.vst3:FileInfo) [Remove-Item], Unauthoriz
   edAccessException
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand

I don’t have a clue what to do next.

[UPDATE]

I was able to delete the .vst3 file after restarting Windows. Tried removing the JUCE_FORCE_USE_LEGACY_PARAM_IDS without any effect.

After a successful VS clean solution, the build hangs at:

3>Kairatune_VST3.vcxproj -> C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.dll
3>        1 file(s) copied.
3>Could Not Find C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\moduleinfo.json
3>Could Not Find C:\Users\matti\Code\test\Kairatune\Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\Resources

The only thing about that is that the Resources folder exists and the moduleinfo.json is inside the Resources, not in Contents, where it’s being looked for.

I haven’t been able to repro this with a new, empty plugin project.

The Could Not Find... error messages are normal. The location of the moduleinfo.json changed since its introduction and the build script is checking for old locations to delete them, before creating the new one in Resources.

The moduleinfo.json is created by the juce_vst3_helper.exe, and it seems this step is never terminating in your case. The helper loads your plugin .dll and populates the moduleinfo with information loaded from the plugin. It seems this operation hangs for you.

My guess is that if you look in the Task Manager you’ll see juce_vst3_helper.exe running while the build is hanging. Since this helper loads your .dll, you will also not be able to delete it, as long as it’s running.

What I don’t know is why this operation is hanging in your case. By the time the build hangs, you already have a built VST3 plugin, it’s just the moduleinfo that hasn’t been populated yet. Can you load this plugin in a host? Maybe that will hang too and help us figure out what’s going wrong.

1 Like

Thank you for clearing a lot of this out already!

I’m also unable to reproduce this with an new empty plugin project.

The plugin (Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3) is fully functional and i can load and unload it in AudioPluginHost and Reaper attached with a debugger without any visible errors, except that both leave a background task behind after closing. It’s this background task that prevents me from deleting the plugin .vst3 file. Killing it releases the file.

The moduleinfo.json seems now to end into the right place Builds\VisualStudio2019\x64\Debug\VST3\Kairatune.vst3\Contents\Resources\moduleinfo.json and AFAIK looks valid. Also the old moduleinfo.json is successfully deleted. The build still hangs after the Deleted file - line

It looks like my plugin is leaking a Thread and a WaitableEvent and somehow that causes the build to hang. Fixing the leaks removed the problem and everything seems to work now with regards to the build.

Huge thanks @attila !

I encountered with similar problem after updating to latest version 7.0.12 from 7.0.3. Although it could be something wrong with my plugin, is there any modification regarding VST3 build?