Call to System.Environment.GetEnvironmentVariable in my *.Build.cs file not possible

I have a test game project with a plugin. In my plugin build file, I’m calling System.Environment.GetEnvironmentVariable in order to reference a directory which is outside of the game project (not sure this is the right way too).
It seems to properly expand the system vars when I check the NMAKE section of VisualStudio project, but does generate an exception when trying to build the project. Is the build tool executing this in some sort of sandboxed environment perhaps?
Here’s the build output:

2>EXEC : error : Unable to instantiate instance of 'MyPlugin' object type from compiled assembly 'MyGameModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.  Unreal Build Tool creates an instance of your module's 'Rules' object in order to find out about your module's requirements.  The CLR exception details may provide more information:  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
2>         Parameter name: path1
2>            at System.IO.Path.Combine(String path1, String path2)
2>            at UnrealBuildTool.Rules.MyPlugin..ctor(ReadOnlyTargetRules Target) in d:\UnrealProjects\MyGame\Plugins\MyPlugin\Source\MyPlugin\MyPlugin.Build.cs:line 38
2>            --- End of inner exception stack trace ---
2>            at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
2>            at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2>            at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
2>            at UnrealBuildTool.RulesAssembly.CreateModuleRules(String ModuleName, ReadOnlyTargetRules Target, FileReference& ModuleFileName) in D:\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 299

Any suggestions?

Thanks.