1

I'm executing Xenko via Visual Studio which opens the Xenko's loading interface, and after selecting my project it opens Xenko's main interface.

Here starts the problem: when I snoop the window of the Xenko's main interface, it stops the execution of the code (to be exact it stops when I press the + on the left in snoop)

see: https://drive.google.com/open?id=1mYp1whk63DbAxLX4kSDOvBLUScS2h-c0

throwing a FatalExecutionEngineError see: https://drive.google.com/open?id=1ZcqNxawpoKh69ybD1ooSrbcnZ9zO-kwF

or a System.ExecutionEngineException when I try clicking on Continue in Visual Studio.

If it can help, that's what we can see by opening the exception parameters:
see: https://drive.google.com/open?id=1fuGeDvF-PO0uOvN07mStTUJHVDe_6BeB

Is there a way to avoid the error to stop the project from running? How to do so?

I tried:

  • try catch
  • unchecking: stop when that type of error occurs
  • checking it but by checking also "excepted when it occurs with...'
  • disabling the exception assistant
  • I also tried to launch Xenko directly instead of launching it via Visual Studio, but it also crashed obviously.
[STAThread]
public static void Main() {
    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
    EditorPath.EditorTitle = XenkoGameStudio.EditorName;

    if (IntPtr.Size == 4) {
        MessageBox.Show("Xenko GameStudio requires a 64bit OS to run.", "Xenko", MessageBoxButton.OK, MessageBoxImage.Error);
        Environment.Exit(1);
    }

    PrivacyPolicyHelper.RestartApplication = RestartApplication;
    PrivacyPolicyHelper.EnsurePrivacyPolicyXenko30();

    // We use MRU of the current version only when we're trying to reload last session.
    var mru = new MostRecentlyUsedFileCollection(InternalSettings.LoadProfileCopy, InternalSettings.MostRecentlyUsedSessions, InternalSettings.WriteFile);
    mru.LoadFromSettings();

    EditorSettings.Initialize();
    Thread.CurrentThread.Name = "Main thread";

    // Install Metrics for the editor
    using(XenkoGameStudio.MetricsClient = new MetricsClient(CommonApps.XenkoEditorAppId)) {
        try {
            // Environment.GetCommandLineArgs correctly process arguments regarding the presence of '\' and '"'
            var args = Environment.GetCommandLineArgs().Skip(1).ToList();
            var startupSessionPath = XenkoEditorSettings.StartupSession.GetValue();
            var lastSessionPath = EditorSettings.ReloadLastSession.GetValue() ? mru.MostRecentlyUsedFiles.FirstOrDefault() : null;
            var initialSessionPath = !UPath.IsNullOrEmpty(startupSessionPath) ? startupSessionPath: lastSessionPath ? .FilePath;

            // Handle arguments
            for (var i = 0; i < args.Count; i++) {
                if (args[i] == "/LauncherWindowHandle") {
                    windowHandle = new IntPtr(long.Parse(args[++i]));
                }
                else if (args[i] == "/NewProject") {
                    initialSessionPath = null;
                }
                else if (args[i] == "/DebugEditorGraphics") {
                    EmbeddedGame.DebugMode = true;
                }
                else if (args[i] == "/RenderDoc") {
                    // TODO: RenderDoc is not working here (when not in debug)
                    GameStudioPreviewService.DisablePreview = true;
                    renderDocManager = new RenderDocManager();
                }
                else if (args[i] == "/Reattach") {
                    var debuggerProcessId = int.Parse(args[++i]);

                    if (!System.Diagnostics.Debugger.IsAttached) {
                        using(var debugger = VisualStudioDebugger.GetByProcess(debuggerProcessId)) {
                            debugger ? .Attach();
                        }
                    }
                }
                else if (args[i] == "/RecordEffects") {
                    GameStudioBuilderService.GlobalEffectLogPath = args[++i];
                }
                else {
                    initialSessionPath = args[i];
                }
            }
            RuntimeHelpers.RunModuleConstructor(typeof(Asset).Module.ModuleHandle);

            //listen to logger for crash report
            GlobalLogger.GlobalMessageLogged += GlobalLoggerOnGlobalMessageLogged;

            mainDispatcher = Dispatcher.CurrentDispatcher;
            mainDispatcher.InvokeAsync(() = >Startup(initialSessionPath));

            using(new WindowManager(mainDispatcher)) {
                app = new App {
                    ShutdownMode = ShutdownMode.OnExplicitShutdown
                };
                app.Activated += (sender, eventArgs) = >{
                    XenkoGameStudio.MetricsClient ? .SetActiveState(true);
                };
                app.Deactivated += (sender, eventArgs) = >{
                    XenkoGameStudio.MetricsClient ? .SetActiveState(false);
                };

                app.InitializeComponent();
                app.Run();
            }

            renderDocManager ? .Shutdown();
        }
        catch(Exception e) {
            HandleException(e, 0);
        }
    }
}

I can't give you anything that could reproduce the error, but at least you can see the context of the error. It stops at app.Run(); .

It would be great if the project could keep running when I expand the tree in snoop, because of course snoop also closes when the project stops running.

karel
  • 5,489
  • 46
  • 45
  • 50
Beefr
  • 59
  • 6
  • If you get a `FatalExecutionEngineError` or `ExecutionEngineException`, there is no hope. You can't catch that and your process will die. You need to figure out what is causing that exception and then fix that. P/Invoke and interop are the things I would look at first. – Lasse V. Karlsen Apr 10 '19 at 09:12
  • If snoop is injecting something into the process space of the application you're snooping on, that is likely the cause of this. – Lasse V. Karlsen Apr 10 '19 at 09:14
  • Yeah I'm causing it with snoop, but I was hoping that I could keep my process alive :/ if you say there is no hope with that type of error then I guess I should close the subject ? – Beefr Apr 10 '19 at 09:38
  • Unfortunately the .NET runtime or whichever flavor of it you're running on is hosed at that point. – Lasse V. Karlsen Apr 10 '19 at 10:07
  • I discovered that visual studio was owning its own "snooping functionnality' which allowed me to do what i wanted – Beefr Apr 16 '19 at 07:59

0 Answers0