From 46730280c769e405978cb49e3e2c24315f92dcd1 Mon Sep 17 00:00:00 2001 From: Rival Abdrakhmanov Date: Thu, 20 Feb 2025 10:06:13 +0100 Subject: [PATCH 1/3] Fix compilation --- .../azure-intellij-plugin-monitor/build.gradle.kts | 2 +- .../azure/toolkit/intellij/debugger/relay/WebSocketRelay.kt | 3 ++- .../legacy/function/toolingFeed/FunctionsToolingFeedService.kt | 1 + PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-monitor/build.gradle.kts b/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-monitor/build.gradle.kts index ada1c3446d..ea2ffdee3a 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-monitor/build.gradle.kts +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-monitor/build.gradle.kts @@ -20,7 +20,7 @@ dependencies { intellijPlatform { rider(platformVersion, false) jetbrainsRuntime() - bundledModule("intellij.libraries.microba") + bundledModules("intellij.libraries.microba", "intellij.json.split") bundledPlugins(listOf("com.intellij.properties", "com.intellij.modules.json")) } diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/WebSocketRelay.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/WebSocketRelay.kt index b4b9fea5a8..8d05354f3b 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/WebSocketRelay.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/WebSocketRelay.kt @@ -12,12 +12,13 @@ import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import kotlin.time.Duration.Companion.seconds class WebSocketRelay(private val requestProvider: HttpRequestBuilder.() -> Unit) : Relay { private val logger = logger() private val client = HttpClient(CIO) { install(WebSockets) { - pingInterval = 30000 + pingInterval = 30.seconds } } diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/legacy/function/toolingFeed/FunctionsToolingFeedService.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/legacy/function/toolingFeed/FunctionsToolingFeedService.kt index eb51553de2..63352feba1 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/legacy/function/toolingFeed/FunctionsToolingFeedService.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/legacy/function/toolingFeed/FunctionsToolingFeedService.kt @@ -28,6 +28,7 @@ import io.ktor.serialization.kotlinx.json.* import io.ktor.utils.io.ByteReadChannel import io.ktor.utils.io.core.isEmpty import io.ktor.utils.io.core.readBytes +import io.ktor.utils.io.readRemaining import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties b/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties index 58ba51194a..58a4fae559 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties +++ b/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties @@ -15,7 +15,7 @@ pluginUntilBuild = 251.* # Release: 2020.2 # EAP: 2020.3-EAP2-SNAPSHOT # Nightly: 2020.3-SNAPSHOT -platformVersion = 2025.1-EAP3-SNAPSHOT +platformVersion = 2025.1-SNAPSHOT dotnetBuildConfiguration=Release From 5489b113ebc51818c930023b35f305ce2d46202b Mon Sep 17 00:00:00 2001 From: Rival Abdrakhmanov Date: Thu, 20 Feb 2025 10:23:37 +0100 Subject: [PATCH 2/3] Fix compilation in the aspire module --- .../FunctionProjectSessionDebugProfile.kt | 4 +- .../FunctionProjectSessionProcessLauncher.kt | 21 ++-- .../FunctionProjectSessionRunProfile.kt | 4 +- .../FunctionSessionExecutableFactory.kt | 3 + ...ctionProjectSessionProcessLauncherUtils.kt | 51 -------- .../TempSessionExecutableFactoryUtils.kt | 109 ------------------ 6 files changed, 19 insertions(+), 173 deletions(-) delete mode 100644 PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempFunctionProjectSessionProcessLauncherUtils.kt delete mode 100644 PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempSessionExecutableFactoryUtils.kt diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionDebugProfile.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionDebugProfile.kt index 5dd2ba7c6e..ac40f616ec 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionDebugProfile.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionDebugProfile.kt @@ -19,13 +19,13 @@ import javax.swing.Icon class FunctionProjectSessionDebugProfile( private val sessionId: String, - projectName: String, + projectPath: Path, dotnetExecutable: DotNetExecutable, private val dotnetRuntime: DotNetCoreRuntime, private val sessionProcessEventListener: ProcessListener, private val sessionProcessLifetime: Lifetime, aspireHostProjectPath: Path? -) : ProjectSessionProfile(projectName, dotnetExecutable, aspireHostProjectPath), IRiderDebuggable { +) : ProjectSessionProfile(projectPath, dotnetExecutable, aspireHostProjectPath, true), IRiderDebuggable { override fun getIcon(): Icon = IntelliJAzureIcons.getIcon(AzureIcons.FunctionApp.RUN) diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionProcessLauncher.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionProcessLauncher.kt index 6bdcc5f4a1..367471b9d9 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionProcessLauncher.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionProcessLauncher.kt @@ -2,6 +2,8 @@ * Copyright 2018-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the MIT license. */ +@file:Suppress("UnstableApiUsage") + package com.microsoft.azure.toolkit.intellij.aspire import com.intellij.execution.executors.DefaultDebugExecutor @@ -19,6 +21,8 @@ import com.jetbrains.rd.util.lifetime.Lifetime import com.jetbrains.rider.aspire.generated.CreateSessionRequest import com.jetbrains.rider.aspire.run.AspireHostConfiguration import com.jetbrains.rider.aspire.sessionHost.projectLaunchers.SessionProcessLauncherExtension +import com.jetbrains.rider.aspire.sessionHost.projectLaunchers.getAspireHostRunConfiguration +import com.jetbrains.rider.aspire.sessionHost.projectLaunchers.getDotNetRuntime import com.jetbrains.rider.model.runnableProjectsModel import com.jetbrains.rider.projectView.solution import com.jetbrains.rider.runtime.DotNetExecutable @@ -27,7 +31,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import java.nio.file.Path import kotlin.io.path.Path -import kotlin.io.path.nameWithoutExtension class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { companion object { @@ -64,12 +67,12 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { ) ?: return val runtime = getDotNetRuntime(executable, project) ?: return - val projectName = Path(sessionModel.projectPath).nameWithoutExtension + val projectPath = Path(sessionModel.projectPath) val aspireHostProjectPath = aspireHostRunConfig?.let { Path(it.parameters.projectFilePath) } val profile = getRunProfile( sessionId, - projectName, + projectPath, executable, runtime, sessionProcessEventListener, @@ -111,12 +114,12 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { ) ?: return val runtime = getDotNetRuntime(executable, project) ?: return - val projectName = Path(sessionModel.projectPath).nameWithoutExtension + val projectPath = Path(sessionModel.projectPath) val aspireHostProjectPath = aspireHostRunConfig?.let { Path(it.parameters.projectFilePath) } val profile = getDebugProfile( sessionId, - projectName, + projectPath, executable, runtime, sessionProcessEventListener, @@ -162,7 +165,7 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { private fun getRunProfile( sessionId: String, - projectName: String, + projectPath: Path, dotnetExecutable: DotNetExecutable, dotnetRuntime: DotNetCoreRuntime, sessionProcessEventListener: ProcessListener, @@ -170,7 +173,7 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { aspireHostProjectPath: Path? ) = FunctionProjectSessionRunProfile( sessionId, - projectName, + projectPath, dotnetExecutable, dotnetRuntime, sessionProcessEventListener, @@ -180,7 +183,7 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { private fun getDebugProfile( sessionId: String, - projectName: String, + projectPath: Path, dotnetExecutable: DotNetExecutable, dotnetRuntime: DotNetCoreRuntime, sessionProcessEventListener: ProcessListener, @@ -188,7 +191,7 @@ class FunctionProjectSessionProcessLauncher : SessionProcessLauncherExtension { aspireHostProjectPath: Path? ) = FunctionProjectSessionDebugProfile( sessionId, - projectName, + projectPath, dotnetExecutable, dotnetRuntime, sessionProcessEventListener, diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionRunProfile.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionRunProfile.kt index ea1016388f..5b614dfd56 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionRunProfile.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionProjectSessionRunProfile.kt @@ -19,13 +19,13 @@ import javax.swing.Icon class FunctionProjectSessionRunProfile( private val sessionId: String, - projectName: String, + projectPath: Path, dotnetExecutable: DotNetExecutable, private val dotnetRuntime: DotNetCoreRuntime, private val sessionProcessEventListener: ProcessListener, private val sessionProcessLifetime: Lifetime, aspireHostProjectPath: Path? -) : ProjectSessionProfile(projectName, dotnetExecutable, aspireHostProjectPath) { +) : ProjectSessionProfile(projectPath, dotnetExecutable, aspireHostProjectPath, false) { override fun getIcon(): Icon = IntelliJAzureIcons.getIcon(AzureIcons.FunctionApp.RUN) diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionSessionExecutableFactory.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionSessionExecutableFactory.kt index 74a7c8b97e..3852ce252f 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionSessionExecutableFactory.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/FunctionSessionExecutableFactory.kt @@ -16,6 +16,9 @@ import com.intellij.openapi.project.Project import com.intellij.util.io.systemIndependentPath import com.jetbrains.rider.aspire.generated.CreateSessionRequest import com.jetbrains.rider.aspire.run.AspireHostConfiguration +import com.jetbrains.rider.aspire.sessionHost.getLaunchProfile +import com.jetbrains.rider.aspire.sessionHost.mergeArguments +import com.jetbrains.rider.aspire.sessionHost.mergeEnvironmentVariables import com.jetbrains.rider.aspire.settings.AspireSettings import com.jetbrains.rider.aspire.util.MSBuildPropertyService import com.jetbrains.rider.aspire.util.MSBuildPropertyService.ProjectRunProperties diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempFunctionProjectSessionProcessLauncherUtils.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempFunctionProjectSessionProcessLauncherUtils.kt deleted file mode 100644 index 3f8e2484fc..0000000000 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempFunctionProjectSessionProcessLauncherUtils.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2018-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the MIT license. - */ - -package com.microsoft.azure.toolkit.intellij.aspire - -import com.intellij.execution.RunManager -import com.intellij.execution.configurations.ConfigurationTypeUtil -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.project.Project -import com.jetbrains.rider.aspire.run.AspireHostConfiguration -import com.jetbrains.rider.aspire.run.AspireHostConfigurationType -import com.jetbrains.rider.run.configurations.RunnableProjectKinds -import com.jetbrains.rider.runtime.DotNetExecutable -import com.jetbrains.rider.runtime.DotNetRuntime -import com.jetbrains.rider.runtime.RiderDotNetActiveRuntimeHost -import com.jetbrains.rider.runtime.dotNetCore.DotNetCoreRuntime - -//TODO: Remove after an appropriate EAP - -private val LOG = Logger.getInstance("#com.microsoft.azure.toolkit.intellij.aspire.TempFunctionProjectSessionProcessLauncherUtils") - -fun getAspireHostRunConfiguration(name: String?, project: Project): AspireHostConfiguration? { - if (name == null) return null - - val configurationType = ConfigurationTypeUtil.findConfigurationType(AspireHostConfigurationType::class.java) - val runConfiguration = RunManager.getInstance(project) - .getConfigurationsList(configurationType) - .singleOrNull { it is AspireHostConfiguration && it.name == name } - if (runConfiguration == null) { - LOG.warn("Unable to find Aspire run configuration type: $name") - } - - return runConfiguration as? AspireHostConfiguration -} - -fun getDotNetRuntime(executable: DotNetExecutable, project: Project): DotNetCoreRuntime? { - val runtime = DotNetRuntime.detectRuntimeForProject( - project, - RunnableProjectKinds.DotNetCore, - RiderDotNetActiveRuntimeHost.getInstance(project), - executable.runtimeType, - executable.exePath, - executable.projectTfm - )?.runtime as? DotNetCoreRuntime - if (runtime == null) { - LOG.warn("Unable to detect runtime for executable: ${executable.exePath}") - } - - return runtime -} \ No newline at end of file diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempSessionExecutableFactoryUtils.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempSessionExecutableFactoryUtils.kt deleted file mode 100644 index bc78f2762a..0000000000 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet-aspire/src/main/kotlin/com/microsoft/azure/toolkit/intellij/aspire/TempSessionExecutableFactoryUtils.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2018-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the MIT license. - */ - -package com.microsoft.azure.toolkit.intellij.aspire - -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.diagnostic.trace -import com.intellij.openapi.project.Project -import com.intellij.util.execution.ParametersListUtil -import com.jetbrains.rider.aspire.generated.CreateSessionRequest -import com.jetbrains.rider.aspire.generated.SessionEnvironmentVariable -import com.jetbrains.rider.model.RunnableProject -import com.jetbrains.rider.run.configurations.launchSettings.LaunchSettingsJson -import com.jetbrains.rider.run.configurations.launchSettings.LaunchSettingsJsonService -import java.nio.file.Path - -//TODO: Remove after an appropriate EAP - -private const val DOTNET_LAUNCH_PROFILE = "DOTNET_LAUNCH_PROFILE" -private val LOG = Logger.getInstance("#com.microsoft.azure.toolkit.intellij.aspire.SessionExecutableFactoryUtils") - -//See: https://github.com/dotnet/aspire/blob/main/docs/specs/IDE-execution.md#launch-profile-processing-project-launch-configuration -suspend fun getLaunchProfile( - sessionModel: CreateSessionRequest, - runnableProject: RunnableProject, - project: Project -): LaunchSettingsJson.Profile? { - val launchProfileKey = getLaunchProfileKey(sessionModel) ?: return null - - val launchSettings = LaunchSettingsJsonService - .getInstance(project) - .loadLaunchSettingsSuspend(runnableProject) - ?: return null - - return launchSettings.profiles?.get(launchProfileKey) -} - -//See: https://github.com/dotnet/aspire/blob/main/docs/specs/IDE-execution.md#launch-profile-processing-project-launch-configuration -suspend fun getLaunchProfile( - sessionModel: CreateSessionRequest, - sessionProjectPath: Path, - project: Project -): LaunchSettingsJson.Profile? { - val launchProfileKey = getLaunchProfileKey(sessionModel) ?: return null - - val launchSettingsFile = - LaunchSettingsJsonService.getLaunchSettingsFileForProject(sessionProjectPath.toFile()) ?: return null - val launchSettings = - LaunchSettingsJsonService.getInstance(project).loadLaunchSettingsSuspend(launchSettingsFile) ?: return null - - return launchSettings.profiles?.get(launchProfileKey) -} - -private fun getLaunchProfileKey(sessionModel: CreateSessionRequest): String? { - if (sessionModel.disableLaunchProfile) { - LOG.trace { "Launch profile disabled" } - return null - } - - val launchProfileKey = - if (!sessionModel.launchProfile.isNullOrEmpty()) { - sessionModel.launchProfile - } else { - sessionModel.envs?.firstOrNull { it.key.equals(DOTNET_LAUNCH_PROFILE, false) }?.value - } - - LOG.trace { "Found launch profile key: $launchProfileKey" } - - return launchProfileKey -} - -//See: https://github.com/dotnet/aspire/blob/main/docs/specs/IDE-execution.md#launch-profile-processing-project-launch-configuration -fun mergeArguments( - sessionArguments: Array?, - defaultArguments: List, - launchProfileArguments: String? -) = buildString { - if (defaultArguments.isNotEmpty()) { - append(ParametersListUtil.join(defaultArguments)) - append(" ") - } - - if (sessionArguments != null) { - if (sessionArguments.isNotEmpty()) { - append(ParametersListUtil.join(sessionArguments.toList())) - } - } else { - if (!launchProfileArguments.isNullOrEmpty()) { - append(launchProfileArguments) - } - } -} - -//See: https://github.com/dotnet/aspire/blob/main/docs/specs/IDE-execution.md#launch-profile-processing-project-launch-configuration -fun mergeEnvironmentVariables( - sessionEnvironmentVariables: Array?, - launchProfileEnvironmentVariables: Map? -) = buildMap { - if (launchProfileEnvironmentVariables?.isNotEmpty() == true) { - launchProfileEnvironmentVariables.forEach { - it.value?.let { value -> put(it.key, value) } - } - } - - if (sessionEnvironmentVariables?.isNotEmpty() == true) { - sessionEnvironmentVariables.associateTo(this) { it.key to it.value } - } -} \ No newline at end of file From 59033fb73b77b9241d4bfcc27e48da30dfef6e72 Mon Sep 17 00:00:00 2001 From: Ilnar Agliamzianov Date: Thu, 20 Feb 2025 15:07:56 +0200 Subject: [PATCH 3/3] tcp().bind() became `suspend` - use runBlocking as a workaround --- .../azure/toolkit/intellij/debugger/relay/RelayServer.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/RelayServer.kt b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/RelayServer.kt index f5ccf091c9..4366ee91e3 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/RelayServer.kt +++ b/PluginsAndFeatures/azure-toolkit-for-rider/azure-intellij-plugin-appservice-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/debugger/relay/RelayServer.kt @@ -2,6 +2,7 @@ package com.microsoft.azure.toolkit.intellij.debugger.relay import com.azure.core.credential.TokenRequestContext import com.azure.identity.implementation.util.ScopeUtil +import com.intellij.openapi.progress.runBlockingCancellable import com.intellij.platform.util.coroutines.childScope import com.intellij.remote.RemoteCredentials import com.intellij.remote.RemoteCredentialsHolder @@ -64,7 +65,9 @@ abstract class RelayServer(protected val appServiceApp: AppServiceAppBase<*, *, protected inner class SocketServer(hostName: String, port: Int = 0) { private val selectorManager = ActorSelectorManager(Dispatchers.IO) - private val serverSocket = aSocket(selectorManager).tcp().bind(InetSocketAddress(hostName, port)) + private val serverSocket: ServerSocket = runBlocking { + aSocket(selectorManager).tcp().bind(InetSocketAddress(hostName, port)) + } val port = (serverSocket.localAddress as InetSocketAddress).port