Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rider plugin not running, CustomPathInstaller.validateInstall returning null #1337

Closed
BenjaBobs opened this issue Aug 26, 2024 · 2 comments
Closed

Comments

@BenjaBobs
Copy link

Environments

  • IDE Version: Rider 2024.2.1
  • Extension Version: 1.8.0
  • CSharpier Version: 0.29.0
  • Operating System: EndeavorOS / Arch
  • .csharpierrc Settings: N/A
  • .editorconfig Settings: N/A

Log Output
Based on this it looks like it cannot validate the installation:

2024-08-26 11:28:31,233 [  43879]   WARN - #c.i.c.CSharpierLogger - Exception while running 'dotnet csharpier --version' in /home/bh/.cache/csharpier/0.29.0
java.lang.NullPointerException: Cannot invoke "String.trim()" because the return value of "com.intellij.csharpier.ProcessHelper.executeCommand(java.util.List, java.util.Map, java.io.File)" is null
	at com.intellij.csharpier.CustomPathInstaller.validateInstall(CustomPathInstaller.java:75)
	at com.intellij.csharpier.CustomPathInstaller.ensureVersionInstalled(CustomPathInstaller.java:60)
	at com.intellij.csharpier.CSharpierProcessProvider.setupCSharpierProcess(CSharpierProcessProvider.java:268)
	at com.intellij.csharpier.CSharpierProcessProvider.findAndWarmProcess(CSharpierProcessProvider.java:105)
	at com.intellij.csharpier.CSharpierProcessProvider.getProcessFor(CSharpierProcessProvider.java:120)
	at com.intellij.csharpier.FormattingService.getCanFormat(FormattingService.java:137)
	at com.intellij.csharpier.ReformatWithCSharpierAction.update(ReformatWithCSharpierAction.java:59)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$performDumbAwareUpdate$runnable$1.invoke(ActionUtil.kt:199)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$performDumbAwareUpdate$runnable$1.invoke(ActionUtil.kt:193)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.kt:217)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$success$1$1$1.invoke(ActionUpdater.kt:561)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$success$1$1$1.invoke(ActionUpdater.kt:560)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$callAction$2$1.invoke(ActionUpdater.kt:155)
	at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:104)
	at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:15)
	at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:94)
	at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:93)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1$lambda$0(cancellableReadAction.kt:31)
	at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:291)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:965)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1(cancellableReadAction.kt:29)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:27)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:93)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:77)
	at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:64)
	at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$3.invokeSuspend(InternalReadAction.kt:35)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$3.invoke(InternalReadAction.kt)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$3.invoke(InternalReadAction.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
	at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:34)
	at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:38)
	at com.intellij.openapi.application.ReadWriteActionSupport.executeReadAction$default(ReadWriteActionSupport.kt:15)
	at com.intellij.openapi.application.CoroutinesKt.constrainedReadActionUndispatched(coroutines.kt:82)
	at com.intellij.openapi.application.CoroutinesKt.readActionUndispatched(coroutines.kt:69)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$callAction$$inlined$useWithScope$1.invokeSuspend(trace.kt:163)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$callAction$$inlined$useWithScope$1.invoke(trace.kt)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$callAction$$inlined$useWithScope$1.invoke(trace.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:163)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.callAction(ActionUpdater.kt:939)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.access$callAction(ActionUpdater.kt:85)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$success$1$1.invokeSuspend(ActionUpdater.kt:560)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$success$1$1.invoke(ActionUpdater.kt)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$success$1$1.invoke(ActionUpdater.kt)
	at com.jetbrains.rdclient.actions.base.FrontendActionUpdateInterceptor.updateAction$suspendImpl(FrontendActionUpdateInterceptor.kt:79)
	at com.jetbrains.rdclient.actions.base.FrontendActionUpdateInterceptor.updateAction(FrontendActionUpdateInterceptor.kt)
	at com.jetbrains.rider.actions.RiderActionUpdateInterceptor.updateAction(RiderActionUpdateInterceptor.kt:31)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$$inlined$retryOnAwaitSharedData$1.invokeSuspend(ActionUpdater.kt:940)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$$inlined$retryOnAwaitSharedData$1.invoke(ActionUpdater.kt)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater$updateAction$$inlined$retryOnAwaitSharedData$1.invoke(ActionUpdater.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:163)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.updateAction(ActionUpdater.kt:979)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.presentation(ActionUpdater.kt:530)
	at com.intellij.openapi.actionSystem.impl.Utils$runUpdateSessionForActionSearch$1$1$1.invokeSuspend(Utils.kt:1059)
	at com.intellij.openapi.actionSystem.impl.Utils$runUpdateSessionForActionSearch$1$1$1.invoke(Utils.kt)
	at com.intellij.openapi.actionSystem.impl.Utils$runUpdateSessionForActionSearch$1$1$1.invoke(Utils.kt)
	at com.intellij.ide.util.gotoByName.ActionAsyncProvider$matchedActionsAndStubsFlow$$inlined$map$1$2.emit(Emitters.kt:220)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:33)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)

But further down in the logs there is also this:

2024-08-26 12:30:17,872 [  75516]   FINE - #c.i.c.CSharpierLogger - Running 'dotnet tool list' to look for version
2024-08-26 12:30:17,873 [  75517]   FINE - #c.i.c.CSharpierLogger - Output was: 
 Package Id      Version      Commands              Manifest                                               
----------------------------------------------------------------------------------------------------------
csharpier       0.29.0       dotnet-csharpier      /home/bh/dev/MySln/.config/dotnet-tools.json
2024-08-26 12:30:17,873 [  75517]   FINE - #c.i.c.CSharpierLogger - Using 0.29.0 as the version number.
2024-08-26 12:30:17,879 [  75523]   FINE - #c.i.c.CSharpierLogger - Running /home/bh/.cache/csharpier/0.29.0/dotnet-csharpier --version in /home/bh/.cache/csharpier/0.29.0
2024-08-26 12:30:17,988 [  75632]   FINE - #c.i.c.CSharpierLogger - /home/bh/.cache/csharpier/0.29.0/dotnet-csharpier--version output: 0.29.0
2024-08-26 12:30:17,988 [  75632]   FINE - #c.i.c.CSharpierLogger - Using 0.29.0 as the version number.
2024-08-26 12:30:17,988 [  75632]   FINE - #c.i.c.CSharpierLogger - CSharpier at /home/bh/.cache/csharpier/0.29.0 already exists

And when checking locally for the version I get this:
image

Steps to reproduce
I just installed Rider fresh and added the CSharpier plugin, restarted Rider and tried to format a file.

Expected behavior

Actual behavior

@BenjaBobs
Copy link
Author

Well, I'm not sure exactly what happened, but after trying again today, it worked. I suspect maybe a restart of the computer did something.

@belav
Copy link
Owner

belav commented Aug 28, 2024

Based on the fix I just did in #1338 I am guessing that trying to run 'dotnet csharpier --version' in /home/bh/.cache/csharpier/0.29.0 resulted in an error. The code I have in ProcessHelper returns null when that happens and I've been assuming it won't in a few places. There may have been a debug log above the exception that would show the error output but it didn't have a label on it.

I'm going to tweak the logic in there to hopefully give a better indication of what is wrong if it happens again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants