Skip to content

Commit

Permalink
Second half of fix to dotnet#106
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme committed Aug 14, 2015
1 parent 4385bb7 commit adebe18
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3846,11 +3846,20 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
referencedAssemblies = [| for r in resolutions.GetAssemblyResolutions() -> r.resolvedPath |]
temporaryFolder = Path.GetTempPath() }

// The type provider should not hold strong references to disposed
// TcImport objects. So the callbacks provided in the type provider config
// dispatch via a thunk which gets set to a non-resource-capturing
// failing function when the object is disposed.
let systemRuntimeContainsType =
let systemRuntimeContainsTypeRef = ref tcImports.SystemRuntimeContainsType
tcImports.AttachDisposeAction(fun () -> systemRuntimeContainsTypeRef := (fun _ -> raise (System.ObjectDisposedException("The type provider has been disposed"))))
fun arg -> systemRuntimeContainsTypeRef.Value arg

let providers =
[ for assemblyName in providerAssemblies do
yield ExtensionTyping.GetTypeProvidersOfAssembly(displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders, tpApprovals,
fileNameOfRuntimeAssembly, ilScopeRefOfRuntimeAssembly, assemblyName, typeProviderEnvironment,
tcConfig.isInvalidationSupported, tcConfig.isInteractive, tcImports.SystemRuntimeContainsType, systemRuntimeAssemblyVersion, m) ]
tcConfig.isInvalidationSupported, tcConfig.isInteractive, systemRuntimeContainsType, systemRuntimeAssemblyVersion, m) ]
let wasApproved = providers |> List.forall (fun (ok,_) -> ok)
let providers = providers |> List.map snd |> List.concat

Expand Down

0 comments on commit adebe18

Please sign in to comment.