Repository: microsoft/terminal
File: src/cascadia/TerminalApp/TerminalWindow.cpp (C++)

Code before:
                                   const TerminalApp::ContentManager& manager) :
        _settings{ settingsLoadedResult.NewSettings() },
        _manager{ manager },
        _initialLoadResult{ settingsLoadedResult },
        _WindowProperties{ winrt::make_self<TerminalApp::implementation::WindowProperties>() }
    {
        // The TerminalPage has to ABSOLUTELY NOT BE constructed during our
        // construction. We can't do ANY xaml till Initialize() is called.

        // For your own sanity, it's better to do setup outside the ctor.
        // If you do any setup in the ctor that ends up throwing an exception,
        // then it might look like App just failed to activate, which will
        // cause you to chase down the rabbit hole of "why is App not
        // registered?" when it definitely is.
    }

    // Method Description:
    // - Implements the IInitializeWithWindow interface from shobjidl_core.
    HRESULT TerminalWindow::Initialize(HWND hwnd)
    {
        // Now that we know we can do XAML, build our page.
        _root = winrt::make_self<TerminalPage>(*_WindowProperties, _manager);
        _dialog = ContentDialog{};

        // Pass in information about the initial state of the window.
        // * If we were suppost to start from serialized "content", do that,
        // * If we were supposed to load from a persisted layout, do that
        //   instead.
        // * if we have commandline arguments, Pass commandline args into the
        //   TerminalPage.
        if (!_initialContentArgs.empty())
        {
            _root->SetStartupActions(_initialContentArgs);
        }
        else
        {
            // layout will only ever be non-null if there were >0 tabs persisted in
            // .TabLayout(). We can re-evaluate that as a part of TODO: GH#12633
            if (const auto& layout = LoadPersistedLayout())
            {
                std::vector<Settings::Model::ActionAndArgs> actions;
                for (const auto& a : layout.TabLayout())
                {
                    actions.emplace_back(a);
                }
                _root->SetStartupActions(actions);
            }
            else
            {
                _root->SetStartupActions(_appArgs.GetStartupActions());
            }

Review comment (suggestion):
```suggestion
        // * If we were supposed to start from serialized "content", do that,
```

Code after:
{
    TerminalWindow::TerminalWindow(const TerminalApp::SettingsLoadEventArgs& settingsLoadedResult,
                                   const TerminalApp::ContentManager& manager) :
        _settings{ settingsLoadedResult.NewSettings() },
        _manager{ manager },
        _initialLoadResult{ settingsLoadedResult },
        _WindowProperties{ winrt::make_self<TerminalApp::implementation::WindowProperties>() }
    {
        // The TerminalPage has to ABSOLUTELY NOT BE constructed during our
        // construction. We can't do ANY xaml till Initialize() is called.

        // For your own sanity, it's better to do setup outside the ctor.
        // If you do any setup in the ctor that ends up throwing an exception,
        // then it might look like App just failed to activate, which will
        // cause you to chase down the rabbit hole of "why is App not
        // registered?" when it definitely is.
    }

    // Method Description:
    // - Implements the IInitializeWithWindow interface from shobjidl_core.
    HRESULT TerminalWindow::Initialize(HWND hwnd)
    {
        // Now that we know we can do XAML, build our page.
        _root = winrt::make_self<TerminalPage>(*_WindowProperties, _manager);
        _dialog = ContentDialog{};

        // Pass in information about the initial state of the window.
        // * If we were supposed to start from serialized "content", do that,
        // * If we were supposed to load from a persisted layout, do that
        //   instead.
        // * if we have commandline arguments, Pass commandline args into the
        //   TerminalPage.
        if (!_initialContentArgs.empty())
        {
            _root->SetStartupActions(_initialContentArgs);
        }
        else
        {
            // layout will only ever be non-null if there were >0 tabs persisted in
            // .TabLayout(). We can re-evaluate that as a part of TODO: GH#12633
            if (const auto& layout = LoadPersistedLayout())
            {
                std::vector<Settings::Model::ActionAndArgs> actions;
                for (const auto& a : layout.TabLayout())
                {
                    actions.emplace_back(a);
                }
                _root->SetStartupActions(actions);
            }
            else
            {