Skip to content

Commit 7a614fc

Browse files
committed
remove hack
1 parent 3d55f0c commit 7a614fc

File tree

2 files changed

+5
-40
lines changed

2 files changed

+5
-40
lines changed

build.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let release =
3434
|> ReleaseNotesHelper.parseReleaseNotes
3535

3636
let useMsBuildToolchain = environVar "USE_MSBUILD" <> null
37-
let dotnetSdkVersion = "2.1.403"
37+
let dotnetSdkVersion = "2.2.105"
3838
let sdkPath = lazy DotNetCli.InstallDotNetSDK dotnetSdkVersion
3939
let getSdkPath() = sdkPath.Value
4040

src/ProvidedTypesTesting.fs

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,16 @@ open Microsoft.FSharp.Reflection
1919
module Utils =
2020
let isNull x = match x with null -> true | _ -> false
2121

22-
23-
/// Simulate a real host of TypeProviderConfig
24-
type internal DllInfo(path: string) =
25-
member __.FileName = path
26-
27-
/// Simulate a real host of TypeProviderConfig
28-
type internal TcImports(bas: TcImports option, dllInfos: DllInfo list) =
29-
member __.Base = bas
30-
member __.DllInfos = dllInfos
31-
32-
3322
type internal Testing() =
3423

3524
/// Simulates a real instance of TypeProviderConfig
3625
static member MakeSimulatedTypeProviderConfig (resolutionFolder: string, runtimeAssembly: string, runtimeAssemblyRefs: string list, ?isHostedExecution, ?isInvalidationSupported) =
37-
38-
let cfg = TypeProviderConfig(fun _ -> false)
26+
let cfg = TypeProviderConfig(fun _ -> failwith "SystemRuntimeContainsType is deprecated and should never be called")
3927
cfg.IsHostedExecution <- defaultArg isHostedExecution false
4028
cfg.IsInvalidationSupported <- defaultArg isInvalidationSupported true
41-
let (?<-) cfg prop value =
42-
let ty = cfg.GetType()
43-
match ty.GetProperty(prop,BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic) with
44-
| null ->
45-
let fld = ty.GetField(prop,BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic)
46-
if fld = null then failwith ("expected TypeProviderConfig to have a property or field "+prop)
47-
fld.SetValue(cfg, value)|> ignore
48-
| p ->
49-
p.GetSetMethod(nonPublic = true).Invoke(cfg, [| box value |]) |> ignore
50-
cfg?ResolutionFolder <- resolutionFolder
51-
cfg?RuntimeAssembly <- runtimeAssembly
52-
cfg?ReferencedAssemblies <- Array.zeroCreate<string> 0
53-
54-
// Fake an implementation of SystemRuntimeContainsType the shape expected by AssemblyResolver.fs.
55-
let dllInfos = [yield DllInfo(runtimeAssembly); for r in runtimeAssemblyRefs do yield DllInfo(r)]
56-
let tcImports = TcImports(Some(TcImports(None,[])),dllInfos)
57-
let systemRuntimeContainsType = (fun (_s:string) -> if tcImports.DllInfos.Length = 1 then true else true)
58-
cfg?systemRuntimeContainsType <- systemRuntimeContainsType
59-
60-
//Diagnostics.Debugger.Launch() |> ignore
61-
Diagnostics.Debug.Assert(cfg.GetType().GetField("systemRuntimeContainsType",BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Instance) |> isNull |> not)
62-
Diagnostics.Debug.Assert(systemRuntimeContainsType.GetType().GetField("tcImports",BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Instance) |> isNull |> not)
63-
Diagnostics.Debug.Assert(typeof<TcImports>.GetField("dllInfos",BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Instance) |> isNull |> not)
64-
Diagnostics.Debug.Assert(typeof<TcImports>.GetProperty("Base",BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Instance) |> isNull |> not)
65-
Diagnostics.Debug.Assert(typeof<DllInfo>.GetProperty("FileName",BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Instance) |> isNull |> not)
66-
29+
cfg.ResolutionFolder <- resolutionFolder
30+
cfg.RuntimeAssembly <- runtimeAssembly
31+
cfg.ReferencedAssemblies <- Array.ofList runtimeAssemblyRefs
6732
cfg
6833

6934
/// Simulates a real instance of TypeProviderConfig and then creates an instance of the last

0 commit comments

Comments
 (0)