19.02.2014, 14:11 | #1 |
Участник
|
Axilicious:The Registry.CurrentUser impediment
Источник: http://www.ksaelen.be/wordpresses/dy...er-impediment/
============== Today I was working on creating a build process template for AX2012. I will not go into the details about the build process template and the custom activities as these activities will be covered by Joris De Gruyter later on. But still, I wanted to show you guys a nasty little problem I was experiencing yesterday. The build process threw an exception : ” Object reference not set to an instance of an object” So, this was of course a null reference, but after some investigation ( by using primitive logging because this was running in the agent process ) it turned out to be located in this code: public static string GetInstallDir32(){ RegistryKey componentsKey = Registry.CurrentUser.OpenSubKey(regKey, false); String installDir32 = componentsKey.GetValue("InstallDir32", null) as String; return System.Environment.ExpandEnvironmentVariables(installDir32);} It turned out to be the Registry.CurrentUser property that returned null. And then it struck me, the agent ran under a service account s_tfs_build and since this account was never used to log on interactively, the profile of this user was not loaded up to that point. The simple solution was to log on to the system with the service account so that the user profile and registry hive were loaded. From then on, the Registry.CurrentUser property was properly filled. Источник: http://www.ksaelen.be/wordpresses/dy...er-impediment/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|