[Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-03 Thread Carlos Alberto Cortez
Hey,

A patch is attached, containing a check for InternalsVisibleToAttribute,
when it is applied to an assembly. It reports a warning or shows an
error, just like csc does.

Carlos.
Index: ChangeLog
===
--- ChangeLog	(revisión: 47987)
+++ ChangeLog	(copia de trabajo)
@@ -1,3 +1,9 @@
+2005-08-03  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+	* codegen.cs
+	(AssemblyClass.CheckAttributeValid): New method to check
+	validity in assembly attributes.
+	
 2005-08-03  Martin Baulig  <[EMAIL PROTECTED]>
 
 	Make iterators in generic methods work; see gtest-191.cs.
Index: codegen.cs
===
--- codegen.cs	(revisión: 47987)
+++ codegen.cs	(copia de trabajo)
@@ -1186,6 +1186,45 @@
 			Report.Error (1548, "Error during assembly signing. " + text);
 		}
 
+		void CheckAttributeValid (Attribute a)
+		{
+			if (a == null)
+throw new ArgumentNullException ("a");
+
+			Type t = a.Type;
+			if (t.Equals (typeof (System.Runtime.CompilerServices.InternalsVisibleToAttribute))) {
+string [] args = a.GetString ().Trim ().Split (new char [] {','});
+
+bool is_name_valid = true;
+bool version = false, culture = false, key_token = false;
+for (int i = 1; i < args.Length; i++) {
+	string [] values = args [i].Split (new char [] {'='});
+	if (values.Length < 2 || values [1] == String.Empty) {
+		is_name_valid = false;
+		break;
+	}
+
+	if (String.Compare (values [0], "Version", true) == 0)
+		version = true;
+	else if (String.Compare (values [0], "Culture", true) == 0)
+		culture = true;
+	else if (String.Compare (values [0], "PublicKeyToken", true) == 0)
+		key_token = true;
+	// PublicKey is the only valid entry
+	else if (String.Compare (values [0], "PublicKey", true) != 0) {
+		is_name_valid = false;
+		break;
+	}
+}
+
+// If the name is invalid, report CS1700
+if (!is_name_valid || args [0] == "")
+	Report.Warning (1700, a.Location, "Assembly reference '" + a.GetString () + "' is invalid and cannot be resolved");
+else if (culture || key_token || version)
+	throw new Exception ("Friend assembly '" + a.GetString () + "' is invalid. InternalsVisibleTo cannot have version, culture or key token specified.");
+			}
+		}
+
 		public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
 		{
 			if (a.Type.IsSubclassOf (TypeManager.security_attr_type) && a.CheckSecurityActionValidity (true)) {
@@ -1196,6 +1235,7 @@
 return;
 			}
 
+			CheckAttributeValid (a);
 			Builder.SetCustomAttribute (customBuilder);
 		}
 
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-03 Thread Ben Maurer
On Wed, 2005-08-03 at 20:55 -0500, Carlos Alberto Cortez wrote:
> Hey,
> 
> A patch is attached, containing a check for InternalsVisibleToAttribute,
> when it is applied to an assembly. It reports a warning or shows an
> error, just like csc does.



> +   if (t.Equals (typeof 
> (System.Runtime.CompilerServices.InternalsVisibleToAttribute))) {

This precludes us from using the assembly in mscorlib.dll. It could
potentially be useful to use there -- say to let us write nunit tests
that poked at internals.

See http://blogs.msdn.com/junfeng/archive/2004/09/14/229254.aspx about
how there is support for handling commas in file names. Your code would
break under this.

Finally, comparisons should be done with the invariant culture.

-- Ben

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Carlos Alberto Cortez
Hello,

Below my comments.

El jue, 04-08-2005 a las 00:46 -0400, Ben Maurer escribió:
> On Wed, 2005-08-03 at 20:55 -0500, Carlos Alberto Cortez wrote:
> > Hey,
> > 
> > A patch is attached, containing a check for InternalsVisibleToAttribute,
> > when it is applied to an assembly. It reports a warning or shows an
> > error, just like csc does.
> 
> 
> 
> > +   if (t.Equals (typeof 
> > (System.Runtime.CompilerServices.InternalsVisibleToAttribute))) {
> 
> This precludes us from using the assembly in mscorlib.dll. It could
> potentially be useful to use there -- say to let us write nunit tests
> that poked at internals.

I'm not very sure about the scenarios you are thinking in. Could you
please show some detailed examples?

> 
> See http://blogs.msdn.com/junfeng/archive/2004/09/14/229254.aspx about
> how there is support for handling commas in file names. Your code would
> break under this.

Well, I didn't know about that, but IHMO I find it like a very bad
practice, and I'm sure that there aren't people out there who like to
call their assemblies 'My,Assembly,Version=xx..." or something like
that.

Also, to test this, I tried to load an assembly named
'Test,Assembly' (using Assembly.Load ()) in both mono and ..NET, and
neither could load it successfully. The only way to work with it AFAIK
is when you get name of the assembly itself, or use Assembly.LoadFrom.

So, I don't think it's that important. But, if anybody find it
neccessary, we could add it.

> 
> Finally, comparisons should be done with the invariant culture.
> 
> -- Ben
> 

Thanks, I just noted that's the way the comparisons are done in the
runtime.

Carlos.


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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Marek Safar

Hello Carlos,


A patch is attached, containing a check for InternalsVisibleToAttribute,
when it is applied to an assembly. It reports a warning or shows an
error, just like csc does.


 


+   if (a == null)
+   throw new ArgumentNullException ("a");

This will never happen.

+   if (t.Equals (typeof 
(System.Runtime.CompilerServices.InternalsVisibleToAttribute))) {

Please use direct comparison with type declared in TypeManager. See how it's 
used elsewhere.


+   string [] args = a.GetString ().Trim ().Split 
(new char [] {','});

a.GetString () can return null.

+   CheckAttributeValid (a);

Could you rename the method to be more explicit ?


+   Report.Warning (1700, a.Location, "Assembly reference 
'" + a.GetString () + "' is invalid and cannot be resolved");

Here you are missing warning level (2nd parameter)



Do you have tests for this ?


Marek




Index: ChangeLog
===
--- ChangeLog   (revisión: 47987)
+++ ChangeLog   (copia de trabajo)
@@ -1,3 +1,9 @@
+2005-08-03  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+   * codegen.cs
+   (AssemblyClass.CheckAttributeValid): New method to check
+   validity in assembly attributes.
+   
2005-08-03  Martin Baulig  <[EMAIL PROTECTED]>

Make iterators in generic methods work; see gtest-191.cs.
Index: codegen.cs
===
--- codegen.cs  (revisión: 47987)
+++ codegen.cs  (copia de trabajo)
@@ -1186,6 +1186,45 @@
Report.Error (1548, "Error during assembly signing. " + 
text);
}

+   void CheckAttributeValid (Attribute a)
+   {
+   if (a == null)
+   throw new ArgumentNullException ("a");
+
+   Type t = a.Type;
+   if (t.Equals (typeof 
(System.Runtime.CompilerServices.InternalsVisibleToAttribute))) {
+   string [] args = a.GetString ().Trim ().Split 
(new char [] {','});
+
+   bool is_name_valid = true;
+   bool version = false, culture = false, 
key_token = false;
+   for (int i = 1; i < args.Length; i++) {
+   string [] values = args [i].Split (new 
char [] {'='});
+   if (values.Length < 2 || values [1] == 
String.Empty) {
+   is_name_valid = false;
+   break;
+   }
+
+   if (String.Compare (values [0], 
"Version", true) == 0)
+   version = true;
+   else if (String.Compare (values [0], 
"Culture", true) == 0)
+   culture = true;
+   else if (String.Compare (values [0], 
"PublicKeyToken", true) == 0)
+   key_token = true;
+   // PublicKey is the only valid entry
+   else if (String.Compare (values [0], 
"PublicKey", true) != 0) {
+   is_name_valid = false;
+   break;
+   }
+   }
+
+   // If the name is invalid, report CS1700
+   if (!is_name_valid || args [0] == "")
+   Report.Warning (1700, a.Location, "Assembly reference 
'" + a.GetString () + "' is invalid and cannot be resolved");
+   else if (culture || key_token || version)
+   throw new Exception ("Friend assembly '" + 
a.GetString () + "' is invalid. InternalsVisibleTo cannot have version, culture or key token 
specified.");
+   }
+   }
+
public override void ApplyAttributeBuilder (Attribute a, 
CustomAttributeBuilder customBuilder)
{
if (a.Type.IsSubclassOf (TypeManager.security_attr_type) 
&& a.CheckSecurityActionValidity (true)) {
@@ -1196,6 +1235,7 @@
return;
}

+   CheckAttributeValid (a);
Builder.SetCustomAttribute (customBuilder);
}

 




___
Mono-devel-li

Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Ben Maurer
On Thu, 2005-08-04 at 00:07 -0500, Carlos Alberto Cortez wrote:
> > This precludes us from using the assembly in mscorlib.dll. It could
> > potentially be useful to use there -- say to let us write nunit tests
> > that poked at internals.
> 
> I'm not very sure about the scenarios you are thinking in. Could you
> please show some detailed examples?

For example, I add an internal api to corlib called FooParser. I want to
write nunit tests, so what I do is make the nunit assembly be able to
see corlib's insides.

> > 
> > See http://blogs.msdn.com/junfeng/archive/2004/09/14/229254.aspx about
> > how there is support for handling commas in file names. Your code would
> > break under this.
> 
> Well, I didn't know about that, but IHMO I find it like a very bad
> practice, and I'm sure that there aren't people out there who like to
> call their assemblies 'My,Assembly,Version=xx..." or something like
> that.

Well, it was important enough to add the feature in msft

> Also, to test this, I tried to load an assembly named
> 'Test,Assembly' (using Assembly.Load ()) in both mono and ..NET, and
> neither could load it successfully. The only way to work with it AFAIK
> is when you get name of the assembly itself, or use Assembly.LoadFrom.

It is a whidbey feature, as mentioned in the article.

-- Ben

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Carlos Alberto Cortez
Hey Marek,

On 8/4/05, Marek Safar <[EMAIL PROTECTED]> wrote:


> 
> +   string [] args = a.GetString ().Trim ().Split 
> (new char [] {','});
> 
> a.GetString () can return null.
> 

I don't think so. When the emtpy string is passed, it shows no errors.
When you don't pass any argument, it will complain about the
parameter. Or I'm missing something?

> +   CheckAttributeValid (a);
> 
> Could you rename the method to be more explicit ?
> 

I changed it to CheckAttributeValidity, but I'm  not very sure about
it. Do you have any better idea?


The other things were applied. I attached two test cases. Do you think
we could need more tests?

Carlos.
Index: typemanager.cs
===
--- typemanager.cs	(revisión: 47987)
+++ typemanager.cs	(copia de trabajo)
@@ -106,6 +106,7 @@
 	static internal Type compiler_generated_attr_type;
 	static internal Type fixed_buffer_attr_type;
 	static internal Type default_charset_type;
+	static public Type internals_visible_attr_type;
 
 	//
 	// An empty array of types
@@ -1232,6 +1233,7 @@
 		compiler_generated_attr_type = CoreLookupType ("System.Runtime.CompilerServices.CompilerGeneratedAttribute");
 		fixed_buffer_attr_type = CoreLookupType ("System.Runtime.CompilerServices.FixedBufferAttribute");
 		default_charset_type = CoreLookupType ("System.Runtime.InteropServices.DefaultCharSetAttribute");
+		internals_visible_attr_type = CoreLookupType ("System.Runtime.CompilerServices.InternalsVisibleToAttribute");
 		//
 		// When compiling corlib, store the "real" types here.
 		//
Index: ChangeLog
===
--- ChangeLog	(revisión: 47987)
+++ ChangeLog	(copia de trabajo)
@@ -1,3 +1,9 @@
+2005-08-03  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+	* codegen.cs
+	(AssemblyClass.CheckAttributeValid): New method to check
+	validity in assembly attributes.
+	
 2005-08-03  Martin Baulig  <[EMAIL PROTECTED]>
 
 	Make iterators in generic methods work; see gtest-191.cs.
Index: codegen.cs
===
--- codegen.cs	(revisión: 47987)
+++ codegen.cs	(copia de trabajo)
@@ -1186,6 +1186,42 @@
 			Report.Error (1548, "Error during assembly signing. " + text);
 		}
 
+		void CheckAttributeValidity (Attribute a)
+		{
+			Type t = a.Type;
+			if (t == TypeManager.internals_visible_attr_type) {
+string [] args = a.GetString ().Trim ().Split (new char [] {','});
+
+bool is_name_valid = true;
+bool version = false, culture = false, key_token = false;
+for (int i = 1; i < args.Length; i++) {
+	string [] values = args [i].Split (new char [] {'='});
+	if (values.Length < 2 || values [1] == String.Empty) {
+		is_name_valid = false;
+		break;
+	}
+
+	if (String.CompareOrdinal (values [0], "Version") == 0)
+		version = true;
+	else if (String.CompareOrdinal (values [0], "Culture") == 0)
+		culture = true;
+	else if (String.CompareOrdinal (values [0], "PublicKeyToken") == 0)
+		key_token = true;
+	// PublicKey is the only valid entry
+	else if (String.CompareOrdinal (values [0], "PublicKey") != 0) {
+		is_name_valid = false;
+		break;
+	}
+}
+
+// If the name is invalid, report CS1700
+if (!is_name_valid || args [0] == "")
+	Report.Warning (1700, 3, a.Location, "Assembly reference '" + a.GetString () + "' is invalid and cannot be resolved");
+else if (culture || key_token || version)
+	throw new Exception ("Friend assembly '" + a.GetString () + "' is invalid. InternalsVisibleTo cannot have version, culture or key token specified.");
+			}
+		}
+
 		public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
 		{
 			if (a.Type.IsSubclassOf (TypeManager.security_attr_type) && a.CheckSecurityActionValidity (true)) {
@@ -1196,6 +1232,7 @@
 return;
 			}
 
+			CheckAttributeValidity (a);
 			Builder.SetCustomAttribute (customBuilder);
 		}
 
// gcs0647.cs: Error during emitting `System.Runtime.CompilerServices.InternalsVisibleToAttribute' attribute. 
// The reason is `Friend assembly 'AssemblySomething,Version=1.2.3.4,Culture=neutral,PublicKeyToken=27576a8182a18822' is invalid. 
// InternalsVisibleTo cannot have version, culture or key token specified.'
// Line: 8
using System;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo ("AssemblySomething,Version=1.2.3.4,Culture=neutral,PublicKeyToken=27576a8182a18822")]

public class InternalsVisibleToTest {

	static void Main ()
	{
	}

}

// gcs0647-2.cs: Error during emitting `System.Runtime.CompilerServices.InternalsVisibleToAttribute' attribute. 
// The reason is `Friend assembly 'AssemblySomething,PublicKeyToken=27576a8182a18822' is invalid. 
// InternalsVisibleTo cannot have version, culture or key token specified.'
// Line: 8
using System;
using System.Runtime.CompilerServices;

[assem

Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Ben Maurer
On Thu, 2005-08-04 at 17:15 -0500, Carlos Alberto Cortez wrote:
> +   if (String.CompareOrdinal
> (values [0], "Version") == 0)
> +   version = true;

Weren't these case insensitive in your first version?

If they are, then you can just use String.Equals, otherwise, i think
this call is wrong

-- Ben

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-04 Thread Carlos Alberto Cortez
Right, that's true, since we need to support an insensitive case
comparison. Just corrected that.

Carlos.

El jue, 04-08-2005 a las 18:23 -0400, Ben Maurer escribió:
> On Thu, 2005-08-04 at 17:15 -0500, Carlos Alberto Cortez wrote:
> > +   if (String.CompareOrdinal
> > (values [0], "Version") == 0)
> > +   version = true;
> 
> Weren't these case insensitive in your first version?
> 
> If they are, then you can just use String.Equals, otherwise, i think
> this call is wrong
> 
> -- Ben
> 

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-05 Thread Marek Safar

Hello Carlos


+   string [] args = a.GetString ().Trim ().Split 
(new char [] {','});

a.GetString () can return null.

   



I don't think so. When the emtpy string is passed, it shows no errors.
When you don't pass any argument, it will complain about the
parameter. Or I'm missing something?
 


Sorry, you are right.

 


+   CheckAttributeValid (a);

Could you rename the method to be more explicit ?

   



I changed it to CheckAttributeValidity, but I'm  not very sure about
it. Do you have any better idea?
 


What about 'CheckInternalsVisibleAttribute' ?



The other things were applied. I attached two test cases. Do you think
we could need more tests?
 


They look fine.

BTW: Could not we use AssemblyName class from corlib to avoid this 
parsing code ?


Marek




Index: typemanager.cs
===
--- typemanager.cs  (revisión: 47987)
+++ typemanager.cs  (copia de trabajo)
@@ -106,6 +106,7 @@
static internal Type compiler_generated_attr_type;
static internal Type fixed_buffer_attr_type;
static internal Type default_charset_type;
+   static public Type internals_visible_attr_type;

//
// An empty array of types
@@ -1232,6 +1233,7 @@
compiler_generated_attr_type = CoreLookupType 
("System.Runtime.CompilerServices.CompilerGeneratedAttribute");
fixed_buffer_attr_type = CoreLookupType 
("System.Runtime.CompilerServices.FixedBufferAttribute");
default_charset_type = CoreLookupType 
("System.Runtime.InteropServices.DefaultCharSetAttribute");
+   internals_visible_attr_type = CoreLookupType 
("System.Runtime.CompilerServices.InternalsVisibleToAttribute");
//
// When compiling corlib, store the "real" types here.
//
Index: ChangeLog
===
--- ChangeLog   (revisión: 47987)
+++ ChangeLog   (copia de trabajo)
@@ -1,3 +1,9 @@
+2005-08-03  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+   * codegen.cs
+   (AssemblyClass.CheckAttributeValid): New method to check
+   validity in assembly attributes.
+   
2005-08-03  Martin Baulig  <[EMAIL PROTECTED]>

Make iterators in generic methods work; see gtest-191.cs.
Index: codegen.cs
===
--- codegen.cs  (revisión: 47987)
+++ codegen.cs  (copia de trabajo)
@@ -1186,6 +1186,42 @@
Report.Error (1548, "Error during assembly signing. " + 
text);
}

+   void CheckAttributeValidity (Attribute a)
+   {
+   Type t = a.Type;
+   if (t == TypeManager.internals_visible_attr_type) {
+   string [] args = a.GetString ().Trim ().Split 
(new char [] {','});
+
+   bool is_name_valid = true;
+   bool version = false, culture = false, 
key_token = false;
+   for (int i = 1; i < args.Length; i++) {
+   string [] values = args [i].Split (new 
char [] {'='});
+   if (values.Length < 2 || values [1] == 
String.Empty) {
+   is_name_valid = false;
+   break;
+   }
+
+   if (String.CompareOrdinal (values [0], 
"Version") == 0)
+   version = true;
+   else if (String.CompareOrdinal (values [0], 
"Culture") == 0)
+   culture = true;
+   else if (String.CompareOrdinal (values [0], 
"PublicKeyToken") == 0)
+   key_token = true;
+   // PublicKey is the only valid entry
+   else if (String.CompareOrdinal (values [0], 
"PublicKey") != 0) {
+   is_name_valid = false;
+   break;
+   }
+   }
+
+   // If the name is invalid, report CS1700
+   if (!is_name_valid || args [0] == "")
+   Report.Warning (1700, 3, a.Location, "Assembly 
reference '" + a.GetString () + "' is invalid and cannot be resolved");
+   else if (culture || key_token || version)
+   throw new Exception ("Friend assembly '" + 
a.GetString () + "' is i

Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-05 Thread Carlos Alberto Cortez
Hey Marek,

Comments below:



> >
> >I changed it to CheckAttributeValidity, but I'm  not very sure about
> >it. Do you have any better idea?
> >  
> >
> What about 'CheckInternalsVisibleAttribute' ?
> 

Good. (Note that my idea was to have here some other attributes checks,
but, since we have only one, we can keep call it this way).

> >
> >The other things were applied. I attached two test cases. Do you think
> >we could need more tests?
> >  
> >
> They look fine.
> 
> BTW: Could not we use AssemblyName class from corlib to avoid this 
> parsing code ?
> 

Well, yes. That's exactly what I tought. But, we don't have a Parse ()
method that takes the assembly name (long format) and retrieves an
AssemblyName. At least, I didn't found it ;-)

Carlos.



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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-05 Thread Marek Safar

Hello,


The other things were applied. I attached two test cases. Do you think
we could need more tests?


 


They look fine.

BTW: Could not we use AssemblyName class from corlib to avoid this 
parsing code ?


   



Well, yes. That's exactly what I tought. But, we don't have a Parse ()
method that takes the assembly name (long format) and retrieves an
AssemblyName. At least, I didn't found it ;-)

 

I found string constructor in AssemblyName class which should be exactly 
what we need.


Marek

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-05 Thread Carlos Alberto Cortez
Hey,

The constructor receiving a string doesn't parse the long format name.
Instead, it just assign "Name" property. So, I don't think we can use
it.

Carlos.

El vie, 05-08-2005 a las 13:55 +0100, Marek Safar escribió:
> Hello,
> 
> >>>The other things were applied. I attached two test cases. Do you think
> >>>we could need more tests?
> >>> 
> >>>
> >>>  
> >>>
> >>They look fine.
> >>
> >>BTW: Could not we use AssemblyName class from corlib to avoid this 
> >>parsing code ?
> >>
> >>
> >>
> >
> >Well, yes. That's exactly what I tought. But, we don't have a Parse ()
> >method that takes the assembly name (long format) and retrieves an
> >AssemblyName. At least, I didn't found it ;-)
> >
> >  
> >
> I found string constructor in AssemblyName class which should be exactly 
> what we need.
> 
> Marek
> 

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-05 Thread Carlos Alberto Cortez
Hey,

I just checked it, and saw that in the .Net docs, it states that
AssemblyName (string name) receives the simple name. However, in the
beta 2, if you pass the long format name, it parses it. 

I think we should keep this change to mcs this way, and wait for this
change in the api (System.Reflection) to be 'official'. On the other
hand, we could just implement the constructor the way .Net does, and the
re-use it.

Carlos.

El vie, 05-08-2005 a las 13:55 +0100, Marek Safar escribió:
> Hello,
> 
> >>>The other things were applied. I attached two test cases. Do you think
> >>>we could need more tests?
> >>> 
> >>>
> >>>  
> >>>
> >>They look fine.
> >>
> >>BTW: Could not we use AssemblyName class from corlib to avoid this 
> >>parsing code ?
> >>
> >>
> >>
> >
> >Well, yes. That's exactly what I tought. But, we don't have a Parse ()
> >method that takes the assembly name (long format) and retrieves an
> >AssemblyName. At least, I didn't found it ;-)
> >
> >  
> >
> I found string constructor in AssemblyName class which should be exactly 
> what we need.
> 
> Marek
> 

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


Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-08 Thread Marek Safar

Hello,


I just checked it, and saw that in the .Net docs, it states that
AssemblyName (string name) receives the simple name. However, in the
beta 2, if you pass the long format name, it parses it. 
 


I think we should keep this change to mcs this way, and wait for this
change in the api (System.Reflection) to be 'official'. On the other
hand, we could just implement the constructor the way .Net does, and the
re-use it.
 

I think Beta2 API is more or less stable. I prefer to implement this 
piece of API at least in same way as you did for mcs.
If you don't want to do it then mark relevant code in mcs with a comment 
about this.


Marek

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


[Mono-dev] Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-08 Thread Carlos Alberto Cortez
Hey,

I'm implementing it right now. So, as soon as it gets in the svn tree,
we can re-use it in mcs.

Carlos.

El lun, 08-08-2005 a las 14:42 +0100, Marek Safar escribió:
> Hello,
> 
> >I just checked it, and saw that in the .Net docs, it states that
> >AssemblyName (string name) receives the simple name. However, in the
> >beta 2, if you pass the long format name, it parses it. 
> >  
> >
> >I think we should keep this change to mcs this way, and wait for this
> >change in the api (System.Reflection) to be 'official'. On the other
> >hand, we could just implement the constructor the way .Net does, and the
> >re-use it.
> >  
> >
> I think Beta2 API is more or less stable. I prefer to implement this 
> piece of API at least in same way as you did for mcs.
> If you don't want to do it then mark relevant code in mcs with a comment 
> about this.
> 
> Marek
> 

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


RE: SPAM-LOW: Re: [Mono-devel-list] [PATCH] Check for assembly attributes

2005-08-06 Thread Charlie Poole
Hi Ben,

> On Thu, 2005-08-04 at 00:07 -0500, Carlos Alberto Cortez wrote:
> > > This precludes us from using the assembly in 
> mscorlib.dll. It could 
> > > potentially be useful to use there -- say to let us write nunit 
> > > tests that poked at internals.
> > 
> > I'm not very sure about the scenarios you are thinking in. 
> Could you 
> > please show some detailed examples?
> 
> For example, I add an internal api to corlib called 
> FooParser. I want to write nunit tests, so what I do is make 
> the nunit assembly be able to see corlib's insides.

I'm not sure I'd want to be able to do that so easily. I'm weak and
might succumb to the temptation of testing the insides rather than
designing the parser so I didn't need to see the insides. :-)

Charlie 


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