[Mono-dev] ObservableCollection and BindingList Serialization

2013-03-11 Thread Neale Ferguson
Hi,
 ObservableCollection was moved from Windows.Base to System and
TypeForwardedTo and TypeForwardedFrom tags were added to the relevant source
code. ObservableCollection is serializable but when done on a Windows system
using .NET >= 3 the serialized object will still contain the WindowsBase,
Version=3.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35 data but
Mono will use System. Hence, if you serialize on Mono and then try and
deserialize on .NET then you get an error message:

Error when trying to deserialize with ObservableCollection: Unable to find
assembly 'System'.

Should the serializer use the forwarded information to ensure compatibility
with older programs (and with what .NET does)?

 In addition, Windows serializes a variable name _busyCount whereas Mono
defines _count.
 
 Also, I note that BindingList serialization on Mono has different and
missing variable names compared to the .NET equivalent. For example,
allow_new is allowNew in .NET. In addition, do those serialized variables
need to be public or should they be declared as private?

 A test case may be found at http://pastebin.com/sRFjhWka

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] OracleClient fixes

2013-03-20 Thread Neale Ferguson
Problems - 
1. 64-bit Oracle routine uses size_t for some of its parameters to
OCICharSetToUnicode and OCIUnicodeToCharSet. Mono is marshalling variables
to UnmanagedType.U4 which causes a segv when call either of these functions.
Use UnmanagedType.SysUInt instead fixes that problem.

2. In OracleParameter.SetOracleType a null variable "value" may be passed
but is not handled by the code. When it tries value.GetType() it gets a null
reference exception. Code was added to test for this null value and to set
the type to typeof(System.DBNull)

diffs attached. 

Neale




oracle.diffs
Description: Binary data
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] TypeForwardedFrom

2013-04-04 Thread Neale Ferguson
Hi,
 I¹m looking at fixing an incompatibility between .NET and Mono when it
comes to Serialization. Bugzilla 11294 describes the situation but in brief
it is a case that when .NET serializes something that has a
TypeForwardedFrom attribute that information gets put into the serialized
object, but mono does not. It appears that all mono does when it encounters
that attribute it simply stores it away and nothing uses it. To emulate the
.NET behavior that information needs to be accessible in metadata about the
type and that information uses by the Serializers.
 I¹m trying to work out how the information captured by
TypeForwardedFromAttribute.cs can be made available at runtime to the
serializer. My knowledge of how mcs operates and what the contents of
metadata are and how to access them is my roadblock. So any reading/code
that I can be directed to would be a great help.

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-08 Thread Neale Ferguson
Hi,
 I've taken your code as a base for creating a test fix. It works nicely but
.NET appears to be doing something a little strange (in my eyes, not theirs
of course). A program (such as shown in bugzilla 11294) when run creates a
serialized object but the header contents are different:

Mono - 

000 nul soh nul nul nul del del del del soh nul nul nul nul nul nul
020 nul  ff stx nul nul nul bel   P   r   o   g   r   a   m  ff etx
040 nul nul nul ack   S   y   s   t   e   m enq soh nul nul nul   9  <==
060   S   e   r   i   a   l   i   z   a   t   i   o   n   P   r   o
100   t   o   t   y   p   e   .   D   a   t   a   O   b   j   e   c
120   t   W   i   t   h   O   b   s   e   r   v   a   b   l   e   C
140   o   l   l   e   c   t   i   o   n etx nul nul nul  cr   m   _
160   s   t   r   i   n   g   V   a   l   u   e  cr   m   _   d   o
200   u   b   l   e   V   a   l   u   e  ff   m   _   c   o   l   l
220   e   c   t   i   o   n soh nul eot ack dc3 soh   S   y   s   t
240   e   m   .   C   o   l   l   e   c   t   i   o   n   s   .   O
260   b   j   e   c   t   M   o   d   e   l   .   O   b   s   e   r
300   v   a   b   l   e   C   o   l   l   e   c   t   i   o   n

Windows - 

000  nul soh nul nul nul  FF  FF  FF  FF soh nul nul nul nul nul nul
020  nul  ff stx nul nul nul   >   P   r   o   g   r   a   m   ,  sp
040V   e   r   s   i   o   n   =   0   .   0   .   0   .   0   ,
060   sp   C   u   l   t   u   r   e   =   n   e   u   t   r   a   l
100,  sp   P   u   b   l   i   c   K   e   y   T   o   k   e   n
120=   n   u   l   l  ff etx nul nul nul   N   W   i   n   d   o <==
140w   s   B   a   s   e   ,  sp   V   e   r   s   i   o   n   =
1603   .   0   .   0   .   0   ,  sp   C   u   l   t   u   r   e
200=   N   e   u   t   r   a   l   ,  sp   P   u   b   l   i   c
220K   e   y   T   o   k   e   n   =   3   1   b   f   3   8   5
2406   a   d   3   6   4   e   3   5 enq soh nul nul nul   9   S
260e   r   i   a   l   i   z   a   t   i   o   n   P   r   o   t
300o   t   y   p   e   .   D   a   t   a   O   b   j   e   c   t
320W   i   t   h   O   b   s   e   r   v   a   b   l   e   C   o
340l   l   e   c   t   i   o   n

Note, that Mono associates System with Program, but .NET associates it with
WindowsBase. I'm not sure why it does this.

On 4/5/13 10:14 AM, "Robert Jordan"  wrote:

> You don't need to know how mcs operates. The TypeForwardedFrom
> information can be obtained via reflection:


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-09 Thread Neale Ferguson
When I use your sample I get the expected results:

...SomeOtherAssembly..TestClass.

But when run using the 11294 test case it does insert WindowsBase for
System.Collection But not for the one at the top which is where the
extract is from.

I'll have a look at your suggestions to see if I can determine a correct way
of doing things.

Thanks again... Neale


On 4/9/13 6:11 AM, "Robert Jordan"  wrote:

> Hi Neale,
> 
> It looks like your patch doesn't work correctly, because the
> assembly references are still the same, as if the patch
> didn't have any effect.
> 
> Assembly references start with "ff" in your dump ("ff" is
> decimal 12). See:
> 
> https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Runtime.Seria
> lization.Formatters.Binary/binary_serialization_format.htm
> 
> 
>  | ID (LE) | String length | String (assembly name)
> --
> Mono:12 | 3 0 0 0 | 6  | System
> Windows: 12 | 3 0 0 0 | 78 | WindowsBase, Version=...
> 
> 
> I had a look at Mono's
> 
> System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
> 
> and it seems that the necessary patch isn't quite a smooth sailing.
> The code is dealing with Assembly objects which we don't have
> if TypeForwardedFrom is in effect. The code must be somehow
> changed to deal with plain assembly names (strings).
> 
> I'd rename ObjectWriter.WriteAssembly to ObjectWriter.WriteTypeAssembly
> and pass it a Type in place of the type's Assembly object.
> 
> Whatever you do, don't forget that there is another
> fast serializer implemented in CodeGenerator.cs which must be
> kept in sync with ObjectWriter.cs
> 
> Robert
> 
> 
> On 09.04.2013 00:18, Neale Ferguson wrote:
>> Hi,
>>   I've taken your code as a base for creating a test fix. It works nicely but
>> .NET appears to be doing something a little strange (in my eyes, not theirs
>> of course). A program (such as shown in bugzilla 11294) when run creates a
>> serialized object but the header contents are different:
>> 
>> Mono -
>> 
>> 000 nul soh nul nul nul del del del del soh nul nul nul nul nul nul
>> 020 nul  ff stx nul nul nul bel   P   r   o   g   r   a   m  ff etx
>> 040 nul nul nul ack   S   y   s   t   e   m enq soh nul nul nul   9  <==
>> 060   S   e   r   i   a   l   i   z   a   t   i   o   n   P   r   o
>> 100   t   o   t   y   p   e   .   D   a   t   a   O   b   j   e   c
>> 120   t   W   i   t   h   O   b   s   e   r   v   a   b   l   e   C
>> 140   o   l   l   e   c   t   i   o   n etx nul nul nul  cr   m   _
>> 160   s   t   r   i   n   g   V   a   l   u   e  cr   m   _   d   o
>> 200   u   b   l   e   V   a   l   u   e  ff   m   _   c   o   l   l
>> 220   e   c   t   i   o   n soh nul eot ack dc3 soh   S   y   s   t
>> 240   e   m   .   C   o   l   l   e   c   t   i   o   n   s   .   O
>> 260   b   j   e   c   t   M   o   d   e   l   .   O   b   s   e   r
>> 300   v   a   b   l   e   C   o   l   l   e   c   t   i   o   n
>> 
>> Windows -
>> 
>> 000  nul soh nul nul nul  FF  FF  FF  FF soh nul nul nul nul nul nul
>> 020  nul  ff stx nul nul nul   >   P   r   o   g   r   a   m   ,  sp
>> 040V   e   r   s   i   o   n   =   0   .   0   .   0   .   0   ,
>> 060   sp   C   u   l   t   u   r   e   =   n   e   u   t   r   a   l
>> 100,  sp   P   u   b   l   i   c   K   e   y   T   o   k   e   n
>> 120=   n   u   l   l  ff etx nul nul nul   N   W   i   n   d   o <==
>> 140w   s   B   a   s   e   ,  sp   V   e   r   s   i   o   n   =
>> 1603   .   0   .   0   .   0   ,  sp   C   u   l   t   u   r   e
>> 200=   N   e   u   t   r   a   l   ,  sp   P   u   b   l   i   c
>> 220K   e   y   T   o   k   e   n   =   3   1   b   f   3   8   5
>> 2406   a   d   3   6   4   e   3   5 enq soh nul nul nul   9   S
>> 260e   r   i   a   l   i   z   a   t   i   o   n   P   r   o   t
>> 300o   t   y   p   e   .   D   a   t   a   O   b   j   e   c   t
>> 320W   i   t   h   O   b   s   e   r   v   a   b   l   e   C   o
>> 340l   l   e   c   t   i   o   n
>> 
>> Note, that Mono associates System with Program, but .NET associates it with
>> WindowsBase. I'm not sure why it does this.
>> 
>> On 4/5/13 10:14 AM, "Robert Jordan"  wrote:
>> 
>>> You don't need to know how mcs operates. The TypeForwardedFrom
>>> information can be obtained via reflection:
>> 
>> 
>> ___
>> Mono-devel-list mailing list
>> Mono-devel-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>> 
> 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-10 Thread Neale Ferguson
It appears ObjectWriter gets that particular assembly name here:

public int WriteAssembly (BinaryWriter writer, Assembly assembly)
{
   return WriteAssemblyName (writer, assembly.FullName);
}

FullName is in Assembly.cs:

public virtual string FullName {
get {
//
// FIXME: This is wrong, but it gets us going
// in the compiler for now
//
return ToString ();
}
}

ToString:

public override string ToString ()
{
// note: ToString work without requiring CodeBase (so no checks are
needed)

if (assemblyName != null)
return assemblyName;

assemblyName = get_fullname ();
return assemblyName;
}

[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern string get_fullname ();

Where is get_fullname? I can't find it anywhere. In any event just
manipulating the strings isn't good enough, I need the type information to
do the TypeForwardedLookup don't I?

The good news, looking through the serialized object caused me to write a
decoder. It's not complete but it prints some useful stuff:

Element code:  00 (Header)

Element code:  12 (Assembly)
Assembly ID:   2
Assembly Name: Program

Element code:  12 (Assembly)
Assembly ID:   3
Assembly Name: System

Element code:  05 (External Object)
Object ID: 1
Class name:
SerializationPrototype.DataObjectWithObservableCollection
Field count:   3
Field names:
   m_stringValue
   m_doubleValue
   m_collection
Type Tags:
   String
   Primitive
   Generic
Field Specs:
   No spec required
   (null)
   
System.Collections.ObjectModel.ObservableCollection`1[[System.String,
mscorlib,
   Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
   [Defined in 3]
External Id:   2
Values:
   [4] foo
   123
   Generic

Element code:  12 (Assembly)
Assembly ID:   6
Assembly Name: WindowsBase

Element code:  05 (External Object)
Object ID: 5
Class name:
System.Collections.ObjectModel.ObservableCollection`1[[System.String,
mscorlib,
   Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
Field count:   5
Field names:
:
:


Neale


On 4/9/13 6:11 AM, "Robert Jordan"  wrote:

> Hi Neale,
> 
> It looks like your patch doesn't work correctly, because the
> assembly references are still the same, as if the patch
> didn't have any effect.
> 
> Assembly references start with "ff" in your dump ("ff" is
> decimal 12). See:
> 
> https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Runtime.Seria
> lization.Formatters.Binary/binary_serialization_format.htm
> 
> 
>  | ID (LE) | String length | String (assembly name)
> --
> Mono:12 | 3 0 0 0 | 6  | System
> Windows: 12 | 3 0 0 0 | 78 | WindowsBase, Version=...
> 
> 
> I had a look at Mono's
> 
> System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
> 
> and it seems that the necessary patch isn't quite a smooth sailing.
> The code is dealing with Assembly objects which we don't have
> if TypeForwardedFrom is in effect. The code must be somehow
> changed to deal with plain assembly names (strings).
> 
> I'd rename ObjectWriter.WriteAssembly to ObjectWriter.WriteTypeAssembly
> and pass it a Type in place of the type's Assembly object.
> 
> Whatever you do, don't forget that there is another
> fast serializer implemented in CodeGenerator.cs which must be
> kept in sync with ObjectWriter.cs
> 
> Robert
> 
> 
> On 09.04.2013 00:18, Neale Ferguson wrote:
>> Hi,
>>   I've taken your code as a base for creating a test fix. It works nicely but
>> .NET appears to be doing something a little strange (in my eyes, not theirs
>> of course). A program (such as shown in bugzilla 11294) when run creates a
>> serialized object but the header contents are different:
>> 
>> Mono -
>> 
>> 000 nul soh nul nul nul del del del del soh nul nul nul nul nul nul
>> 020 nul  ff stx nul nul nul bel   P   r   o   g   r   a   m  ff etx
>> 040 nul nul nul ack   S   y   s   t   e   m enq soh nul nul nul   9  <==
>> 060   S   e   r   i   a   l   i   z   a   t   i   o   n   P   r   o
>> 100   t   o   t   y   p   e   .   D   a   t   a   O   b   j   e   c
>> 120   t   W   i   t   h   O   b   s   e   r   v   a   b   l   e   C
>> 140   o   l   l   

Re: [Mono-dev] TypeForwardedFrom

2013-04-11 Thread Neale Ferguson
So would my best approach be a case of saving the type information at the
same time the fullname information is saved in Assembly and then retrieving
it before the WriteAssemblyName() to get the forwarded name?

Out of curiosity shouldn't I find get_fullname() defined somewhere in the
source tree?

Neale


On 4/11/13 6:47 AM, "Robert Jordan"  wrote:

> Hi Neale,
> 
> On 11.04.2013 01:45, Neale Ferguson wrote:
>> [MethodImplAttribute (MethodImplOptions.InternalCall)]
>> private extern string get_fullname ();
>> 
>> Where is get_fullname? I can't find it anywhere. In any event just
>> manipulating the strings isn't good enough, I need the type information to
>> do the TypeForwardedLookup don't I?
> 
> It's an internal call implemented in the runtime.
> 
> Anyway, you can't change this property. Assembly.FullName must
> always reflect the real assembly name, regardless of whether
> TypeForwardedFrom is in effect or not.
> 
> Bad Things(TM) would happen if you'd change it.
> 
> Robert
> 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-11 Thread Neale Ferguson
Thanks again and apologies for peppering you with questions. In
WriteAssemblyName() it retrieves the AssemblyFullName so I'm not sure how I
can get the forwarded name without the associated Type value.

Neale

On 4/11/13 10:04 AM, "Robert Jordan"  wrote:

> Neale,
> 
> The icall's declaration:
> 
> mono/metadata/icall-def.h:ICALL(ASSEM_23, "get_fullname",
> ves_icall_System_Reflection_Assembly_get_fullName)
> 
> The function:
> 
> mono/metadata/icall.c:ves_icall_System_Reflection_Assembly_get_fullName
> (MonoReflectionAssembly *assembly)
> 
> 
> I won't add this overhead to the Assembly class because it's a Type
> feature after all. You can handle this locally in ObjectWriter,
> as this is the only place where TypeForwardedFrom is used at all.


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-11 Thread Neale Ferguson
This, in my naivety, looks like what I want. However, it's not and leads to
a NULL reference exception. What I am attempting to do is change the
generated code from calling ow.WriteAssembly(writer, memberType.Assembly) to
ow.WriteTypeAssembly(writer, memberType)

--- 
a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
tor.cs
+++ 
b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
tor.cs
@@ -115,8 +115,10 @@ namespace
System.Runtime.Serialization.Formatters.Binary
-   // EMIT ow.WriteAssembly (writer,
memberType.Assembly);
+   // EMIT ow.WriteTypeAssembly
(writer, memberType);

gen.Emit (OpCodes.Ldarg_1);
gen.Emit (OpCodes.Ldarg_2);
-   EmitLoadTypeAssembly (gen,
memberType, field.Name);
-   gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
+// EmitLoadTypeAssembly (gen,
memberType, field.Name);
+// gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
+   EmitLoadType (gen, memberType);
+   gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("WriteTypeAssembly"), null);
gen.Emit (OpCodes.Pop);
}
}
@@ -318,6 +320,12 @@ namespace
System.Runtime.Serialization.Formatters.Binary
gen.EmitCall (OpCodes.Callvirt,
typeof(Type).GetProperty("Assembly").GetGetMethod(), null);
}

+   static void EmitLoadType (ILGenerator gen, Type type)
+   {
+   gen.Emit (OpCodes.Ldtoken, type);
+   gen.EmitCall (OpCodes.Call,
typeof(Type).GetMethod("GetTypeFromHandle"), null);
+   }
+   
static void EmitWrite (ILGenerator gen, Type type)
{
gen.EmitCall (OpCodes.Callvirt,
typeof(BinaryWriter).GetMethod("Write", new Type[] { type }), null);



On 4/11/13 1:21 PM, "Robert Jordan"  wrote:

> Neale,
> 
> Rename & Modify WriteAssembly to take a Type argument:
> 
> public int WriteTypeAssembly (BinaryWriter writer, Type type)
> {
> return WriteAssemblyName (writer, type.GetAssemblyName ());
> }
> 
> (GetAssemblyName () is the extension from my first post)
> 
> Then change all call sites such that they pass the type directly
> instead type.Assembly to WriteTypeAssembly. Don't forget
> CodeGenerator.cs, where things get nastier due to IL code
> generation ;)
> 
> Robert
> 
> 
> On 11.04.2013 17:48, Neale Ferguson wrote:
>> Thanks again and apologies for peppering you with questions. In
>> WriteAssemblyName() it retrieves the AssemblyFullName so I'm not sure how I
>> can get the forwarded name without the associated Type value.
>> 
>> Neale
>> 
>> On 4/11/13 10:04 AM, "Robert Jordan"  wrote:
>> 
>>> Neale,
>>> 
>>> The icall's declaration:
>>> 
>>> mono/metadata/icall-def.h:ICALL(ASSEM_23, "get_fullname",
>>> ves_icall_System_Reflection_Assembly_get_fullName)
>>> 
>>> The function:
>>> 
>>> mono/metadata/icall.c:ves_icall_System_Reflection_Assembly_get_fullName
>>> (MonoReflectionAssembly *assembly)
>>> 
>>> 
>>> I won't add this overhead to the Assembly class because it's a Type
>>> feature after all. You can handle this locally in ObjectWriter,
>>> as this is the only place where TypeForwardedFrom is used at all.
>> 
>> 
> 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-12 Thread Neale Ferguson
In both the MONO_REFLECTION_SERIALIZER=yes & no cases we die in
GetAssemblyId when called from WriteTypeSpec:

case TypeTag.GenericType:
  writer.Write (type.FullName);
  writer.Write ((int)GetAssemblyId (type.Assembly));
  break;

I put a couple of WriteLines in the ObjectWriter version before each call
and prior to the break and saw:

type.FullName = TypeTag.GenericType:
System.Collections.ObjectModel.ObservableCollection`1[[System.String,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]

Type.Assembly = Getting assembly id System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089

I'm not sure why commenting out the EmitLoadType/EmitCall to
WriteTypeAssembly and using the previous EmitLoadAssemblyType/EmitCall to
WriteAssembly causes things not to fail.


On 4/11/13 6:40 PM, "Robert Jordan"  wrote:

> This looks good. Maybe the error is somewhere else, so try to
> disable the IL serializer with
> 
> MONO_REFLECTION_SERIALIZER=yes mono yourtest.exe
> 
> If it still breaks, the bug is in WriteTypeAssembly.
> 
> Robert
> 
> On 11.04.2013 20:58, Neale Ferguson wrote:
>> This, in my naivety, looks like what I want. However, it's not and leads to
>> a NULL reference exception. What I am attempting to do is change the
>> generated code from calling ow.WriteAssembly(writer, memberType.Assembly) to
>> ow.WriteTypeAssembly(writer, memberType)
>> 
>> ---
>> a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
>> tor.cs
>> +++
>> b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
>> tor.cs
>> @@ -115,8 +115,10 @@ namespace
>> System.Runtime.Serialization.Formatters.Binary
>> -   // EMIT ow.WriteAssembly (writer,
>> memberType.Assembly);
>> +   // EMIT ow.WriteTypeAssembly
>> (writer, memberType);
>> 
>>  gen.Emit (OpCodes.Ldarg_1);
>>  gen.Emit (OpCodes.Ldarg_2);
>> -   EmitLoadTypeAssembly (gen,
>> memberType, field.Name);
>> -   gen.EmitCall (OpCodes.Callvirt,
>> typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
>> +// EmitLoadTypeAssembly (gen,
>> memberType, field.Name);
>> +// gen.EmitCall (OpCodes.Callvirt,
>> typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
>> +   EmitLoadType (gen, memberType);
>> +   gen.EmitCall (OpCodes.Callvirt,
>> typeof(ObjectWriter).GetMethod("WriteTypeAssembly"), null);
>>  gen.Emit (OpCodes.Pop);
>>  }
>>  }
>> @@ -318,6 +320,12 @@ namespace
>> System.Runtime.Serialization.Formatters.Binary
>>  gen.EmitCall (OpCodes.Callvirt,
>> typeof(Type).GetProperty("Assembly").GetGetMethod(), null);
>>  }
>> 
>> +   static void EmitLoadType (ILGenerator gen, Type type)
>> +   {
>> +   gen.Emit (OpCodes.Ldtoken, type);
>> +   gen.EmitCall (OpCodes.Call,
>> typeof(Type).GetMethod("GetTypeFromHandle"), null);
>> +   }
>> +
>>  static void EmitWrite (ILGenerator gen, Type type)
>>  {
>>  gen.EmitCall (OpCodes.Callvirt,
>> typeof(BinaryWriter).GetMethod("Write", new Type[] { type }), null);
>> 
>> 
>> 
>> On 4/11/13 1:21 PM, "Robert Jordan"  wrote:
>> 
>>> Neale,
>>> 
>>> Rename & Modify WriteAssembly to take a Type argument:
>>> 
>>> public int WriteTypeAssembly (BinaryWriter writer, Type type)
>>> {
>>> return WriteAssemblyName (writer, type.GetAssemblyName ());
>>> }
>>> 
>>> (GetAssemblyName () is the extension from my first post)
>>> 
>>> Then change all call sites such that they pass the type directly
>>> instead type.Assembly to WriteTypeAssembly. Don't forget
>>> CodeGenerator.cs, where things get nastier due to IL code
>>> generation ;)
>>> 
>>> Robert
>>> 
>>> 
>>> On 11.04.2013 17:48, Neale Ferguson wrote:
>>>> Thanks again and apologies for peppering you with questions. In
>>>> W

Re: [Mono-dev] TypeForwardedFrom

2013-04-12 Thread Neale Ferguson
I wondered if it was a case of needing to "prime the pump" by invoking
aType.Assembly.FullName so that the full name would be set such that
subsequent getId calls would succeed, as I was seeing this in the --trace
output:

[0x7f1650c02740: 2.19819 4] ENTER: (wrapper managed-to-native)
System.Reflection.Assembly:get_fullname
(System.Reflection.Assembly)([System.Reflection.MonoAssembly:0x7f1650a35a20]
, )
[0x7f1650c02740: 2.19822 4] LEAVE: (wrapper managed-to-native)
System.Reflection.Assembly:get_fullname
(System.Reflection.Assembly)[STRING:0x7f1650a36b40:System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]
[0x7f1650c02740: 2.19836 4] ENTER: (wrapper runtime-invoke)
object:runtime_invoke_void__this__
(object,intptr,intptr,intptr)([System.NullReferenceException:0x7f1650a619a0]
, (nil), (nil), 0x7f164f667120, )
[0x7f1650c02740: 2.19839 4] LEAVE: (wrapper runtime-invoke)
object:runtime_invoke_void__this__
(object,intptr,intptr,intptr)[OBJECT:(nil)]

After which the segv occurs.

I simply added:

string asmName;
int asmId;
asmName = aType.Assembly.FullName;
asmId = GetAssemblyId(aType.Assembly);

Prior to the 

return WriteAssemblyName (writer,
GetForwardedAttribute.GetAssemblyName(aType));
 
However, while the aType.Assembly.FullName returns the expected string into
asmName, the subsequent call to GetAssemblyId(aType.Assembly) ends up with a
segv.

Neale

On 4/12/13 10:46 AM, "Neale Ferguson"  wrote:

> In both the MONO_REFLECTION_SERIALIZER=yes & no cases we die in
> GetAssemblyId when called from WriteTypeSpec:
> 
> case TypeTag.GenericType:
>   writer.Write (type.FullName);
>   writer.Write ((int)GetAssemblyId (type.Assembly));
>   break;
> 
> I put a couple of WriteLines in the ObjectWriter version before each call
> and prior to the break and saw:
> 
> type.FullName = TypeTag.GenericType:
> System.Collections.ObjectModel.ObservableCollection`1[[System.String,
> mscorlib, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089]]
> 
> Type.Assembly = Getting assembly id System, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089
> 
> I'm not sure why commenting out the EmitLoadType/EmitCall to
> WriteTypeAssembly and using the previous EmitLoadAssemblyType/EmitCall to
> WriteAssembly causes things not to fail.
> 
> 
> On 4/11/13 6:40 PM, "Robert Jordan"  wrote:
> 
>> This looks good. Maybe the error is somewhere else, so try to
>> disable the IL serializer with
>> 
>> MONO_REFLECTION_SERIALIZER=yes mono yourtest.exe
>> 
>> If it still breaks, the bug is in WriteTypeAssembly.
>> 
>> Robert
>> 
>> On 11.04.2013 20:58, Neale Ferguson wrote:
>>> This, in my naivety, looks like what I want. However, it's not and leads to
>>> a NULL reference exception. What I am attempting to do is change the
>>> generated code from calling ow.WriteAssembly(writer, memberType.Assembly) to
>>> ow.WriteTypeAssembly(writer, memberType)
>>> 
>>> ---
>>> a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
>>> tor.cs
>>> +++
>>> b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenera
>>> tor.cs
>>> @@ -115,8 +115,10 @@ namespace
>>> System.Runtime.Serialization.Formatters.Binary
>>> -   // EMIT ow.WriteAssembly (writer,
>>> memberType.Assembly);
>>> +   // EMIT ow.WriteTypeAssembly
>>> (writer, memberType);
>>> 
>>>  gen.Emit (OpCodes.Ldarg_1);
>>>  gen.Emit (OpCodes.Ldarg_2);
>>> -   EmitLoadTypeAssembly (gen,
>>> memberType, field.Name);
>>> -   gen.EmitCall (OpCodes.Callvirt,
>>> typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
>>> +// EmitLoadTypeAssembly (gen,
>>> memberType, field.Name);
>>> +// gen.EmitCall (OpCodes.Callvirt,
>>> typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
>>> +   EmitLoadType (gen, memberType);
>>> +   gen.EmitCall (OpCodes.Callvirt,
>>> typeof(ObjectWriter).GetMethod("WriteTypeAssembly"), null);
>>>  gen.Emit (OpCodes.Pop);
>>>  }
>>>  }
>>> @@ -318,6 +320,12 @@ namespace
>>> System.Runtime.Serializatio

Re: [Mono-dev] TypeForwardedFrom

2013-04-12 Thread Neale Ferguson
If I add the following to WriteTypeSpec it works fine and the serialization
exactly matches that of .NET.

@@ -994,7 +1064,12 @@ namespace
System.Runtime.Serialization.Formatters.Binary
 
 case TypeTag.GenericType:
  writer.Write (type.FullName);
+#if NET_4_0
+ string asmName = GetForwardedAttribute.GetAssemblyName(type);
+ writer.Write ((int) GetAssemblyNameId (asmName));
+#else
  writer.Write ((int)GetAssemblyId (type.Assembly));
+#endif
  break;
 
However, trying to add the same to CodeGenerator.cs requires some help:

@@ -292,8 +297,14 @@ namespace
System.Runtime.Serialization.Formatters.Binary
 // EMIT writer.Write ((int)ow.GetAssemblyId (type.Assembly));
 gen.Emit (OpCodes.Ldarg_2);
 gen.Emit (OpCodes.Ldarg_1);
+#if NET_4_0
+EmitLoadType (gen, type);
+gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("GetForwardedAttribute.GetAssemblyName"),
null);
+gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("GetAssemblyNameId"), null);
+#else
 EmitLoadTypeAssembly (gen, type, member);
 gen.EmitCall (OpCodes.Callvirt,
typeof(ObjectWriter).GetMethod("GetAssemblyId"), null);
+#endif
 gen.Emit (OpCodes.Conv_I4);
 EmitWrite (gen, typeof(int));
 break;

GetForwardedAttribute is defined at the top of ObjectWriter.cs

namespace System.Runtime.Serialization.Formatters.Binary
{
#if NET_4_0
public class GetForwardedAttribute
{
public static string GetAssemblyName (Type self)
{
var attrs = self.GetCustomAttributes(
typeof (TypeForwardedFromAttribute),
false);
if (attrs.Length == 0)
return self.Assembly.FullName;
else
return ((TypeForwardedFromAttribute)attrs
[0]).AssemblyFullName;
}
}
#endif

So I'm not sure how to code the EmitCall for that method. At the moment I
get:

Error when trying to serialize with ObservableCollection: Argument cannot be
null.

Neale


On 4/12/13 1:37 PM, "Robert Jordan"  wrote:

> It looks like there are more places where we need the same
> Assembly -> Type "promotion".
> 
> GetAssemblyId should also take a Type argument where the
> forwarded assembly is determined, similar to the first change.
> 
> Robert
> 
> On 12.04.2013 16:46, Neale Ferguson wrote:
>> In both the MONO_REFLECTION_SERIALIZER=yes & no cases we die in
>> GetAssemblyId when called from WriteTypeSpec:
>> 
>> case TypeTag.GenericType:
>>writer.Write (type.FullName);
>>writer.Write ((int)GetAssemblyId (type.Assembly));
>>break;
>> 
>> I put a couple of WriteLines in the ObjectWriter version before each call
>> and prior to the break and saw:
>> 
>> type.FullName = TypeTag.GenericType:
>> System.Collections.ObjectModel.ObservableCollection`1[[System.String,
>> mscorlib, Version=4.0.0.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089]]
>> 
>> Type.Assembly = Getting assembly id System, Version=4.0.0.0,
>> Culture=neutral, PublicKeyToken=b77a5c561934e089
>> 
>> I'm not sure why commenting out the EmitLoadType/EmitCall to
>> WriteTypeAssembly and using the previous EmitLoadAssemblyType/EmitCall to
>> WriteAssembly causes things not to fail.
>> 
>> 
>> On 4/11/13 6:40 PM, "Robert Jordan"  wrote:
>> 
>>> This looks good. Maybe the error is somewhere else, so try to
>>> disable the IL serializer with
>>> 
>>> MONO_REFLECTION_SERIALIZER=yes mono yourtest.exe
>>> 
>>> If it still breaks, the bug is in WriteTypeAssembly.
>>> 
>>> Robert
>>> 
>>> On 11.04.2013 20:58, Neale Ferguson wrote:
>>>> This, in my naivety, looks like what I want. However, it's not and leads to
>>>> a NULL reference exception. What I am attempting to do is change the
>>>> generated code from calling ow.WriteAssembly(writer, memberType.Assembly)
>>>> to
>>>> ow.WriteTypeAssembly(writer, memberType)
>>>> 
>>>> ---
>>>> 
a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGener>>>>
a
>>>> tor.cs
>>>> +++
>>>> 
b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGener>>>>
a
>>>> tor.cs
>>>> @@ -115,8 +115,10 @@ namespace
>>>> System.Runtime.Serialization.Formatters.Binary
>>>> -   // EMIT ow.WriteAssembly (writer,
>>>> memberType.Assembly);
>>>&

Re: [Mono-dev] TypeForwardedFrom

2013-04-15 Thread Neale Ferguson
Using the patches attached to this email I am now able to serialize on Mono
and deserialize on Windows using ObservableCollections. The only differences
I see between the serializations on each platform is as follows:

--- mono.decode2013-04-15 14:44:18.952996746 -0400
+++ win.decode2013-04-15 12:40:56.654035312 -0400
@@ -1,14 +1,14 @@
 Element code:   00 (Header)
 
 Element code:   12 (Assembly)
 Assembly ID:2
-Assembly Name:  Program
+Assembly Name:  Program, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
 
 Element code:   12 (Assembly)
 Assembly ID:3
-Assembly Name:  WindowsBase
+Assembly Name:  WindowsBase, Version=3.0.0.0, Culture=Neutral,
PublicKeyToken=31bf3856ad364e35
 
 Element code:   05 (External Object)
 Object ID:  1
 Class name:   
SerializationPrototype.DataObjectWithObservableCollection
 Field count:3
@@ -46,12 +46,12 @@
 Field Specs:
 
System.Collections.ObjectModel.ObservableCollection`1+SimpleMonitor[[System.
Stri
 ng, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]
 ]
 [Defined in 3]
-System.Collections.Generic.IList`1[[System.String, mscorlib,
Version=4.0.0.0, Cu
-lture=neutral, PublicKeyToken=b77a5c561934e089]]
+System.Collections.Generic.List`1[[System.String, mscorlib,
Version=4.0.0.0, Cul
+ture=neutral, PublicKeyToken=b77a5c561934e089]]
 External Id:3
 Values:
 Generic:   [9] 6
 Run Time:  [9] 7
 
i.e. Windows defaults to using the full assembly name and where we use
System.Collections.Generic.IList it uses System.Collections.Generic.List -
I'm not sure how significant this is but it doesn't cause problems
serializing/deserializing on each platform.

Neale




serial.diff
Description: Binary data
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] TypeForwardedFrom

2013-04-16 Thread Neale Ferguson
Crap! I managed to stuff up the request-pull procedure. I thought I had
committed and pushed to my fork but apparently I pushed to master. Not sure
how I can recover from this stupidity.


On 4/16/13 9:12 AM, "Robert Jordan"  wrote:
 
> Would you please create separate github pull requests for these
> 2 distinct issues (TypeForwardedFrom and ObjectModel/Collection.cs)
> so I can comment on them?
> 
> Robert
> 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Build problem

2013-04-19 Thread Neale Ferguson
Before I go on a bisect adventure, I was wondering if anyone had any ideas
why this has started happening into last couple of weeks:

Creating the per profile list ../../build/deps/basic_System.Core.dll.sources
...
MCS [basic] System.Core.dll
MCS [build] mscorlib.dll
Stacktrace:

  at  <0x>
  at (wrapper managed-to-native)
object.__icall_wrapper_mono_object_new_ptrfree (intptr) <0x>
  at System.Security.SecurityManager..cctor () <0x0003c>
  at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr) <0x>
  at  <0x>
  at System.Environment.GetEnvironmentVariable (string) <0x0002e>
  at Mono.CSharp.Driver.Main (string[]) <0x0004c>
  at (wrapper runtime-invoke) .runtime_invoke_int_object
(object,intptr,intptr,intptr) <0x>

Native stacktrace:

A look at git log  for the above mentioned modules doesn¹t reveal anything
of note.

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Help with xsp

2013-09-17 Thread Neale Ferguson
I had a webservice that was working fine. I duplicated a routine - same name
but with different parameters which requires the MessageName attribute. So
for the duplicated routine which originally just had:
[WebMethod (Description="Process VMARCH QUERY TAPES ALL
command")]
I changed it to
[WebMethod (Description="Process VMARCH QUERY TAPES ALL
command",
MessageName="vmaQryTapesAll")]

Pointed browser to: http://localhost:9000/webservice.asmx and now get:

System.ArgumentOutOfRangeException
Argument is out of range.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or
object): System.Web.Services.
Exception stack trace:
  at System.Web.Services.Description.MessageCollection.get_Item (Int32
index) [0x0] in :0
  at System.Web.Services.Description.MessageCollection.get_Item
(System.String name) [0x0] in :0
  at System.Web.Services.Description.BasicProfileChecker.CheckR2305
(System.Web.Services.Description.ConformanceCheckContext ctx,
System.Web.Services.Description.Operation value) [0x0] in :0 
  at System.Web.Services.Description.BasicProfileChecker.Check
(System.Web.Services.Description.ConformanceCheckContext ctx,
System.Web.Services.Description.Operation value) [0x0] in :0 
  at System.Web.Services.Description.WebServicesInteroperability.Check
(System.Web.Services.Description.ConformanceCheckContext ctx,
System.Web.Services.Description.ConformanceChecker checker,
System.Web.Services.Description.ServiceDescription sd) [0x0] in
:0
  at System.Web.Services.Description.WebServicesInteroperability.Check
(WsiProfiles claims, System.Web.Services.Description.ConformanceCheckContext
ctx, IEnumerable documents) [0x0] in :0
  at 
System.Web.Services.Description.WebServicesInteroperability.CheckConformance
(WsiProfiles claims,
System.Web.Services.Description.ServiceDescriptionCollection services,
System.Web.Services.Description.BasicProfileViolationCollection violations)
[0x0] in :0
  at ASP.DefaultWsdlHelpGenerator_aspx.Page_Load (System.Object sender,
System.EventArgs e) [0x0] in :0
  at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x0] in
:0
  at System.Web.UI.Control.LoadRecursive () [0x0] in :0 
  at System.Web.UI.Page.ProcessLoad () [0x0] in :0
  at System.Web.UI.Page.ProcessPostData () [0x0] in :0
  at System.Web.UI.Page.InternalProcessRequest () [0x0] in :0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context)
[0x0] in :0

Is there some way to get more informative messages from xsp to get it to
tell me exactly what it's choking on? I can invoke the webmethods directly
on the browser but it's just this bit that is giving me grief.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Help with xsp

2013-09-18 Thread Neale Ferguson
Thanks Robert.

Using --debug shows:

  at System.Web.Services.Description.MessageCollection.get_Item (Int32
index) [0x00019] in
/home/BUILD/mono-3.2.3/mcs/class/System.Web.Services/System.Web.Services.Des
cription/MessageCollection.cs:50

Which corresponds to the throw below. Just out of curiosity why does add
subtract one from the Count in the Add method?

public Message this [int index] {
get {
if (index < 0 || index > Count)
throw new
ArgumentOutOfRangeException ();

return (Message) List [index];
}
set { List [index] = value; }
}

public Message this [string name] {
get { return this [IndexOf ((Message) Table
[name])]; }
}

#endregion // Properties

#region Methods

public int Add (Message message)
{
Insert (Count, message);
return (Count - 1);
}



On 9/18/13 5:08 AM, "Robert Jordan"  wrote:

> Neale,
> 
> On 18.09.2013 00:19, Neale Ferguson wrote:
>> I had a webservice that was working fine. I duplicated a routine - same name
>> but with different parameters which requires the MessageName attribute. So
>> for the duplicated routine which originally just had:
>>  [WebMethod (Description="Process VMARCH QUERY TAPES ALL
>> command")]
>> I changed it to
>>  [WebMethod (Description="Process VMARCH QUERY TAPES ALL
>> command",
>>  MessageName="vmaQryTapesAll")]
>> 
>> Pointed browser to: http://localhost:9000/webservice.asmx and now get:
>> 
>> System.ArgumentOutOfRangeException
>> Argument is out of range.
>> 
>> Is there some way to get more informative messages from xsp to get it to
>> tell me exactly what it's choking on? I can invoke the webmethods directly
>> on the browser but it's just this bit that is giving me grief.
> 
> The Web Service overview and test page is generated by
> $prefix/etc/mono/x.x/DefaultWsdlHelpGenerator.aspx,
> where x.x is the .NET version.
> 
> It looks like the exception is thrown when Page_Load of this
> ASPX page is invoking WebServicesInteroperability.CheckConformance.
> 
> That's where I would start looking for issue with overloaded
> WebMethods following back the stack trace.
> 
> Try to get line numbers with
> 
> MONO_OPTIONS=--debug xsp ...
> 
> Robert
> 
> 
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Help with xsp

2013-09-19 Thread Neale Ferguson
At the bottom is the minimal test case that results in the error. If you
rename the 2nd testIt to something else and get rid of the (MessageName...),
there's no problem.

Would someone try it on there platform to check that it's not something I've
done on my system? 

The problem appears to be when
System.Web.Services.Description.BasicProfileChecker.CheckR2305 invokes
System.Web.Services.Description.MessageCollection.get_Item using the string
"TestInt". The IndexOf comes back with -1 which triggers the throw. The call
to IndexOf is:

[  6] . . . . . . ENTER:
System.Web.Services.Description.MessageCollection:IndexOf
(System.WebDescription.Message) ip: 0x3ffd725d0ac sp: 0x3fff4b13a98 -
this[MONO_TYPE_CLASS]: 0x3ffd767ae3:null],ECTT


public Message this [int index] {
get {
if (index < 0 || index > Count)
throw new
ArgumentOutOfRangeException ();

return (Message) List [index];
}
set { List [index] = value; }
}

public Message this [string name] {
get { return this [IndexOf ((Message) Table
[name])]; }
}

The trace shows:

[  6] . . . . . . ENTER:
System.Web.Services.Description.MessageCollection:IndexOf
(System.WebDescription.Message) ip: 0x3ffd725d0ac sp: 0x3fff4b13a98 -
this[MONO_TYPE_CLASS]: 0x3ffd767ae3:null],ECTT

As far as I can see from the trace, List.Insert is never called to put
things into the table.

---

<%@ WebService Language="C#" Class="TestService.Testing" %>

using System;
using System.Web.Services;
using System.Xml;
using System.Runtime.InteropServices;

namespace TestService
{
[WebService (Namespace="http://localhost/TestService";,
 Description="Webservice test case")]
public class Testing : WebService
{
[WebMethod]
public XmlDocument testIt()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("Test Data");

return(doc);
}
[WebMethod (MessageName="testInt")]
public XmlDocument testIt(int a)
{
XmlDocument doc = new XmlDocument();
if (a == 0)
doc.LoadXml("Test 0");
else
doc.LoadXml("Test !0");

return(doc);
    }
}
}


On 9/18/13 5:08 AM, "Robert Jordan"  wrote:

> Neale,
> 
> On 18.09.2013 00:19, Neale Ferguson wrote:
>> I had a webservice that was working fine. I duplicated a routine - same name
>> but with different parameters which requires the MessageName attribute. So
>> for the duplicated routine which originally just had:
>>  [WebMethod (Description="Process VMARCH QUERY TAPES ALL
>> command")]
>> I changed it to
>>  [WebMethod (Description="Process VMARCH QUERY TAPES ALL
>> command",
>>  MessageName="vmaQryTapesAll")]
>> 
>> Pointed browser to: http://localhost:9000/webservice.asmx and now get:
>> 
>> System.ArgumentOutOfRangeException
>> Argument is out of range.
>> 
>> Is there some way to get more informative messages from xsp to get it to
>> tell me exactly what it's choking on? I can invoke the webmethods directly
>> on the browser but it's just this bit that is giving me grief.
> 
> The Web Service overview and test page is generated by
> $prefix/etc/mono/x.x/DefaultWsdlHelpGenerator.aspx,
> where x.x is the .NET version.
> 
> It looks like the exception is thrown when Page_Load of this
> ASPX page is invoking WebServicesInteroperability.CheckConformance.
> 
> That's where I would start looking for issue with overloaded
> WebMethods following back the stack trace.
> 
> Try to get line numbers with
> 
> MONO_OPTIONS=--debug xsp ...
> 
> Robert
> 
> 
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Help with xsp

2013-09-20 Thread Neale Ferguson
Reported as bug 14877


On 9/19/13 11:16 PM, "Daniel Lo Nigro"  wrote:

> I can confirm that I get the same error using Mono 3.0.7. I'd suggest raising
> it as a bug in the Mono bug tracker.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] WCF compilation

2013-10-02 Thread Neale Ferguson
Hi,
 I am writing a WCF-based service which I¹m making available via xsp. When I
go to access it, the compilation starts as expected. However, the parameters
used by the mcs.exe process that is kicked off doesn¹t include a
­r:System.Web that my service needs to build cleanly. I added the following
to web.config within the  and  sections:



However, it seems to have no effect. Neither option is being used. Is there
something else I need to be doing?

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Update SqlParameter.cs to support DateTime2

2014-05-01 Thread Neale Ferguson
Proposing the following. Comments?

--- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
@@ -594,6 +594,10 @@ namespace System.Data.SqlClient {
   MetaParameter.TypeName =3D "datetime";
   sqlDbType =3D SqlDbType.DateTime;
   break;
+   case DbType.DateTime2:
+   MetaParameter.TypeName =3D "datetime2";
+   sqlDbType =3D SqlDbType.DateTime2;
+   break;
   case DbType.Decimal:
   MetaParameter.TypeName =3D "decimal";
   sqlDbType =3D SqlDbType.Decimal;
diff --git =
a/mcs/class/System.Web/System.Web.Security/SqliteMembershipProvider.cs =
b/mcs/class/System.Web
/System.Web.Security/SqliteMembershipProvider.cs
index 2acff57..b56308c 100644
--- =
a/mcs/class/System.Web/System.Web.Security/SqliteMembershipProvider.cs
+++ =
b/mcs/class/System.Web/System.Web.Security/SqliteMembershipProvider.cs
@@ -762,6 +762,7 @@ namespace System.Web.Security
   dbCommand.Prepare();
=20
   numOnline =3D =
(int)dbCommand.ExecuteScalar();
+   =
Int32.TryParse(dbCommand.ExecuteScalar().ToString(), out
numOnline);
   }
   catch (SqliteException e)
   {
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] MS Sans Serif

2014-05-16 Thread Neale Ferguson
I'm running the test suite for mono on System z using my Mac as the X-server. 
When it gets to the forms tests etc. it calls gdi+ to return a generic sans 
serif font. It returns MS Sans Serif which doesn't exist on the Mac. Am I able 
to influence gdi+ so that it returns Microsoft Sans Serif or some other font 
that does exist on the Mac?

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list



Re: [Mono-dev] MS Sans Serif

2014-05-16 Thread Neale Ferguson
Yep, just checked src/font.c and it's hardcoded there.  Making a local mod so I 
can run tests.

Neale

On May 16, 2014, at 6:04 PM, Miguel de Icaza  wrote:

> This looks hardcoded, and I do not know of a way of configuring it, other 
> than patching libgdiplus:
> 
> This is the method:
> 
> font.c:GdipGetGenericFontFamilySansSerif (GpFontFamily **nativeFamily)
> 
> 
> 
> On Fri, May 16, 2014 at 5:49 PM, Neale Ferguson  
> wrote:
> I'm running the test suite for mono on System z using my Mac as the X-server. 
> When it gets to the forms tests etc. it calls gdi+ to return a generic sans 
> serif font. It returns MS Sans Serif which doesn't exist on the Mac. Am I 
> able to influence gdi+ so that it returns Microsoft Sans Serif or some other 
> font that does exist on the Mac?
> 
> Neale
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] AssemblyFileVersion

2014-05-22 Thread Neale Ferguson
Hi,
 When compiling an assembly , the File version info of the file is set by 
reading the AssemblyInfo.AssemblyFileVersion attribute. On mono it seems to be 
reading the AssemblyVersion attribute.

As a test, set these 2 attributes into an assembly:
[assembly: AssemblyVersion("2011.04.0.0")]
[assembly : AssemblyFileVersion("2011.02.0.0")]

Then build it and try this:
Assembly executingAssembly = Assembly.GetAssembly(typeof(Runtime));
FileVersionInfo fvi = 
FileVersionInfo.GetVersionInfo(executingAssembly.Location);
string version1 = fvi.FileVersion;
Console.WriteLine("version: "+version1);

In our test it was returning 2011.04.0.0 but on Windows it would return 
2011.02.0.0 and right clicking on the files in Windows Explorer would show the 
same things. Could Linux be putting this in a different area?

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Some test failures for s390x

2014-05-28 Thread Neale Ferguson
After adding support for handler block trampoline, I ran through the test suite 
and found that I'm failing in these tests (I tested without the handler changes 
as well).

All these timeout:

bug-10127.exe
finalizer-exception.exe
monitor.exe
sleep.exe

It doesn't appear to matter whether its boehm or sgen as the gc but it does 
appear gc-related. A couple of them sometimes work if I use the --trace option 
which indicates some sort of race condition that the additional trace 
processing hides.

I used gdb to try and find out what the processes were up to:

Thread 4 (Thread 0x3fffb3d5910 (LWP 4854)):
#0  0x03fffcf14c7c in sigsuspend () from /lib64/libc.so.6
#1  0x8020055a in suspend_thread (context=, 
info=)
at sgen-os-posix.c:113
#2  suspend_handler (sig=, siginfo=, 
context=)
at sgen-os-posix.c:140
#3  
#4  0x03fffd074efa in sem_wait@@GLIBC_2.2 () from /lib64/libpthread.so.0
#5  0x80278110 in mono_sem_wait (sem=0x803ca9b0 , 
alertable=1)
at mono-semaphore.c:101
#6  0x801cbf6a in finalizer_thread (unused=) at gc.c:1073
#7  0x801a4948 in start_wrapper_internal (data=) at 
threads.c:660
#8  start_wrapper (data=0x804a3ed0) at threads.c:707
#9  0x8027dd88 in inner_start_thread (arg=) at 
mono-threads-posix.c:94
#10 0x03fffd06e37a in start_thread () from /lib64/libpthread.so.0
#11 0x03fffcfcc92a in thread_start () from /lib64/libc.so.6

Thread 3 (Thread 0x3fffb1b4910 (LWP 4855)):
#0  0x03fffcf14c7c in sigsuspend () from /lib64/libc.so.6
#1  0x8020055a in suspend_thread (context=, 
info=)
at sgen-os-posix.c:113
#2  suspend_handler (sig=, siginfo=, 
context=)
at sgen-os-posix.c:140
#3  
#4  0x03fffd075c66 in __lll_lock_wait () from /lib64/libpthread.so.0
#5  0x03fffd06fdfa in pthread_mutex_lock () from /lib64/libpthread.so.0
#6  0x8020c824 in mono_gc_collect (generation=1) at sgen-gc.c:4291
#7  0x03fffb1ba7da in ?? ()
#8  0x03fffb1ba438 in ?? ()
#9  0x03fffb1b8d2a in ?? ()
#10 0x03fffb1b8b04 in ?? ()
#11 0x03fffb1b8958 in ?? ()
#12 0x80027156 in mono_jit_runtime_invoke (method=0x8053e1b0, 
obj=0x3fffc807010, 
params=0x3fffb1b3e58, exc=0x8053b740) at mini.c:6723
#13 0x801d17d4 in mono_runtime_invoke (method=0x8053e1b0, 
obj=, 
params=0x3fffb1b3e58, exc=0x0) at object.c:2828
#14 0x801a4a8a in start_wrapper_internal (data=) at 
threads.c:666
#15 start_wrapper (data=0x804e1f40) at threads.c:707
#16 0x8027dd88 in inner_start_thread (arg=) at 
mono-threads-posix.c:94
#17 0x03fffd06e37a in start_thread () from /lib64/libpthread.so.0
#18 0x03fffcfcc92a in thread_start () from /lib64/libc.so.6

Thread 2 (Thread 0x3fffabab910 (LWP 4856)):
#0  0x03fffd074efa in sem_wait@@GLIBC_2.2 () from /lib64/libpthread.so.0
#1  0x80278110 in mono_sem_wait (sem=0x803cad98 
, alertable=0)
at mono-semaphore.c:101
#2  0x802006c8 in sgen_wait_for_suspend_ack (count=3) at 
sgen-os-posix.c:175
#3  0x8020082a in sgen_thread_handshake (suspend=) at 
sgen-os-posix.c:209
#4  0x80242b6c in sgen_stop_world (generation=1) at sgen-stw.c:228
#5  0x8020c2ca in sgen_perform_collection (requested_size=0, 
generation_to_collect=1, 
reason=0x80359ab8 "user request", wait_to_finish=1) at sgen-gc.c:3154
#6  0x8020c846 in mono_gc_collect (generation=1) at sgen-gc.c:4294
#7  0x03fffb1ba7da in ?? ()
#8  0x03fffb1ba438 in ?? ()
#9  0x03fffb1b8d2a in ?? ()
#10 0x03fffb1b8b04 in ?? ()
#11 0x03fffb1b8958 in ?? ()
#12 0x80027156 in mono_jit_runtime_invoke (method=0x8053e1b0, 
obj=0x3fffc800d80, 
params=0x3fffabaae58, exc=0x8053b740) at mini.c:6723
#13 0x801d17d4 in mono_runtime_invoke (method=0x8053e1b0, 
obj=, 
params=0x3fffabaae58, exc=0x0) at object.c:2828
#14 0x801a4a8a in start_wrapper_internal (data=) at 
threads.c:666
#15 start_wrapper (data=0x805505e0) at threads.c:707
#16 0x8027dd88 in inner_start_thread (arg=) at 
mono-threads-posix.c:94
#17 0x03fffd06e37a in start_thread () from /lib64/libpthread.so.0
#18 0x03fffcfcc92a in thread_start () from /lib64/libc.so.6

Thread 1 (Thread 0x3fffced9770 (LWP 4841)):
#0  0x03fffd075c64 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x03fffd06fdfa in pthread_mutex_lock () from /lib64/libpthread.so.0
#2  0x80206384 in mono_gc_register_root_inner (start=0x8053e680 "", 
size=, 
descr=, 
root_type=) at 
sgen-gc.c:3615
#3  0x80230924 in mono_gc_alloc_fixed (size=24, descr=0x0) at 
sgen-alloc.c:672
#4  0x801cece2 in new_slot (hash=) at mono-hash.c:77
#5  mono_g_hash_table_insert_replace (hash=0x804a31d0, key=0x3fffc802e88, 
value=0x0, replace=0)
at mono-hash.c:443
#6  0x801a38b6 in create_thread (thread=0x3fffc802e88, 
internal=0x3fffcc90590, 
start_info=0x8053e4d0, threadpool_thread=0, stack_size=, 
throw_on_failure=0)
at threads.c:746
#7  0x801a3dd6 i

Re: [Mono-dev] Some test failures for s390x

2014-05-29 Thread Neale Ferguson
I found that the tests (except for finalizer-exception) work if there are more 
than 1 core. It seems the threads that are woken after gc don't get much of an 
opportunity to do anything before the thread doing GC kicks off again. Now to 
find out why finalizer-exception doesn't work.

Neale

On May 28, 2014, at 2:17 PM, Neale Ferguson  wrote:

> After adding support for handler block trampoline, I ran through the test 
> suite and found that I'm failing in these tests (I tested without the handler 
> changes as well).
> 
> All these timeout:
> 
> bug-10127.exe
> finalizer-exception.exe
> monitor.exe
> sleep.exe
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Problem building with big arrays

2014-06-10 Thread Neale Ferguson
Building from head and using --trace=E

[0x228a030:] EXCEPTION handling: System.IndexOutOfRangeException: Array 
index is out of range.
[0x228a030:] EXCEPTION handling: System.TypeInitializationException: An 
exception was thrown by the type initializer for System.TermInfoDriver
[0x228a030:] EXCEPTION handling: System.TypeInitializationException: An 
exception was thrown by the type initializer for System.ConsoleDriver
[0x228a030:] EXCEPTION handling: System.TypeInitializationException: An 
exception was thrown by the type initializer for System.Console
[0x228a030:] EXCEPTION handling: System.IndexOutOfRangeException: Array 
index is out of range.

Unhandled Exception:
Nested exception detected.
Original Exception: at Mono.CSharp.Driver.Main (string[]) <0x0008a>

Nested exception:at (wrapper stelemref) object.virt_stelemref_object 
(intptr,object) <0x00044>
at string.Format (string,object,object) <0x00062>
at System.Exception.get_StackTrace () <0x0011c>
at System.Exception.ToString () <0x00230>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>


[ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
Original Exception: at Mono.CSharp.Driver.Main (string[]) <0x0008a>

Nested exception:at (wrapper stelemref) object.virt_stelemref_object 
(intptr,object) <0x00044>
at string.Format (string,object,object) <0x00062>
at System.Exception.get_StackTrace () <0x0011c>
at System.Exception.ToString () <0x00230>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>

Using just --trace shows:

0x228a030 [ 16] . . . . . . . . . . . . . . . . ENTER: string:ToCharArray 
() ip: 0x266cf80 sp: 0x3d591d8 - 
this:[STRING:0x2801ce0:],0x228a030 [ 17] . . . . . . . . . . . . . . . 
. . ENTER: string:ToCharArray (int,int) ip: 0x27407c0 sp: 0x3d590e8 - 
this:[STRING:0x2801ce0:], [INT4:0], [INT4:1],
0x228a030 [ 18] . . . . . . . . . . . . . . . . . . ENTER: (wrapper alloc) 
object:AllocVector (intptr,intptr) ip: 0x274095c sp: 0x3d58fb8 - 
[INTPTR:0x804a9bf8], [INTPTR:0x1],
0x228a030 [ 18] . . . . . . . . . . . . . . . . . . LEAVE: (wrapper alloc) 
object:AllocVector (intptr,intptr)[System.Char[]:0x2801d00] ip: 
0x2665626
0x228a030 [ 18] . . . . . . . . . . . . . . . . . . ENTER: string:CharCopy 
(char*,char*,int) ip: 0x2740a0a sp: 0x3d58fb8 - [PTR:(nil)], 
[PTR:0x2801cf4], [INT4:1],
0x228a030 [ 19] . . . . . . . . . . . . . . . . . . . ENTER: string:memcpy4 
(byte*,byte*,int) ip: 0x2740da0 sp: 0x3d58eb8 - [PTR:(nil)], 
[PTR:0x2801cf4], [INT4:2],

With the relevant section being:

public unsafe char[] ToCharArray (int startIndex, int length)
{
if (startIndex < 0)
throw new ArgumentOutOfRangeException 
("startIndex", "< 0");
if (length < 0)
throw new ArgumentOutOfRangeException 
("length", "< 0");
if (startIndex > this.length - length)
throw new ArgumentOutOfRangeException 
("startIndex", "Must be greater than the length of the string.");

char[] tmp = new char [length];
fixed (char* dest = tmp, src = this)
CharCopy (dest, src + startIndex, length);
return tmp;
}

Which indicates new char [length] is returning NULL.

Before I trace this any further, is this something that's been seen before with 
big arrays?

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Large object size limits

2014-06-12 Thread Neale Ferguson
The following program runs fine on .NET -

using System;
using System.Collections.Generic;
using System.Runtime;
using System.Text;

namespace LargeObjectTest
{
class Program
{
static void Main(string[] args)
{

IList myList = new List();


long index = 1024*1024*1024;

Console.WriteLine("index:" + index);

double[] array = null;

Console.WriteLine("UInt32.MaxValue: "+UInt32.MaxValue);
try
{
array = new double[index];

Console.WriteLine("doubleArray:LongLength " + 
array.Length * sizeof(double) + " bytes");
Console.WriteLine("sizeof(double) " + 
sizeof(double) + " bytes");
Console.WriteLine("index " + index);
Console.WriteLine("doubleArray:LongLength " + 
array.LongLength);
Console.WriteLine("doubleArray:Size " + 
array.LongLength * sizeof(double) * 1.0 + " Bytes");
}
catch (Exception e)
{
Console.WriteLine("Exception:" + e);
Console.WriteLine("Exception:" + e.Message + " 
allocating :" + index);
Console.WriteLine("Exception:" + e.Message + " 
allocating :" + index * sizeof(double));
}
}
}
}

However, on mono on Linux it results in:

index:1073741824
UInt32.MaxValue: 4294967295
Exception:System.OutOfMemoryException: Out of memory
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific 
(intptr,int)
  at LargeObjectTest.Program.Main (System.String[] args) [0x0] in :0 
Exception:Out of memory allocating :1073741824
Exception:Out of memory allocating :8589934592

If I make the following change to override the SIZE_MAX value from 
/usr/include/stdint.h:

--- a/mono/metadata/sgen-los.c
+++ b/mono/metadata/sgen-los.c
@@ -342,8 +342,12 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t 
size)
 *
 * size <= SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject)
 */
+#undef SIZE_MAX
+#define SIZE_MAX (17179869184U)
if (size > SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject))
return NULL;
+#undef SIZE_MAX
+#define SIZE_MAX (4294967295U)
 
 #ifdef LOS_DUMMY
if (!los_segment)

Then the program works as it does under .NET:

index:1073741824
UInt32.MaxValue: 4294967295
doubleArray:LongLength 0 bytes
sizeof(double) 8 bytes
index 1073741824
doubleArray:LongLength 1073741824
doubleArray:Size 8589934592 Bytes

The question is, what is the correct value for the comparison in lieu of 
SIZE_MAX? I can't determine what the max is on .NET. Another question is what 
type of compacting happens with large objects like this?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Large object size limits

2014-06-13 Thread Neale Ferguson
If we include limits.h it includes posix1_lim.h which defines SSIZE_MAX

Neale

On Jun 14, 2014, at 4:07 AM, Rodrigo Kumpera  wrote:

> Hi Neale,
> 
> We should change from SIZE_MAX to the max value a ssize_t can hold.
> 
> --
> Rodrigo
> 
> 
> On Thu, Jun 12, 2014 at 4:38 PM, Neale Ferguson  
> wrote:
> The following program runs fine on .NET -
> 
> using System;
> using System.Collections.Generic;
> using System.Runtime;
> using System.Text;
> 
> namespace LargeObjectTest
> {
> class Program
> {
> static void Main(string[] args)
> {
> 
> IList myList = new List();
> 
> 
> long index = 1024*1024*1024;
> 
> Console.WriteLine("index:" + index);
> 
> double[] array = null;
> 
> Console.WriteLine("UInt32.MaxValue: 
> "+UInt32.MaxValue);
> try
> {
> array = new double[index];
> 
> Console.WriteLine("doubleArray:LongLength " + 
> array.Length * sizeof(double) + " bytes");
> Console.WriteLine("sizeof(double) " + 
> sizeof(double) + " bytes");
> Console.WriteLine("index " + index);
> Console.WriteLine("doubleArray:LongLength " + 
> array.LongLength);
> Console.WriteLine("doubleArray:Size " + 
> array.LongLength * sizeof(double) * 1.0 + " Bytes");
> }
> catch (Exception e)
> {
> Console.WriteLine("Exception:" + e);
> Console.WriteLine("Exception:" + e.Message + 
> " allocating :" + index);
> Console.WriteLine("Exception:" + e.Message + 
> " allocating :" + index * sizeof(double));
> }
> }
> }
> }
> 
> However, on mono on Linux it results in:
> 
> index:1073741824
> UInt32.MaxValue: 4294967295
> Exception:System.OutOfMemoryException: Out of memory
>   at (wrapper managed-to-native) 
> object:__icall_wrapper_mono_array_new_specific (intptr,int)
>   at LargeObjectTest.Program.Main (System.String[] args) [0x0] in 
> :0
> Exception:Out of memory allocating :1073741824
> Exception:Out of memory allocating :8589934592
> 
> If I make the following change to override the SIZE_MAX value from 
> /usr/include/stdint.h:
> 
> --- a/mono/metadata/sgen-los.c
> +++ b/mono/metadata/sgen-los.c
> @@ -342,8 +342,12 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t 
> size)
>  *
>  * size <= SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject)
>  */
> +#undef SIZE_MAX
> +#define SIZE_MAX (17179869184U)
> if (size > SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject))
> return NULL;
> +#undef SIZE_MAX
> +#define SIZE_MAX (4294967295U)
> 
>  #ifdef LOS_DUMMY
> if (!los_segment)
> 
> Then the program works as it does under .NET:
> 
> index:1073741824
> UInt32.MaxValue: 4294967295
> doubleArray:LongLength 0 bytes
> sizeof(double) 8 bytes
> index 1073741824
> doubleArray:LongLength 1073741824
> doubleArray:Size 8589934592 Bytes
> 
> The question is, what is the correct value for the comparison in lieu of 
> SIZE_MAX? I can't determine what the max is on .NET. Another question is what 
> type of compacting happens with large objects like this?
> 
> Neale
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Large object size limits

2014-06-13 Thread Neale Ferguson
Yep, this appears to do the trick...

--- a/mono/metadata/sgen-los.c
+++ b/mono/metadata/sgen-los.c
@@ -336,13 +336,13 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t 
size)
g_assert ((size & 1) == 0);
 
/*
-* size + sizeof (LOSObject) <= SIZE_MAX - (mono_pagesize () - 1)
+* size + sizeof (LOSObject) <= SSIZE_MAX - (mono_pagesize () - 1)
 *
 * therefore:
 *
-* size <= SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject)
+* size <= SSIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject)
 */
-   if (size > SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject))
+   if (size > SSIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject))
return NULL;
 
 #ifdef LOS_DUMMY

On Jun 14, 2014, at 4:07 AM, Rodrigo Kumpera  wrote:

> Hi Neale,
> 
> We should change from SIZE_MAX to the max value a ssize_t can hold.
> 
> --
> Rodrigo
> 
> 
> On Thu, Jun 12, 2014 at 4:38 PM, Neale Ferguson  
> wrote:
> The following program runs fine on .NET -
> 
> using System;
> using System.Collections.Generic;
> using System.Runtime;
> using System.Text;
> 
> namespace LargeObjectTest
> {
> class Program
> {
> static void Main(string[] args)
> {
> 
> IList myList = new List();
> 
> 
> long index = 1024*1024*1024;
> 
> Console.WriteLine("index:" + index);
> 
> double[] array = null;
> 
> Console.WriteLine("UInt32.MaxValue: 
> "+UInt32.MaxValue);
> try
> {
> array = new double[index];
> 
> Console.WriteLine("doubleArray:LongLength " + 
> array.Length * sizeof(double) + " bytes");
> Console.WriteLine("sizeof(double) " + 
> sizeof(double) + " bytes");
> Console.WriteLine("index " + index);
> Console.WriteLine("doubleArray:LongLength " + 
> array.LongLength);
> Console.WriteLine("doubleArray:Size " + 
> array.LongLength * sizeof(double) * 1.0 + " Bytes");
> }
> catch (Exception e)
> {
> Console.WriteLine("Exception:" + e);
> Console.WriteLine("Exception:" + e.Message + 
> " allocating :" + index);
> Console.WriteLine("Exception:" + e.Message + 
> " allocating :" + index * sizeof(double));
> }
> }
> }
> }
> 
> However, on mono on Linux it results in:
> 
> index:1073741824
> UInt32.MaxValue: 4294967295
> Exception:System.OutOfMemoryException: Out of memory
>   at (wrapper managed-to-native) 
> object:__icall_wrapper_mono_array_new_specific (intptr,int)
>   at LargeObjectTest.Program.Main (System.String[] args) [0x0] in 
> :0
> Exception:Out of memory allocating :1073741824
> Exception:Out of memory allocating :8589934592
> 
> If I make the following change to override the SIZE_MAX value from 
> /usr/include/stdint.h:
> 
> --- a/mono/metadata/sgen-los.c
> +++ b/mono/metadata/sgen-los.c
> @@ -342,8 +342,12 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t 
> size)
>  *
>  * size <= SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject)
>  */
> +#undef SIZE_MAX
> +#define SIZE_MAX (17179869184U)
> if (size > SIZE_MAX - (mono_pagesize () - 1) - sizeof (LOSObject))
> return NULL;
> +#undef SIZE_MAX
> +#define SIZE_MAX (4294967295U)
> 
>  #ifdef LOS_DUMMY
> if (!los_segment)
> 
> Then the program works as it does under .NET:
> 
> index:1073741824
> UInt32.MaxValue: 4294967295
> doubleArray:LongLength 0 bytes
> sizeof(double) 8 bytes
> index 1073741824
> doubleArray:LongLength 1073741824
> doubleArray:Size 8589934592 Bytes
> 
> The question is, what is the correct value for the comparison in lieu of 
> SIZE_MAX? I can't determine what the max is on .NET. Another question is what 
> type of compacting happens with large objects like this?
> 
> Neale
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] RPM Build Error

2014-08-18 Thread Neale Ferguson
Using the source RPM for openSUSE 12.3 I get the following error:

usr/src/packages/BUILD/mono-3.6.0
+ cp ../../SOURCES/env.sh 
/usr/src/packages/BUILDROOT/mono-opt-3.6.0-1.1.x86_64//opt/mono
cp: cannot stat `../../SOURCES/env.sh': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.abBMdB (%install)

Apparently, the env.sh didn't get put in the source RPM.

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] RPM build

2014-08-18 Thread Neale Ferguson
I copied env.sh from monodevelop and adapted for openSUSE and the build went 
cleanly. However, why does the RPM believe it has these "Requires":

rpm -q --requires -p ../RPMS/x86_64/mono-opt-3.6.0-1.1.x86_64.rpm
:
mono() = 0.0.736.133
mono() = 0.0.738.133
mono() = 0.0.741.133
mono() = 0.0.743.133
:

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] RPM build

2014-08-18 Thread Neale Ferguson
Are you interested in packages for Linux on System z (aka s390x)? 

On Aug 18, 2014, at 5:09 PM, Timotheus Pokorra 
 wrote:

> Hello Neale,
> 
>> I copied env.sh from monodevelop and adapted for openSUSE and the build went 
>> cleanly. However, why does the RPM believe it has these "Requires":
>> 
>> rpm -q --requires -p ../RPMS/x86_64/mono-opt-3.6.0-1.1.x86_64.rpm
>> :
>> mono() = 0.0.736.133
>> mono() = 0.0.738.133
>> mono() = 0.0.741.133
>> mono() = 0.0.743.133
> 
> I don't have an openSUSE machine around at the moment.
> The output on the OBS Server does make sense, but seems to be
> different than your output:
> https://build.opensuse.org/package/binary/home:tpokorra:mono/mono-opt?arch=x86_64&filename=mono-opt-3.6.0-4.1.x86_64.rpm&repository=openSUSE_12.3
> 
> I hope this helps,
>  Timotheus

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] RPM build

2014-08-19 Thread Neale Ferguson
Not personally, but as part of your build process to make a download of the 
s390x RPM available publicly.

On Aug 19, 2014, at 2:29 AM, Timotheus Pokorra 
 wrote:

> Hello Neale,
> 
>> Are you interested in packages for Linux on System z (aka s390x)?
> I can only speak for myself: No
> 
> I just found: 
> http://www.mono-project.com/docs/about-mono/supported-platforms/s390/
> mentioning your name :)
> 
> Timotheus

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] RPM build

2014-08-19 Thread Neale Ferguson
I can provide a buildbot environment or whatever you use to create packages at 
the same time the x86[_64] ones are built.

On Aug 19, 2014, at 10:45 AM, Timotheus Pokorra 
 wrote:

> On 19 August 2014 15:01, Neale Ferguson  wrote:
>> Not personally, but as part of your build process to make a download of the 
>> s390x RPM available publicly.
> I am using the build platform at https://build.opensuse.org/ and
> unfortunately there is no support for s390x build machines at the
> moment.
> 
> This list is a bit outdated:
> http://en.opensuse.org/openSUSE:Build_Service_supported_build_targets
> 
> It mentions s390x, as "tested, but not available".

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] thread6 test

2014-08-19 Thread Neale Ferguson
What should the output of thread6 test look like (apart from "caught" instead 
of "cought")? Here's what I'm getting at the moment - 

Thread 1 started
Count: 0
cought exception level 3
cought exception level 2 STATETEST
System.Threading.ThreadAbortException: Thread was being aborted
  at Tests.ThreadStart1 () [0x00087] in 
/home/neale/mono/mono/tests/thread6.cs:51
cought exception level 1
System.Threading.ThreadAbortException: Thread was being aborted
  at Tests.ThreadStart1 () [0x00087] in 
/home/neale/mono/mono/tests/thread6.cs:51
end
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] thread6 test

2014-08-19 Thread Neale Ferguson
Thanks, my test times out but the output looks like it should. 

On Aug 19, 2014, at 4:17 PM, Rodrigo Kumpera  wrote:

> Thread 1 started
> 
> Count: 0
> 
> cought exception level 3 
> 
> cought exception level 2 STATETEST
> 
> System.Threading.ThreadAbortException: Thread was being aborted
> 
>   at Tests.ThreadStart1 () [0x00087] in 
> /Users/kumpera/src/mono/mono/tests/thread6.cs:51 
> 
> cought exception level 1 
> 
> System.Threading.ThreadAbortException: Thread was being aborted
> 
>   at Tests.ThreadStart1 () [0x00087] in 
> /Users/kumpera/src/mono/mono/tests/thread6.cs:51 
> 
> end
> 
> Regression tests: 6 ran, 0 failed in Tests
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] OracleClient.Oci and GC

2014-08-21 Thread Neale Ferguson
I've been looking at OciDefineHandle and the OciDefineByPos call it uses in 
particular. Currently two of the parameters passed to this call are short 
variables. They are passed as "ref" fields as Oracle uses their address to put 
size and indicator data once the data is fetched. However, being defined as 
short means that they are eligible for being moved during garbage collection. 
Thus if that field is moved between the OciDefineByPos call and the fetch of 
the data then what Oracle is pointing to may no longer be variable. I'm 
thinking it may be better to define these fields as IntPtr and allocate them 
and retrieve their values via Marshal.ReadInt16. I'm currently testing these 
changes and so far I'm not getting the failures I had been encountering. If 
this is a valid analysis then the OciBind calls will also need attention as 
it uses a ref indp parameter as well - these appear to be used in 
OracleParameter.cs. 

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-22 Thread Neale Ferguson
I am also wondering about the parameters in some of the OCIBind methods and 
the OCIDefineByPosPtr that are "ref IntPtr". There's a small window when GC 
could suspend the thread where the IntPtr object is also moved before the OCI 
call has completed and set the underlying IntPtr field.

On Aug 21, 2014, at 9:48 PM, Miguel de Icaza  wrote:

> Hello,
> 
> Wanted to follow up to Neale's comment, as he clarified an important point 
> that I overlooked.
> 
> There are two ref parameters that are being passed to unmanaged code, both 
> point to fields inside the OciDefineHandle managed type.   
> 
> Neale's analysis is correct: the object might move and with it, the two short 
> variables that were passed to OciDefineByPos.   This would explain the 
> crashes that developers are experiencing with the OracleClient provider and 
> Sgen.
> 
> The proposed fix is one possible solution: to allocate the values outside of 
> the managed heap for both the short values.
> 
> There is another suspicious use that we should look into.  The OciDefineByPos 
> method is actually a set of overloaded methods, with different types for the 
> "value" parameter.It is often a handle that is usually allocated via an 
> unmanaged API.   But there are a few troubling uses:
> ref value: used in DefineTimeStamp
> ref value: when passing the reference to a Handle defined in a separate 
> class, DefineLob, DefineInterval
> The above does not look very easy to fix.
> 
> Given that these are resources that should be explicitly disposed, perhaps 
> what we should do is allocate a GCHandle for the OciDefineHandle object (from 
> OciStatementHandle, the one place that creates these objects) and also create 
> GCHandles for the objects that we use their Handle fields from (in 
> DefineTimeStamp, DefineLob, DefineInterval) and release the GCHandles in the 
> respective Dispose methods.
> 
> Miguel
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-22 Thread Neale Ferguson
Is that just a comment on my ref IntPtr question or the use of ref with the 
OCI stuff in general?

On Aug 22, 2014, at 10:45 AM, Rodrigo Kumpera  wrote:

> Mono does conservative scanning of the native stack, so once the pointer has 
> crossed over to native, the containing object will remain pinned.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-22 Thread Neale Ferguson
Thanks. I've made changes to OciDefineHandle and have cured nearly all the 
failures I had been experiencing. I have started on OracleParameter as it has 
an object called indicator that is used by the OCIBindxxx calls and appears to 
suffer from the same problem. I was allocating the object in native memory in 
the constructors and was going to free them in a destructor. However, in my 
test runs I see I'm allocating 1200+ objects but only freeing ~900. Would you 
elaborate on your final comment "failing to dispose..." as I'm reading this as 
I don't need to Marshal.FreeHGlobal() the object I allocated in the 
constructors.

Neale

On Aug 22, 2014, at 11:31 AM, Rodrigo Kumpera  wrote:

> Hey Neale,
> 
> You can safely pass interior pointers to pinvoke without fearing the object 
> been collected for the duration of the call.
> Mind that you have to correctly use specify in/out/ref depending on the copy 
> semantics you need.
> 
> Problems only arise when native keeps that pointer after the call finishes, 
> this can result in the object been moved
> as the GC has no visibility into the native heap.
> 
> For those cases you can either create a pinning GC handle to the victim 
> object or you can allocate a chunk of native
> memory that will be shared between managed and native to store the desired 
> value. Both options suck, TBH.
> 
> I'd say go with the native chunk of code if you can't lexically scope the 
> pinning regions, it will be more reliable as
> failing to dispose the object won't lead to permanent leaks.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-25 Thread Neale Ferguson
I implemented a Dispose method for OracleParameter:

~OracleParameter ()
{
Dispose(false);
}

public void Dispose ()
{
Dispose (true);
}

void Dispose (bool disposing)
{
if (disposing) {
GC.SuppressFinalize(this);
}
if (indicator != IntPtr.Zero) {
Marshal.FreeHGlobal (indicator);
indicator = IntPtr.Zero;
}
}

However, when I run the test program I see 1251 constructors being run but only 
572 destructors/disposals. How do I reconcile this disparity?

Neale

On Aug 22, 2014, at 11:40 AM, Neale Ferguson  wrote:

> Thanks. I've made changes to OciDefineHandle and have cured nearly all the 
> failures I had been experiencing. I have started on OracleParameter as it has 
> an object called indicator that is used by the OCIBindxxx calls and appears 
> to suffer from the same problem. I was allocating the object in native memory 
> in the constructors and was going to free them in a destructor. However, in 
> my test runs I see I'm allocating 1200+ objects but only freeing ~900. Would 
> you elaborate on your final comment "failing to dispose..." as I'm reading 
> this as I don't need to Marshal.FreeHGlobal() the object I allocated in the 
> constructors.
> 
> Neale
> 
> On Aug 22, 2014, at 11:31 AM, Rodrigo Kumpera  wrote:
> 
>> Hey Neale,
>> 
>> You can safely pass interior pointers to pinvoke without fearing the object 
>> been collected for the duration of the call.
>> Mind that you have to correctly use specify in/out/ref depending on the copy 
>> semantics you need.
>> 
>> Problems only arise when native keeps that pointer after the call finishes, 
>> this can result in the object been moved
>> as the GC has no visibility into the native heap.
>> 
>> For those cases you can either create a pinning GC handle to the victim 
>> object or you can allocate a chunk of native
>> memory that will be shared between managed and native to store the desired 
>> value. Both options suck, TBH.
>> 
>> I'd say go with the native chunk of code if you can't lexically scope the 
>> pinning regions, it will be more reliable as
>> failing to dispose the object won't lead to permanent leaks.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-25 Thread Neale Ferguson
Do you mean mine not having protected virtual? 

On Aug 25, 2014, at 2:00 PM, Jonathan Pryor  wrote:

> Idiomatic IDisposable implementation is slightly different from what you have:
> 
>   
> http://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] OracleClient.Oci and GC

2014-08-26 Thread Neale Ferguson
Yeah, it is a sealed class which is why I didn't do protected virtual, so I'm 
wondering to what your initial remark referred: "Idiomatic IDisposable 
implementation is slightly different from what you have." 

On Aug 26, 2014, at 1:09 AM, Jonathan Pryor  wrote:

> On Aug 25, 2014, at 2:05 PM, Neale Ferguson  wrote:
>> Do you mean mine not having protected virtual? 
> 
> Dispose(bool) doesn't need to be `protected virtual` unless you plan on 
> supporting inheritance.
> 
> Rephrased: if your type is sealed, it doesn't need to be `protected virtual`. 
> If your type *isn't* sealed, your type probably should provide a `protected 
> virtual void Dispose(bool disposing)`.
> 
> - Jon
> 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] spec file changes to enable RH builds

2014-09-29 Thread Neale Ferguson
A couple of changes needed in order to enable building on RHEL and CentOS 6/7 - 

libgdiplus0:

--- a/libgdiplus0.spec.in
+++ b/libgdiplus0.spec.in
@@ -16,14 +16,19 @@ Provides:   libgdiplus
 
 BuildRequires:  cairo-devel >= 1.6.4
 BuildRequires:  fontconfig-devel
-BuildRequires:  freetype2-devel
 BuildRequires:  giflib-devel
 BuildRequires:  glib2-devel
 BuildRequires:  libexif-devel
 BuildRequires:  libjpeg-devel
 BuildRequires:  libpng-devel
 BuildRequires:  libtiff-devel
+%if 0%{?suse_version}
 BuildRequires:  xorg-x11-libXrender-devel
+BuildRequires:  freetype2-devel
+%else
+BuildRequires:  libXrender-devel
+BuildRequires:  freetype-devel
+%endif
 
 %description
 This is part of the Mono project. It is required when using

mono:

--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -4,6 +4,9 @@
 
 %ifnarch %ix86 x86_64
 %define llvm no
+%endif
+
+%ifnarch %ix86 x86_64 s390x
 %define sgen no
 %endif
 
@@ -16,10 +19,14 @@ Version:@VERSION@
 Release:0
 Source0:mono-%{version}.tar.bz2
 BuildRequires:  bison
+%if 0%{?suse_version}
 BuildRequires:  fdupes
+BuildRequires:  xorg-x11-libX11-devel
+%else
+BuildRequires: libX11-devel
+%endif
 BuildRequires:  gcc-c++
 BuildRequires:  pkgconfig
-BuildRequires:  xorg-x11-libX11-devel
 BuildRequires:  zlib-devel
 %ifnarch ia64
 BuildRequires:  valgrind-devel
@@ -48,7 +55,9 @@ Conflicts:  banshee < 1.0
 Conflicts:  f-spot < 0.4
 Conflicts:  helix-banshee < 1.0
 Conflicts:  mono-addins < 0.3.1
+%if 0%{?suse_version}
 Recommends: libgdiplus0 >= 2.6
+%endif
 %if %llvm == yes
 Recommends: libmono-llvm0 = %{version}-%{release}

+%endif
 %if %llvm == yes
 Recommends: libmono-llvm0 = %{version}-%{release}
 %endif
@@ -92,6 +101,7 @@ export CFLAGS=" $RPM_OPT_FLAGS -fno-strict-aliasing"
 export PATH=/opt/novell/llvm-mono/bin:$PATH
 %endif
 %configure \
+  --target=%{_host} \
   --with-sgen=%{sgen} \
 %if %llvm == yes
   --enable-loadedllvm \
@@ -104,6 +114,7 @@ export PATH=/opt/novell/llvm-mono/bin:$PATH
   --with-moonlight=no
 #make # We are not -jN safe! %{?jobs:-j%jobs}
 # We are now !
+make get-monolite-latest
 make %{?_smp_mflags}
 
 %install
@@ -130,7 +141,9 @@ rm -f %buildroot%_prefix/lib/mono/2.0/cilc.exe*
 ln -s . %buildroot%_prefix%_prefix
 RPM_BUILD_ROOT=%buildroot%_prefix /usr/lib/rpm/brp-compress
 rm %buildroot%_prefix%_prefix
+%if 0%{?suse_version}
 %fdupes %buildroot%_prefix
+%endif
 %find_lang mcs
 
 %clean



___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] gc

2014-10-17 Thread Neale Ferguson
Hi,
 We were helping someone who was having performance problems with a large
streaming application that they run under .NET and mono. On .NET the app
takes around 7-10 seconds to do its stuff. On Mono on Linux it was taking
47 seconds or so to do the same thing. The mono system had 256G RAM and 48
cores. When they used Mono on Windows the figure was back to around 7
seconds. We suggested they use MONO_GC_DEBUG to try and determine where
they were spending time. It turns out that the old generation scan was
responsible for nearly all of the difference between the runs (i.e. around
40 seconds). How (or does) does the sgen gc differ under Windows to Linux?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Build problems

2015-02-18 Thread Neale Ferguson
Over the last couple of days I’ve had problems building from head on
s390x. 

(1) When I use 3.6.1 I get:

MCS [basic] mscorlib.dll
warning CS2002: Source file
`../../../external/referencesource/mscorlib/system/globalization/bidicatego
ry.cs' specified multiple times
warning CS2002: Source file
`../../../external/referencesource/mscorlib/system/globalization/charunicod
einfo.cs' specified multiple times
warning CS2002: Source file
`../../../external/referencesource/mscorlib/system/globalization/globalizat
ionassembly.cs' specified multiple times
../../../external/referencesource/mscorlib/system/collections/compatiblecom
parer.cs(23,25): warning CS1635: Cannot restore warning `CS0618' because
it was disabled globally
../../../external/referencesource/mscorlib/system/collections/compatiblecom
parer.cs(67,25): warning CS1635: Cannot restore warning `CS0618' because
it was disabled globally
../../../external/referencesource/mscorlib/system/collections/hashtable.cs(
1206,25): warning CS1635: Cannot restore warning `CS0618' because it was
disabled globally
../../../external/referencesource/mscorlib/system/collections/hashtable.cs(
1244,25): warning CS1635: Cannot restore warning `CS0618' because it was
disabled globally
../../../external/referencesource/mscorlib/system/collections/hashtable.cs(
1270,25): warning CS1635: Cannot restore warning `CS0618' because it was
disabled globally
../../../external/referencesource/mscorlib/system/threading/Tasks/TaskSched
uler.cs(50,25): warning CS1635: Cannot restore warning `CS0618' because it
was disabled globally
System/TimeZoneInfo.cs(1414,30): warning CS0219: The variable
`ambiguousStartModified' is assigned but its value is never used
System/TimeZoneInfo.cs(1415,30): warning CS0219: The variable
`ambiguousEndModified' is assigned but its value is never used
../../../external/referencesource/mscorlib/system/text/asciiencoding.cs(502
,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/text/asciiencoding.cs(683
,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/text/unicodeencoding.cs(4
93,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/text/unicodeencoding.cs(4
93,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/text/unicodeencoding.cs(7
77,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/text/unicodeencoding.cs(7
77,21): error CS0165: Use of unassigned local variable `ch'
../../../external/referencesource/mscorlib/system/threading/Tasks/Parallel.
cs(125,21): warning CS0472: The result of comparing value type
`System.Threading.CancellationToken' with null is always `false'
../../../external/referencesource/mscorlib/system/threading/Tasks/Parallel.
cs(126,21): warning CS0162: Unreachable code detected
Compilation failed: 6 error(s), 10 warnings


The code looks correct in those files, it appears to be a compiler error.
I tried initializing the variable ch but that results in a different
problem.

(2) When I use monolite-latest things go bizarre and appear endian-related:

/home/neale/Mono/mono/mcs/class/lib/monolite/basic.exe:
/home/neale/Mono/mono/mcs/class/lib/monolite/basic.exe: cannot execute
binary file
make[6]: *** [build/deps/basic-profile-check.exe] Error 126
*** The compiler '/home/neale/Mono/mono/mcs/class/lib/monolite/basic.exe'
doesn't appear to be usable.
*** Trying the 'monolite' directory.
.miudlc/moom/nabis-crpfoli-ehcce.ksc1(0,:)e rrroC 1S25:5U
enpxceet dysbmlo` suinSy'
'miudlc/moom/nabis-crpfoli-ehcce.ksc2(,535:)e rrroC 1S10:0N
weileni  nocsnattn
nmiudlc/moom/nabis-crpfoli-ehcce.ksc2(,632:)e rrroC 1S10:0N
weileni  nocsnattn
nmiudlc/moom/nabis-crpfoli-ehcce.ksc3(,9)4 :reor rSC5098
:nIetnrlac moipel rreor rudirgnp raisgnyStsmeF.roamEtcxpeitno :nUnkwo
nhcra 
a  tyStsmeD.uolb.eaPsr eS(syet.mtSirgns  ,uNbmretSlyses ytel
,FIroamPtorived rrpvodire )0[0x ]ni< ifelanemu knonnw:> 0
a  toMonC.hSra.poTekinez.rdaujtsr_ae lT(pyCedo e,tL cotaoi nol)c[
x0]0i  nfn0:
   taM no.oSCahprT.konezirei._sunbmre( nI3t 2,cB ooelnad toeLda )0[0x
]ni< ifelanemu knonnw:> 0
a  toMonC.hSra.poTekinez.rtxkone(  )0[0x ]ni< ifelanemu knonnw:> 0
a  toMonC.hSra.poTekinez.rotek n)([ x0]0i  nfn0:
   taM no.oSCahprC.hSraPpraes.ryyapsr ey(Iypntuy Lyxe )0[0x ]ni<
ifelanemu knonnw:> 0
a  toMonC.hSra.pSCahpraPsrrep.raes(  )0[0x ]ni< ifelanemu knonnw:> 0
Copmlitaoi naflide : 4reor(r)s , 0awnrings

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Endian problem - #27258

2015-02-27 Thread Neale Ferguson
This appears to solve the problem I reported that was causing build
problems on s390x (big-endian). I get a clean build at least, and the
tests in mono/mini & mono/tests pass. I'm sure it is suboptimal (it seems
that a generic method might be an option) but it illustrates what needs
doing:

--- a/mscorlib/system/globalization/charunicodeinfo.cs
+++ b/mscorlib/system/globalization/charunicodeinfo.cs
@@ -109,6 +109,54 @@ namespace System.Globalization {
 internal sbyte digit;
 }

+unsafe private static int EndianSwap(int value)
+{
+if (!BitConverter.IsLittleEndian) {
+byte *ptr = (byte *) &value;
+int res;
+byte *buf = (byte *) &res;
+int t = sizeof(int) - 1;
+
+for (int i = 0; i < sizeof(int); i++)
+buf[t-i] = ptr[i];
+
+return(res);
+} else
+return(value);
+}
+
+unsafe private static uint EndianSwap(uint value)
+{
+if (!BitConverter.IsLittleEndian) {
+byte *ptr = (byte *) &value;
+uint res;
+byte *buf = (byte *) &res;
+uint t = sizeof(uint) - 1;
+
+for (uint i = 0; i < sizeof(uint); i++)
+buf[t-i] = ptr[i];
+
+return(res);
+} else
+return(value);
+}
+
+unsafe private static ushort EndianSwap(ushort value)
+{
+if (!BitConverter.IsLittleEndian) {
+byte *ptr = (byte *) &value;
+ushort res;
+byte *buf = (byte *) &res;
+ushort t = sizeof(ushort) - 1;
+
+for (ushort i = 0; i < sizeof(ushort); i++)
+buf[t-i] = ptr[i];
+
+return(res);
+} else
+return(value);
+}
+

 //We need to allocate the underlying table that provides us with
the
information that we
 //use.  We allocate this once in the class initializer and then we
don't need to worry
@@ -125,11 +173,11 @@ namespace System.Globalization {
 UnicodeDataHeader* mainHeader =
(UnicodeDataHeader*)pDataTable;

 // Set up the native pointer to different part of the tables.
-s_pCategoryLevel1Index = (ushort*) (pDataTable +
mainHeader->OffsetToCategoriesIndex);
-s_pCategoriesValue = (byte*) (pDataTable +
mainHeader->OffsetToCategoriesValue);
-s_pNumericLevel1Index = (ushort*) (pDataTable +
mainHeader->OffsetToNumbericIndex);
-s_pNumericValues = (byte*) (pDataTable +
mainHeader->OffsetToNumbericValue);
-s_pDigitValues = (DigitValues*) (pDataTable +
mainHeader->OffsetToDigitValue);
+s_pCategoryLevel1Index = (ushort*) (pDataTable +
EndianSwap(mainHeader->OffsetToCategoriesIndex));
+s_pCategoriesValue = (byte*) (pDataTable +
EndianSwap(mainHeader->OffsetToCategoriesValue));
+s_pNumericLevel1Index = (ushort*) (pDataTable +
EndianSwap(mainHeader->OffsetToNumbericIndex));
+s_pNumericValues = (byte*) (pDataTable +
EndianSwap(mainHeader->OffsetToNumbericValue));
+s_pDigitValues = (DigitValues*) (pDataTable +
EndianSwap(mainHeader->OffsetToDigitValue));

 return true;
 }
@@ -254,11 +302,11 @@ namespace System.Globalization {
 internal unsafe static double InternalGetNumericValue(int ch) {
 Contract.Assert(ch >= 0 && ch <= 0x10, "ch is not in valid
Unicode range.");
 // Get the level 2 item from the highest 12 bit (8 - 19) of
ch.
-ushort index = s_pNumericLevel1Index[ch >> 8];
+ushort index = EndianSwap(s_pNumericLevel1Index[ch >> 8]);
 // Get the level 2 WORD offset from the 4 - 7 bit of ch.  This
provides the base offset of the level 3 table.
 // The offset is referred to an float item in
m_pNumericFloatData.
 // Note that & has the lower precedence than addition, so
don't
forget the parathesis.
-index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)];
+index = EndianSwap(s_pNumericLevel1Index[index + ((ch >> 4) &
0x000f)]);
 byte* pBytePtr = (byte*)&(s_pNumericLevel1Index[index]);
 // Get the result from the 0 -3 bit of ch.
 #if WIN64
@@ -448,12 +496,13 @@ namespace System.Globalization {

 [System.Security.SecuritySafeCritical]  // auto-generated
 internal unsafe static byte InternalGetCategoryValue(int ch, int
offset) {
+
 Contract.Assert(ch >= 0 && ch <= 0x10, "ch is not in valid
Unicode range.");
 // Get the level 2 item from the highest 12 bit (8 - 19) of
ch.
-ushort index = s_pCategoryLevel1Index[ch >> 8];
+ushort index = EndianSwap(s_pCategoryLevel1Index[ch >> 8]);
 // Get t

[Mono-dev] NRE building from head

2015-03-05 Thread Neale Ferguson
I cloned from head yesterday and am now crashing in
IKVM.Reflection.TypeName.GetHashCode with a NRE. Does this look familiar?
Before the clone, the copy I was using was up to date as of Monday and it
was working. I recloned just to have a clean slate after Atushi committed
my endian fixes for the reference sources.

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of
an object
  at IKVM.Reflection.TypeName.GetHashCode () [0x0] in :0 
  at 
System.Collections.Generic.GenericEqualityComparer`1[IKVM.Reflection.TypeNa
me].GetHashCode (TypeName obj) [0x0] in :0
  at 
System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Refle
ction.Type].Insert (TypeName key, IKVM.Reflection.Type value, Boolean add)
[0x0] in :0
  at 
System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Refle
ction.Type].Add (TypeName key, IKVM.Reflection.Type value) [0x0] in
:0
  at IKVM.Reflection.Reader.ModuleReader.PopulateTypeDef () [0x0] in
:0
  at IKVM.Reflection.Reader.ModuleReader.FindType (TypeName typeName)
[0x0] in :0
  at IKVM.Reflection.Reader.AssemblyReader.FindType (TypeName typeName)
[0x0] in :0
  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean
throwOnError, Boolean ignoreCase) [0x0] in :0
  at IKVM.Reflection.Assembly.GetType (System.String name, Boolean
throwOnError) [0x0] in :0
  at IKVM.Reflection.Assembly.GetType (System.String name) [0x0] in
:0
  at Mono.CSharp.StaticImporter.InitializeBuiltinTypes
(Mono.CSharp.BuiltinTypes builtin, IKVM.Reflection.Assembly corlib)
[0x0] in :0
  at Mono.CSharp.StaticLoader.LoadReferences (Mono.CSharp.ModuleContainer
module) [0x0] in :0
  at Mono.CSharp.Driver.Compile () [0x0] in :0
  at Mono.CSharp.Driver.Main (System.String[] args) [0x0] in :0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object
reference not set to an instance of an object

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] NRE building from head

2015-03-09 Thread Neale Ferguson
I am still trying to track down the build NRE for s390x.

I put in a couple of displays in GetHashCode() and in the method that sets
the ns and name variables. I found that the crash is occurring as the
WindowsRuntimeProjection constructor is running. It gets to the point of:

projections.Add(new TypeName("Windows.Foundation",
"EventRegistrationToken"), new
Mapping(ProjectionAssembly.System_Runtime_InteropServices_WindowsRuntime,
"System.Runtime.InteropServices.WindowsRuntime",
"EventRegistrationToken"));


Note when TypeName(ns, name) is invoked it shows these strings:
ns: Windows.Foundation name: EventRegistrationToken

However, when we get to GetHashCode() I attempt to display the values ns
and name again. I had to simply do a null test for name as if I attempt to
use its value I get an NRE (again, this only happens for this invocation):

ns: Windows.Foundation
name: not null

Interestingly, if I add this to WindowsRuntimeProjection()

Console.Error.WriteLine("WindowsRuntimeProjection - {0} {1} {2}",
ProjectionAssembly.System_Runtime,
ProjectionAssembly.System_Runtime_InteropServices_WindowsRuntime,
ProjectionAssembly.Count);


I get:

WindowsRuntimeProjection - System_Runtime 1 5


Seeing this, I changed the order of projection.Add statements such that
the Interop one happened after an add of System_Runtime_WindowsRuntime,
and the crash then occurred when it encountered the first of these. That
is, everything with ProjectionAssembly.System_Runtime is successfully
added but the first time a non-System_Runtime is encountered the crash
occurs.

So I changed the order of things in the enum ProjectionAssembly and only
the one declared first in the enum gets printed out as a name and not an
integer. For example, I made System_Runtime the third entry and then got:

WindowsRuntimeProjection - 2 System_Runtime_InteropServices_WindowsRuntime
5


I do not know the significance of this, but it also results in a crash
when the first projection.Add of a System_Runtime entry is processed.
Which source file contains the Dictionary Add processing? I wonder if
there is some little endian/big endian issue here as 0 index would never
be a problem but non-zero would.

Here is the original exception message (without my above changes:

Unhandled Exception:
Mono.CSharp.InternalErrorException:
Microsoft.Win32/RegistryKeyPermissionCheck.cs(31,21): Microsoft.Win32 --->
Mono.CSharp.InternalErrorException:
Microsoft.Win32/RegistryKeyPermissionCheck.cs(33,14):
Microsoft.Win32.RegistryKeyPermissionCheck --->
System.TypeInitializationException: An exception was thrown by the type
initializer for IKVM.Reflection.WindowsRuntimeProjection --->
System.NullReferenceException: Object reference not set to an instance of
an object
  at IKVM.Reflection.TypeName.GetHashCode () [0x0] in :0 
  at 
System.Collections.Generic.GenericEqualityComparer`1[IKVM.Reflection.TypeNa
me].GetHashCode (TypeName obj) [0x0] in :0
  at 
System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Refle
ction.WindowsRuntimeProjection+Mapping].Insert (TypeName key,
IKVM.Reflection.Mapping value, Boolean add) [0x0] in :0 
  at 
System.Collections.Generic.Dictionary`2[IKVM.Reflection.TypeName,IKVM.Refle
ction.WindowsRuntimeProjection+Mapping].Add (TypeName key,
IKVM.Reflection.Mapping value) [0x0] in :0
  at IKVM.Reflection.WindowsRuntimeProjection..cctor () [0x0] in
:0



On 3/5/15, 10:28 AM, "Neale Ferguson"  wrote:

>I cloned from head yesterday and am now crashing in
>IKVM.Reflection.TypeName.GetHashCode with a NRE. Does this look familiar?
>Before the clone, the copy I was using was up to date as of Monday and it
>was working. I recloned just to have a clean slate after Atushi committed
>my endian fixes for the reference sources.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Strange enum issue

2015-03-10 Thread Neale Ferguson
Thanks! This is a good starting point.

On 3/10/15, 3:01 PM, "Robert Jordan"  wrote:

>There was a recent commit which added MS' reference source Enum
>support to Mono:
>
>https://github.com/mono/mono/commit/65dba595eaea2c871d1f72fbdc04f6440350af
>96
>
>Maybe it's an endian-related issue.
>
>Robert

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Strange enum issue

2015-03-10 Thread Neale Ferguson
Definitely the problem:

ves_icall_System_Enum_GetEnumValuesAndNames.3229: 0. field=System_Runtime
value=0
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 1.
field=System_Runtime_InteropServices_WindowsRuntime value=16777216
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 2.
field=System_ObjectModel value=33554432
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 3.
field=System_Runtime_WindowsRuntime value=50331648
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 4.
field=System_Runtime_WindowsRuntime_UI_Xaml value=67108864
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 5. field=Count
value=83886080

Note 16777216 is hex 1000. Now to find out how that value gets placed
there and to do some byte swapping on it.


Neale

P.S. I am wondering if it would be worth it to create a routine or more in
icall.c to do the byte swap for 2/4/8 byte integers rather than coding up
clumsy stuff in managed code.

On 3/10/15, 3:01 PM, "Robert Jordan"  wrote:

>There was a recent commit which added MS' reference source Enum
>support to Mono:
>
>https://github.com/mono/mono/commit/65dba595eaea2c871d1f72fbdc04f6440350af
>96
>
>Maybe it's an endian-related issue.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Strange enum issue

2015-03-10 Thread Neale Ferguson
No, I think the change here is germane:

- switch (mono_class_enum_basetype (enumc)->type) {
- case MONO_TYPE_U1:
- case MONO_TYPE_I1:
- mono_array_set (info->values, gchar, j, *p);
- break;
- case MONO_TYPE_CHAR:
- case MONO_TYPE_U2:
- case MONO_TYPE_I2:
- mono_array_set (info->values, gint16, j, read16 (p));
- break;
- case MONO_TYPE_U4:
- case MONO_TYPE_I4:
- mono_array_set (info->values, gint32, j, read32 (p));
- break;
- case MONO_TYPE_U8:
- case MONO_TYPE_I8:
- mono_array_set (info->values, gint64, j, read64 (p));
- break;
- default:
- g_error ("Implement type 0x%02x in get_enum_info", mono_class_enum_basetype 
(enumc)->type);
- }
+
+ field_value = read_enum_value (p, base_type);
+ mono_array_set (*values, guint64, j, field_value);
+
+ if (previous_value > field_value)
+ sorted = FALSE;
+
+ previous_value = field_value;

Note the use of read16/read32/read64 which are defined in mono-endian.h:


#define read16(x) GUINT16_FROM_LE (*((const guint16 *) (x)))

#define read32(x) GUINT32_FROM_LE (*((const guint32 *) (x)))

#define read64(x) GUINT64_FROM_LE (*((const guint64 *) (x)))


From: Marek Safar mailto:marek.sa...@gmail.com>>
Date: Tuesday, March 10, 2015 at 1:44 PM
To: Neale Ferguson mailto:ne...@sinenomine.net>>
Cc: Mono-Devel 
mailto:mono-devel-list@lists.ximian.com>>
Subject: Re: [Mono-dev] Strange enum issue

Hi Neale,

ves_icall_System_Enum_GetEnumValuesAndNames.3229: 0. field=System_Runtime
value=0
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 1.
field=System_Runtime_InteropServices_WindowsRuntime value=16777216
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 2.
field=System_ObjectModel value=33554432
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 3.
field=System_Runtime_WindowsRuntime value=50331648
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 4.
field=System_Runtime_WindowsRuntime_UI_Xaml value=67108864
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 5. field=Count
value=83886080

Note 16777216 is hex 1000. Now to find out how that value gets placed
there and to do some byte swapping on it.

You are probably looking for 
https://github.com/mono/mono/blob/master/mono/metadata/icall.c#L2961. There has 
been no endian changes there for years but due to different codepath this is 
now hit more often before.

Marek

P.S. I am wondering if it would be worth it to create a routine or more in
icall.c to do the byte swap for 2/4/8 byte integers rather than coding up
clumsy stuff in managed code.

On 3/10/15, 3:01 PM, "Robert Jordan" mailto:robe...@gmx.net>> 
wrote:

>There was a recent commit which added MS' reference source Enum
>support to Mono:
>
>https://github.com/mono/mono/commit/65dba595eaea2c871d1f72fbdc04f6440350af
>96
>
>Maybe it's an endian-related issue.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com<mailto:Mono-devel-list@lists.ximian.com>
http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Strange enum issue

2015-03-10 Thread Neale Ferguson
I changed the read_enum_value function to do the swaps and rebuilt. Now the 
Console.Error.WriteLine() in WindowsRuntimeProjection() produces:

WindowsRuntimeProjection - System_Runtime 
System_Runtime_InteropServices_WindowsRuntime Count

Which is what is expected. However, I’m still crashing with NRE later in the 
build:


Unhandled Exception:

Mono.CSharp.InternalErrorException: 
Microsoft.Win32/RegistryKeyPermissionCheck.cs(31,21): Microsoft.Win32 ---> 
Mono.CSharp.InternalErrorException: 
Microsoft.Win32/RegistryKeyPermissionCheck.cs(33,14): 
Microsoft.Win32.RegistryKeyPermissionCheck ---> 
System.TypeInitializationException: An exception was thrown by the type 
initializer for IKVM.Reflection.WindowsRuntimeProjection ---> 
System.NullReferenceException: Object reference not set to an instance of an 
object

  at IKVM.Reflection.TypeName.GetHashCode ()<0x2000800c398 + 0x001bc> in 
:0


Hi Neale,

ves_icall_System_Enum_GetEnumValuesAndNames.3229: 0. field=System_Runtime
value=0
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 1.
field=System_Runtime_InteropServices_WindowsRuntime value=16777216
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 2.
field=System_ObjectModel value=33554432
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 3.
field=System_Runtime_WindowsRuntime value=50331648
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 4.
field=System_Runtime_WindowsRuntime_UI_Xaml value=67108864
ves_icall_System_Enum_GetEnumValuesAndNames.3229: 5. field=Count
value=83886080

Note 16777216 is hex 1000. Now to find out how that value gets placed
there and to do some byte swapping on it.

You are probably looking for 
https://github.com/mono/mono/blob/master/mono/metadata/icall.c#L2961. There has 
been no endian changes there for years but due to different codepath this is 
now hit more often before.

Marek

P.S. I am wondering if it would be worth it to create a routine or more in
icall.c to do the byte swap for 2/4/8 byte integers rather than coding up
clumsy stuff in managed code.

On 3/10/15, 3:01 PM, "Robert Jordan" mailto:robe...@gmx.net>> 
wrote:

>There was a recent commit which added MS' reference source Enum
>support to Mono:
>
>https://github.com/mono/mono/commit/65dba595eaea2c871d1f72fbdc04f6440350af
>96
>
>Maybe it's an endian-related issue.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Proposed endian optimization - s390x

2015-03-11 Thread Neale Ferguson
Hi,
 I am proposing the following changes to mono-endian.h to optimize
little-endian to big-endian processing for s390x. The architecture defines
instructions for just this purpose so instead of doing shifts etc. we can
just do this:

--- a/mono/metadata/mono-endian.h
+++ b/mono/metadata/mono-endian.h
@@ -14,7 +14,49 @@ typedef union {
unsigned char cval [8];
 } mono_rdouble;
 
-#if NO_UNALIGNED_ACCESS
+#if defined(__s390x__)
+
+#define read16(x)  s390x_read16(*(guint16 *)(x))
+#define read32(x)  s390x_read32(*(guint32 *)(x))
+#define read64(x)  s390x_read64(*(guint64 *)(x))
+
+static __inline__ guint16
+s390x_read16(guint16 x)
+{
+   guint16 ret;
+
+   __asm__ ("  lrvr%0,%1\n"
+"  sra %0,16\n"
+: "=r" (ret) : "r" (x));
+
+   return(ret);
+}
+
+static __inline__ guint32
+s390x_read32(guint32 x)
+{
+   guint32 ret;
+
+   __asm__ ("  lrvr%0,%1\n"
+: "=r" (ret) : "r" (x));
+
+   return(ret);

+}
+
+static __inline__ guint64
+s390x_read64(guint64 x)
+{
+   guint64 ret;
+
+   __asm__ ("  lrvgr   %0,%1\n"
+: "=r" (ret) : "r" (x));
+
+   return(ret);
+}
+
+#else
+
+# if NO_UNALIGNED_ACCESS
 
 guint16 mono_read16 (const unsigned char *x);
 guint32 mono_read32 (const unsigned char *x);
@@ -24,12 +66,14 @@ guint64 mono_read64 (const unsigned char *x);
 #define read32(x) (mono_read32 ((const unsigned char *)(x)))
 #define read64(x) (mono_read64 ((const unsigned char *)(x)))
 
-#else
+# else
 
 #define read16(x) GUINT16_FROM_LE (*((const guint16 *) (x)))
 #define read32(x) GUINT32_FROM_LE (*((const guint32 *) (x)))
 #define read64(x) GUINT64_FROM_LE (*((const guint64 *) (x)))
 
+# endif
+
 #endif
 
 #define readr4(x,dest) \


Any objections?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Strange enum issue

2015-03-12 Thread Neale Ferguson
I really need some advice or direction on this…

If I make the following change to external/ikvm/reflect/Projection.cs:

--- a/reflect/Projection.cs
+++ b/reflect/Projection.cs
@@ -71,11 +71,17 @@ namespace IKVM.Reflection
 
static WindowsRuntimeProjection()
{
+Console.Error.WriteLine("WindowsRuntimeProjection - {0} {1} {2}",
+ProjectionAssembly.System_Runtime,
+ProjectionAssembly.System_Runtime_InteropServices_WindowsRuntime,
+ProjectionAssembly.Count);

and build and use it on x86_64 it will output:

WindowsRuntimeProjection - System_Runtime
System_Runtime_InteropServices_WindowsRuntime Count

However, on s390x it outputs:

WindowsRuntimeProjection - System_Runtime 1 5

I'm trying to work out why there is this difference and whether it is
responsible for a crash later during the build process.

The enum looks like:

enum ProjectionAssembly
{
System_Runtime,
System_Runtime_InteropServices_WindowsRuntime,
System_ObjectModel,
System_Runtime_WindowsRuntime,
System_Runtime_WindowsRuntime_UI_Xaml,

Count
}

If I play around with the order of entries, only the one listed first gets
printed as the enum name and the others get the integer value.


Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] LoadWIthPartialNameInternal

2015-04-08 Thread Neale Ferguson
I am running the test suite on s390x and am getting a lot of failures in
the System.Windows.Forms tests. A trace shows that
LoadWithPartialNameInternal is generating a not-implemented exception.
This method is being called by methods in the referencesource tree which
also has its own LoadWithPartialNameInternal implementation. A traceback
may be found at http://pastebin.com/HraTpdRD that shows the call sequence
from the Keyboard LoadLayout method upwards. Is this a case of the source
tree being in a state of flux between the current Mono implementation to
the Microsoft reference source?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] mono-core.spec.in

2015-04-21 Thread Neale Ferguson
Why was mono-core.spec.in dropped from the source? What is/will be used to
generate RPMS?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Endian Question

2015-04-28 Thread Neale Ferguson
The following test fails on s390x as the string that is encoded from the
decrypted block ends is in little endian order:

public void FullRoundtripRead ()
{
byte[] encrypted;
using (DebugStream mem1 = new DebugStream ()) {
byte[] toEncrypt =
Encoding.Unicode.GetBytes ("Please encode me!");
using (CryptoStream crypt = new
CryptoStream (mem1, aes.CreateEncryptor (), CryptoStreamMode.Write)) {
crypt.Write (toEncrypt, 0,
toEncrypt.Length);
crypt.FlushFinalBlock ();
}
encrypted = mem1.ToArray ();
}

using (DebugStream mem2 = new DebugStream
(encrypted)) {
byte[] buffer = new byte [1024];
CryptoStream cr = new CryptoStream (mem2,
aes.CreateDecryptor (), CryptoStreamMode.Read);
int len = cr.Read (buffer, 0,
buffer.Length);
cr.Close ();
Assert.AreEqual (34, len, "Full Length
Read");
Assert.AreEqual ("Please encode me!",
Encoding.Unicode.GetString (buffer, 0, len), "Full Block Read");
}
}


The question is at what point should byte swapping be performed? Should
all Encoding.Unicode.GetBytes(string) do the swap to little ending and
Encoding.Unicode.GetString(bytes) do the reverse?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Not building on s390x

2015-05-08 Thread Neale Ferguson
Hi,
 I cloned from master and now my s390x build fails on the corlib build
(the second one after basic). It is crashing in get of CurrentThread. The
sequence of code that is now being produced is odd:

1  tls_get R17 <-
2  load_membase R18 <- [R17 + 0x60]
3  load_membase R19 <- [R18 + 0x80]
4  load_membase R21 <- [R19 + 0x3]

It is steps 3 & 4 that are problematic. Firstly, it gets a null pointer
when it loads R19. Even if it got a correct value the next step is quite
strange. I am not sure how it is getting a displacement of 3.

The 3.10.1 sequence, for example, looks like this:

1  tls_get R17 <-
2  load_membase R18 <- [R17 + 0x60]
3  load_membase R19 <- [R18 + 0x0]
4  load_membase R21 <- [R19 + 0x68]

What should I look at to work out why this new sequence is being produced?

Neale



___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Token not found

2015-05-19 Thread Neale Ferguson
I am trying to determine why I am getting the following abort with the
following message and stack trace. I am after a strategy for shooting the
problem rather than a definitive answer...

Could not find required dynamic token 0x0a05


#7  0x003979832925 in raise () from /lib64/libc.so.6
   
#8  0x003979834105 in abort () from /lib64/libc.so.6
   
#9  0x00628209 in monoeg_log_default_handler (log_domain=, log_level=G_LOG_LEVEL_ERROR,
message=, unused_data=) at
goutput.c:233
#10 0x00628297 in monoeg_g_logv (log_domain=0x0,
log_level=G_LOG_LEVEL_ERROR, format=,
args=) at goutput.c:113
#11 0x006283e3 in monoeg_g_log (log_domain=,
log_level=, format=)
at goutput.c:123
#12 0x005b6d12 in mono_reflection_lookup_dynamic_token
(image=0x16a4a10, token=167772165, valid_token=1, handle_class=
0x7fb1867ed4d0, context=0x0) at reflection.c:11877
#13 0x0053eff7 in mono_get_method_from_token (image=0x16a4a10,
token=167772165, klass=0x0, context=0x0,
used_context=, error=0x7fb1867ed580) at
loader.c:1790
#14 0x0053e002 in mono_get_method_checked (image=0x16a4a10,
token=167772165, klass=0x0, context=0x0, error=0x7fb1867ed580)
at loader.c:1947
#15 0x0053f651 in mono_get_method_full (image=, token=, klass=,
context=) at loader.c:1911
#16 0x0042997f in mini_get_method_allow_open (cfg=0x7fb174011ca0,
m=, token=,
context=, klass=0x0) at method-to-ir.c:7144
#17 mini_get_method (cfg=0x7fb174011ca0, m=,
token=, context=, klass=0x0)
at method-to-ir.c:7153
#18 0x00458668 in mono_method_to_ir (cfg=0x7fb174011ca0,
method="%s:%s ()", start_bblock=0x7fb174014a10, end_bblock=
0x7fb174014b38, return_var=0x0, inline_args=,
inline_offset=0, is_virtual_call=0) at method-to-ir.c:8795
#19 0x0041bb02 in mini_method_compile (method="%s:%s ()",
opts=37023, domain=0xcf2d10, flags=, parts=0)
at mini.c:5208
#20 0x0041d2a1 in mono_jit_compile_method_inner (method="%s:%s
()", opt=37023, ex=0x7fb1867edfb8) at mini.c:5951
#21 mono_jit_compile_method_with_opt (method="%s:%s ()", opt=37023,
ex=0x7fb1867edfb8) at mini.c:6230
#22 0x0041dd2b in mono_jit_compile_method (method="%s:%s ()") at
mini.c:6267
#23 0x004acb88 in common_call_trampoline (regs=0x7fb1867ee3c8,
code=0x7fb1c8041f5e "A\203\377\377\017\204\020", m="%s:%s ()",
---Type  to continue, or q  to quit---
tramp=, vt=vtable(%s), vtable_slot=, need_rgctx_tramp=0) at mini-trampolines.c:590
#24 0x004ad594 in mono_vcall_trampoline (regs=0x7fb1867ee3c8,
code=0x7fb1c8041f5e "A\203\377\377\017\204\020",
slot=, tramp=0x4175d05a
"\350\201\356{\377\004\a") at mini-trampolines.c:783
#25 0x40f1c046 in ?? ()
#26 0x7fb1867ee2a0 in ?? ()
#27 0x41764ddd in ?? ()
#28 0x7fb1c4b8efc0 in ?? ()
#29 0x7fb174000bd5 in ?? ()
#30 0x7fb1c804281b in
System.Runtime.Serialization.Formatters.Binary.ObjectWriter:GetObjectData
(this=

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Timing/race conditions

2015-05-21 Thread Neale Ferguson
Hi,
I have been experiencing some failures with the tests in mono/tests,
particularly in a single core configuration.

Firstly, the sleep test: when the delegated thread is started, the main
thread goes to call the StopWatch start method which requires JITting.
This involves gc interaction as objects are allocated. However, the
delegated thread gets up and starts issuing GC.Collection() calls which
end up occurring every 50 microseconds. This means the main thread never
gets a chance to get out of the allocation phase so never gets to execute
the stopwatch start, thread sleep etc. so the thread never ends. In a
multi-core configuration this is not a problem and the test passes. I
found by inserting a Thread.Yield() as the first method called in the
delegated thread eliminates the problem [1].

Secondly, the x-exit (e.g. thread-exit) tests will occasionally fail
with an abort due to "suspend_thread suspend took xxx ms, which is more
than the allowed 200 ms” where xxx exceeds 200. This seems to be due to
the exiting thread sometimes not getting to the stage of setting the
thread->state to ThreadState_Stopped in the
ves_icall_System_Environment_Exit() processing within the 200ms time
period. Again, with multiple cores this is not a problem (or the problem
is much rarer). I found by inserting a mono_thread_info_yield() prior to
the suspend_internal_thread() in mono_thread_suspend_all_other_threads()
fixes the problem [2]. I am not sure this is the best option and it’s
still theoretically possible for the problem to still occur depending on
how heavily the system is loaded. I was wondering if the setting of the
state to ThreadState_stopped could be moved earlier in the process rather
than in thread_cleanup() or if there’s another alternative.

While the occasional failure has been experienced with some of the more
pathological tests, the trouble is they happen nearly 100% of the time on
a single core virtual machine, less often on a 2 core but in a virtual
machine environment where there may be 100s of virtual machines competing
for the real cores the probability of failure increases. In addition tests
in the main test suite also have failed for the same reason as described
in the second case.

Neale

[1] Circumvention for case 1 -

--- a/mono/tests/sleep.cs
+++ b/mono/tests/sleep.cs
@@ -13,6 +13,7 @@ public class Tests
public static int test_0_time_drift () {
// Test the Thread.Sleep () is able to deal with time
drifting due to interrupts
Thread t = new Thread (delegate () {
+   Thread.Yield();
while (!finished)
GC.Collect ();
});

[2] Circumvention for case 2 -

--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c

@@ -3132,6 +3147,8 @@ void mono_thread_suspend_all_other_threads (void)
 
UNLOCK_THREAD (thread);
 
+   mono_thread_info_yield ();
+
/* Signal the thread to suspend */
suspend_thread_internal (thre

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] do_rehash race

2015-05-28 Thread Neale Ferguson
Hi,
 When a hash table exceeds a threshold a rehash operation is triggered. At
the moment the new table is allocated and its address placed in the table
field of the structure. The do_rehash also then copies the entries from
the old table to the new. However, if there is another thread active that
is doing lookups then there is a window where the new table is still being
filled such that a lookup can fail. This is because the new table is made
active before it has been copied. This proposed patch will fill the new
table before swapping the old for the new table in the hash structure.

Neale

@@ -194,24 +196,24 @@ do_rehash (void *_data)
Slot **table;
 
/* printf ("Resizing diff=%d slots=%d\n", hash->in_use -
hash->last_rehash, hash->table_size); */
-   hash->last_rehash = hash->table_size;
current_size = hash->table_size;
-   hash->table_size = data->new_size;
/* printf ("New size: %d\n", hash->table_size); */
table = hash->table;
-   hash->table = data->table;
 
for (i = 0; i < current_size; i++){
Slot *s, *next;
 
for (s = table [i]; s != NULL; s = next){
-   guint hashcode = ((*hash->hash_func) (s->key)) %
hash->table_size;
+   guint hashcode = ((*hash->hash_func) (s->key)) %
data->new_size;
next = s->next;
 
-   s->next = hash->table [hashcode];
-   hash->table [hashcode] = s;
+   s->next = data->table [hashcode];
+   data->table [hashcode] = s;
}
}
+   hash->table_size = data->new_size;
+   hash->last_rehash = hash->table_size;
+   hash->table = data->table;
return table;
 }
 

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] nunit-console

2015-07-05 Thread Neale Ferguson
I have a series of tests for the c# mongodb driver of the form:

[Test]
public async Task QueryAll()
{


I had successfully run nunit-console4 against the dll that xbuild created
but just suddenly the tests started to be not run with nunit-console
complaining: Method QueryAll's signature is not correct: it must return
void

However, the nunit-console doc states that async Task tests are valid.

I have no idea what’s changed. Yes I know things don’t suddenly stop
working for no reason at all, but what I am trying to determine is what
that change was that would cause the tests to behave as they now are.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Update strangeness

2015-07-30 Thread Neale Ferguson
9ffebc9d4e13bebe456b05fad1fd85e4f3c7f0d2 (May 12) introduced this piece of
code:
-   else
-   start = get_delegate_invoke_impl (TRUE, 0, NULL,
FALSE);
+   } else
+   MonoTrampInfo *info;
+   start = get_delegate_invoke_impl (&info, TRUE, 0,
FALSE);
+   mono_tramp_info_register (info);
+   }

I have no idea how it's been being built cleanly ever since. I am adding
the '{' and will commit shortly, but I am puzzled.

I'm also seeing these failures during make check for the first time:

Checking unintended native code changes in objects.exe without AOT
23c23
< Method Tests:.cctor () (code length 202) [objects.exe]
---
> Method Tests:.cctor () (code length 196) [objects.exe]
40c40
< Method Tests:int_to_r4_inner (int) (code length 142) [objects.exe]
—


Other than that the other tests are passing except for
delegate-async-exit.exe which is segving in
major_copy_or_mark_object_no_evacuation during System.Environment.Exit
processing.

The reason I am raising these issues to the list is that I note there has
been a bit of reverting/reapplying that seem to have affected architecture
dependent code.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Update strangeness

2015-07-30 Thread Neale Ferguson
Ah, that explains it. I will push my fix shortly.


Please note that even though that commit was authored on May 12, it only went 
into master with https://github.com/mono/mono/pull/1929 about 9 hours ago.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] s390x - delegate-async-exit

2015-08-05 Thread Neale Ferguson
Hi,
 The above test appears to have started failing after
https://github.com/mono/mono/commit/8f7b98b9b23dd5cc42011cff5c5c31b32ae1b55
6 (at least according to the jenkins log). What I’m seeing is that the obj
pointer being passed to major_copy_or_mark_object_no_evacuation is
0x1:

Thread 2 (Thread 0x3fffaa7b910 (LWP 56738)):
#0  0x03fffd22df80 in waitpid () from /lib64/libpthread.so.0
#1  0x800afd44 in mono_handle_native_sigsegv (signal=, ctx=, info=) at mini-exceptions.c:2243
#2  0x8001a3a2 in mono_sigsegv_signal_handler (_dummy=11,
_info=0x3fffaa795e8, context=0x3fffaa79668) at mini-runtime.c:2462
#3  
#4  major_copy_or_mark_object_no_evacuation (queue=,
obj=, ptr=) at
sgen-marksweep-drain-gray-stack.h:133
#5  major_scan_object_no_evacuation (obj=, desc=, queue=0x803a8cc0 ) at sgen-scan-object.h:74
#6  0x80231276 in drain_gray_stack_no_evacuation (ctx=...) at
sgen-marksweep-drain-gray-stack.h:248
#7  drain_gray_stack (ctx=) at sgen-marksweep.c:1223
#8  0x80221476 in sgen_drain_gray_stack (max_objs=-1, ctx=) at sgen-gc.c:552
#9  0x802214e2 in finish_gray_stack (generation=1, ctx=...) at
sgen-gc.c:1095
#10 0x8022366a in major_finish_collection (reason=0x80325f98 "user
request", old_next_pin_slot=32, forced=1, scan_whole_nursery=) at sgen-gc.c:2017
#11 0x80223c3a in major_do_collection (reason=0x80325f98 "user
request", forced=1) at sgen-gc.c:2139
#12 0x80223dc0 in sgen_perform_collection (requested_size=0,
generation_to_collect=1, reason=0x80325f98 "user request",
wait_to_finish=1) at sgen-gc.c:2379
#13 0x802243d2 in sgen_gc_collect (generation=1) at sgen-gc.c:2800
#14 0x801c784e in mono_domain_finalize (domain=0x803f4ee0,
timeout=2000) at gc.c:379
#15 0x80016c82 in mini_cleanup (domain=0x803f4ee0) at
mini-runtime.c:3427
#16 0x80142a62 in ves_icall_System_Environment_Exit (result=0) at
icall.c:6001


I initially wondered about an endian issue with the forwarding bit but

I can’t see anything in that particular push that has anything to do with
this area of code.  I am actively debugging the code now but wondered if
anyone had seen anything that may cause this.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] s390x - delegate-async-exit

2015-08-05 Thread Neale Ferguson
Further investigation shows the value being set here:

0x80200bb2 is in mono_gc_wbarrier_set_arrayref (sgen-mono.c:171).
166 void
167 mono_gc_wbarrier_set_arrayref (MonoArray *arr, gpointer slot_ptr,
MonoObject* value)
168 {
169 HEAVY_STAT (++stat_wbarrier_set_arrayref);
170 if (sgen_ptr_in_nursery (slot_ptr)) {
171 *(void**)slot_ptr = value;
172 return;
173 }
174 SGEN_LOG (8, "Adding remset at %p", slot_ptr);
175 if (value)


This is called from:

0x801a5c22 is in mono_threadpool_ms_end_invoke (threadpool-ms.c:1310).
1305}
1306
1307MONO_OBJECT_SETREF (ares, endinvoke_called, 1);
1308
1309/* wait until we are really finished */
1310if (ares->completed) {
1311mono_monitor_exit ((MonoObject *) ares);
1312} else {
1313gpointer wait_event;
1314if (ares->handle) {


Now the fact that the scan is pulling the value 0x1 this would
indicate that the slot_ptr (ares) is not aligned on a pointer boundary so
the calculation of this location must be incorrect.
Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] MonoJitInfo question

2015-08-19 Thread Neale Ferguson
In MonoJitInfo there is a union:

union {
MonoMethod *method;
MonoImage *image;
gpointer aot_info;
gpointer tramp_info;
} d;

How do I know which thing to dereference against? There is a field
"is_trampoline" which answers it for one of the fields but on what basis
do I select the others?

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] WCF

2015-08-26 Thread Neale Ferguson
Does the doc at http://www.mono-project.com/docs/web/wcf/ reflect the
current state of WCF support?

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Registry question

2015-08-27 Thread Neale Ferguson
Is registry multi-process safe? How are registry transactions maintained
by Mono? Also, I assume the EventLog is just syslog on Linux.


Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Registry

2015-10-06 Thread Neale Ferguson
We have a client who is testing the waters with porting some .NET based
applications to mono. However, a couple of these critical applications
rely on the windows registry. The implementation of registry-support in
mono is quite crude and not process-safe and this is holding them back. I
am looking for ideas as to improving this so that apps can share the
registry safely and efficiently.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Registry

2015-10-08 Thread Neale Ferguson
Client wants to move from Windows to mono on Linux.


Hi there,


Are you trying to run "on mono" or do you mean on mono linux or mac?
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Registry

2015-10-08 Thread Neale Ferguson
While this wouldn’t protect against “rogue” apps who want to trash things, 
would using the existing mechanism but using the Linux locking primitives 
(which are co-operative and not proscriptive)  to serialize access to the 
underlying files/directories be an option?


One option would be to write a backend that uses one of the various 
configuration systems in Unix that use a separate process to arbitrate access 
to the information.

Perhaps you can use dconf.

Since the registry lives in mscorlib, and this would bring a number of 
dependencies , I recommend to make this a loadable plugin.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] certmgr problem

2015-10-16 Thread Neale Ferguson
When running certmgr to import a key I am getting the following error:

System.Security.Cryptography.CryptographicException: Invalid MAC - file
may have been tampered!


I have verified that the key is ok:

[neale@lneale3 - mono] openssl pkcs12 -info -in /tmp/MonoTestCert.pfx
Enter Import Password:
MAC Iteration 2000
MAC verified OK
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2000
Bag Attributes
localKeyID: 01 00 00 00
Microsoft CSP Name: Microsoft Strong Cryptographic Provider
friendlyName: PvkTmp:171f74c0-49c3-484a-90c0-a9453b04e318
Key Attributes
X509v3 Key Usage: 10


The calculated MAC that PCKS12.cs is generating is quite different. I
added some debug code:

MAC does not match calculated MAC
Lengths: 20 20
57 AF 88 DD B6 40 07 24 56 A3 71 1C 25 F1 A9 8F 46 D0 E5 BA
A7 4A 04 50 E5 67 39 5E D9 A6 B7 86 3D 00 09 DE 57 4F 2C FC


Is this a known limitation of mono or some error on my part?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] certmgr problem

2015-10-19 Thread Neale Ferguson
Further to this problem. This is how the certs/keys were created. It all
works under Windows including the certmgr —importKey but always gives the
MAC error on mono:

makecert.exe -n "CN=MonoTestCA" -cy authority -a sha1 -len 2048 -pe -r -sv
MonoTestCA.pvk MonoTestCA.cer
makecert.exe -n "CN=MonoTestCert" -b 01/01/2000 -e 12/31/2039 -eku
1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2,1.3.6.1.5.5.7.3.3,1.3.6.1.5.5.7.3.4,1.3
.6.1.5.5.7.3.5,1.3.6.1.5.5.7.3.6,1.3.6.1.5.5.7.3.7,1.3.6.1.5.5.7.3.8,1.3.6.
1.5.5.7.3.9 -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -ic
MonoTestCA.cer -iv MonoTestCA.pvk -a sha1 -len 2048 -pe -sky exchange -sv
MonoTestCert.pvk MonoTestCert.cer
pvk2pfx.exe -pvk MonoTestCert.pvk -spc MonoTestCert.cer -pfx
MonoTestCert.pfx

I took the above makecert commands and, allowing for options not supported
on mono, ran them on linux. I transported the resulting files back to
windows so I could run the pvk2pfx and then attempted to import that key
back on mono.


Neale



On 10/16/15, 12:35 PM, "Neale Ferguson"  wrote:

>When running certmgr to import a key I am getting the following error:
>
>System.Security.Cryptography.CryptographicException: Invalid MAC - file
>may have been tampered!
>
>
>I have verified that the key is ok:
>
>[neale@lneale3 - mono] openssl pkcs12 -info -in /tmp/MonoTestCert.pfx
>Enter Import Password:
>MAC Iteration 2000
>MAC verified OK
>PKCS7 Data
>Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2000
>Bag Attributes
>localKeyID: 01 00 00 00
>Microsoft CSP Name: Microsoft Strong Cryptographic Provider
>friendlyName: PvkTmp:171f74c0-49c3-484a-90c0-a9453b04e318
>Key Attributes
>X509v3 Key Usage: 10
>
>
>The calculated MAC that PCKS12.cs is generating is quite different. I
>added some debug code:
>
>MAC does not match calculated MAC
>   Lengths: 20 20
>57 AF 88 DD B6 40 07 24 56 A3 71 1C 25 F1 A9 8F 46 D0 E5 BA
>A7 4A 04 50 E5 67 39 5E D9 A6 B7 86 3D 00 09 DE 57 4F 2C FC
>
>
>Is this a known limitation of mono or some error on my part?
>
>Neale
>

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] certmgr - #35064

2015-11-09 Thread Neale Ferguson
Hi,
 I still haven’t found a solution to the problem #35064 (see below). Is
there another way on Linux to achieve the same result - i.e. Import a
private key into the right place required?

Neale

MONO_PATH=$MCS/class/lib/net_4_x:$HOME/Mono/xsp/src/lib
$MONO/mono/mini/mono-sgen $MCS/tools/security/certmgr.exe --importKey -c
-v -m
My MonoTestCert.pfx
Mono Certificate Manager - version 4.3.0.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD
licensed.
 
Unhandled Exception:
System.Security.Cryptography.CryptographicException: Invalid MAC - file may
have been tampered!
  at Mono.Security.X509.PKCS12.Decode (System.Byte[] data) <0x3fffcca5378
0x00fd0> in :0
  at Mono.Security.X509.PKCS12..ctor (System.Byte[] data) <0x3fffcca4cb0
0x0005e> in :0
  at Mono.Security.X509.PKCS12.LoadFromFile (System.String filename)
<0x3fffcca47e8  0x0006e> in :0
  at Mono.Tools.CertificateManager.LoadCertificates (System.String
filename,
System.String password, Boolean verbose) <0x3fffcca2fa8  0x0046e> in
:0 
  at Mono.Tools.CertificateManager.ImportKey (ObjectType type, Boolean
machine,
System.String file, System.String password, Boolean verbose)
<0x3fffcca2488 
0x000b2> in :0
  at Mono.Tools.CertificateManager.Main (System.String[] args)
<0x3fffac5d120 
0x007d4> in :0
[ERROR] FATAL UNHANDLED EXCEPTION:
System.Security.Cryptography.CryptographicException: Invalid MAC - file may
have been tampered!
  at Mono.Security.X509.PKCS12.Decode (System.Byte[] data) <0x3fffcca5378
0x00fd0> in :0
  at Mono.Security.X509.PKCS12..ctor (System.Byte[] data) <0x3fffcca4cb0
0x0005e> in :0
  at Mono.Security.X509.PKCS12.LoadFromFile (System.String filename)
<0x3fffcca47e8  0x0006e> in :0
  at Mono.Tools.CertificateManager.LoadCertificates (System.String
filename,
System.String password, Boolean verbose) <0x3fffcca2fa8  0x0046e> in
:0 
  at Mono.Tools.CertificateManager.ImportKey (ObjectType type, Boolean
machine,
System.String file, System.String password, Boolean verbose)
<0x3fffcca2488 
0x000b2> in :0
  at Mono.Tools.CertificateManager.Main (System.String[] args)
<0x3fffac5d120 
0x007d4> in :0
 
This happens either 3.10.1 or head (as at 19 Oct 2015). I added some debug
code
just to see what was happening:
 
password:  iterations: 2000
MAC does not match calculated MAC
Lengths: 20 20
47 0D 4F D5 B3 2B D6 62 45 C7 53 8C 33 89 C8 6C B1 DB C5 DA <--- MAC from
key
8B 3D 08 E3 F5 CE 37 AB 64 D1 A6 CE F6 B8 86 75 C1 07 4F BE <---
Calculated MAC

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Strange build problem

2016-01-19 Thread Neale Ferguson
Re: bugzilla 37781

On the same virtual machine in which the Jenkins bot successfully builds
mono, I am encountering failures of an unusual type. Thinking it might be
a hangover to something in the account’s home directory, I created a
completely new account, cloned from master, configured and built. It craps
out with the following:

MCS [build] mscorlib.dll
Assembly/AssemblyInfo.cs(33,5): error CS8025: Parsing error
System/AndroidPlatform.cs(66,246): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System/Console.iOS.cs(127,246): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System/Guid.MonoTouch.cs(24,253): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System/TimeZoneInfo.Android.cs(737,246): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System/TimeZoneInfo.MonoTouch.cs(109,246): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System.Globalization/RegionInfo.MonoTouch.cs(54,246): error CS1525:
Unexpected symbol `end-of-file', expecting `end-of-file'
System.IO/LogcatTextWriter.cs(80,246): error CS1525: Unexpected symbol
`end-of-file', expecting `end-of-file'
System.Security/SecurityManager_mobile.cs(215,246): error CS1525:
Unexpected symbol `end-of-file', expecting `end-of-file'
System.Security.Cryptography/CryptoConfig.fullaot.cs(239,246): error
CS1525: Unexpected symbol `end-of-file', expecting `end-of-file'
../../../external/referencesource/mscorlib/system/resources/__hresults.cs(2
6,246): error CS1525: Unexpected symbol `end-of-file', expecting
`end-of-file'
../../../external/referencesource/mscorlib/system/resources/looselylinkedre
sourcereference.cs(89,246): error CS1525: Unexpected symbol `end-of-file',
expecting `end-of-file'
Compilation failed: 12 error(s), 0 warnings

I am at a loss to work out WTF is happening. I like the way the error
message keeps a straight face when it complains about encountering
“end-of-file” symbol when it was really expecting “end-of-file”!


Any suggestions about where to look?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Data protection failed exception

2016-01-21 Thread Neale Ferguson
Does this problem description ring any bells before I go too much further
problem shooting (done a couple of hours already, so should have sent this
first!):

1. Application Version: Mono 4.3
2. redhat 5.1-5.3
3. intel x86
4. Priority: 20 
5. Description: Data protection failed.: at
System.Security.Cryptography.ProtectedData.Protect

Details of our issue:
When trying to do an Process.Start() to start a process I will get this
error:

Data protection failed.: at
System.Security.Cryptography.ProtectedData.Protect (System.Byte[]
userData, System.Byte[] optionalEntropy, DataProtectionScope scope)
<0x41723770  0x00127> in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.Byte[] data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41723470  0x0023b>
in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.String data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41722e80  0x0004f>
in :0
at Drms.Server.Shared.Scheduling.JobProcess.Execute (Guid jobId, Guid
repositoryId, ProcessPriorityClass priorityClass, Int32 numberOfProcesses,
System.String username, System.String password) <0x417228a0  0x0027f> in
:0
at Drms.Server.Service.Manager.ServiceManager.RunJob (Guid jobId, Guid
repositoryId, ProcessPriorityClass priorityClass, Int32 numberOfProcesses)
<0x41720c50  0x00547> in :0 :False
[06:08:10] Info Message: Error Launching!!! Data protection failed.:
at System.Security.Cryptography.ProtectedData.Protect (System.Byte[]
userData, System.Byte[] optionalEntropy, DataProtectionScope scope)
<0x41723770  0x00127> in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.Byte[] data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41723470  0x0023b>
in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.String data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41722e80  0x0004f>
in :0
at Drms.Server.Shared.Scheduling.JobProcess.Execute (Guid jobId, Guid
repositoryId, ProcessPriorityClass priorityClass, Int32 numberOfProcesses,
System.String username, System.String password) <0x417228a0  0x0027f> in
:0
at Drms.Server.Service.Manager.ServiceManager.RunJob (Guid jobId, Guid
repositoryId, ProcessPriorityClass priorityClass, Int32 numberOfProcesses)
<0x41720c50  0x00547> in :0 :False
[06:08:10] Info Message: Error Launching!!! Data protection failed.:
at System.Security.Cryptography.ProtectedData.Protect (System.Byte[]
userData, System.Byte[] optionalEntropy, DataProtectionScope scope)
<0x41723770  0x00127> in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.Byte[] data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41723470  0x0023b>
in :0
at Drms.Shared.Common.Core.CryptoCore.ProtectLocal (System.String data,
System.Byte[] extraEntropy, ProtectionScope scope) <0x41722e80  0x0004f>
in :0
at Drms.Server.Shared.Scheduling.JobProcess.Execute (Guid jobId, Guid
repositoryId, ProcessPriorityClass priorityClass, Int32 numberOfProcesses,
System.String username, System.String password) <0x417228a0  0x0027f> in
:0
at Drms.Server.Service.Manager.ServiceManager.RunJob (Guid jobId, Guid
repositoryId, Proc


This doesn't happen all the time and is random and it always works as root
but as a standard user I would get this error. Is there any way to turn
off whatever security check this is trying to do since we really don't
care?


Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Data protection failed exception

2016-01-21 Thread Neale Ferguson
Further to the problem, tt seems to be a threading issue since if a lock
is put around this method call:

return ProtectedData.Protect(data, extraEntropy, dataProtectionScope);

then it would work. This seems to try an access some file in .mono/keypair
and it seems to be some concurrency issue since we have multiple threads
all calling this code at the same time and that’s where it get tripped up.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] profiling

2016-02-25 Thread Neale Ferguson
Sometimes when we run the profiler and then run mprof-report we get
instances of “unresolved classes” in the report. How does this happen and
is it a concern?

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] System.SR

2016-03-28 Thread Neale Ferguson
I am looking at incorporating the CoreFx System.Data.SqlClient into mono
and in examining the code have come across references to the System.SR
namespace. I am not familiar with this and it seems not to exist elsewhere
in either the reference sources or mono sources.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Build error

2016-05-10 Thread Neale Ferguson
Over the last couple of days days I have been encountering an error
building from master. I did a make clean but it persists:

System.Net.Sockets/SocketAsyncEventArgs.cs(203,34): warning CS0420:
`System.Net.Sockets.SocketAsyncEventArgs.in_progress': A volatile field
references will not be treated as volatile
System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension
.cs(71,20): error CS0135: `oid' conflicts with a declaration in a child
block
System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension
.cs(74,17): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 38 warnings


I have no local changes in this area.

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Build failure

2016-05-31 Thread Neale Ferguson
Anyone seen this:

ReferenceSources/SettingsSectionInternal.cs(24,17): error CS8051:
Auto-implemented property
`System.Net.Configuration.SettingsSectionInternal.CheckCertificateName'
must have set accessor or initializer
ReferenceSources/SettingsSectionInternal.cs(28,29): error CS8051:
Auto-implemented property
`System.Net.Configuration.SettingsSectionInternal.EncryptionPolicy' must
have set accessor or initializer


Just started today, but this is the first time I’ve built since Friday.

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Setting and Getting Thread Priority

2016-06-07 Thread Neale Ferguson
After adding support for setting and getting thread priorities I’ve found
there’s one piece missing. Before a thread is started you can set its
priority such that when it’s started it will start with this priority
instead of the priority of the thread creating it.

At the moment the code lets this happen but does nothing with it. I have
started adding code to fix this missing piece. The trouble I am having is
that the wthreads.c implementation of GetThreadPriority() will simply
return THREAD_PRIORITY_NORMAL if the thread hasn’t been started yet: even
if a call to SetPriority has already been made. I was storing the priority
value in the MonoThread structure, however, wthreads.c does not have
visibility of this structure. I thought of putting it in MonoThreadInfo
but I’m not sure at which point this structure comes into existence. The
other place is within MonoThreadInternal which wthreads.c does see but
this requires a change in Threads.cs which has a one-to-one field
correspondence with the structure.

The other changes work fine such that a thread (running with the right
policy) will have its priority set at creation time. All that is missing
is GetPriority reporting the correct value before start time.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] DateTime.Now

2016-06-16 Thread Neale Ferguson
When DateTime.Now looks to adjust its value based on timezone (and
daylight saving requirements), it fetches a value UtcNow. This value is
obtained by a call to unmanaged code GetSystemTimeAsFileTime() which the
JIT maps to mono_100ns_datetime(). This routine uses gettimeofday() to
fetch the current time. However, this is the local time and it does not
adjust it to be UTC. So the comparison it makes in the test to see if the
datetime has transitioned to or from daylight saving or not is done
against local time and not UTC.


I have instrumented the code to show how the test against the rule appears
to be being made against local time and not UTC at
http://pastebin.ca/3629144.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Form Authentication

2016-07-01 Thread Neale Ferguson
I have been trying to get a good looking demo to show off Mono to some
folks new to the technology. I used the NerdDinner app as it exercised a
number of interesting things. However, there is one problem that is
causing some grief. I am able to register an account and sign on. However,
it does not appear that whatever signing on does is not working. The sign
on results in SetAuthCookie() being called, but when I click on something
that ends up driving a method with the [Authorize] tag, I get redirected
to the login form again. This is on mono 4.4 on s390x. When I run it on
4.0 on Intel it works fine.

I do not understand the mechanics of the auth cookie and how it is used so
am not sure it is some endian issue, something that has changed with mono
4.4, or something entirely different.

I am looking for suggestions to look within the Mono code to determine
where the problem may be.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] s390x test failures

2009-06-29 Thread Neale Ferguson
I¹ve fixed some LCONV/ICONV stuff for s390x and now pass the
basic/basic-long/exceptions tests that used to fail. However, it is failing
in the more complex tests in ./tests:

synchronized:
-
Unhandled Exception: System.Threading.SynchronizationLockException: Object
is not synchronized
  at System.Threading.Monitor.Pulse (System.Object obj) [0x0002d] in
/home/neale/Mono/mcs/class/corlib/System.Threading/Monitor.cs:90
  at Tests.test () [0x6] in
/home/neale/Mono/mono/mono/tests/synchronized.cs:19
  at (wrapper delegate-invoke) Tests/Delegate1:invoke_int__this__ ()
  at Tests.Main (System.String[] args) [0x000b8] in
/home/neale/Mono/mono/mono/tests/synchronized.cs:86

filter-stack:
-
** ERROR **: file method-to-ir.c: line 10737 (mono_spill_global_vars):
assertion failed: (((sreg == -1) && (regtype == ' ')) || ((sreg != -1) &&
(regtype != ' ')))
aborting...
Stacktrace:

  at main.Main () [0x0001c] in
/home/neale/Mono/mono/mono/tests/filter-stack.cs:61
  at main.Main () [0x5] in
/home/neale/Mono/mono/mono/tests/filter-stack.cs:57
  at (wrapper runtime-invoke) .runtime_invoke_int
(object,intptr,intptr,intptr) 

exception17:

Unhandled Exception: System.Exception: Exception of type 'System.Exception'
was thrown.
  at main.finaller () [0x0] in
/home/neale/Mono/mono/mono/tests/exception17.cs:8
  at main.catcher1 () [0x5] in
/home/neale/Mono/mono/mono/tests/exception17.cs:17

bug-400716:
Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
  at Repro.Driver.TestEnumerator[Byte[],Object] () [0x0001f] in
/home/neale/Mono/mono/mono/tests/bug-400716.cs:19
  at Repro.Driver.Main () [0x0005f] in
/home/neale/Mono/mono/mono/tests/bug-400716.cs:61

vararg:
---
-2145998900
-7949248
0
-2145998900
-2145998900
-7949248
test_85_varargs_refany failed: got 2141019148, expected 85
Regression tests: 4 ran, 1 failed in Tests

vararg2:

Nothing in stdout/stderr but:
Testing vararg2.exe... failed 256 (1) signal (0).

Before I go through the process of debugging these guys, are these failures
familiar to anyone for other architectures that may give me a headstart?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Problem with regression test of exceptions.exe

2009-07-27 Thread Neale Ferguson
I¹m having problems with Pastebin at the moment so I was unable to place the
following there and use IRC:

Strange situation running regression test for exceptions.exe. I am crashing
as the following call returns NULL:

case OP_START_HANDLER: {
MonoInst *spvar = mono_find_spvar_for_region (cfg,
bb->region);

I have traced the code and it shows bb->region = 258. I traced
mono_create_spvar_for_region and it shows and entry being placed in the hash
table for region 258. However, in the find routine we have:

if ((region & (0xf << 4)) == MONO_REGION_TRY) {
MonoMethodHeader *header = mono_method_get_header
(cfg->method);

/*
 * This can happen if a try clause is nested inside a
finally clause.
 */
int clause_index = (region >> 8) - 1;
g_assert (clause_index >= 0 && clause_index <
header->num_clauses);
region = mono_find_block_region_notry (cfg, header->clauses
[clause_index].try_offs
et);   
}  

A trace shows that 258 passes the == MONO_REGION_TRY test and so we get a
new region number (530) and when we do a g_hash_table_lookup() using that
region we get null. I see no inserts using that (530) region number.

Also, MONO_REGION_TRY is 0. Is the test supposed to be against this value or
for checking bit 0?

I am confused as to what is happening.

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Possible Bug in BigInteger.Multiply

2005-12-30 Thread Neale Ferguson
I've been having build problems with my 64-bit s390 system. I've tracked it 
down to what I believe is a bug in BigInteger.Multiply that is overwriting a 
BigInteger field and corrupting the .data.Length field of the object. Multiply 
is being called from OddPow. The error manifests itself in SquarePositive when 
the bounds check for the array is performed: 

Unhandled Exception: System.IndexOutOfRangeException: Array index is out of 
range.
in <0x00094> Mono.Math.BigInteger+Kernel:SquarePositive (Mono.Math.BigInteger 
bi, System.UInt32[] wkSpace)
in <0x00900> Mono.Math.BigInteger+ModulusRing:OddPow (Mono.Math.BigInteger b, 
Mono.Math.BigInteger exp)
in <0x00092> Mono.Math.BigInteger+ModulusRing:Pow (Mono.Math.BigInteger b, 
Mono.Math.BigInteger exp)
in <0x000be> Mono.Math.BigInteger:ModPow (Mono.Math.BigInteger exp, 
Mono.Math.BigInteger n)
in <0x0026c> Mono.Security.Cryptography.RSAManaged:DecryptValue (System.Byte[] 
rgb)
in <0x00086> System.Security.Cryptography.RSACryptoServiceProvider:DecryptValue 
(System.Byte[] rgb)
in <0x0003e> Mono.Security.Cryptography.PKCS1:RSASP1 
(System.Security.Cryptography.RSA rsa, System.Byte[] m)
in <0x000ee> Mono.Security.Cryptography.PKCS1:Sign_v15 
(System.Security.Cryptography.RSA rsa, 
System.Security.Cryptography.HashAlgorithm hash, System.Byte[] hashValue)
in <0x0009c> 
System.Security.Cryptography.RSAPKCS1SignatureFormatter:CreateSignature 
(System.Byte[] rgbHash)
in <0x00278> Mono.Security.StrongName:Sign (System.String fileName)
in <0x002f2> Mono.Tools.SN:ReSign (System.String assemblyName, 
System.Security.Cryptography.RSA key)
in <0x0175c> Mono.Tools.SN:Main (System.String[] args)

The bug is described at http://pastebin.com/484359 with background information 
at http://pastebin.com/484243.

Neale

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


RE: [Mono-dev] Possible Bug in BigInteger.Multiply

2005-12-30 Thread Neale Ferguson
I now believe it's my implementation of long_div_un that is the underlying
problem. The bounds are only being exceeded because the size of the
BigInteger is twice the size it should be. I'm investigating this and will
report when done.

Neale
-Original Message-

Hello Neale,

I'll look into this on Monday (*), on the i386 architecture but this should
also happen there...
* but maybe Ben will also want to take a look at his old code before that
;-)

Please fill a bugzilla entry for this (on Mono.Security.dll) including the
pastebin information.
Thanks


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Error compiling WebConnection.cs

2010-04-07 Thread Neale Ferguson
Just updated to head, did get-monolite-latest and getting this during the build:

System.Net/WebConnection.cs(361,82): error CS0246: The type or namespace name 
`CertificateValidationCallback2' could not be found. Are you missing a using 
directive or an assembly reference?
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Problem building mscorlib.dll

2011-04-28 Thread Neale ferguson
  
I am adding softdebugger support to s390x and tried a build this morning. It's 
clean through my changes but I am getting the following when it starts on MCS:

make[8]: Entering directory `/home/neale/Mono/mono/mcs/class/corlib'
MCS [build] mscorlib.dll
error CS2011: Unable to open response file: corlib.dll.sources
make[8]: *** [../../class/lib/build/tmp/mscorlib.dll] Error 1


The file corlib.dll.sources exists, is non-empty, and has a date stamp from 
February. I wouldn't have expected adding softdebug support would've led to 
this 
error - especially when the mono command isn't requesting debugging.

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Crash in delegate-invoke test

2011-06-19 Thread Neale Ferguson
Since Friday I¹ve been getting the following failure in running the
delegate-invoke test after building from Head:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
(wrapper delegate-invoke) :invoke_int__this___EmptyStruct&
(EmptyStruct&): IL_004d: castclass 0x0007


  at Driver.test_0_valuetype_invokes () [0x0003c] in
/home/neale/Mono/mono/mono/tests/delegate-invoke.cs:94
  at Driver.Main () [0xe] in
/home/neale/Mono/mono/mono/tests/delegate-invoke.cs:46

Is this a known problem?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Candidate Fix for 699643

2011-11-23 Thread Neale Ferguson
I am looking to commit the following fix http://pastebin.com/qw2WdzPr to
resolve bug 699643 (https://bugzilla.novell.com/show_bug.cgi?id=699643).
Would someone be willing to review it?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Suggested fix for dropped SQL connection

2011-12-02 Thread Neale Ferguson
While executing SQL Transactions it's possible that the connection may be
lost and a read or write operation will fail. For example, at the moment
Tds.ExecuteQuery will catch the I/O exception (resulting from
TdsComm.SendPhysicalPacket getting an error doing a write) and set connected
= false. The application program will detect this error and attempt to close
down which involves the various Dispose methods being invoked and doing
their thing. Currently, the SqlTransaction Dispose method will invoke
Rollback(). Now, when a transaction hasn't been completed/committed but the
connection is still up, this is a valid thing to do. However, if the
connection has been lost then Rollback() will in turn lead to a
Tds.ExecuteQuery which involves sending a packet to the server side. With a
dead connection this will fail and we'll get a heap of other exceptions.

As Tds.ExecuteQuery is detecting the failed connection and setting connected
to false, I propose the following:

--- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
@@ -158,8 +158,9 @@ namespace System.Data.SqlClient
if (!isOpen)
throw ExceptionHelper.TransactionNotUsable
(GetType ());
 
-   connection.Tds.Execute (String.Format ("IF
@@TRANCOUNT > 0 ROLLBACK TRANSACTION {0}",
-  
transactionName));
+   if (connection.Tds.IsConnected)
+   connection.Tds.Execute (String.Format ("IF
@@TRANCOUNT > 0 ROLLBACK TRANSACTION {0}",
+  
transactionName));
isOpen = false;
connection.Transaction = null;
connection = null;


A bit more background...

Here's where Tds.ExecuteQuery is noticing the failed connection:

protected void ExecuteQuery (string sql, int timeout, bool
wantResults)
{
InitExec ();

Comm.StartPacket (TdsPacketType.Query);
Comm.Append (sql);
try {
Comm.SendPacket ();
CheckForData (timeout);
if (!wantResults)
SkipToEnd ();
} catch (IOException ex) {
connected = false;
throw new TdsInternalException ("Server
closed the connection.", ex);
}
}


The fix has been tested with the application that was previously failing
with:

Drms.Server.Oas.Persistence.Tests.DAOTests.TestLargeByteArrayFieldPersis
tence
System.ObjectDisposedException: The object was used after being
disposed.
Source: System
Target Site: Void CheckDisposed()
Stack Trace: at System.Net.Sockets.NetworkStream.CheckDisposed ()
[0x0001c] in
/home/monosrc/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:
451
at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32
offset, Int32 size) [0x0] in
/home/monosrc/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:
421
at Mono.Data.Tds.Protocol.TdsComm.SendPhysicalPacket (Boolean
isLastSegment) [0x000a2] in
/home/monosrc/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsCom
m.cs:761
at Mono.Data.Tds.Protocol.TdsComm.SendPacket () [0x0001f] in
/home/monosrc/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsCom
m.cs:736
at Mono.Data.Tds.Protocol.Tds.ExecuteQuery (System.String sql, Int32
timeout, Boolean wantResults) [0x0001e] in
/home/monosrc/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs
:564

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Candidate Fix for 699643

2011-12-05 Thread Neale Ferguson
Actually, given that TdsMetaParameter is only referenced by Tds70.cs and
Tds80.cs, then is the test necessary?

If it is, what would be the best way of getting the value of tdsVersion?
Should Tds.cs constructor invoke something in TdsMetaParameter to pass it
the value for future reference? I seem to be having a senior moment trying
to work out the simplest method of performing the test.

Neale


On 11/23/11 2:14 PM, "Veerapuram Varadhan"  wrote:

> Yes, certainly
> 
> On Wed, 2011-11-23 at 14:05 -0500, Neale Ferguson wrote:
>> Understood. Will something like this help?
>> 
>> if (tdsVersion >= TdsVersion.tds70) {
>> :
>> }
>> 
>> 
>> On 11/23/11 1:54 PM, "Veerapuram Varadhan"  wrote:
>> 
>>> Hi Neale,
>>> 
>>> First part of the fix would be good to go.  The later part will have
>>> issues with earlier versions of TDS, which people still use.
>>> 
>>> V. Varadhan
>>> 
>>> On Wed, 2011-11-23 at 13:28 -0500, Neale Ferguson wrote:
>>>> I am looking to commit the following fix http://pastebin.com/qw2WdzPr to
>>>> resolve bug 699643 (https://bugzilla.novell.com/show_bug.cgi?id=699643).
>>>> Would someone be willing to review it?
>>>> 
>>>> Neale
>>>> 
>>>> 
>>>> ___
>>>> Mono-devel-list mailing list
>>>> Mono-devel-list@lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] SQL Server question

2011-12-20 Thread Neale Ferguson
After fixing bug 609109, we're encountering an interesting situation. It
appears that the performance improvement is working "too well". Running an
internal test suite, we're finding that things work well but then suddenly
we get the server side closing the connection (a RST packet is being sent)
which results in us shutting down the connection and reflecting an IO
exception to the mono code:

14112 13:24:44.554091 sendto(8, ..., 126, 0, NULL, 0) = 126 <0.29>
14112 13:24:44.554166 recvfrom(8, ..., 8, 0, NULL, NULL) = 8 <0.000575>
14112 13:24:44.554790 recvfrom(8, ..., 18, 0, NULL, NULL) = 18 <0.10>
14112 13:24:44.558550 sendto(8, ..., 7999, 0, NULL, 0) = 7999 <0.39>
14112 13:24:44.558712 sendto(8, ..., 489, 0, NULL, 0) = 489 <0.08>
14112 13:24:44.558766 poll([{fd=8, events=POLLIN}], 1, 30) = 1 ([{fd=8,
revents=POLLERR|POLLHUP}]) <0.000974>
14112 13:24:44.559794 recvfrom(8, 0x7f1f7642b138, 8, 0, 0, 0) = -1
ECONNRESET (Connection reset by peer) <0.13>
14112 13:24:44.560381 shutdown(8, 0 /* receive */) = -1 ENOTCONN (Transport
endpoint is not connected) <0.08>
14112 13:24:44.560422 close(8)  = 0 <0.20>

19549 19.576639   129.2.10.148  129.2.10.36   TCP  60
ms-sql-s > 58955 [RST, ACK] Seq=3201427 Ack=16493 Win=0 Len=0

Worried that something in my fix had broken something we started
instrumenting the code. We found that when code to display what was being
appended to the output buffer the problem went away. When that code was
replaced by a simple 1 ms sleep the problem also disappeared.

This has led me to wonder if it is possible to hammer a SQL Server too hard
and have it simply shut up the client by closing its connection. Maybe this
is outside of SQL Server and something that Windows itself is doing. I am
not an expert in either of these components but I've seen references when
searching on these symptoms to indicate I may not be mad. Does anyone have
any experiences or opinions?

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono Maintainers list

2012-04-16 Thread Neale Ferguson
s390x architecture maintainer


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Printer profile

2006-05-22 Thread Neale Ferguson
Hi, 
 I have created a few different printer profiles for a printer that I want
to invoke under certain conditions. Is there something I can use that will
cause a specific profile to be used for a given job? I cannot find anything
under PrintDocument.PrinterSettings.

Neale


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


  1   2   >