[wix-users] More on unbind

Keith.Douglas at statcan.gc.ca Keith.Douglas at statcan.gc.ca
Fri Aug 28 06:29:05 PDT 2015


I've since run a little test of my own, trying to replicate what I see in the Unbind code.

        Dim tfc As New TempFileCollection

        Dim subdir = IO.Path.Combine(tfc.BasePath, "temp.dir")
        Dim r As New Random
        Dim block(100000) As Byte
        For i = 0 To 100000 - 1
            block(i) = r.Next() Mod 256
        Next
        Dim fullpath As String = String.Format("{0}\test.temp", subdir)
        If Not My.Computer.FileSystem.DirectoryExists(subdir) Then
            My.Computer.FileSystem.CreateDirectory(subdir)
        End If
        Dim result As MsgBoxResult = MsgBox("Register the file?", MsgBoxStyle.YesNo)
        If result = MsgBoxResult.Yes Then
            tfc.AddFile(fullpath, False)
        End If
        My.Computer.FileSystem.WriteAllBytes(fullpath, block, True)
        While My.Computer.FileSystem.GetFileInfo(fullpath).Length < 1024L * 1024L
            My.Computer.FileSystem.WriteAllBytes(fullpath, block, True)
        End While

The above code (partially cannibalized from another experiment I ran on an unrelated topic) allows the user to decide whether or not to "register" (i.e., add) the file with the TFC. If I do that, after the process terminates, the random file I create goes away. I take it this is the non-determinism of the .NET garbage collector; that's fine. However, if I do *not* add the file, it preserves past termination of the process. My reading of the Unbind code suggests that this is what is going on there. I can take this up on WiX-devs or file a bug if someone can confirm that this is unintentional ... or, as I ask below, is DeleteTemporaryFiles supposed to be run by the consuming program when Unbind is called?

None of this explains however why there would be unaffected machines, either, and I'd like to understand that as well if at all possible.



Keith Douglas
Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6
Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6
Keith.Douglas at statcan.gc.ca
Telephone | Téléphone 613-854-5589
Facsimile | Télécopieur 613-951-4674
Government of Canada | Gouvernement du Canada 


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Keith.Douglas at statcan.gc.ca
Sent: August-27-15 3:35 PM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] More on unbind

Due to pressing questions from my techsupport colleagues and others I have returned to this topic.

I have downloaded the WiX source to attempt to see why Microsoft.Tools.WindowsInstallerXml.Unbinder.Unbind would leak temporary files.

There is a Unbinder.DeleteTempFiles() available. Do *I* have to call *that* after Unbind? That's not obvious (one would hope not!). Internally Unbind makes use of TempFileCollection objects but I do not know this class well enough. Does simply having one with its temporary directory set clean up *any* files within that directory when the object is disposed, or just the ones added to the collection via AddFile and such? If it is the latter, this explains why Unbind leaks, since there is no AddFile that I can see, merely a reference to the directory. 

There's the interesting twist to all of this that only *some* machines seem to behave this way at all. There's at least one techsupport machine (which has the user-level stuff installed for support reasons) which does seem to clean up "correctly".



Keith Douglas
Programmer Analyst | Programmeur analyste Questionnaire Development Services - CAI Social | Services de développement de questionnaires - IAO Social Jean Talon Building | Immeuble Jean-Talon / Floor | Étage 4 A-3 Statistics Canada | 170 Tunney's Pasture Driveway, Ottawa ON K1A 0T6 Statistique Canada | 170, promenade Tunney's Pasture, Ottawa ON K1A 0T6 Keith.Douglas at statcan.gc.ca Telephone | Téléphone 613-854-5589 Facsimile | Télécopieur 613-951-4674 Government of Canada | Gouvernement du Canada 



____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list