fsprojects / fantomas-for-vs

Visual Studio Formatter for F#
https://marketplace.visualstudio.com/items?itemName=asti.fantomas-vs
46 stars 10 forks source link

Bump Fantomas.Client #30

Closed nojaf closed 2 years ago

nojaf commented 2 years ago

Hey @deviousasti, I've just discovered that the 5.0.0-alphas are not being picked up. See https://github.com/fsprojects/fantomas/pull/2227

deviousasti commented 2 years ago

Thanks! I hadn't see this release bump when I last checked for an update of Fantomas.Client.

nojaf commented 2 years ago

Well, I discovered the problem a few hours ago, so you didn't miss any updates. I just want to jump to fix this as it would hinder future releases.

deviousasti commented 2 years ago

@nojaf just found out that I have to bump FSharp.Core as well.

Assembly 'Fantomas.Client' with identity 'Fantomas.Client, Version=0.5.4.0, Culture=neutral, PublicKeyToken=null' uses 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'FSharp.Core' with identity 'FSharp.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'    FantomasVs.VS2019   
nojaf commented 2 years ago

image

That should not be the case. I really spent half an hour fixing that part.

nojaf commented 2 years ago

But if you can bump to FSharp.Core 6, I won't mind actually. FSAutocomplete also uses F# 6 now and it makes things a lot easier.

deviousasti commented 2 years ago

So that's the package metadata. The dll actually references 6.0. image

I did upgrade: https://github.com/fsprojects/fantomas-for-vs/commit/e19525d0d1881bc169685bd37265de07ac66a77f

But I'm getting some weird MissingMethodException now,

nojaf commented 2 years ago

image

Ok 🙃, can you show a stacktrace of the MissingMethodException?

deviousasti commented 2 years ago

lmao. It's from VSSDK. I upgraded that as well, and now it went away. Hopefully I don't break VS for everyone. I get most nervous about upgrading VS SDK, because almost all the failures are silent. 😱

deviousasti commented 2 years ago

Spoke too soon - for VS19:

The formatting operation failed:
 System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonSerializationException: Deserializing JSON-RPC result to type FormatDocumentResponse failed with JsonSerializationException: Could not create an instance of type Fantomas.Client.LSPFantomasServiceTypes+FormatDocumentResponse. Type is an interface or abstract class and cannot be instantiated. Path 'result.Case', line 1, position 41.
   at StreamJsonRpc.JsonMessageFormatter.JsonRpcResult.GetResult[T]()
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Fantomas.Client.LSPFantomasService.Fantomas-Client-Contracts-FantomasService-FormatDocumentAsync@256-1.Invoke(Task`1 t) in C:\Users\nojaf\Projects\fantomas\src\Fantomas.Client\LSPFantomasService.fs:line 256
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at FantomasVs.FantomasHandler.<FormatAsync>d__8.MoveNext()
---> (Inner Exception #0) Newtonsoft.Json.JsonSerializationException: Deserializing JSON-RPC result to type FormatDocumentResponse failed with JsonSerializationException: Could not create an instance of type Fantomas.Client.LSPFantomasServiceTypes+FormatDocumentResponse. Type is an interface or abstract class and cannot be instantiated. Path 'result.Case', line 1, position 41.
   at StreamJsonRpc.JsonMessageFormatter.JsonRpcResult.GetResult[T]()
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()<---

Trying both against Fantomas 4.7.9, freshly installed globally.

nojaf commented 2 years ago

Dammit, is that all related to FSharp.Core you think? If we can fix it to use 5.0.1, I'm game of that, I just couldn't get it right with paket. Maybe time to drop paket for that project?

deviousasti commented 2 years ago

Don't bother with it. This is likely something to do with StreamJsonRpc. I'll figure it out.

nojaf commented 2 years ago

Alright, keep me posted if you need anything.