Shader source directory mapping not working correctly when packaging

I am having an issue with virtual shader source paths on engine version 5.2. In my plugin module, I have the following code:

void FMyPluginModule::StartupModule()
{
const FString ShaderDirectory = FPaths::Combine(IPluginManager::Get().FindPlugin(TEXT(“MyPlugin”))->GetBaseDir(), TEXT(“Shaders”));
AddShaderSourceDirectoryMapping(TEXT(“/MyPlugin”), ShaderDirectory);

}

When packaging everything seems to work just fine when included with several different projects. However, when packaging one particular project, I get the following error:

UATHelper: Packaging (Windows): LogShaders: Error: Can’t map virtual shader source path “/MyPlugin/MyPluginShader.usf”.
UATHelper: Packaging (Windows): Directory mappings are:

I am then given a list which does not include the mapping set in my plugin’s StartupModule() method. However, calling ShaderCore::AllShaderSourceDirectoryMappings() at run time returns a list of paths that matches the list in the error (Though in a slightly different order) AND also includes the path set in my plugin’s StartupModule() call. This inconsistent behavior has been very confusing. Does anyone have any ideas what might be going on, and why the module would package correctly when included in some projects but not in others?

Hello!
Your plugin may be loaded too late during the engine initialization. Check the “LoadingPhase” property of MyPluginModule in your .uplugin to see if it’s properly set.

I tried moving up the the loading phase time to match or be before that of some of the other plugins which also call AddShaderSourceDirectoryMapping in the project, but unfortunately I get the same result. Thank you for the idea, though, Dlingr.