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.
* AssemblyBuilder.cs (GetTypes): Raise ReflectionTypeLoadException
if any type was not finished.
* AssemblyBuilderTest.cs: Add test for GetTypes () and incomplete
TypeBuilders'.
Fixes#640288
* 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
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
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
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
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
* 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
* 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
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
* 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
* AssemblyBuilderTest.cs (TestCustomAttributes): Remove
KeyFileAttribute from the test, since it must point to a valid keyfile.
svn path=/trunk/mcs/; revision=22539