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

More reliable extensions #995

Closed
belav opened this issue Nov 9, 2023 · 2 comments
Closed

More reliable extensions #995

belav opened this issue Nov 9, 2023 · 2 comments

Comments

@belav
Copy link
Owner

belav commented Nov 9, 2023

Based on the problem with #989, it makes sense to add better error handling. The code in csharpier probably needs to use a try/catch around the call to format a file. If the work to get GRPC working is done, it would be easier to report the failure back to the extension.

Maybe it is also possible to detect the crashing/hung csharpier process better on the extension side. I can re-introduce the problem and try to come up with a better way to deal with a similar situation in the future.

  1. Ignore in rider C:\Users\bela\AppData\Local\Temp\SourceGeneratedDocuments\F4DCBEE912DC99E14C52B9BC\CSharpier.Tests.Generators\CSharpier.Tests.Generators.FormattingTestsGenerator
  2. Add logging on the csharpier end
  3. Make sure extensions don't retry a hung csharpier indefinitely - may be done in all but VS
  4. VS does not have the better validation/notification yet
  5. VSCode does not link to read more troubleshooting
  6. Look at VS 2022 addin isn't working: System.UnauthorizedAccessException: Access to the path 'CSharpier.dll' is denied. #1048 a bit, it seems that if one IDE is using csharpier, then another one can't delete it. But why would it delete it if it can be run?
  7. Can we read the error output of trying to install csharpier? the failure in Failing in Rider #1050 seems to be a problem installing csharpier
@belav belav added this to the 0.26.0 milestone Nov 9, 2023
@belav belav modified the milestones: 0.26.0, 0.26.3 Nov 17, 2023
@belav
Copy link
Owner Author

belav commented Nov 18, 2023

Some exceptions I saw around the time Rider finally hung for me

2023-11-18 10:28:21,937 [   8786]   WARN - #c.i.c.CSharpierLogger - Exception while running 'dotnet csharpier --version' in C:\Users\bela\AppData\Local\CSharpier\0.26.0
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "output" is null
	at com.intellij.csharpier.CustomPathInstaller.ensureVersionInstalled(CustomPathInstaller.java:30)
	at com.intellij.csharpier.CSharpierProcessProvider.setupCSharpierProcess(CSharpierProcessProvider.java:203)
	at com.intellij.csharpier.CSharpierProcessProvider.findAndWarmProcess(CSharpierProcessProvider.java:92)
	at com.intellij.csharpier.CSharpierProcessProvider.<init>(CSharpierProcessProvider.java:45)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
2023-11-18 10:28:21,930 [   8779] SEVERE - #c.i.c.CSharpierLogger - Cannot run program "C:\Users\bela\AppData\Local\CSharpier\0.26.0\dotnet-csharpier" (in directory "C:\Users\bela\AppData\Local\CSharpier\0.26.0"): CreateProcess error=2, The system cannot find the file specified
java.lang.Throwable: Cannot run program "C:\Users\bela\AppData\Local\CSharpier\0.26.0\dotnet-csharpier" (in directory "C:\Users\bela\AppData\Local\CSharpier\0.26.0"): CreateProcess error=2, The system cannot find the file specified
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:370)
	at com.intellij.csharpier.ProcessHelper.ExecuteCommand(ProcessHelper.java:53)
	at com.intellij.csharpier.CustomPathInstaller.ensureVersionInstalled(CustomPathInstaller.java:26)
	at com.intellij.csharpier.CSharpierProcessProvider.setupCSharpierProcess(CSharpierProcessProvider.java:203)
	at com.intellij.csharpier.CSharpierProcessProvider.findAndWarmProcess(CSharpierProcessProvider.java:92)
	at com.intellij.csharpier.CSharpierProcessProvider.<init>(CSharpierProcessProvider.java:45)

@belav belav modified the milestones: 0.26.3, 0.26.4 Nov 29, 2023
@belav belav modified the milestones: 0.26.4, 0.26.5 Dec 10, 2023
@markusmeder
Copy link

I also experience the issue with "System.UnauthorizedAccessException: Access to the path 'CSharpier.dll' is denied.".

When I open the first solution csharpier works fine, but i get this error as soon as I open a second solution. Formatting in the first solution still works fine.

I use visual studio 17.8.3 on windows and csharpier 0.26.5 installed globally.

@belav belav modified the milestones: 0.26.5, 0.26.7 Dec 16, 2023
@belav belav modified the milestones: 0.26.7, Planned - Extensions Jan 2, 2024
@belav belav closed this as completed Apr 19, 2024
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