exit app if fail to open plugin library (#449)
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / lib / core_runtime.cc
index 2f1d7d6..5f1be89 100644 (file)
@@ -189,14 +189,6 @@ static void initEnvForSpecialFolder()
        }
 }
 
-// terminate candidate process when language changed
-// icu related data (CultureInfo, etc) should be recreated.
-static void langChangedCB(keynode_t *key, void* data)
-{
-       _INFO("terminiate candidate process to update language.");
-       exit(0);
-}
-
 static void setLang()
 {
        char* lang = vconf_get_str(VCONFKEY_LANGSET);
@@ -277,12 +269,15 @@ void preload()
 
 bool initializeCoreClr(PathManager* pm, const std::string& tpa)
 {
+       bool ncdbStartupHook = isNCDBStartupHookProvided();
+
        const char *propertyKeys[] = {
                "TRUSTED_PLATFORM_ASSEMBLIES",
                "APP_PATHS",
                "APP_NI_PATHS",
                "NATIVE_DLL_SEARCH_DIRECTORIES",
-               "AppDomainCompatSwitch"
+               "AppDomainCompatSwitch",
+               ncdbStartupHook ? "STARTUP_HOOKS" : "" // must be the last one
        };
 
        const char *propertyValues[] = {
@@ -290,14 +285,15 @@ bool initializeCoreClr(PathManager* pm, const std::string& tpa)
                pm->getAppPaths().c_str(),
                pm->getAppNIPaths().c_str(),
                pm->getNativeDllSearchingPaths().c_str(),
-               "UseLatestBehaviorWhenTFMNotSpecified"
+               "UseLatestBehaviorWhenTFMNotSpecified",
+               ncdbStartupHook ? getNCDBStartupHook() : "" // must be the last one
        };
 
        std::string selfPath = readSelfPath();
 
        int st = initializeClr(selfPath.c_str(),
                                                        "TizenDotnetApp",
-                                                       sizeof(propertyKeys) / sizeof(propertyKeys[0]),
+                                                       sizeof(propertyKeys) / sizeof(propertyKeys[0]) - (ncdbStartupHook ? 0 : 1),
                                                        propertyKeys,
                                                        propertyValues,
                                                        &__hostHandle,
@@ -340,6 +336,7 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode)
        // So, plugin initialize should be called before creating threads.
        if (initializePluginManager(appType) < 0) {
                _ERR("Failed to initialize PluginManager");
+               return -1;
        }
 
        // checkInjection checks dotnet-launcher run mode
@@ -470,9 +467,6 @@ int CoreRuntime::initialize(const char* appType, LaunchMode launchMode)
        }
 
        if (launchMode == LaunchMode::loader) {
-               // terminate candidate process if language is changed.
-               // CurrentCulture created for preloaded dlls should be updated.
-               vconf_notify_key_changed(VCONFKEY_LANGSET, langChangedCB, NULL);
 
                // preload libraries and manage dlls for optimizing startup time
                preload();
@@ -578,6 +572,7 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i
 
                        if (exist(multiCoreJitProfile)) {
                                setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "1");
+                               _INFO("MCJ playing start for %s", appId);
                        } else {
                                setEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "0");
                                // stop profiling and write collected data after delay if env value is set.
@@ -590,6 +585,7 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i
                                                stopProfileAfterDelay(delay);
                                        }
                                }
+                               _INFO("MCJ recording start for %s", appId);
                        }
                }
                free(localDataPath);
@@ -601,8 +597,6 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i
 
        setSwitch("Switch.System.Diagnostics.StackTrace.ShowILOffsets", true);
 
-       vconf_ignore_key_changed(VCONFKEY_LANGSET, langChangedCB);
-
        pluginBeforeExecute();
 
        _INFO("execute assembly : %s", path);