This has been happening for a good while now. Basically when I double click a script file in project explorer or an log/warning/print message in console, Rider doesn't show up/focus. The file is actually open in Rider but I need to focus Rider myself. It is getting pretty annoying so I just wanted to address it here. I'm surprised that no one else is hitting this issue. It's been happening in multiple projects, even after reinstalling Windows/Rider/Unity a few times. I'm using Rider 2017.2
Cheers!
Here are couple of root causes:
Could you please describe your workflow? Do you start Unity first and let it startup Rider?
I am closing this issue for now, but if you have any other ideas or if the described scenario is not working for you, I will still address it and reopen issue if needed. Thank you for the feedback!
Little update: from my testing it seems like it only happens when I let Unity open Rider. It works if I open Rider project before opening Unity.
@Nufflee Please switch Logging level to Verbose and paste here all the Unity Console output. Thanks!

The part of Unity Editor log from when I double clicked the file https://pastebin.com/spVrPnpZ. Also, the Unity Editor gets unfocused and the Rider icon in the taskbar flashes orange but Rider doesn't pop up (not sure what's the right term).
@Nufflee Before this log starts, was Rider started by Unity? Could you please make a full log starting with Unity startup, first double click causing Rider startup, second double click on different file, withexpected Rider window activation.
Here: https://pastebin.com/xwAJQqZd @van800
I see, investigating
Is it Windows 10?
Yes. @van800
Unfortunately no idea for now. According to the logs SetForegroundWindow silently doesn't work.
Please, if anyone also has this problem, write here.
Also have the problem (also on Windows 10).
It usually works, but then just stops for no particular reason. The icon on the Taskbar will flash, though.
I have the same issue using pinvoke in other scripts unrelated to Unity, so it might be some weirdness with Windows itself. I remember having similar issues with every Windows version since XP.
I still use my own Rider integration before this official one was available, and mine uses Autohotkey to force Rider to come to the front if it doesn't when I double click a script. The main reason I use my own is that I don't want to change the default editor in Unity so I can keep my assemblies named as when I use Visual Studio (for a number of reasons).
This doesn't apply here at all, but below is an (extreme) example of programs being nasty and not obeying Windows.
I had a particularly nasty bug once when trying to bring the Visual Studio to the front. It was a pretty deep rabbit hole until I reached some arcane knowledge to make the thread retry with a IOleMessageFilter and use the proper apartment for the entry point. Turns out that the window was busy (but didn't appear so) so it silently ignored Windows promoting it to front window.
Maybe an extra API in Rider so it can promote itself to front would be more consistent to using SetForegroundWindow from within Unity.
@SugoiDev On Windows there is no reliable legitimate way for an application to activate itself and "steal focus", I was thinking this way some time ago https://youtrack.jetbrains.com/issue/IDEA-172890
@van800 Interesting.
Here's the file with the code Autohotkey uses for this: WinActivate.
The juice is mostly in the method SetForegroundWindowEx.
There's a lot going on there and many methods are tried in sequence (and also retries). It also deals with LockSetForegroundWindow that might have been set for some reason (like opening a menu or holding the ALT key).
Since this is so excessively complicated, it is probably out of scope of this project or even Rider itself. In the end, I just use Autohotkey directly and it does the job (usually). If even that fails, I give up.
Edit: proper persistent links.
@SugoiDev Also interesting! But unless there will be many complaints on current implementation, it doesn't feel right to include such hacks like AttachThreadInput.
@van800 Pretty much. I think that, even if there were a lot of complaints, it would probably be easier to compile a small helper program (could even be Autohotkey itself; no dependencies) than to bloat this extension with all this madness.
help?
@Lyrcaxis I don't think there's any available fix for this.
Ensuring a window is the topmost window is a hard problem on Windows, and there's no trivial solution.
I added new fix for focus, it will appear in nightly builds in a couple of days.
https://github.com/JetBrains/resharper-unity/commit/8502766e9b070ab8d0fbf0e3b9dd1f3bf83a99e2
Latest fix is in 2018.1.2
I still have this issue in Rider 2018.2 RC
Still seeing this issue in the latest version of Rider. Have you guys tried the following approach?
this.WindowState = FormWindowState.Minimized;
this.Show();
this.WindowState = FormWindowState.Normal;
@sorencoder @danielkrenn Are you on Windows?
I'm on Windows 10.
@sorencoder @danielkrenn Are you on Windows?
Yes
@sorencoder Can you confirm that Rider process is started by Unity? (Otherwise Windows doesn't allow setting other application to front)
@sorencoder Can you confirm that Rider process is started by Unity? (Otherwise Windows doesn't allow setting other application to front)
Hi again van800.
With the example code I posted above, is this a method that your team has tried to bring the Rider window to the front? The reason I posted it is that it's the only reliable method I know of to bring a window to the front.
@danielkrenn No, we are using different approach
https://github.com/JetBrains/resharper-unity/blob/183/unity/EditorPlugin/OnOpenAssetHandler.cs#L139
I have the same problem on Win 10. Starting from within or outside of Unity does not affect it. What does though is if you minimize Rider window from the taskbar button (you click the Rider icon in the taskbar while the Rider window has focus). After you do that it doesn't go to foreground when you open a file in Unity.
I have the same problem also when hitting breakpoints in the debugger. This one however is not affected by the window minimized status.
I have 2 monitors if this is of any help.
@sorencoder Can you confirm that Rider process is started by Unity? (Otherwise Windows doesn't allow setting other application to front)
I had to switch to Visual Studio. But the team is now using Rider for our new project, and we have the this problem again.
We are developing online game. Server is also C# so I have two Rider instances open. One for client that gets started by Unity and one for server which is .Net Core console app.
If both Rider instances get minimized, Unity doesn't change focus to the Rider window. But if one of Rider instances remain open, everything works fine and the Rider instance for Unity pops up.
Hope it helps.
JetBrains Rider 2018.3.1
Build #RD-183.5253.26, built on December 27, 2018
Windows 10 10.0
Rider 2018.3.2 still have this problem >_<
@victor647 please try at least 2018.3.4 or even 2019.1 EAP
This issue is happening for me with 2019.1.2, same thing as Original issue. If i open Rider manually, then it take focus normally.
@Virosa This issue was fixed somewhere in 2019.2 versions. Install the latest version and check if you have issues.
Does work so far on 2019.2, cheers.
I'm experiencing this issue with Rider 2020.2.3 and Unity 2019.4.11f1 on Windows 10. When opening a file from Unity with Rider not open, I get a prompt asking to open the file or the whole solution, and choosing either one properly opens Rider with focus. However, anytime I try to open another file from Unity after this, it doesn't get focus, it just opens in Rider and flashes orange in the taskbar. This also happens when I open Rider manually before clicking anything in Unity.
@malexj93 Try to install or update Rider package in Unity. Latest public version is 2.0.7. Make sure to set external editor in Unity to Rider.
Most helpful comment
@Virosa This issue was fixed somewhere in 2019.2 versions. Install the latest version and check if you have issues.