-
-
Notifications
You must be signed in to change notification settings - Fork 99
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] formatting on save not working since 0.28.0 #1266
Comments
There have been issues with csharpier server trying to use a reserved windows port, I'm not sure if linux has something similar - #1249 (comment). What happens if you run I did add an option to bypass csharpier server to VS, I'll probably add that option to rider + vscode as well. I've also considered automatically falling back to the older way of communicating. |
Some quick research shows that while Linux (all operating systems, in fact) have the concept of the dynamic/ephemeral port range, it seems like Windows is the only one that will block users from binding to those ports. |
formatting does not work with or without it. Errors did not became more meaningful, it's still just:
I also noticed this at the start:
|
Also having this issue using Rider on Windows. I saw this PR #1329 so I tried turning off VS Code and it seems to work now. If there's a problem with finding an unused port in addition to the problem in #1329 we use this code snippet that might be of help to find an unused port? /// <summary>
/// Tries to get the TCP port in the specified range that is currently unused.
/// </summary>
/// <returns>True if the unusedPort is set, otherwise false.</returns>
public bool TryGetUnusedTcpPort(int start, int end, out int unusedPort)
{
var usedPorts = new HashSet<int>();
var properties = IPGlobalProperties.GetIPGlobalProperties();
var activeTcpListeners = properties.GetActiveTcpListeners();
var activeUdpListeners = properties.GetActiveUdpListeners();
var activeConnections = properties.GetActiveTcpConnections();
for (int port = start; port < end; port++)
{
if (!usedPorts.Contains(port)
&& activeTcpListeners.All(c => c.Port != port)
&& activeUdpListeners.All(c => c.Port != port)
&& activeConnections.All(c => c.LocalEndPoint.Port != port))
{
unusedPort = port;
usedPorts.Add(port);
return true;
}
}
unusedPort = default;
return false;
} |
It's been a hot second, versions of everything changed, and at this very moment cshapier still doesn't work but for a different reason. 1st, using old dotnet-tools.json doesn't work anymore: {
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.0",
"commands": [
"dotnet-csharpier"
]
}
}
} This fails with
So it seems that it should be updated to {
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.0",
"commands": [
"csharpier"
]
}
}
} This succeeds.
In fact, Other data for reference:
|
Really struggling with the CSharpier plugin in Rider 2024.3 as well. Sometimes it works, most times it just fails with the "CSharpier unable to format files" warning toast. Enabled debug logging, which gives me these relevant entries:
THe tools are installed and I can run them just fine from a terminal myself. It also seems to work fine with the VSCode extension if I run VSCode instead. But in Rider, it's usually just a second or two hanging on the first attempt to format and then that infamous warning toast pops up. The repository dotnet-tools.json file: {
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.2",
"commands": [
"dotnet-csharpier"
],
"rollForward": true
},
"roslynator.dotnet.cli": {
"version": "0.9.3",
"commands": [
"roslynator"
],
"rollForward": true
}
}
} |
Sorry for the delay, I haven't had time to really look at this yet but some info that may help. 0.30.0 - was broken for all plugins. For 0.30.X, there are logs available at a path similar to Rider does have an option to disable cshapier server and use the older method of communication - tools - csharpier - disable csharpier server. |
Okay, I've updated csharpier to 0.30.3, made sure I have a log entry Trying to format (on save), a notification appears: Rider logs end with the usual
I found the cshapier logs in
(no port in filename) but it contains only
I've switched on
In riders logs:
|
Environments
will NOT be the same as the extension version
.config/dotnet-tools.json
Log Output
before update:
after update
Steps to reproduce
Downgrading to 0.27.3 works, manual formatting trough terminal works, action does not work with the same problem:
The text was updated successfully, but these errors were encountered: