Commit Graph
34 Commits
Author SHA1 Message Date
Rodrigo Kumpera a700784767 [runtime] Don't allow execution of dynamic assemblies without run access. Fixes #7126 2013-08-21 12:08:11 -04:00
Marek Safar 6d132a7c23 Remove generated file dependency to make fresh checkout tests work out of box 2013-03-07 09:31:47 +01:00
Andres G. Aragoneses df4a73d70f [System.Reflection.Emit] Store dynamic assemblies after the static ones
AssemblyBuilder class was adding generated dynamic assemblies at the
beginning of the list of the assemblies of the current domain, instead
of at the end.

This not only is not the behaviour of MS.NET but was inconsistent to
previous calls to the CurrentDomain.GetAssemblies() method, which would
return assemblies in different positions.

If code was relying on the order of these assemblies being returned (i.e.
to find the first type in the loaded assemblies that conforms to certain
requirements), it would result in unexpected behaviour if used along with
frameworks that mock/stub types on the fly, such as RhinoMocks, FakeItEasy
or other Castle.DynamicProxy-based ones.

This fixes BXC#10004:
https://bugzilla.xamarin.com/show_bug.cgi?id=10004

Patch contributed under the terms of MIT/X11 licence.
2013-02-03 19:12:25 +00:00
Miguel de Icaza ae0feab435 Removal of NET_1_1 defines and some NET_2_0; Both defines are true these days in Mono, no versions prior to 2.0 are supported 2012-06-01 18:04:24 -04:00
Zoltan Varga 866ea36635 Fix some tests broken by some NET 4.0 changes. 2011-07-01 02:32:25 +02:00
Rodrigo Kumpera e340fb6e79 Fix AssemblyBuilder::GetTypes () with unfinished types.
* AssemblyBuilder.cs (GetTypes): Raise ReflectionTypeLoadException
	if any type was not finished.

	* AssemblyBuilderTest.cs: Add test for GetTypes () and incomplete
	TypeBuilders'.

	Fixes #640288
2010-09-20 14:32:24 -03:00
Zoltan Varga 0acf9469fb Fix warnings.
svn path=/trunk/mcs/; revision=155701
2010-04-19 08:41:42 +00:00
Rodrigo Kumpera 280fce3bf7 2010-03-26 Rodrigo Kumpera <[email protected]>
* AssemblyBuilder.cs: Implement v4 GetReferencedAssemblies
	and GetLoadedModules.

2010-03-26 Rodrigo Kumpera  <[email protected]>

	* AssemblyBuilderTest.cs: Test GetReferencedAssemblies
	and GetLoadedModules.

svn path=/trunk/mcs/; revision=154311
2010-03-26 19:15:31 +00:00
Rodrigo Kumpera bb85d0c720 2010-03-25 Rodrigo Kumpera <[email protected]>
* AssemblyBuilder.cs: Implement v4 GetModule(s).

2010-03-25 Rodrigo Kumpera  <[email protected]>

	* AssemblyBuilderTest.cs: Add test for v4 GetModule(s).

svn path=/trunk/mcs/; revision=154232
2010-03-25 23:42:14 +00:00
Rodrigo Kumpera 6493d5e8ba 2010-03-25 Rodrigo Kumpera <[email protected]>
* AssemblyBuilder.cs: Implement v4 GetType.

2010-03-25 Rodrigo Kumpera  <[email protected]>

	* AssemblyBuilderTest.cs: Add test for v4 GetType and
	fix other test to not be broken.

svn path=/trunk/mcs/; revision=154231
2010-03-25 23:42:05 +00:00
Zoltan Varga 0e327b9c11 2008-04-14 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs (GetCustomAttributes_NotCreated): New test for
	#363447.

svn path=/trunk/mcs/; revision=100613
2008-04-13 22:21:20 +00:00
Gert Driesen f96ea1be6b * Win32Resources.cs: On 2.0 profile, initialize fixed info to empty
string when emitting versioninfo in compiler context. Default to
neutral language in compiler context. On 1.0 profile, use 0xffff as
default value for version parts. In Version, abort on first invalid
version part and also set FileVersion string. In ProductVersion and
FileVersion, parse version string and abort on first invalid version 
part.               
* AssemblyBuilder.cs: Added enum that determines the type of the
native (version) resource. Added fields for holding the native
resource type and the version culture. The versioninfo_culture was
introduced to hold the original culture of the assembly, since
the AssemblyCultureAttribute should only affect the language of the
versioninfo block when not used in compiler context. Move constructin 
of native version info to DefineVersionInfoResourceImpl to allow 
attributes to affect the versioninfo after DefineVersionInfoResource 
has been invoked. Allow ArgumentException for invalid culture string 
to bubble up. In compiler context, use FileVersion as default value
for ProductionVersion.
* AssemblyBuilderTest.cs: Enabled DefineUnmanagedResource and
DefineVersionInfoResource tests for ArgumentException when native
resource is already defined. Added tests for not supported culture
in AssemblyCultureAttribute when definining versioninfo resource.

svn path=/trunk/mcs/; revision=99280
2008-03-29 12:35:53 +00:00
Zoltan Varga 5933ddf48c 2008-01-29 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs (GetModule): Add some tests and comment out one which
	doesn't run on mono.

svn path=/trunk/mcs/; revision=94288
2008-01-29 18:57:51 +00:00
Gert Driesen 39737ac369 * AssemblyBuilder.cs: Introduce magic value for AssemblyBuilferAccess
to signal usage from a compiler. On 2.0 profile, perform argument
check for access. Use AssemblyFlags passed in through AssemblyName
arguments. Modified SetCustomAttribute to only use the Assembly*
attribute for constructing the assembly name when used in compiler
context. Fixes corlib part of bug #354970.
* AppDomainTest.cs: Added DefineDynamicAssembly tests for invalid
AssemblyBuilderAccess argument. Enabled test for DefineDynamicAssembly
overload taking IEnumerable<CustomAttributeBuilder>. Fixed typo in
comments.
* AssemblyBuilderTest.cs: Enabled test for bug #354970.

svn path=/trunk/mcs/; revision=93490
2008-01-22 09:26:29 +00:00
Gert Driesen a0065f3330 * AppDomainTest.cs: Added test for DefineDynamicAssembly overload
taking IEnumerable<CustomAttributeBuilder>.
* AssemblyBuilderTest.cs: Added tests for DefineUnmanagedResource and  
DefineVersionInfoResource overloads that check whether only a single
unmanaged resource can be defined. Improved test for SetCustomAttribute.
* AssemblyNameTest.cs: Added test for effect of AssemblyNameFlags on
FullName. Added test for PublicKey with value "null". Added ctor test
for Retargetable spec.
* AssemblyName.cs: Added support for Retargetable spec in FullName.

svn path=/trunk/mcs/; revision=93348
2008-01-20 15:51:42 +00:00
Gert Driesen a2a4a396a4 * AssemblyBuilderTest.cs: Added (NotWorking) test for bug #351932.
svn path=/trunk/mcs/; revision=92353
2008-01-06 17:34:42 +00:00
Gert Driesen 75fa72c63c * AssemblyBuilder.cs (UnprotectedGetName): Set the public key token
as well.
* AssemblyBuilderTest.cs: Improved existing AssemblyName related tests.
Enabled AssemblyName tests that previously failed.
* AssemblyNameCas.cs: Sync test methods with AssemblyNameTest.cs.
* AssemblyNameTest.cs: Removed AssertEqualsByteArrays method since
NUnit supports this out-of-the-box. Use more meaningful names for
some existing tests. Improved existing tests and added lots more.
Enabled tests that were previously failing.  Fixed and improved
tests for public key; the original "public key" was actually a         
key pair.
* AssemblyName.cs: Fixed default value for ProcessorArchitecture to
match MS. On 2.0 profile, return zero-length in FullName is no name
is set, and throw a SecurityException in FullName and GetPublicKeyToken
if a public key is set with no corresponding public key token. 
Fixed FullName to also include PublicKeyToken spec with "null" value
if public key is empty byte array. Fixed corlib part of bug #351057.   
In SetPublicKey, modify Flags accordingly. On the 2.0 profile, verify
the public key when the public key token is computed.

svn path=/trunk/mcs/; revision=92314
2008-01-05 19:35:02 +00:00
Miguel de Icaza fdd5d5d2dd Fix growth and validation; Have a test case, but it generates junk
svn path=/trunk/mcs/; revision=89874
2007-11-17 21:21:42 +00:00
Gert Driesen 19f6a68a50 * AssemblyTest.cs: Added test for ManifestModule.
* AssemblyBuilderTest.cs: Added test for ManifestModule. Added missing
Test attributes. Avoid using ExpectedException, thereby improving lots
of existing tests. Uncomment test that checks max length of dynamic
module name and removed LAMESPEC, since MS implements the described 
behavior (but we don't, so mark it NotWorking). Code formatting.
* TypeBuilderTest.cs: Removed unused variables.
* AssemblyBuilder.cs: Added missing paramname to ArgumentExceptions.
Use String.Length to check for zero-length string.

svn path=/trunk/mcs/; revision=86236
2007-09-23 09:39:35 +00:00
Sebastien Pouliot 24b49a1fb1 2006-07-31 Sebastien Pouliot <[email protected]>
* AssemblyBuilderTest.cs: The GetType_IgnoreCase test case doesn't 
	work under MS.
	* ConstructorBuilderTest.cs: The TestMethodHandle test case doesn't
	work under MS.


svn path=/trunk/mcs/; revision=63204
2006-07-31 21:33:50 +00:00
Gert Driesen 357e6e38b0 * corlib_test.dll.sources: Added DynamicMethodTest.cs from
Test/System.Reflection.Emit.
* DynamicMethod.cs: Fix check for empty method body, avoids SIGSEV.
* DynamicMethodTest.cs: Added test for bug #78253, and added test for empty
method body.
* AssemblyBuilderTest.cs: Added test for bug #78724.

svn path=/trunk/mcs/; revision=62377
2006-07-09 11:48:58 +00:00
Raja R Harinath d474fce3ae * AssemblyBuilderTest.cs (TestIsDefined): Make failure messages unique.
svn path=/trunk/mcs/; revision=54226
2005-12-12 08:19:42 +00:00
Zoltan Varga e9c061e32e 2005-07-29 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: Add test for #75650.

svn path=/trunk/mcs/; revision=47845
2005-07-29 13:55:41 +00:00
Sebastien Pouliot fdd40fc213 2005-06-14 Sebastien Pouliot <[email protected]>
* AssemblyBuilderTest.cs: Split AssemblyName_PublicKey to move culture
	tests to a new method (as their problem is different from #75246).


svn path=/trunk/mcs/; revision=45974
2005-06-14 14:26:25 +00:00
Gert Driesen 5e6a88b43d * AssemblyBuilderTest.cs: Setting KeyPair of AssemblyName has currently no
effect on PublicKey(Token) and FullName of AssemblyName of the 
AssemblyBuilder. Test for bug #75246.

svn path=/trunk/mcs/; revision=45852
2005-06-13 05:50:36 +00:00
Gert Driesen 738ca08bfa * AssemblyBuilderTest.cs: Removed inheritance from deprecated Assertion class,
use Assert class instead.

svn path=/trunk/mcs/; revision=45851
2005-06-13 05:23:55 +00:00
Gert Driesen 9beb5f6dae * AssemblyBuilderTest.cs: Added AssemblyName tests that currently fail on
Mono.

svn path=/trunk/mcs/; revision=45825
2005-06-12 16:57:02 +00:00
Zoltan Varga 4b806b101b 2005-04-28 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: Add test for GetModules ().

svn path=/trunk/mcs/; revision=43718
2005-04-28 12:53:07 +00:00
Zoltan Varga 0bf073055a 2004-11-22 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: Add regression test for bug #69780.

svn path=/trunk/mcs/; revision=36393
2004-11-22 15:00:27 +00:00
Sebastien Pouliot dcb5fa8f0b 2004-03-24 Sebastien Pouliot <[email protected]>
* AssemblyBuilderTest.cs: Added new tests to build strongnamed
	assemblies.

svn path=/trunk/mcs/; revision=24525
2004-03-24 16:12:50 +00:00
Zoltan Varga aa9cc67aef 2004-01-27 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs (TestCustomAttributes): Remove
	KeyFileAttribute from the test, since it must point to a valid keyfile.

svn path=/trunk/mcs/; revision=22539
2004-01-27 14:47:18 +00:00
Zoltan Varga 06538b8da8 2003-07-11 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: Added error handling tests.

svn path=/trunk/mcs/; revision=16123
2003-07-11 17:29:05 +00:00
Zoltan Varga bef0980eee 2003-05-19 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: More tests.

svn path=/trunk/mcs/; revision=14705
2003-05-19 16:40:24 +00:00
Zoltan Varga 72b6bb613d 2003-02-13 Zoltan Varga <[email protected]>
* AssemblyBuilderTest.cs: New file.

svn path=/trunk/mcs/; revision=11549
2003-02-13 12:39:31 +00:00