[Mono-list] Ask Microsoft: Mono support

2004-10-27 Thread RoBiK
Just found an article regarding comment from microsoft on mono...


http://searchvb.techtarget.com/originalContent/0,289142,sid8_gci1019210,00.h
tml

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Problem with xml.Serialization

2004-10-15 Thread RoBiK
Hi,

I see another problem here. It is not an good idea to derive from ArrayList,
because the XmlSerializer has special handling for ArrayList and also
classes that derive from it. Instead you should Package the ArrayList indo
another class (this may be for example a custom collection type).
The second thing you need to do is to tell the serializer if there are any
instances of custom objets, that you are inserting into the ArrayList. This
is done by the XmlInclude attribute.
Try this example:

using System;
using System.Collections;
using System.IO;
using System.Xml.Serialization;
using System.Text;
namespace XmlSerializationTest
{
class Program
{
static void Main(string[] args)
{
Subject subject = new Subject();
subject.name = Subject Name;
subject.comment = Subject Comment;
SubjectList subjectList = new SubjectList();
subjectList.subject = subject;
subjectList.list.Add(Test);
subjectList.list.Add(123);
CustomObject co = new CustomObject();
co.customString = Custom String;
subjectList.list.Add(co);
XmlSerializer serializer = new
XmlSerializer(typeof(SubjectList));
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
serializer.Serialize(sw, subjectList);
Console.WriteLine(sb.ToString());
Console.ReadLine();
}
}
[XmlInclude(typeof(CustomObject))]
public class SubjectList
{
public Subject subject;
public ArrayList list;
public SubjectList()
{
list = new ArrayList();
}
}
public class Subject
{
public string name;
public string comment;
}
public class CustomObject
{
public string customString;
}
}

Robert

-Original Message-
From: Sergio Paracuellos [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 14. Oktober 2004 16:03
To: RoBiK
Cc: [EMAIL PROTECTED]
Subject: RE: [Mono-list] Problem with xml.Serialization

El jue, 14-10-2004 a las 15:42 +0200, RoBiK escribió:
 As the error message says: The type gorganizer.Subject was not 
 expected. Use the XmlInclude or SoapInclude attribute to specify types 
 that are not known statically.
 You are assinging an instance of type gorganizer.Subject to a obj 
 variable of type object. When the serializer tries to serialize this 
 variable, it finds that this is not an instance of type object but 
 something it did not expected. So either use the XmlInlude attribude 
 to tell the serializer what to expect, or rework your code to use another
aproach.
 
 Robert

If I change the list to work with Subject the error is the same.

Could you put me an example of how to say the serializer what I want to
serialize? 

Thanks!

 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Sergio 
 Paracuellos
 Sent: Donnerstag, 14. Oktober 2004 15:27
 To: [EMAIL PROTECTED]
 Subject: [Mono-list] Problem with xml.Serialization
 
 Hi!
 
 I'm doing an application and I need to serialize in xml a list of 
 objects. I get the following error:
 
 Unhandled Exception: System.InvalidOperationException: The type 
 gorganizer.Subject was not expected. Use the XmlInclude or SoapInclude 
 attribute to specify types that are not known statically.
 in 0x001d0
 System.Xml.Serialization.XmlSerializationWriter:WriteTypedPrimitive
 (string,string,object,bool)
 in 0x00380
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteObject
 (System.Xml.Serialization.XmlTypeMapping,object,string,string,bool,boo
 l,bool
 )
 in 0x00ca0
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteMember
 Elemen t (System.Xml.Serialization.XmlTypeMapElementInfo,object)
 in 0x004f8
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteListCo
 ntent 
 (System.Xml.Serialization.TypeData,System.Xml.Serialization.ListMap,ob
 ject,S
 ystem.Text.StringBuilder)
 in 0x0024c
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteListEl
 ement
 (System.Xml.Serialization.XmlTypeMapping,object,string,string)
 in 0x0050c
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteObject
 (System.Xml.Serialization.XmlTypeMapping,object,string,string,bool,boo
 l,bool
 )
 in 0x001c0
 System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteRoot
 (object)
 in 0x000e0 System.Xml.Serialization.XmlSerializer:Serialize
 (object,System.Xml.Serialization.XmlSerializationWriter)
 in 0x00150 System.Xml.Serialization.XmlSerializer:Serialize
 (System.Xml.XmlWriter,object,System.Xml.Serialization.XmlSerializerNam
 espace
 s)
 in 0x000a4 System.Xml.Serialization.XmlSerializer:Serialize
 (System.IO.Stream,object)
 in 0x000b4 gorganizer.MainWindow:SaveDataToXml () in 0x0002c 
 gorganizer.MainWindow:OnSaveClicked
 (object,System.EventArgs)
 in 0x000bc (wrapper delegate-invoke

RE: [Mono-list] Problem with xml.Serialization

2004-10-14 Thread RoBiK
As the error message says: The type gorganizer.Subject was not expected. Use
the XmlInclude or SoapInclude attribute to specify types that are not known
statically.
You are assinging an instance of type gorganizer.Subject to a obj variable
of type object. When the serializer tries to serialize this variable, it
finds that this is not an instance of type object but something it did not
expected. So either use the XmlInlude attribude to tell the serializer what
to expect, or rework your code to use another aproach.

Robert



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sergio Paracuellos
Sent: Donnerstag, 14. Oktober 2004 15:27
To: [EMAIL PROTECTED]
Subject: [Mono-list] Problem with xml.Serialization

Hi!

I'm doing an application and I need to serialize in xml a list of objects. I
get the following error:

Unhandled Exception: System.InvalidOperationException: The type
gorganizer.Subject was not expected. Use the XmlInclude or SoapInclude
attribute to specify types that are not known statically.
in 0x001d0
System.Xml.Serialization.XmlSerializationWriter:WriteTypedPrimitive
(string,string,object,bool)
in 0x00380
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteObject
(System.Xml.Serialization.XmlTypeMapping,object,string,string,bool,bool,bool
)
in 0x00ca0
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteMemberElemen
t (System.Xml.Serialization.XmlTypeMapElementInfo,object)
in 0x004f8
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteListContent
(System.Xml.Serialization.TypeData,System.Xml.Serialization.ListMap,object,S
ystem.Text.StringBuilder)
in 0x0024c
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteListElement
(System.Xml.Serialization.XmlTypeMapping,object,string,string)
in 0x0050c
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteObject
(System.Xml.Serialization.XmlTypeMapping,object,string,string,bool,bool,bool
)
in 0x001c0
System.Xml.Serialization.XmlSerializationWriterInterpreter:WriteRoot
(object)
in 0x000e0 System.Xml.Serialization.XmlSerializer:Serialize
(object,System.Xml.Serialization.XmlSerializationWriter)
in 0x00150 System.Xml.Serialization.XmlSerializer:Serialize
(System.Xml.XmlWriter,object,System.Xml.Serialization.XmlSerializerNamespace
s)
in 0x000a4 System.Xml.Serialization.XmlSerializer:Serialize
(System.IO.Stream,object)
in 0x000b4 gorganizer.MainWindow:SaveDataToXml () in 0x0002c
gorganizer.MainWindow:OnSaveClicked
(object,System.EventArgs)
in 0x000bc (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in 0x001c8 GtkSharp.voidObjectSignal:voidObjectCallback (intptr,int) in
0x00094 (wrapper native-to-managed)
GtkSharp.voidObjectSignal:voidObjectCallback (intptr,int) in (unmanaged)
(wrapper managed-to-native) Gtk.Application:gtk_main () in 0x00080
(wrapper managed-to-native) Gtk.Application:gtk_main () in 0x00014
Gtk.Application:Run () in 0x00044 gorganizer.Gorganizer:Main ()

A resume of the code:

When I push save button:

 private void OnSaveClicked (object o, EventArgs args) {
 this.SaveDataToXml();
 }


private void SaveDataToXml () {
  using (FileStream fs = new FileStream(data.xml, FileMode.Create)) {
 XmlSerializer serializer = new XmlSerializer(typeof(SubjectList));
 serializer.Serialize(fs, mySubjectList);
  }
}

* SubjectList.cs:

using System;
using System.Collections;
using System.Xml.Serialization;

namespace gorganizer {

public class SubjectList: ArrayList, IMyList {
private object obj;
private int length;

//For Serialization
public SubjectList (){}

public Subject Obj {
get {
return ((Subject)obj);
}
}

public int Length () {
return this.Count;
}

/*
 * Add an object to list if doesn't exists
 */
public bool AddToList(object obj) {
if (obj != null  !this.Contains(obj)) {
this.Add(obj);
Console.WriteLine(Insertado);
return true;
}
return false;
}

/*
 * Remove a object if it is in the list
 */
public bool RemoveFromList(object obj) {
if (this.Contains(obj)  obj != null) {
this.Remove(obj);
Console.WriteLine(Eliminado);
return true;
}
return false;
}

 public void ListElements (ArrayList myList) {
this.PrintValues(myList);
}

/* returns a Subject from specified name */
public Subject getSubject (string name) {
Subject aux = null;
Subject s = null;
IEnumerator i = this.GetEnumerator();
while (i.MoveNext()) {
if (i.Current is Subject) {
aux = (Subject) i.Current;
if 

RE: [Mono-list] Windows to Linux Remoting problem

2004-10-08 Thread RoBiK
Hi!

This seems to be an DNS-resolving issue. You provided no source code so i
can only guess. When the runtime is marshaling object into another appdomain
(from server to client), it creates an ObjRef class wich contains all
relevant info to create a proxy (on client) for the marshaled object in the
another appdomain. Inside this info is also an uri wich is used when invokig
methods on the marshaled object. The problem ist, that this uri is generated
on the server. The server uses ist hostname to create this uri. If the
hostname can not be roselved on the client machine, then you get an
exception when you try to invoke a method on the mashaled object.

Example:

Client calls new MXSRemoteQuote.QuoteProviderController(...) (the remoting
knows that this is a client activated type, so it sends a request to the url
from your client config file) Server creates an instance of
MXSRemoteQuote.QuoteProviderController, generates an ObjRef for it (with
unique uri for the marshaled instance, part of this uri ist the hostname eg
server-xyz) and send is as response to the client Client creates a proxy
object from the ObjRef received from the server Client tryes to invoke a
method on the proxy class, wich causes the remoting to try to send a request
to the server, but this fails, because the hostname part of the uri
(server-xyz) can not be resolved on the client

I hope this helps you to resolve your problem

Robert




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zbigniew Babiej
Sent: Donnerstag, 07. Oktober 2004 15:53
To: [EMAIL PROTECTED]
Subject: [Mono-list] Windows to Linux Remoting problem

Hello All,
I was wondering if anyone had encountered the following problem.
I have a simple remoting test program (binaries compiled with MS .NET C# (VS
2003 ver. 7.1.3088 .NET Runtime 1.1.4322 SP1).
This works OK in the scenarios Windows - Windows(both local and remote
server) and Linux - Linux (local server only, did not test remote server),
but does not work in the scenarions Windows-Linux and 
Linux-Windows.

In the scenario Windows-Linux, the client throws the following exception
when trying to activate the first object:

A) When hosted by Mono (ver. 1.0.2):

Unhandled Exception: System.Runtime.Remoting.RemotingException: No such host
is known Server stack trace:
in 0x000c4
System.Runtime.Remoting.Channels.Tcp.HostConnectionPool:CreateConnection ()
in 0x00112
System.Runtime.Remoting.Channels.Tcp.HostConnectionPool:GetConnection () in
0x00105
System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool:GetConnection
(string,int)
in 0x00146
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink:Process
Message
(System.Runtime.Remoting.Messaging.IMessage,System.Runtime.Remoting.Channels
.ITransportHeaders,System.IO.Stream,System.Runtime.Remoting.Channels.ITransp
ortHeaders,System.IO.Stream)
in 0x002bc
System.Runtime.Remoting.Channels.BinaryClientFormatterSink:SyncProcessMessag
e
(System.Runtime.Remoting.Messaging.IMessage)

Exception rethrown at [0]:

in 0x00583 System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
(System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messaging
.IMessage,System.Exception,object[])

B) When hosted by .NET
Error: The requested name is valid and was found in the database, but it
does not have the correct associated data being resolved for
Source: mscorlib
Stack:
Server stack trace:
   at System.Net.Dns.GetHostByName(String hostName)
   at System.Net.Dns.Resolve(String hostName)
   at System.Runtime.Remoting.Channels.RemoteConnection..ctor(SocketCache
socketCache, String machineAndPort)
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
machineAndPort)
   at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWit
hRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage
(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders responseHeaders, Stream responseStream)
   at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessag
e(IMessage
msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData
msgData, Int32 type)
   at MXSRemoteQuote.QuoteProvider.AddQuoteListener(IQuoteListener listener)
   at MXSRemoteClient.RemoteClient.Run()
Inner:

In the scenario Linux-Windows , the same errors are reported, but this time
by the server.

The windows version is Win2K SP4 and the linux is Fedora Core 2. Both
machines are in the same lan (switch).
I tested both IP and hostname, but no success.
I run other services(like ftp, samba etc.) on that Linux box and can access
them from Windows clients using both IP and hostname without any problems.

Would you have any hints about how resolve this issue ?
The sample binaries 

RE: [Mono-list] mono scripting?

2004-10-08 Thread RoBiK
Hi Daniel!

There is no scripting language for mono because the Common Language Runtime
executes only compiled code, but it is possible to simulate the scriptig
behavior by compiling the source into an assembly, load the assembly and
execute the code inside on the fly.
Check out this article: http://www.codeproject.com/dotnet/DotNetScript.asp

Robert

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of daniel narf
Sent: Donnerstag, 07. Oktober 2004 21:31
To: [EMAIL PROTECTED]
Subject: [Mono-list] mono scripting?


 Hi i am new to mono and since i saw nothing mentioned in documentation i
wonder what scripting language i can use in mono that has full access to clr
services and to the standart library? since python implementations to clr
are still very experimental vbscript seems the only option? if not are there
any plans to include an oficial scripting language for mono with monodevelop
suport also?

And an offtopic question; isnt it dangerous to implement winforms and
asp.net 
which hasnt been submited by microsoft as standart to ecma?

thanks in advance.
 

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] foreach and GetEnumerator (with fixed test case)

2004-10-06 Thread RoBiK
Hi,

I think this is a mono c# compiler error. Because there are two
GetEnumerator() methods with the same signature, the compiler should report
an error on the foreach statement. The microsoft compiler does it right wit
the The call is ambiguous between the following methods or properties
error message.

Robert

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rodolfo Campero
Sent: Mittwoch, 06. Oktober 2004 01:11
To: [EMAIL PROTECTED]
Subject: [Mono-list] foreach and GetEnumerator (with fixed test case)

Hello,

I'm resending this email, this time with a sample that actually reproduces
the problem - I checked it in both MS .NET and mono 1.1.1.0.

Sorry for the previous one.

Considering that the previous sample actually compiles and run in MS .NET,
now I'm thinking it's a bug in csc... anyway, I'd like to read your
comments, and if a mono hacker considers it's a mono bug, I can file a bug
report.

Here goes the testcase; it doesn't compile on Windows, but it does on mono
(if you run it, you'll get a NullReferenceException but that's ok):

compiled with:
Microsoft (R) Visual C# .NET Compiler version 7.00.9951 for Microsoft (R)
.NET Framework version 1.0.3705

The error is in the line that contains the 'foreach' statement:

The call is ambiguous between the following methods or
properties: 'Testing.ICustomEnumerable.GetEnumerator()'
and 'System.Collections.IEnumerable.GetEnumerator()'

8
using System;
using System.Collections;

namespace Testing {
interface ICustomEnumerable {
IEnumerator GetEnumerator();
}

interface IMixedEnumerable : IEnumerable, ICustomEnumerable {}

class TestCollection : IMixedEnumerable {
IEnumerator IEnumerable.GetEnumerator() {
Console.WriteLine(IEnumerable);
return null;
}

IEnumerator ICustomEnumerable.GetEnumerator()  {
Console.WriteLine(ICustomEnumerable);
return null;
}
}

class Test {
public static void Main(string[] args) {
IMixedEnumerable c = new TestCollection();
foreach(object o in c) {}
}
}
}
8

El lun, 04-10-2004 a las 20:04, Rodolfo Campero escribió:
Hello,

I've run into a situation with foreachs and the GetEnumerator method.
The issue is reproduced with this small piece of code:


the wrong example was removed/

This program can be compiled using mcs, and when I run it I get:

 $ mono cols.exe
 IEnumerable

The problem is that this same piece of code won't compile in MS.NET csc 
compiler (I checked my original program with version 1.1, but not this 
simplified example): it complains that it can't choose between 
System.Collections.IEnumerable and IMyEnumerable.

I'm rising this question because I'm not sure if this is a mono or a MS 
.NET bug, because I find the spec (ECMA-334, 15.8.4) rather ambiguous.
At a given point it reads:

 A type C is said to be a collection type if it implements
 the System.IEnumerable interface or implements the collection
 pattern by meeting all of the following criteria: [...]

The thing is that it's not specified what happens when _both_ criteria 
are met.

So, what do you think?

Looking forward to reading all your comments,

Rodolfo

_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Please help me with polimorfism, etc. (possible bug in the compiler?)

2004-09-23 Thread RoBiK
Hi Roberto!

Your code has nothing to do with polymorphism. What you do is called
hyding.
Please read this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html
/vclrfcsharpspec_3_7_1.asp

Anyway, in your example, you can never get different output form
this.GetType() and o.GetType() because both this and o point to the same
instance.

Robert


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roberto Jimeno
Sent: Donnerstag, 23. September 2004 07:27
To: [EMAIL PROTECTED]
Subject: [Mono-list] Please help me with polimorfism, etc. (possible bug in
the compiler?)

Please help me monoers,

some days ago I was overriding Object's Equals() when I came across what I
thought to be a bug. Now I think I'm simply being confused about
inheritance, polimorfism, substitutability principle and such. Please
compile and execute the small example (attached file). You will see the
string:

Types of self and argument are derivedClass and derivedClass respectively.

, while I was expecting to see

Types of self and argument are derivedClass and baseClass respectively.

Can you tell me which changes (a suggestions is commented out in the
code) should I apply to my code in order to obtain the baseClass
expected result?

TIA


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Remoting problem

2004-08-11 Thread RoBiK
Hi,
 
could you please post the whole source for client and server?
 
I've made my own test and everything works fine here. I use .NET Famework
2.0 beta on a win2003 server to run the client part and FC2 with mono 1.0 as
server.
Here ist my source:
 
Client:

#region Using directives

using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

#endregion

namespace StreamSerializationTest
{
class Program
{
static void Main()
{
ChannelServices.RegisterChannel(new TcpChannel());
string date = DateTime.Now.ToString();
Console.WriteLine(Write:  + date);
object[] url = { new UrlAttribute(tcp://rre-fc2:1234) };
object[] args = { test.txt, FileMode.Create };
StreamWriter sw = new
StreamWriter((FileStream)Activator.CreateInstance(typeof(FileStream), args,
url));
sw.WriteLine(date);
sw.Close();
args = new object[] { test.txt, FileMode.Open };
StreamReader sr = new
StreamReader((FileStream)Activator.CreateInstance(typeof(FileStream), args,
url));
Console.WriteLine(Read:  + sr.ReadLine());
sr.Close();
Console.ReadLine();
}
}
}

Server:

using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

class MainClass
{
public static void Main(string[] args)
{
ChannelServices.RegisterChannel(new TcpChannel(1234));

RemotingConfiguration.RegisterActivatedServiceType(typeof(FileStream));
Console.WriteLine(Press any key);
Console.ReadLine();
}
}

Robert



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan Cimpoiesu
Sent: Mittwoch, 11. August 2004 11:24
To: [EMAIL PROTECTED]
Subject: [Mono-list] Remoting problem


Hello there.
 
I have a client/server app that runs on Windows, and I must make the server
to run on Linux as well.
I choosed the Mono for start.
The problem is that if I have a remoting object that contains the following
method in the Remoting object
 
public Stream GetStream() 
{
outputStream=(Stream)File.OpenWrite(Test.zip); //outputStream is a
class member
return outputStream;
}
 
and I get a reference of this object on a client ( with Activator object )
and try to use the resulting Stream ( read/write or any other operation ),
the client application hangs.
 
This happens only when I run the server on Linux with Mono. On windows it
works ok.
Any suggestions?
 
Regards
Dan Cimpoiesu




Cautam cinefili pentru premiere!
http://www.videomax.ro/NewsLetter/Step1.asp 
Videomax.ro http://www.videomax.ro/  pune la bataie 172 premii in valoare
de 117 milioane lei. Intra si tu in competitie! 

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Remoting betweem Mono and MS .NET

2004-06-22 Thread RoBiK
Hi,

I'm using MS.NET 1.1.4322.573 and mono build from mono-daily package from
yesterday (20040621). Your sample application works fine (Server running on
FC1 with mono, client on WIN2003 Server with MS.NET). What version of mono
do you use?
Anyway, are you sure, that you pass the right address as a parameter to the
client? I get this sort of exception, when the the server application is not
running at all (or is running somwhere else as defined by the parameter
passed to the client).

Robert


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Yuri Leikind
Sent: Montag, 21. Juni 2004 17:24
Cc: [EMAIL PROTECTED]
Subject: Re: [Mono-list] Remoting betweem Mono and MS .NET

On Mon, 21 Jun 2004 16:35:39 +0200
RoBiK [EMAIL PROTECTED] wrote:

  I use remoting between Mono and MS.NET, and it works fine for me.
What
  problems do you have?
  
  Robert


I run a remoting server on Linux, and try to use it from the Windows
machine.
Here is my code:

common interface, build as a separate assembly == namespace
ProofOfConcepts{
public interface ITest{
string SayHello();
}
}

== Client

using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace ProofOfConcepts{
class Client{

ITest ar;

public Client(string host, int port, string endPoint){
HttpChannel channel = new HttpChannel(0);
ChannelServices.RegisterChannel(channel);
MarshalByRefObject obj = 
(MarshalByRefObject) RemotingServices.Connect(
typeof(ProofOfConcepts.ITest),
http://; +  host + : + port + / + endPoint);
ar = (ITest) obj;
}

public string SayHello(){
return ar.SayHello();
}

public static void Main(string[] args){
Client client = new Client(args[0],  6, MyEndPoint);
Console.WriteLine(client.SayHello());
}
}
}
== Server
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace ProofOfConcepts{

public class AssemblyCache : MarshalByRefObject, ITest{
public string SayHello(){
return hello;
}
}

class RemotingServer{

public RemotingServer(object obj){
HttpChannel channel = new HttpChannel(6);
ChannelServices.RegisterChannel(channel);
MarshalByRefObject mobj = (MarshalByRefObject) obj;
RemotingServices.Marshal(mobj, MyEndPoint); 
}

void Listen(){
Console.WriteLine(Press Enter to exit...);
Console.ReadLine( );
}

public static void Main(){
AssemblyCache ar = new AssemblyCache();
RemotingServer rServer = new RemotingServer(ar);
rServer.Listen();
}
}
}
==

Here is what I get running the client:


Unhandled Exception: System.Net.WebException: The underlying connectio n was
closed: The request was canceled.

Server stack trace:
   at System.Net.HttpWebRequest.CheckFinalStatus()
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult async
Result)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.Pr
ocessAndSend(IMessage msg, ITransportHeaders headers, Stream inputStre
am)
   at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.Pr
ocessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream re
questStream, ITransportHeaders responseHeaders, Stream responseStrea
m)
   at System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncPro
cessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IM
essage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageD
ata msgData, Int32 type)
   at ProofOfConcepts.ITest.SayHello()
   at ProofOfConcepts.Client.Main(String[] args) ===

My Mono version is 0.95,  MS .NET version 1.1.4322


--
Best regards,
Yuri Leikind


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Remoting betweem Mono and MS .NET

2004-06-21 Thread RoBiK
I use remoting between Mono and MS.NET, and it works fine for me. What
problems do you have?

Robert

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Yuri Leikind
Sent: Montag, 21. Juni 2004 16:03
To: [EMAIL PROTECTED]
Subject: [Mono-list] Remoting betweem Mono and MS .NET

Hello all,

Is remoting between Mono and MS .NET supposed to be possible?

I tried different variants, seems line currently you cannot remote between
these 2 platforms.


--
Best regards,
Yuri Leikind

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Can't open a StreamWritter with a file created by File.Create

2004-06-02 Thread RoBiK
Hi,

It doesn't work, because File.Create(test-file) creates a new file and
returns an FileStream object, wich holds the handle for the file. You do not
assing this object anywhere, so it is a candidate for the garbage
collection. Until the GC disposes this object (this can take some time),
wich releases the allocated file handle, the file is still opened. So if
your next statement tryes to access this file, you get an sharing violation.
You should always call Close() to release the underlying file handle.

Solution 1.:

FileStream s = File.Create(test-file);
s.Close();
StreamWriter sw = new StreamWriter(test-file);
//do some work
sw.Close();

Solution 2 (more elegant):

using(StreamWriter sw = new StreamWriter(File.Create(test-file))) {
//do some work
}

RoBiK

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of HannibAl Bundie
Sent: Mittwoch, 02. Juni 2004 16:39
To: [EMAIL PROTECTED]
Subject: [Mono-list] Can't open a StreamWritter with a file created by
File.Create

Hi,

With the mono beta 2 I'm not able to create a file with File.Create and
then, open a StreamWritter on it.
For example a simple program like this throws the error Unhandled
Exception: System.IO.IOException: Win32 IO returned ERROR_SHARING_VIOLATION.

Path: test-file everytime I run it :

using System;
using System.IO;

namespace Test {

public class test {

public test()
{
File.Create(test-file);
StreamWriter sw = new StreamWriter(test-file);
}

static void Main (string[] args)
{
new test();
}
}
}

But this kind of operation works perfectly on mono beta 1.


So I would like to know if this bug is a regression (what regression !!) or
just a bizzarery of my computer.
Accordingly, I would be grateful if someone could run the little program
above and tell me if he has the same result.
In this case I'll open a bug on bugzilla, and in the other case any help
would be appreciated :)

Thanks in advance

_
Bloquez les fenêtres pop-up, c'est gratuit ! http://toolbar.msn.fr

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] A Plugin and WebService Issue

2004-05-20 Thread RoBiK
Hi,

I would use this approach:

1) you must have a plug-in Interface defined, that each plug-in must
implement
2) when the application starts, use static System.IO.Directory.GetFiles()
method to get the names of assemblies in the plug-in directory
3) for each plug-in-assembly file call static
System.Reflection.Assembly.LoadFrom() method to load the assembly into the
current AppDomain, then call the method
System.Reflection.Assembly.GetTypes() on the System.Reflection.Assembly
instance that you've got from the previous LoadFrom() method
4) for each Type that you get from previous GetType() method use the is
operator to check if the particular type implements the plug-in interface,
if it does, you have a type that implements your plug-in interface. 
5) call static Syste.Activator.CreateInstance() method with the type from
previous step as parameter. Cast the result to the plug-in-interface type
and store it for example in an array for later use.
6) now you have an array of plug-in instances and can call the interface
methods on them

This is just an example, there are several other approaches which are more
or less similar to this one... everything depends on the needs of your
application.

RoBiK

Quoting Pablo Fischer [EMAIL PROTECTED]:

 Hi!

 I would like to have some comments and suggestions about a issue.

 I am working in a Blog Client (mbloggy) that will work ONLY in SOAP (NO
 XMLRPC) for different CMS and Blogs (phpnuke, postnuke, jaws, etc, etc).
 To work with all these blogs I'm  planning to use a 'plugin' system,
 based in assemblies, for example:

 If a developer wants the plugin for a CMS (like drupal), he can save his
 .dll plugin in ~./mbloggy/plugins and when mbloggy starts it will read
 default plugins (in /etc/mbloggy) and the user plugins. When mbloggy
 finds a new plugin it will be added to a 'drop down' (gtk#) so the user
 can use it.

 My problem?, yes, I don't know which is the best option:

 a) Use .dll assemblies as plugins. But, how to connect to each plugin
 from the front end?, exists a data type that can 'clone' another
 object?, so I can do something like this:

 Wrapper wrap = new Wrapper();
 wrap.Clone(assemblie.dll);
 wrap.Url = http://www.foo.bar.com/foo.aspx?wsdl;
 wrap.DeletePost(3);

 So I can use the 'methods' of assemblie.dll in the wrap object?.

 b) Or use just one .dll and let the developers to 'develop' just the
 WebService (server)?, So I can just work like this:

 Client c = new Client();
 c.Url = http://www.foo.bar.com/foo.aspx?wsdl;
 c.DeletePost(3);

 Which is the best option? and where can I find more information for the
 best option?.

 Thanks!
 Pablo
 --
 Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
 Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
 http://www.pablo.com.mx
 http://www.debianmexico.org


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] AppDomain problems

2004-05-17 Thread RoBiK
Hi, i try to use an AppDomain, but have serious problems. I'm using RH9
wirt mono beta 1 instaleld from the rpms.

Test program:

using System;

class Test : MarshalByRefObject
{
public void DoTest()
{
Console.WriteLine(DoTest());
}
}

class MainClass
{
public static void Main(string[] args)
{
AppDomain ad = AppDomain.CreateDomain(Test);
Test t = (Test)ad.CreateInstanceAndUnwrap(AppDomainTest, Test);
t.DoTest();
t = null;
AppDomain.Unload(ad);
}
}

Output:

DoTest()
 
Unhandled Exception: System.NullReferenceException: Object reference not
set to
an instance of an object
 
** (AppDomainTest.exe:5828): WARNING **: : error looking up thread
handle 0x84c91c4
 
** (AppDomainTest.exe:5828): WARNING **: Aborting of threads in domain
Test timed out.
 
Unhandled Exception: System.CannotUnloadAppDomainException: Aborting of
threads
in domain Test timed out.
in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x20)
[0x400c3ad8]
in (unmanaged) /usr/lib/libmono.so.0 [0x400ec901]
in (unmanaged) /usr/lib/libmono.so.0 [0x400ec19f]
in [0x00017] (at /cvs/mcs/class/corlib/System/AppDomain.cs:635)
System.AppDomain:Unload (System.AppDomain)
in [0x0002a] (at
/root/.local/share/MonoDevelopProjects/AppDomainTest/Main.cs:21)
MainClass:Main (string[])



Is this a serious bug or am i missing something?

The second (not so big) problem is the setting of private paths for the
AppDomain. I use AppDomainSetup.PrivateBinPath property to set the value
before i create the domain. It works fine, when using single search
path, but when i try to use semicolon separated list of paths, AppDomain
treats this as single path instead of parsing this string to get the
list.

see the documentation from MS:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemappdomainsetupclassprivatebinpathtopic.asp

The workaround is to create the appdomain and then use the
AppendPrivatePath method.

Robert

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] RE: Mono Beta1 and Error with Monodoc

2004-05-12 Thread RoBiK
Please check again that you have these packages properly installed:

http://ftp.ximian.com/pub/ximian-evolution/redhat-9-i386/libgtkhtml3.0_4-3.0
.10-0.ximian.6.1.i386.rpm
http://www.go-mono.com/archive/beta1/fedora-1-i386/gtk-sharp-0.91.1-0.ximian
.7.0.i386.rpm
http://www.go-mono.com/archive/beta1/fedora-1-i386/gtk-sharp-gapi-0.91.1-0.x
imian.7.0.i386.rpm

It seems that the gtkhtml-sharp.dll (wich is a managet wrapper to acces the
unmanaget gtkhtml library) has a problem with locating the library (either
it doesn't know what library it should take or it doesn't know where to find
it).

Robert

 

-Original Message-
From: Tobias Bradtke [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 11. Mai 2004 14:19
To: [EMAIL PROTECTED]
Subject: [Mono-list] RE: Mono Beta1 and Error with Monodoc

txh for your reply.

i installed 'gtkhtml3.0-3.0.10-0.ximian.6.1.i386.rpm'
from http://ftp.ximian.com/pub/ximian-evolution/redhat-9-i386/
(and some dependencies) and now i get the following files if ido: 
find / -name libgtkhtml-*

--snip--

/usr/include/libgtkhtml-3.1
/usr/lib/pkgconfig/libgtkhtml-3.1.pc
/usr/lib/libgtkhtml-2.so.0.0.0
/usr/lib/libgtkhtml-1.1.so.3
/usr/lib/libgtkhtml-3.0.so.4
/usr/lib/libgtkhtml-3.1.so.7
/usr/lib/libgtkhtml-3.0.so.4.0.0
/usr/lib/libgtkhtml-1.1.so.3.0.4
/usr/lib/libgtkhtml-3.1.a
/usr/lib/libgtkhtml-2.so.0
/usr/lib/libgtkhtml-1.1.a
/usr/lib/libgtkhtml-1.1.so
/usr/lib/debug/usr/lib/libgtkhtml-2.so.0.0.0.debug
/usr/lib/debug/usr/lib/libgtkhtml-1.1.so.3.0.4.debug
/usr/lib/libgtkhtml-3.1.so
/usr/lib/libgtkhtml-3.1.so.7.1.0
/usr/src/debug/libgtkhtml-2.6.0

--snap--

but unfortunately i monodoc throughs again this error:

--snip--

Unhandled Exception: System.DllNotFoundException: gtkhtml-3.0 in 0x00053
(wrapper managed-to-native) Gtk.HTML:gtk_html_new () in 0x00021
Gtk.HTML:.ctor () in [0x001aa] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:20
9) Monodoc.Browser:.ctor () in [0x00120] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:81
) Monodoc.Driver:Main (string[])

--snap--

what file is missing?


thx!
webwurst



Am Tue, 11 May 2004 09:48:10 +0200 schrieb RoBiK:

 Hmm, now i see, that you use fedora core2 test 3, i'm not sure if this 
 rpm (this one is for RH9) will work for you.. Give it a try. There are 
 no packages for fedora, so maybe you must buid this library from source.
 
 Robert
 
 -Original Message-
 From: RoBiK [mailto:[EMAIL PROTECTED]
 Sent: Dienstag, 11. Mai 2004 09:35
 To: 'Tobias Bradtke'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [Mono-list] Mono Beta1 and Error with Monodoc
 
 Hi,
 
 The package thaht you need is libgtkhtml3.0_4-3.0.10-0.ximian.6.1.
 Look for these files:
 
 /usr/lib/libgtkhtml-3.0.so.4
 /usr/lib/libgtkhtml-3.0.so.4.0.0
 
 Robert
 
 -Original Message-
 From: Tobias Bradtke [mailto:[EMAIL PROTECTED]
 Sent: Dienstag, 11. Mai 2004 03:07
 To: [EMAIL PROTECTED]
 Subject: [Mono-list] Mono Beta1 and Error with Monodoc
 
 hi everyone,
 
 i know installation-errors are boring, but i don't get it..
 
 i'm running fedora-core2-test3 and installed mono from here:
 http://www.go-mono.com/archive/beta1/fedora-1-i386/
 
 'monodoc --make-index' does work, but just 'monodoc' througs an error:
 
 --snip--
 
 Unhandled Exception: System.DllNotFoundException: gtkhtml-3.0 in 
 0x00053 (wrapper managed-to-native) Gtk.HTML:gtk_html_new () in 
 0x00021 Gtk.HTML:.ctor () in [0x001aa] (at 
 /home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser
 .cs:20
 9) Monodoc.Browser:.ctor () in [0x00120] (at
 /home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser
 .cs:81
 ) Monodoc.Driver:Main (string[])
 
 --snap--
 
 'rpm -q gtkhtml3' says: 'gtkhtml3-3.1.12-1' is installed.
 
 if i search for 'gtkhtml*dll' i get severel locations with 
 gtkhtml-sharp.dll, but none with gtkhtml.dll or so..
 
 what can i do??
 
 
 thanks,
 webwurst


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Mono Beta1 and Error with Monodoc

2004-05-11 Thread RoBiK
Hi,

The package thaht you need is libgtkhtml3.0_4-3.0.10-0.ximian.6.1.
Look for these files:

/usr/lib/libgtkhtml-3.0.so.4
/usr/lib/libgtkhtml-3.0.so.4.0.0

Robert

-Original Message-
From: Tobias Bradtke [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 11. Mai 2004 03:07
To: [EMAIL PROTECTED]
Subject: [Mono-list] Mono Beta1 and Error with Monodoc

hi everyone,

i know installation-errors are boring, but i don't get it..

i'm running fedora-core2-test3 and installed mono from here:
http://www.go-mono.com/archive/beta1/fedora-1-i386/

'monodoc --make-index' does work, but just 'monodoc' througs an error:

--snip--

Unhandled Exception: System.DllNotFoundException: gtkhtml-3.0 in 0x00053
(wrapper managed-to-native) Gtk.HTML:gtk_html_new () in 0x00021
Gtk.HTML:.ctor () in [0x001aa] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:20
9) Monodoc.Browser:.ctor () in [0x00120] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:81
) Monodoc.Driver:Main (string[])

--snap--

'rpm -q gtkhtml3' says: 'gtkhtml3-3.1.12-1' is installed.

if i search for 'gtkhtml*dll' i get severel locations with
gtkhtml-sharp.dll, but none with gtkhtml.dll or so..

what can i do??


thanks,
webwurst

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Mono Beta1 and Error with Monodoc

2004-05-11 Thread RoBiK
Hmm, now i see, that you use fedora core2 test 3, i'm not sure if this rpm
(this one is for RH9) will work for you.. Give it a try. There are no
packages for fedora, so maybe you must buid this library from source.

Robert

-Original Message-
From: RoBiK [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 11. Mai 2004 09:35
To: 'Tobias Bradtke'
Cc: [EMAIL PROTECTED]
Subject: RE: [Mono-list] Mono Beta1 and Error with Monodoc

Hi,

The package thaht you need is libgtkhtml3.0_4-3.0.10-0.ximian.6.1.
Look for these files:

/usr/lib/libgtkhtml-3.0.so.4
/usr/lib/libgtkhtml-3.0.so.4.0.0

Robert

-Original Message-
From: Tobias Bradtke [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 11. Mai 2004 03:07
To: [EMAIL PROTECTED]
Subject: [Mono-list] Mono Beta1 and Error with Monodoc

hi everyone,

i know installation-errors are boring, but i don't get it..

i'm running fedora-core2-test3 and installed mono from here:
http://www.go-mono.com/archive/beta1/fedora-1-i386/

'monodoc --make-index' does work, but just 'monodoc' througs an error:

--snip--

Unhandled Exception: System.DllNotFoundException: gtkhtml-3.0 in 0x00053
(wrapper managed-to-native) Gtk.HTML:gtk_html_new () in 0x00021
Gtk.HTML:.ctor () in [0x001aa] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:20
9) Monodoc.Browser:.ctor () in [0x00120] (at
/home/duncan/conf/mono-conf/monodoc/BUILD/monodoc-0.15/browser/browser.cs:81
) Monodoc.Driver:Main (string[])

--snap--

'rpm -q gtkhtml3' says: 'gtkhtml3-3.1.12-1' is installed.

if i search for 'gtkhtml*dll' i get severel locations with
gtkhtml-sharp.dll, but none with gtkhtml.dll or so..

what can i do??


thanks,
webwurst

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] A couple of Remoting Questions

2004-05-11 Thread RoBiK
 
Hi,

1) You do not need a configuration file, but you must somehow configure the
remoting inside your application. You have two options:
- Call RemotingConfiguration.Configure(). You can use null as the filename
parameter. Passing a null reference as the filename parameter will cause
default remoting initialization without requiring the existence of a
configuration file.
Example: RemotingConfiguration.Configure(null);
- Call at least ChannelServices.RegisterChannel() passing as a parameter an
instance of channel class (in your case HttpChannel Class). You do not need
to define the port on the client side.
Example: ChannelServices.RegisterChannel(new HttpChannel());

2) I have RH9 with mono beta 1 installed. I have run your app for about 30
times (and also my own apps many times in past), but never seen such a
strange behavior... Everything works nice and clean, no asserts, no left
behind processes. I have no idea what's wrong.

3) Here ist the soap specification http://www.w3.org/TR/soap/ and here
http://msdn.microsoft.com/library/en-us/dnsoap/html/understandsoap.asp an
article from microsoft regarding soap (with good examples). For monitoring
purpouses you can find a couple of http and/or soap sniffers to use. You can
also code a simple port forwarder wich copies the messages to the console to
watch the trafic.

Robert

-Original Message-
From: Jonathan Stowe [mailto:[EMAIL PROTECTED]
Sent: Montag, 10. Mai 2004 14:21
To: Mono-List
Subject: [Mono-list] A couple of Remoting Questions

I have been playing around with remoting and a couple of things have come up

I am trying a test based in the example in MS SDK:

Client:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace RemotingTest
{
  public class Client
  {
public static void Main(string [] args)
{
  RemotingConfiguration.Configure(remoting.config);
  HelloServer obj =
(HelloServer)Activator.GetObject(typeof(RemotingTest.HelloServer),
http://localhost:8085/Hello;);
  if (obj == null)
  {
 System.Console.WriteLine(Could not locate server);
  }
  else
  {
 string name = blah;
 if ( args.Length  0 )
 {
name = args[0];
 }
 Console.WriteLine(obj.Hello(name));
  }
}
  }
}


Server:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace RemotingTest
{
  public class Server
  {

public static void Main(string [] args) {

  HttpChannel chan = new HttpChannel(8085);
  ChannelServices.RegisterChannel(chan);
 
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType(RemotingTes
t.HelloServer,Object), Hello, WellKnownObjectMode.SingleCall);
  System.Console.WriteLine(Hit enter to exit...);
  System.Console.ReadLine();
}
  }
}

Test Class:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
using System.Reflection;

namespace RemotingTest
{
  public class HelloServer : MarshalByRefObject
  {

public HelloServer()
{
  Console.WriteLine(this.ToString() +  activated);
}

public String Hello(String name)
{
  Console.WriteLine(HelloServer.Hello : {0}, name);
  return String.Format(Hi there {0}, name);
}
  }
}


Firstly, unlike using the MS.NET SDK it will not work unless one loads the
configuration like:

configuration
   system.runtime.remoting
  application
 client
 /client
 channels
channel
   ref=http
   port=0
/
 /channels
  /application
   /system.runtime.remoting
/configuration

I was wondering why the difference in behaviour - does windows have the http
channels already registered in some default configuration which mono doesn't
have or is there a difference in behaviour of
ChannelServices.RegisterChannel() in the mono library - I notice that the
registered channels are stored in a static array in the ChannelServices
class so it strikes me that another program is not going to have access to
this - or am I missing something here?  It would be nice to have an example
that worked the same with both mono and the MS SDK.

Secondly I am getting weird intermittent behaviour from both server and
client code - every once in a while I am getting:

** (process:5787): ERROR (recursed) **: file class.c: line 1272
(mono_class_init): assertion failed: (class) aborting...

from the client code, which appears to hang afterwards - the server however
behaves as expected.  I am unable to reproduce this at will however.

I also am occasionally getting:

 
** (server.exe:12805): WARNING **: : unref on 38 called when ref was already
0
 
From the server after the remote method has been called - again this is
intermittent and not reproducible at will.

It also appears 

RE: [Mono-list] not installing mono.pc?

2004-05-06 Thread RoBiK
Hi,

You need the mono-runtime-devel package.

Robert 

-Original Message-
From: Tyrel Haveman [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 06. Mai 2004 06:45
To: [EMAIL PROTECTED]
Subject: [Mono-list] not installing mono.pc?

I installed mono beta 1 earlier today, and attempted to install MonoDevelop
0.3 as well. However, when I try to ./configure MonoDevelop, I get the
message:
Package mono was not found in the pkg-config search path.
Perhaps you should add the directory containing `mono.pc'
to the PKG_CONFIG_PATH environment variable No package 'mono' found

I ran a search on all of my hard disks and there is no mono.pc file
anywhere. So how am I supposed to satisfy this library dependancy
btw, I installed mono using the yum repository for Fedora Core 1, if this
makes any difference (I should get the same stuff!)

Anyone have any ideas?

-Tyrel Haveman


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] Socket.Select problem

2004-05-04 Thread RoBiK
Hi!

It seems to me, that you don't fully understand the concept of select/poll.
The behavior that you describe is correct fo select  poll.
For your app, you should use poll, because you are working with single
socket. Use select only if you need to work with multiple socket
simultaneous.

Try this:

public string GetMessage(int timeOut, Socket socket)
{
string s = string.Empty;
while(socket.Poll(timeOut, SelectMode.SelectRead))
{
byte[] buffer = new byte[1];
int count = socket.Receive(buffer, 1,
SocketFlags.None);
if(count == 0)
{
//connection closed
return string.Empty;
}
else
{
char c = (char)buffer[0];
if(c == '\n')
{
//end of line received
return s;
}
s += c;
}
}
//timeout
return string.Empty;
}


Here is the MSDN documentation for Socket.Poll:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemnetsocketssocketclasspolltopic.asp


Robert

-Original Message-
From: Dennis Jarosch [mailto:[EMAIL PROTECTED] 
Sent: Montag, 03. Mai 2004 22:37
To: [EMAIL PROTECTED]
Subject: [Mono-list] Socket.Select problem

Hi!!

This is probably not mono-devel related but I'd really appreciate it, if
somebody could help.

I am writing a client application (w/ mono and C#) that communicates with
the server via message-strings. These strings are terminated by the usual
'\n'. The '\n' may be followed by additional data, which is why the string
has to be processed before reading the rest.

I am currently getting one character at a time, checking the socket-state
with Socket.Select. Yes, using a buffer would be nice, but the
server-protocol forces me to do it this way. ;-)

Somehow Select (and Poll, which I have also tried) does not seem to work
correctly. Sometimes I get correct results, mostly nothing is read though.
When using a buffer, everything works rather fine. When using -1 as timeout
value, everything works fine but blocks after the last char.

This is my code:
 Select

ArrayList listenList = new ArrayList();
listenList.Add(socket);

int count = 0;
bool read = true;

while (read)
{
read = false;
Socket.Select(listenList, null, null, 5000);

if (listenList.Contains(socket))
{   
read = true;
count = socket.Receive(buffer, 1, SocketFlags.None);

Console.WriteLine(count:  + count);

message += (char)buffer[0];

if ((char)buffer[0] == '\n')
return message;
}
}

 Poll

while (socket.Poll(-1, SelectMode.SelectRead)) {
count = socket.Receive(buffer, 1, SocketFlags.None);

message += (char)buffer[0];

if ((char)buffer[0] == '\n')
return message; 
}



Thanks for reading!
Dennis


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] How do I get the RPMs I need

2004-04-23 Thread RoBiK
Hi!

You can find all the packages that you could possibly need to install latest
mono RPM for RH 9 here:

http://www.go-mono.com/archive/0.31/redhat-9-i386/

Robert

-Original Message-
From: Peter Foley [mailto:[EMAIL PROTECTED]
Sent: Freitag, 23. April 2004 02:30
To: [EMAIL PROTECTED]
Subject: [Mono-list] How do I get the RPMs I need



I have downloaded the Mono RPMs to a RedHat 9 install. The PC is NOT
connected
to the internet (for security reasons). How do I get all the dependencies I
need
(and what are they)?

Is it possible for the MONO project to a) keep a mirror of all the RPMs they
need for Mono b) supply a command file that installs them in the right
order?

PS This is my first taste of Linux




---
ABS Web Site:  www.abs.gov.au

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] c# written daemon, System.ServiceProcess, posix signals handling...

2004-04-16 Thread RoBiK
Hi!

I need to write an application in c#, wich should run in background and be
able to shut down gracefully when required.
The best solution would be to use the System.ServiceProcess namespace, but
this namespace is not implemented in mono. I know that there were some
discussion about this topic in summer 2003, but since i found nothing. Is
there something new in this direction?
The other way (not so nice, but would also do the job) would be the catching
of posix signals (SIGINT, SIGTERM...) but i have no idea how to do thin in
an mono application.
The last solution is to use some selfmade communication mechnism, to
comunicate with the process and initiate the shutdow - maybe using remoting
or some simpler mechanism.
Can someone give me some infos or ideas for the solution?

Thanx

Robert

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] c# written daemon, System.ServiceProcess, posix signals handling...

2004-04-16 Thread RoBiK
Hi Fawad,

Thank you for your answer. Even if I use runit, there is still the problem,
that I can't catch a signal inside the managed code. I have found also this
article
(http://lists.ximian.com/archives/public/mono-list/2003-March/012826.html),
but this guy has the same problem and no solution. Can you help me and show
me how should the code look like?

Thank you
Robert

-Original Message-
From: Fawad Halim [mailto:[EMAIL PROTECTED] 
Sent: Freitag, 16. April 2004 16:26
To: [EMAIL PROTECTED]
Subject: Re: [Mono-list] c# written daemon, System.ServiceProcess, posix
signals handling...

Hi Robert,
I'd suggest running your app under runit (http://smarden.org/runit/).
That'll take care of making sure the app is always running even when killed
abnormally. When you 'down' the service in runit, it sends it a SIGTERM and
maintains an internal flag that the service is supposed to be down
intentionally. There is a thread on signal handlers in the March '03 archive
of mono-list, including an example of a sigterm handler using unmanaged
calls.

-fawad

RoBiK wrote:

Hi!

I need to write an application in c#, wich should run in background and 
be able to shut down gracefully when required.
The best solution would be to use the System.ServiceProcess namespace, 
but this namespace is not implemented in mono. I know that there were 
some discussion about this topic in summer 2003, but since i found 
nothing. Is there something new in this direction?
The other way (not so nice, but would also do the job) would be the 
catching of posix signals (SIGINT, SIGTERM...) but i have no idea how 
to do thin in an mono application.
The last solution is to use some selfmade communication mechnism, to 
comunicate with the process and initiate the shutdow - maybe using 
remoting or some simpler mechanism.
Can someone give me some infos or ideas for the solution?

Thanx

Robert

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list