Closed 7sharp9 closed 6 years ago
@dsyme I fixed the tests so that the correct instance of the TP being tested is now being used, unfortunately there are now errors on both travis and appveyor:
System.Exception : failed to find reference to FSharp.Core, Version=3.259.3.1 in output for F# 3.1 Portable 259
@dsyme Also the test case does not seem to make sense: At the end there is a loop:
// re-read the assembly with the more complete reader to allow us to look at generated references
let assem = tp.TargetContext.ReadRelatedAssembly(assemContents)
let res = [| for r in assem.GetReferencedAssemblies() -> r.ToString() |] |> String.concat ","
printfn "----- GenerativeProviderWithRecursiveReferencesToGeneratedTypes %s ------- " text
printfn "compilation references for FSharp.Core target %s = %A" text runtimeAssemblyRefs
printfn "assembly references for FSharp.Core target %s = %s" text res
for desc2 in possibleVersions do
let contains = res.Contains("FSharp.Core, Version="+desc2)
if contains = (desc = desc2) then ()
elif contains then failwith ("unexpected reference to FSharp.Core, Version="+desc+" in output for "+text)
else failwith ("failed to find reference to FSharp.Core, Version="+desc2+" in output for " + text)
res
only contains a reference to System.Runtime, so contains
is always false
On the first iteration of the loop desc = desc2
is true as the second tuple in testCases()
is desc
("3.259.3.1")
and the first item in possibleVersions
is the same ( "3.259.3.1")
let testCases() =
[
("F# 3.1 Portable 259", "3.259.3.1", (fun _ -> Targets.hasPortable259Assemblies()), Targets.Portable259FSharp31Refs)
("F# 4.0 Portable 259", "3.259.4.0", (fun _ -> Targets.hasPortable259Assemblies() && Targets.supportsFSharp40()), Targets.Portable259FSharp40Refs)
("F# 3.1 .NET 4.5", "4.3.1.0", (fun _ -> Targets.supportsFSharp31()), Targets.DotNet45FSharp31Refs)
("F# 4.0 .NET 4.5", "4.4.0.0", (fun _ -> Targets.supportsFSharp40()), Targets.DotNet45FSharp40Refs)
("F# 4.1 .NET 4.5", "4.4.1.0", (fun _ -> true), Targets.DotNet45FSharp41Refs)
("F# 4.1 .NET Standard 2.0", "4.4.1.0", (fun _ -> true), Targets.DotNetStandard20FSharp41Refs)
("F# 4.1 .NET CoreApp 2.0", "4.4.1.0", (fun _ -> true), Targets.DotNetCoreApp20FSharp41Refs) ]
let possibleVersions =
[
"3.259.3.1"
"3.259.4.0"
"4.3.1.0"
"4.4.0.0"
"4.4.1.0"
"4.4.3.0"
(typeof<list<int>>.Assembly.GetName().Version.ToString()) ]
Can you comment on what the test is supposed to achieve as this is confusing, especially as there is never an FSharp.Core reference either, so the first pcl test will always fail:
if contains = (desc = desc2) then ()
if false = ("3.259.3.1" = "3.259.3.1") then ()
Same on windows, in res
doesnt find fsharp.core, but system.runtime
is the TP adding as reference the wrong assembly? so system.runtime instead of fsharp.core?
What do these print?
printfn "compilation references for FSharp.Core target %s = %A" text runtimeAssemblyRefs
printfn "assembly references for FSharp.Core target %s = %s" text res
@dsyme They look like this:
compilation references for FSharp.Core target F# 3.1 Portable 259 = [
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/mscorlib.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Collections.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Core.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Globalization.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.IO.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Linq.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Linq.Expressions.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Linq.Queryable.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Net.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Net.NetworkInformation.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Net.Primitives.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Net.Requests.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.ObjectModel.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Reflection.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Reflection.Extensions.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Reflection.Primitives.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Resources.ResourceManager.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.Extensions.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.InteropServices.WindowsRuntime.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.Serialization.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Threading.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Threading.Tasks.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Xml.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Xml.Linq.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Xml.XDocument.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.Serialization.Json.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Runtime.Serialization.Primitives.dll";
"/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile259/System.Windows.dll";
"/Users/dave.thomas/Documents/GitHub/FSharp.TypeProviders.SDK/packages/fs31/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.dll"
]
assembly references for FSharp.Core target F# 3.1 Portable 259 =
System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
ping, anyone...?
pingy, ping, ping?
If it's not green it's hard to merge :)
res only contains a reference to System.Runtime, so contains is always false
I would have expected a reference to FSharp.Core in the list. Either you need to adjust your type provider to emit more code (including something that uses FSharp.Core) or there is a problem in building this list.
The aim of the test is simply to check that the emitted reference to FSHarp.Core is correct when using all the different profiles.
@dsyme The point was the tests in here are incorrect :-)
GenerativeProviderWithRecursiveReferencesToGeneratedTypes generates for correctly
references GenerativePropertyProviderWithStaticParams
not GenerativeProviderWithRecursiveReferencesToGeneratedTypes
GenerativeProviderWithRecursiveReferencesToGeneratedTypes generates for hosted execution correctly
references GenerativePropertyProviderWithStaticParams
instead of GenerativeProviderWithRecursiveReferencesToGeneratedTypes
Also
group fs41
was missing for paket so it wont run the script on my machine
So when I fix the tests to reference the correct providers I dont know what the correct behaviour is supposed to be.
replaced by #255
Also fix the paket package group