dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
595 stars 50 forks source link

KeyNotFound on interfaces in Proxy projects #1371

Closed Jand42 closed 8 months ago

Jand42 commented 9 months ago

This line can throw: https://github.com/dotnet-websharper/core/blob/7669c38cf10c66ba993c05201640187fabc8951a/src/compiler/WebSharper.Compiler.FSharp/ProjectReader.fs#L1414

This lookup is used by isInterface function that is used for determining value of isInterfaceProxy - WebSharper allows a class to proxy an interface, bc this is the only way we can now support proxying default interface implementations from F#, a trick also used by collection interface proxies

So if you have a Proxy project, the proxied type is not actually visible, as you are not referencing the project you are proxying... indeed an oversight. The solution could be is that for Proxy projects isInterfaceProxy = isThisInterface. (we can assume it's the same type declaration, same code as original...)