[Mono-bugs] [Bug 25678] New - override bug

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
2 Jun 2002 22:50:26 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by alp@atoker.com.

http://bugzilla.ximian.com/show_bug.cgi?id=25678

--- shadow/25678	Sun Jun  2 18:50:26 2002
+++ shadow/25678.tmp.5619	Sun Jun  2 18:50:26 2002
@@ -0,0 +1,138 @@
+Bug#: 25678
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: alp@atoker.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: override bug
+
+I've written a class that inherits the Stream class to provide a
+SoundStream class. It compiles fine with csc, but mcs (20020602 CVS
+snapshot) reports the following error:
+
+
+alp@abox:~/esd/SoundStream$ mcs --unsafe --target library SoundStream.cs
+SoundStream.cs(10) error CS0534: `SoundStream.SoundStream' does not
+implement inherited abstract member `SoundStream.SoundStream.get_CanSeek'
+Error: Compilation failed
+RESULT: 1
+
+
+This is despite that the CanSeek property _is_ implemented. Here's a test case:
+
+
+// Copyright 2002 Alp Toker <alp@atoker.com>
+// Licensed under the GNU GPL. See COPYING for details.
+
+namespace SoundStream {
+
+	using System;
+	using System.IO;
+	using System.Runtime.InteropServices;
+
+	unsafe public class SoundStream : Stream {
+
+		[DllImport("libesd")]
+		static extern int esd_audio_open();
+
+		[DllImport("libesd")]
+		static extern int esd_audio_close();
+
+		[DllImport("libesd")]
+		static extern int esd_audio_flush();
+
+		[DllImport("libesd")]
+		static extern unsafe int esd_audio_write (byte *buffer, int buf_size);
+
+		InvalidOperationException err = new InvalidOperationException("You can only
+Write (play audio) with this class.");
+
+		public SoundStream()
+		{
+			//FIXME: add error checking. the audio device may be busy/unavailable
+			int o = esd_audio_open();
+		}
+		public override void Write (byte[] src, int src_offset, int count)
+		{
+			//FIXME: can we ignore src_offset?
+			fixed (byte* p = src) esd_audio_write(p, count);
+		}
+
+		public override void Close ()
+		{
+			Dispose (true);
+			GC.SuppressFinalize (this);	// remove from finalize queue
+		}
+
+		// protected
+
+		~SoundStream ()
+		{
+			Dispose (false);
+		}
+
+		protected virtual void Dispose (bool disposing) {
+		if (disposing) {
+				Flush ();
+				esd_audio_close();
+		}
+		}
+
+
+		public override int Read (byte[] buffer, int offset, int count) 
+		{
+			throw err;
+		}
+
+		public override void SetLength (long value){
+			throw err;
+		}
+
+		public override long Seek (long offset, SeekOrigin origin){
+			throw err;
+		}
+
+		public override void Flush (){
+			esd_audio_flush();
+		}
+
+		public override long Length
+		{
+			get {throw err;}
+		}
+
+		public override long Position
+		{
+			get {throw err;}
+			set {throw err;}
+		}
+		
+		public override bool CanRead {
+			get {
+				return false;
+			}
+		}
+
+		public override bool CanSeek {
+                        get {
+                                return false;
+                        }
+                }
+
+                public override bool CanWrite {
+                        get {
+				return true;
+                        }
+                }
+	}
+}