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

View: New views
5 Messages — Rating Filter:   Alert me  

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

by anonymous-27 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13443>

                 Summary: static FileStream not written to disk on exit
without Close()
                 Project: DotGNU Portable.NET
            Submitted by: None
            Submitted on: Sam 18.06.2005 um 12:18
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open

    _______________________________________________________

Details:

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);
                s.Write(b,0,5);
        }
}






    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sam 18.06.2005 um 12:18  Name: StreamTest.cs  Size: 272B   By: None
test case
<http://savannah.gnu.org/bugs/download.php?item_id=13443&item_file_id=2613>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13443>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/

_______________________________________________
Pnet-developers mailing list
Pnet-developers@...
http://dotgnu.org/mailman/listinfo/pnet-developers

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

by anonymous-27 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #13443 (project dotgnu-pnet):

                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up 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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13443>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/

_______________________________________________
Pnet-developers mailing list
Pnet-developers@...
http://dotgnu.org/mailman/listinfo/pnet-developers

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

by anonymous-27 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #2, bug #13443 (project dotgnu-pnet):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13443>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/

_______________________________________________
Pnet-developers mailing list
Pnet-developers@...
http://dotgnu.org/mailman/listinfo/pnet-developers

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

by anonymous-27 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #3, bug #13443 (project dotgnu-pnet):

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?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13443>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/

_______________________________________________
Pnet-developers mailing list
Pnet-developers@...
http://dotgnu.org/mailman/listinfo/pnet-developers

Parent Message unknown [bug #13443] static FileStream not written to disk on exit without Close()

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #6, bug #13443 (project dotgnu-pnet):

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*.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?13443>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Dotgnu-pnet mailing list
Dotgnu-pnet@...
http://lists.gnu.org/mailman/listinfo/dotgnu-pnet