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

Update TypeShape 8.0.1 -> 9.0.0 #226

Closed
Zaid-Ajaj opened this issue Mar 12, 2021 · 7 comments · Fixed by #228
Closed

Update TypeShape 8.0.1 -> 9.0.0 #226

Zaid-Ajaj opened this issue Mar 12, 2021 · 7 comments · Fixed by #228

Comments

@Zaid-Ajaj
Copy link
Owner

Some weird FATAL runtime error occurs with TypeShape and it happens only on deployed application in azure (assuming it is running net5.0) but works locally just fine using either -c Debug or -c Release

Fatal error. Internal CLR error. (0x80131506) at System.RuntimeType.get_IsByRefLike() at TypeShape.Core.Core+TypeShapeImpl.resolveTypeShape(System.Type) at TypeShape.Core.Core+ShapeFSharpRecord`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor() at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean) at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at TypeShape.Core.Core+TypeShapeImpl.activateGeneric(System.Type, System.Type[], System.Object[]) at TypeShape.Core.Core.Activator.CreateInstanceGeneric.Static[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpOption`1<System.Type[]>, Microsoft.FSharp.Core.FSharpOption`1<System.Object[]>) at TypeShape.Core.Core+Shape.|FSharpRecord|_|(TypeShape) at Fable.Remoting.Server.Proxy.makeApiProxy[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Fable.Remoting.Server.RemotingOptions`2<System.__Canon,System.__Canon>) at Fable.Remoting.Giraffe.GiraffeUtil.buildFromImplementation[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.AspNetCore.Http.HttpContext,System.__Canon>, Fable.Remoting.Server.RemotingOptions`2<Microsoft.AspNetCore.Http.HttpContext,System.__Canon>) at Fable.Remoting.Giraffe.Remoting.buildHttpHandler[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Fable.Remoting.Server.RemotingOptions`2<Microsoft.AspNetCore.Http.HttpContext,System.__Canon>) at <StartupCode$Server>.$Server.main@()

So I am thinking it might have to do with TypeShape using an old reflection API so I think we should update it to latest 9.0.0 just in case. What do you think, @kerams?

@kerams
Copy link
Collaborator

kerams commented Mar 12, 2021

That is really weird. Updating is certainly worth a shot, it won't hurt anything. However, TypeShape isn't pinned to a major version, are you sure you're not already deploying your application with v9?

@Zaid-Ajaj
Copy link
Owner Author

You are right @kerams it looks like it this is just paket lock from the SAFE template. Maybe that's the problem

@kerams
Copy link
Collaborator

kerams commented Mar 12, 2021

eiriktsarpalis/TypeShape@a8be8c7#diff-6a7780a357a197c700a5c9acdacd22efa6ea59e35cfb542b4ad370acf8766565R147-R151
This has been added in v9 and according to the call stack you're hitting the #else branch for some reason. I have no problems with it locally either (.NET 5 runtime and TypeShape 9.0.0). Maybe ask Eirik if he has any idea what's up?

In the meantime, I'm sure locking into v8 will help you.

@Zaid-Ajaj
Copy link
Owner Author

Zaid-Ajaj commented Mar 12, 2021

Yeah I was talking to @isaacabraham about it (he reported the issue) and I think we should either update TypeShape to 9.0.0 or set better version constraints to say TypeShape should be >= 8.0.1 && < 9.0.0 because now paket (correctly) chose the highest matching version of TypeShape because we have only >= 8.0.1

@eiriktsarpalis
Copy link

@Zaid-Ajaj could you share the full stacktrace?

@eiriktsarpalis
Copy link

Are you consuming TypeShape using the nuget package or by embedding its source file? The former only targets netstandard2.0 which uses the workaround referenced in eiriktsarpalis/TypeShape@a8be8c7#diff-6a7780a357a197c700a5c9acdacd22efa6ea59e35cfb542b4ad370acf8766565R147-R151

@Zaid-Ajaj
Copy link
Owner Author

@eiriktsarpalis The stack trace was posted in TypeShape/#45. Do you recommend to use the source file or the nuget package v9?

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

Successfully merging a pull request may close this issue.

3 participants