override suspend fun createAndStartSession()

in rider/src/main/kotlin/com/jetbrains/aspire/rider/run/runners/AspireHostDebugProgramRunner.kt [36:77]


    override suspend fun createAndStartSession(
        env: ExecutionEnvironment,
        state: IDotNetDebugProfileState,
        protocol: IProtocol,
        sessionLifetime: Lifetime,
        workerProcessHandler: DebuggerWorkerProcessHandler,
        sessionModel: DotNetDebuggerSessionModel,
        workerModel: DebuggerWorkerModel
    ): XSessionStartedResult {
        LOG.info("Creating Aspire debug session")

        if (state !is AspireHostDebugProfileState) {
            throw CantRunException("Unable to execute RunProfileState: $state")
        }

        val aspireHostProcessHandlerLifetime = AspireService
            .getInstance(env.project)
            .lifetime
            .createNested()

        setUpAspireHostModelAndSaveRunConfig(env, state, aspireHostProcessHandlerLifetime)

        val executionResult = state.execute(env.executor, this, workerProcessHandler, sessionLifetime)

        connectExecutionHandlerAndLifetime(executionResult, aspireHostProcessHandlerLifetime)

        return com.jetbrains.rider.debugger.startSession(
            executionResult.executionConsole,
            env,
            sessionLifetime,
            executionResult.processHandler,
            protocol,
            sessionModel,
            state.getDebuggerOutputEventsListener(),
            false
        ) { xDebuggerManager, xDebugProcessStarter ->
            xDebuggerManager
                .newSessionBuilder(xDebugProcessStarter)
                .environment(env)
                .startSession()
        }
    }