AvaloniaRider icon indicating copy to clipboard operation
AvaloniaRider copied to clipboard

Previewer doesn`t load

Open baliross opened this issue 6 months ago • 14 comments

Environment

  • Arch Linux 6.14.11
  • JetBrains Rider 2025.1.3
  • AvaloniaRider 1.5.4
  • .NET 9.0
  • C#13

Problem

If I use any Avalonia template to create an empty project, build a project, and check the preview window, it loads endlessly. When I click on the "Restart previewer" button, the window turns black (to clarify, it becomes a text field), and nothing is written in the Avalonia log (which should appear when I click the "Show Log" button)

Screenshot

Image

baliross avatar Jul 02 '25 14:07 baliross

Could you check if it says anything in the IDE log file? There could be some exceptions (normally prefixed with the word SEVERE).

ForNeVeR avatar Jul 02 '25 20:07 ForNeVeR

Could you check if it says anything in the IDE log file? There could be some exceptions (normally prefixed with the word SEVERE).

2025-07-02 21:27:00,975 [2229468] SEVERE - #c.j.r.e.NetSdkInstaller - Can't update rider sdks metadata 2025-07-02 21:27:00,977 [2229470] SEVERE - #c.j.r.e.NetSdkInstaller - JetBrains Rider 2025.1.3 Build #RD-251.26094.147 2025-07-02 21:27:00,977 [2229470] SEVERE - #c.j.r.e.NetSdkInstaller - JDK: 21.0.7; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 2025-07-02 21:27:00,977 [2229470] SEVERE - #c.j.r.e.NetSdkInstaller - OS: Linux 2025-07-02 21:27:00,977 [2229470] SEVERE - #c.j.r.e.NetSdkInstaller - Last Action: RiderNewSolution

baliross avatar Jul 03 '25 05:07 baliross

This doesn't seem related. Are there any logs from the plugin? E.g. it should log something during the process startup. E.g. these lines: https://github.com/ForNeVeR/AvaloniaRider/blob/7f8443ccd708e9bd2a650e92845251d823950a79/src/rider/main/kotlin/me/fornever/avaloniarider/previewer/AvaloniaPreviewerProcess.kt#L162-L166

ForNeVeR avatar Jul 03 '25 10:07 ForNeVeR

There's nothing like this in the IDE log, and I can't view the plugin log because nothing is displayed when I click the "Show Log" button in the previewer window

baliross avatar Jul 03 '25 10:07 baliross

Meaning it probably failed before even having a chance to start the process. Can you attach the idea.log somewhere? Mind it might contain private information, though.

ForNeVeR avatar Jul 03 '25 10:07 ForNeVeR

To begin with, I grep'ed avaloniarider lines from IDE log. If this doesn't help, I'll attach the full log. https://pastebin.com/Y7FBLTWQ

baliross avatar Jul 03 '25 10:07 baliross

I will attach the full log in advance.

idea.log

baliross avatar Jul 03 '25 11:07 baliross

Hmm, according to the logs, it terminates all the previewer sessions immediately after they are started, but I'm not sure why would that happen. Normally it happens while you build the project, but it isn't the case here.

ForNeVeR avatar Jul 03 '25 21:07 ForNeVeR

I have tried reinstalling the IDE and plugin, but it has not worked. If there is no solution at the moment, are there any suggestions?

baliross avatar Jul 04 '25 03:07 baliross

Sadly, no any other clues so far. I am planning to add more diagnostics (especially around cases when we suppress the previewer during an ongoing build).

But generally, a problem without clear reproducer — most luck you'll have debugging this yourself. Try checking how the AvaloniaPreviewerSessionController behaves around lines like these and these — I expect it to start the process in there somewhere, but it doesn't happen because something cancels the whole session.

You can also try to reduce the case by checking on a newly created project from template, or trying on a different computer / with default IDE settings (in case there's something in the IDE settings that causes this behavior).

ForNeVeR avatar Jul 04 '25 11:07 ForNeVeR

I decided to try a few other linux distributions and check if the plugin works there. I installed the IDE using yay. The symptoms are the same. Could it be a hardware issue?

baliross avatar Jul 10 '25 07:07 baliross

I doubt it is a hardware issue. Also, while "yay" is not a packaging utility I am familiar with, I also don't think the way you install the IDE could be related to this particular problem.

ForNeVeR avatar Jul 10 '25 10:07 ForNeVeR

I've had this happen before. Sometimes hitting refresh a few times fixes it, but typically not. This only started happening with Avalonia 11. Our old internal tools running 0.10 still load fine.

I have gotten IDE errors that are always:

Socket error while session is still alive

java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:318)
	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:208)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:179)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:25)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:29)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:64)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:293)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.internal.SoftLimitedDispatcher$Worker.run(SoftLimitedDispatcher.kt:130)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:613)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:1183)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:778)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:765)

colejohnson66 avatar Aug 25 '25 13:08 colejohnson66

This happens when the previewer process dies. Logs from the previewer process would help.

ForNeVeR avatar Aug 25 '25 20:08 ForNeVeR