Closed sergey-tihon closed 2 years ago
Compiled fine for me with dotnet 2.2.100-preview2-009404 on windows.
Thank @kevmal. Indeed, it works on win even with 2.1.403
I guess it is because System.Net.Http.dll
in available from GAC on Windows.
I've updated sample to use SharpYaml.dll
instead of System.Net.Http.dll
(this dll should not be in GAC on most of machines)
So when I do
let meth = ProvidedMethod("ToYaml", [ProvidedParameter("o", typeof<obj>)],
typeof<string>, isStatic=false,
invokeCode = (fun args ->
<@@
let o = (%%args.[1] : obj)
let serializer = SharpYaml.Serialization.Serializer()
serializer.Serialize(o)
@@>))
compilation fails with
X:\tp-temp\LemonadeEncodingProvider\tests\LemonadeEncodingProvider.Tests\LemonadeEncodingProvider.Tests.fs(7,20): error FS3033: The type provider 'LemonadeEncodingProviderImplementation+BasicGenerativeProvider' reported an error: Could not load file or assembly 'SharpYaml, Version=1.6.4.0, Culture=neutral, PublicKeyToken=1ced8108e942bc02'. The system cannot find the file specified. [X:\tp-temp\LemonadeEncodingProvider\tests\LemonadeEncodingProvider.Tests\LemonadeEncodingProvider.Tests.fsproj]
but when I replace it with
let meth = ProvidedMethod("ToYaml", [ProvidedParameter("o", typeof<obj>)],
typeof<string>, isStatic=false,
invokeCode = (fun args ->
<@@
let o = (%%args.[1] : obj)
Utilities.toYaml o
@@>))
when runtime assembly contains
module Utilities =
let toYaml o =
let serializer = SharpYaml.Serialization.Serializer()
serializer.Serialize(o)
it compiles without errors
@kevmal could you please try again https://github.com/sergey-tihon/tp-encoding-bug
Now I'm seeing the same error with dotnet build
. Though it seems VS 2017 Preview has no issues, builds and tests fine.
CLosing out this old issue
Description
The following provided method does not compile. It tries to access type
System.Text.Encoding.UTF8
defined in assemblySystem.Net.Http.dll
restored from NugetRepro steps
Please provide the steps required to reproduce the problem
Clone repo https://github.com/sergey-tihon/tp-encoding-bug
dotnet build
Expected behavior
Compile without error
Actual behavior
Compilation fails with error
Known workarounds
Define helper function in Runtime assembly
and call it from quotation
Related information