@@ -19,51 +19,16 @@ open Microsoft.FSharp.Reflection
19
19
module Utils =
20
20
let isNull x = match x with null -> true | _ -> false
21
21
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
-
33
22
type internal Testing () =
34
23
35
24
/// Simulates a real instance of TypeProviderConfig
36
25
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" )
39
27
cfg.IsHostedExecution <- defaultArg isHostedExecution false
40
28
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
67
32
cfg
68
33
69
34
/// Simulates a real instance of TypeProviderConfig and then creates an instance of the last
0 commit comments