How can I debug validator failures in Visual Studio?

My ASPiK users and I run into this on occasion.

It is because either the validator failed or because the final .vst3 failed to write to its target folder, which on Windows is a protected directory. Running VS as admin requires more than just logging in as admin and then running VS. Since you didn’t get compile warnings, it looks like the code may compile OK but the error is deeper. There are four things I do:

  1. Plugin Compiles? To test this, go to the Post-Build Event and set “Use in Build” to NO, then recompile. If the plugin compiles, you will see the message like this, showing that it was written to it’s “first” destination in the /Debug folder.

1>DemoVolumePlugin.vcxproj → C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\VST3\Debug\DemoVolumePlugin.vst3\Contents\x86_64-win\DemoVolumePlugin.vst3

If you get this, then the Plugin is compiling, but of course you could still have deeper issues.So, go back and set the “Use in Build” back to YES.

  1. logging from the Post-Build script: you can track the process of the Post-Build script using @echo in strategic locations. For example, to see if the validator is being run you could edit the script like this:

@echo — Running Validator —
C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\bin\Debug\Debug\validator.exe C:/ALL_SDK/VST_SDK/VST3_SDK/myprojects/DemoVolumePlugin/win_build/VST3/Debug/DemoVolumePlugin.vst3/Contents/x86_64-win/DemoVolumePlugin.vst3

You can also place these around the chunk that copies the .vst3 from its /Debug folder to it’s final destination by looking for “cmake.exe” -E copy."

@echo — Copying Plugin —
C:\Program Files\CMake\bin\cmake.exe" -E copy…/SNIP/

  1. logging from the validator: you have all the code for the validator executable in your project, and you can add some more debug logging to that as well. There are numerous places to log from, but the starting place would be Validator::run ( )
int Validator::run ()
{
	if (infoStream)
		*infoStream << "---> Validator::run CALLED!\n";

	// defaults
	bool useGlobalInstance = true;
        etc . . . . .

If you poke around you can find the tests as well.

  1. logging from the Plugin code - if the validator is failing, you can log messages from the plugin itself. You can place logging code all over the place, but a starting point is in your class factory definition and the InitModule( ) functions. Here is the class factory (only the last bit is shown):
	Steinberg::Vst::ASPiK::VST3Plugin::createInstance)		// function pointer called when this component should be instanciated
	printf("---> createInstance in factory \n");
END_FACTORY

and

bool InitModule(){
	printf("---> Factory: InitModule\n");
	return true;
}

After implementing a few of these, you can see what the top of my output window looks like:

1>DemoVolumePlugin.vcxproj -> C:\ALL_SDK\VST_SDK\VST3_SDK\myprojects\DemoVolumePlugin\win_build\VST3\Debug\DemoVolumePlugin.vst3\Contents\x86_64-win\DemoVolumePlugin.vst3
1>		Copy PlugIn.ico and desktop.ini and change their attributes.
1>---Changing Directories---
1>--- Running Validator ---
1>---> Validator::run CALLED!
1>* Loading module...
1>
1>	C:/ALL_SDK/VST_SDK/VST3_SDK/myprojects/DemoVolumePlugin/win_build/VST3/Debug/DemoVolumePlugin.vst3/Contents/x86_64-win/DemoVolumePlugin.vst3
1>
1>---> Factory: InitModule
1>---> Class Factory called
1>* Scanning classes...
1>

Hopefully, one of these strategies will help you find the issue. For most of my users, this has to do with Admin privileges and not being able to write the plugin (as Yvan was pointing out).

Will