@@ -193,6 +193,8 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
193193let mutable mgr : IOleComponentManager = null
194194let mutable componentID = 0 u
195195
196+ let locker = obj()
197+
196198member this.RegisterForIdleTime () =
197199 mgr<- this.GetService( typeof< SOleComponentManager>) :?> IOleComponentManager
198200if componentID= 0 u&& not ( isNull mgr) then
@@ -203,10 +205,7 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
203205 crinfo0.grfcadvf<- uint32(_ OLECADVF.olecadvfModal||| _ OLECADVF.olecadvfRedrawOff||| _ OLECADVF.olecadvfWarningsOff)
204206 crinfo0.uIdleTimeInterval<- 1000 u
205207 crinfo.[ 0 ] <- crinfo0
206- let componentID_out = ref componentID
207- let _hr = mgr.FRegisterComponent( this, crinfo, componentID_ out)
208- componentID<- componentID_ out.Value
209- ()
208+ mgr.FRegisterComponent( this, crinfo, & componentID) |> ignore
210209
211210/// This method loads a localized string based on the specified resource.
212211
@@ -355,6 +354,15 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
355354 pIdIco<- 400 u
356355 VSConstants.S_ OK
357356
357+ override this.Dispose ( disposing ) =
358+ try
359+ lock( locker) ( fun _ ->
360+ if componentID<> 0 u&& not ( isNull mgr) then
361+ mgr.FRevokeComponent( componentID) |> ignore
362+ componentID<- 0 u)
363+ finally
364+ base .Dispose( disposing)
365+
358366interface Microsoft.VisualStudio.FSharp.Interactive.ITestVFSIwith
359367member this.SendTextInteraction ( s : string ) =
360368 GetToolWindowAsITestVFSI() .SendTextInteraction( s)