You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I'm stuck with an assembly error while developing a generative type provider, and I can't figure out what I'm doing wrong.
Context
When doing android development, adding any type of resource (image, sound, colors, styles, etc) will generate a unique id for that resource that developers need to use.
In Xamarin.Android, those ids are generated in a Resource.designer.cs file (written in C# - basically a bunch of classes with const int fields).
I have been following the same logic than the original XA.FSharp.ResourceProvider, meaning:
Compile Resource.designer.cs into its own dll (using Roslyn)
Assembly.Load that dll to get the System.Types
Feed the dll bytes and types to the interface ITypeProvider
But when doing this, either by command line (dotnet build) or in IDE, I get the following error in the project using the type provider:
error FS1108: The type 'Object' is required here and is unavailable. You must add a reference to assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
Weirdly, if I load the compiled dll directly in the target project (<Reference Include="ProvidedTypes.dll" />), it works perfectly well.
But if I let the type provider include the assembly for me, it fails.
I did a lot of tests to try and find the source of the issue, but nothing works.
Assemblies locations match, everything should be good...
Hello!
I'm stuck with an assembly error while developing a generative type provider, and I can't figure out what I'm doing wrong.
Context
When doing android development, adding any type of resource (image, sound, colors, styles, etc) will generate a unique id for that resource that developers need to use.
In Xamarin.Android, those ids are generated in a
Resource.designer.cs
file (written in C# - basically a bunch of classes withconst int
fields).Of course, in F# Android projects, that file is not included preventing us from using those ids.
To work around that, https://github.com/xamarin/Xamarin.Android.FSharp.ResourceProvider has been created.
It's a type provider that compiles
Resource.designer.cs
into a dll and loads it in theITypeProvider
interface.Unfortunately, this type provider is no longer maintained and is a pain for Android development using F#. (dotnet/fsharp#12640, dotnet/fsharp#10837, xamarin/Xamarin.Android.FSharp.ResourceProvider#9, xamarin/Xamarin.Android.FSharp.ResourceProvider#11, dotnet/android#6404, #376)
So I took over that task and made a new type provider using the latest template.
You can find the project here: https://github.com/fabulousfx/FSharp.Android.ResourceProvider
Problem
I have been following the same logic than the original XA.FSharp.ResourceProvider, meaning:
System.Type
sITypeProvider
But when doing this, either by command line (
dotnet build
) or in IDE, I get the following error in the project using the type provider:Weirdly, if I load the compiled dll directly in the target project (
<Reference Include="ProvidedTypes.dll" />
), it works perfectly well.But if I let the type provider include the assembly for me, it fails.
I did a lot of tests to try and find the source of the issue, but nothing works.
Assemblies locations match, everything should be good...
Would you have an idea what I'm doing wrong?
How to reproduce
Prerequisites:
dotnet workload install android
Then run
dotnet build tests/FSharp.Android.ResourceProvider.Tests -c release -v diag
You should see a build error with the reported message.
@dsyme @KevinRansom
The text was updated successfully, but these errors were encountered: