bugDotGNU Portable.NET - Bugs: bug #13443, static FileStream not written to...


You are not allowed to post comments on this tracker with your current authentication level.

bug #13443: static FileStream not written to disk on exit without Close()

Submitted by:  None
Submitted on:  Sat Jun 18 16:18:22 2005  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: None
Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Sun Apr 19 22:00:07 2009, comment #6:

Automatic deterministic resource release does not exist, short of an AppDomain unload and "using".

Mono and Pnet both try to minimize the number of orphan objects but there simply is no general way (circular dependencies ...) to do so.

Mono tries to finalize "static" objects but isn't deteministic in doing so (at least not obviously so from an application developer's POV).

Pnet doesn't even try to finalize "static" objects and is thus deteministic g.

Thomas Uxiou <uxiou>
Wed Apr 16 17:09:16 2008, comment #5:


Fri Mar 28 09:58:52 2008, comment #4:

A relaxing way to download mp3 - http://mp-3.name

Sun Jun 26 15:37:49 2005, comment #3:

The problem might be that static class members not garbage collected in ILExecProcessDestroy.

The static members are mot handled at all.

Should we set all static classmembers to null before doing the final garbage collection or is there a better solution?

Klaus Treichel <ktreichel>
Project Administrator
Mon Jun 20 11:26:08 2005, comment #2:

just in case someone cares: I submited this bug, but wasn't logged in

Erich Kitzm├╝ller <ammoq>
Sun Jun 19 11:02:17 2005, comment #1:

In the test case, the user declares the class member 's' as static. When compiled, the runtime doesn't appear to ever call the finalizer nor the Dispose(bool) method of the System.IO.FileStream class, even on application exit.

Declaring the variable local within the Main() method works as expected as noted in the original comments.

Deryk Robosson <drobosson>
Project Member
Sat Jun 18 16:18:22 2005, original submission:

Look at the following example:
The program writes 5 bytes, but exits without calling s.Close().
In MS.NET and Mono, you have the 5 bytes on the disk; in portable.net, the file is 0 byte long.
If you declare the instance of FileStream localy inside Main(), it works as expected.

public class StreamTest {
static System.IO.FileStream s;
public static void Main(string[] args) {
byte[] b = new byte[5];
s = new System.IO.FileStream("streamtest.out", System.IO.FileMode.Create);
for (byte i=0; i<5; i++) b[i]=(byte)(i+65);



Attached Files
file #3105:  StreamTest.cs added by None (272B - text/x-csharp - test case)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by uxiou (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Jun 19 11:02:17 2005drobossonStatusNone=>Confirmed
    Sat Jun 18 16:18:23 2005NoneAttached File-=>Added StreamTest.cs, #2613

    Back to the top

    Powered by Savane 3.1-cleanup1