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

error FABLE: Cannot reference entity from .dll reference: Chia.Shared.Ids.SortableRowKey #2237

Closed
tforkmann opened this issue Oct 26, 2020 · 9 comments

Comments

@tforkmann
Copy link
Contributor

Description

Chias shared model doesn't get fully compiled.
I get following error message:

error FABLE: Cannot reference entity from .dll reference: Chia.Shared.Ids.SortableRowKey

Repro code

The module inside Chia looks like this:

module Ids =
        type ReportId =
            | ReportId of reportId: int
            member this.GetValue = (fun (ReportId id) -> id) this
            member this.GetValueAsString = (fun (ReportId id) -> string id) this


        type SortableRowKey =
            | SortableRowKey of string
            member this.GetValue = (fun (SortableRowKey id) -> id) this

        module SortableRowKey =
            let toRowKey (dateTime: DateTime) =
                String.Format("{0:D19}", DateTime.MaxValue.Ticks - dateTime.Ticks) |> SortableRowKey
            let toDate (SortableRowKey ticks) = DateTime(DateTime.MaxValue.Ticks - int64 ticks)

Is there any way to get this working?

Expected and actual results

Module should get compile

Related information

  • Fable version: 3.0.0-nagareyama-beta-003
  • Operating system: Windows 10
@Zaid-Ajaj
Copy link
Member

@tforkmann Is Chia compiled as a shared library or referenced as a project? If it is a library where you don't have access to the source code, then you can make it Fable-compatible by publishing the sources as well like all Fable packages do

@alfonsogarciacaro
Copy link
Member

Yes, as @Zaid-Ajaj says, you need to include the F# sources in the package for Fable to be able to compile and access the code as in here: https://github.com/Fulma/Fulma/blob/0e7330d95f7555710dde1f0f992732b9bb357a43/src/Fulma/Fulma.fsproj#L68-L71

Maybe we should improve the error message 🤔

@tforkmann
Copy link
Contributor Author

Thanks guys! That worked!

@joprice
Copy link
Contributor

joprice commented Feb 21, 2025

@Zaid-Ajaj I'm getting the same error when using ProjectReference with a plugin defined in the same project. Is it possible to get that to work, or does it have to be published separately?

@tforkmann
Copy link
Contributor Author

@joprice If possible get rid of Chia since the maintainer of that project arent working at that company anymore.

@joprice
Copy link
Contributor

joprice commented Feb 21, 2025

Thank you, but I'm not using Chia. This is for a separate compiler plugin I've written locally.

@tforkmann
Copy link
Contributor Author

ahh ok

@joprice
Copy link
Contributor

joprice commented Feb 21, 2025

I just noticed that the errors are actually for transitive dependencies. Not sure if that helps clarify the error:

error FABLE: Cannot reference entity from .dll reference, Fable packages must include F# sources: Fable.MemberDeclarationPluginAttribute
error FABLE: Cannot find Fable.AST.Fable.Ident constructor
error FABLE: Cannot find Fable.AST.Fable.Expr constructor
error FABLE: Cannot find Fable.AST.Fable.ImportInfo constructor
error FABLE: Cannot find Fable.AST.Fable.MemberDecl constructor

@joprice
Copy link
Contributor

joprice commented Feb 21, 2025

Ah this was the issue: #3625 (comment). Need to exclude it from compilation to avoid generating js for the plugin code.

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

4 participants