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()

Submitter:  None
Submitted:  Sat 18 Jun 2005 04:18:22 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Jump to the original submission

Sun 19 Apr 2009 10:00:07 PM UTC, 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 16 Apr 2008 05:09:16 PM UTC, comment #5: 
Fri 28 Mar 2008 09:58:52 AM UTC, comment #4: 

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

Sun 26 Jun 2005 03:37:49 PM UTC, 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>
Group administrator
Mon 20 Jun 2005 11:26:08 AM UTC, comment #2: 

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

Erich Kitzm├╝ller <ammoq>
Sun 19 Jun 2005 11:02:17 AM UTC, 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>
Group Member
Sat 18 Jun 2005 04:18:22 PM UTC, 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);



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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
  • -email is unavailable- added by uxiou (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2005-06-19 drobosson StatusNone Confirmed
    2005-06-18 None Attached File- Added StreamTest.cs, #2613

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code