Merge pull request #495 from nicolas-raoul/fix-for-issue2907-with-no-formatting-changes
authorMiguel de Icaza <miguel@gnome.org>
Fri, 7 Dec 2012 21:57:58 +0000 (13:57 -0800)
committerMiguel de Icaza <miguel@gnome.org>
Fri, 7 Dec 2012 21:57:58 +0000 (13:57 -0800)
Fix for issue 2907: XML "choice" not correctly processed during deserialization

1880 files changed:
.gitmodules
LICENSE
Makefile.am
autogen.sh
configure.in
docs/reactive-extension-bundle.txt [new file with mode: 0644]
docs/sources/mono-api-decimal.html [new file with mode: 0644]
eglib/src/goutput.c
external/Lucene.Net [new submodule]
external/ikvm [new submodule]
external/rx [new submodule]
libgc/autogen.sh
libgc/darwin_stop_world.c
libgc/include/private/gcconfig.h
libgc/pthread_support.c
mcs/build/library.make
mcs/build/profiles/monotouch.make
mcs/build/profiles/monotouch_runtime.make
mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngPattern.cs
mcs/class/IKVM.Reflection/AmbiguousMatchException.cs [deleted file]
mcs/class/IKVM.Reflection/Assembly.cs [deleted file]
mcs/class/IKVM.Reflection/AssemblyName.cs [deleted file]
mcs/class/IKVM.Reflection/BadImageFormatException.cs [deleted file]
mcs/class/IKVM.Reflection/Binder.cs [deleted file]
mcs/class/IKVM.Reflection/ConstructorInfo.cs [deleted file]
mcs/class/IKVM.Reflection/CustomAttributeData.cs [deleted file]
mcs/class/IKVM.Reflection/CustomAttributeNamedArgument.cs [deleted file]
mcs/class/IKVM.Reflection/CustomAttributeTypedArgument.cs [deleted file]
mcs/class/IKVM.Reflection/CustomModifiers.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/AssemblyBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/ConstructorBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/CustomAttributeBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/CustomModifiersBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/EnumBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/Enums.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/EventBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/FieldBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/ILGenerator.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/MethodBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/ModuleBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/OpCode.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/OpCodes.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/ParameterBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/PropertyBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/SignatureHelper.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/Tokens.cs [deleted file]
mcs/class/IKVM.Reflection/Emit/TypeBuilder.cs [deleted file]
mcs/class/IKVM.Reflection/Enums.cs [deleted file]
mcs/class/IKVM.Reflection/EventInfo.cs [deleted file]
mcs/class/IKVM.Reflection/ExceptionHandlingClause.cs [deleted file]
mcs/class/IKVM.Reflection/FieldInfo.cs [deleted file]
mcs/class/IKVM.Reflection/FieldSignature.cs [deleted file]
mcs/class/IKVM.Reflection/Fusion.cs [deleted file]
mcs/class/IKVM.Reflection/GenericWrappers.cs [deleted file]
mcs/class/IKVM.Reflection/IKVM.Reflection.csproj [deleted file]
mcs/class/IKVM.Reflection/Impl/ITypeOwner.cs [deleted file]
mcs/class/IKVM.Reflection/Impl/MdbWriter.cs [deleted file]
mcs/class/IKVM.Reflection/Impl/PdbWriter.cs [deleted file]
mcs/class/IKVM.Reflection/Impl/SymbolSupport.cs [deleted file]
mcs/class/IKVM.Reflection/InterfaceMapping.cs [deleted file]
mcs/class/IKVM.Reflection/LocalVariableInfo.cs [deleted file]
mcs/class/IKVM.Reflection/Makefile [deleted file]
mcs/class/IKVM.Reflection/ManifestResourceInfo.cs [deleted file]
mcs/class/IKVM.Reflection/MarshalSpec.cs [deleted file]
mcs/class/IKVM.Reflection/MemberInfo.cs [deleted file]
mcs/class/IKVM.Reflection/Metadata/CliHeader.cs [deleted file]
mcs/class/IKVM.Reflection/Metadata/MetadataRW.cs [deleted file]
mcs/class/IKVM.Reflection/Metadata/Tables.cs [deleted file]
mcs/class/IKVM.Reflection/MethodBase.cs [deleted file]
mcs/class/IKVM.Reflection/MethodBody.cs [deleted file]
mcs/class/IKVM.Reflection/MethodImplMap.cs [deleted file]
mcs/class/IKVM.Reflection/MethodInfo.cs [deleted file]
mcs/class/IKVM.Reflection/MethodSignature.cs [deleted file]
mcs/class/IKVM.Reflection/Missing.cs [deleted file]
mcs/class/IKVM.Reflection/Module.cs [deleted file]
mcs/class/IKVM.Reflection/ParameterInfo.cs [deleted file]
mcs/class/IKVM.Reflection/ParameterModifier.cs [deleted file]
mcs/class/IKVM.Reflection/Properties/AssemblyInfo.cs [deleted file]
mcs/class/IKVM.Reflection/PropertyInfo.cs [deleted file]
mcs/class/IKVM.Reflection/PropertySignature.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/AssemblyReader.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/ByteReader.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/EventInfoImpl.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/Field.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/GenericTypeParameter.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/MetadataReader.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/Method.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/ModuleReader.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/PEReader.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/PropertyInfoImpl.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/ResourceModule.cs [deleted file]
mcs/class/IKVM.Reflection/Reader/TypeDefImpl.cs [deleted file]
mcs/class/IKVM.Reflection/Signature.cs [deleted file]
mcs/class/IKVM.Reflection/StandAloneMethodSig.cs [deleted file]
mcs/class/IKVM.Reflection/StrongNameKeyPair.cs [deleted file]
mcs/class/IKVM.Reflection/Type.cs [deleted file]
mcs/class/IKVM.Reflection/TypeInfo.cs [deleted file]
mcs/class/IKVM.Reflection/TypeNameParser.cs [deleted file]
mcs/class/IKVM.Reflection/Universe.cs [deleted file]
mcs/class/IKVM.Reflection/Util.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/Heaps.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/MetadataWriter.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/ModuleWriter.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/PEWriter.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/ResourceSection.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/TextSection.cs [deleted file]
mcs/class/IKVM.Reflection/Writer/VersionInfo.cs [deleted file]
mcs/class/IKVM.Reflection/reflect.build [deleted file]
mcs/class/Makefile
mcs/class/Managed.Windows.Forms/Documentation/en/System.Windows.Forms/MaskedTextBox.xml
mcs/class/Managed.Windows.Forms/Documentation/en/System.Windows.Forms/TextBox.xml
mcs/class/Managed.Windows.Forms/System.Windows.Forms/AxHost.cs
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Csc.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CscTest.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ResolveAssemblyReferenceTest.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs
mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mcs/class/Mono.Options/Documentation/en/Mono.Options/Option.xml
mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml
mcs/class/Mono.Options/Mono.Options/Options.cs
mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs
mcs/class/Mono.Posix/Documentation/en/Mono.Posix/Syscall.xml
mcs/class/Mono.Reactive.Testing/Makefile [new file with mode: 0644]
mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing.dll.sources [new file with mode: 0644]
mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing_test.dll.sources [new file with mode: 0644]
mcs/class/Mono.Reactive.Testing/more_build_args [new file with mode: 0644]
mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD2.xml [deleted file]
mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD4.xml [deleted file]
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs [new file with mode: 0644]
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs [new file with mode: 0644]
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/Type2Message.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/Type3Message.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs
mcs/class/Mono.Security/Mono.Security.dll.sources
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/MessageBaseTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/Type3MessageTest.cs
mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs
mcs/class/PEAPI/Metadata.cs
mcs/class/PEAPI/PEAPI.cs
mcs/class/System.Configuration/System.Configuration/Configuration.cs
mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs
mcs/class/System.Configuration/System.Configuration/ConfigurationSection.cs
mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
mcs/class/System.Core/System.Linq.Expressions/BinaryExpression.cs
mcs/class/System.Core/System.Linq.Expressions/ConditionalExpression.cs
mcs/class/System.Core/System.Linq.Expressions/ConstantExpression.cs
mcs/class/System.Core/System.Linq.Expressions/ElementInit.cs
mcs/class/System.Core/System.Linq.Expressions/EmitContext.cs
mcs/class/System.Core/System.Linq.Expressions/Expression.cs
mcs/class/System.Core/System.Linq.Expressions/InvocationExpression.cs
mcs/class/System.Core/System.Linq.Expressions/LambdaExpression.cs
mcs/class/System.Core/System.Linq.Expressions/ListInitExpression.cs
mcs/class/System.Core/System.Linq.Expressions/MemberAssignment.cs
mcs/class/System.Core/System.Linq.Expressions/MemberBinding.cs
mcs/class/System.Core/System.Linq.Expressions/MemberExpression.cs
mcs/class/System.Core/System.Linq.Expressions/MemberInitExpression.cs
mcs/class/System.Core/System.Linq.Expressions/MemberListBinding.cs
mcs/class/System.Core/System.Linq.Expressions/MemberMemberBinding.cs
mcs/class/System.Core/System.Linq.Expressions/MethodCallExpression.cs
mcs/class/System.Core/System.Linq.Expressions/NewArrayExpression.cs
mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
mcs/class/System.Core/System.Linq.Expressions/ParameterExpression.cs
mcs/class/System.Core/System.Linq.Expressions/TypeBinaryExpression.cs
mcs/class/System.Core/System.Linq.Expressions/UnaryExpression.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryCastNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryChildNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QuerySetNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStartNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/QueryZipNode.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/SetInclusion.cs
mcs/class/System.Core/System.Linq.Parallel.QueryNodes/WrapHelper.cs
mcs/class/System.Core/System.Linq.Parallel/AggregationList.cs
mcs/class/System.Core/System.Linq.Parallel/ConcurrentGrouping.cs
mcs/class/System.Core/System.Linq.Parallel/ConcurrentLookup.cs
mcs/class/System.Core/System.Linq.Parallel/INodeVisitor.cs
mcs/class/System.Core/System.Linq.Parallel/IVisitableNode.cs
mcs/class/System.Core/System.Linq.Parallel/OrderingEnumerator.cs
mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs
mcs/class/System.Core/System.Linq.Parallel/ParallelPartitioner.cs
mcs/class/System.Core/System.Linq.Parallel/ParallelQueryEnumerator.cs
mcs/class/System.Core/System.Linq.Parallel/ParallelQuickSort.cs
mcs/class/System.Core/System.Linq.Parallel/QueryCheckerVisitor.cs
mcs/class/System.Core/System.Linq.Parallel/QueryIsOrderedVisitor.cs
mcs/class/System.Core/System.Linq.Parallel/QueryOptions.cs
mcs/class/System.Core/System.Linq.Parallel/RangeList.cs
mcs/class/System.Core/System.Linq.Parallel/RepeatList.cs
mcs/class/System.Core/System.Linq.Parallel/ReverseList.cs
mcs/class/System.Core/System.Linq.Parallel/StripPartitioner.cs
mcs/class/System.Core/System.Linq.Parallel/TemporaryArea.cs
mcs/class/System.Core/System.Linq/Enumerable.cs
mcs/class/System.Core/System.Linq/OrderedParallelQuery.cs
mcs/class/System.Core/System.Linq/ParallelEnumerable.cs
mcs/class/System.Core/System.Linq/ParallelExecutionMode.cs
mcs/class/System.Core/System.Linq/ParallelMergeOptions.cs
mcs/class/System.Core/System.Linq/ParallelQuery.cs
mcs/class/System.Core/System.Linq/Queryable.cs
mcs/class/System.Core/System.Linq/QuickSort.cs
mcs/class/System.Core/System.Runtime.CompilerServices/ExecutionScope.cs
mcs/class/System.Core/System.Security.Cryptography/Aes.cs
mcs/class/System.Core/System/TimeZoneInfo.cs
mcs/class/System.Core/mobile_System.Core.dll.sources
mcs/class/System.Data.Services.Client/monotouch_System.Data.Services.Client.dll.sources
mcs/class/System.Json.Microsoft/Assembly/AssemblyInfo.cs [new file with mode: 0755]
mcs/class/System.Json.Microsoft/Assembly/ChangeLog [new file with mode: 0755]
mcs/class/System.Json.Microsoft/ChangeLog [new file with mode: 0644]
mcs/class/System.Json.Microsoft/Makefile [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json.Microsoft.dll.sources [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json.Microsoft_test.dll.sources [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/Extensions/JsonValueExtensions.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/GlobalSuppressions.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JXmlToJsonValueConverter.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonArray.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonObject.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonPrimitive.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonType.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonValue.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonValueChange.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonValueChangeEventArgs.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonValueDynamicMetaObject.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/JsonValueLinqExtensions.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/NGenWrapper.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/Properties/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.Designer.cs [new file with mode: 0644]
mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.resx [new file with mode: 0644]
mcs/class/System.Json.Microsoft/Test/System.Json/JsonValueTest.cs [new file with mode: 0644]
mcs/class/System.Json/Assembly/AssemblyInfo.cs
mcs/class/System.Json/Makefile
mcs/class/System.Json/System.Json-net_4_0.csproj
mcs/class/System.Json/System.Json-net_4_5.csproj
mcs/class/System.Json/System.Json-tests-net_4_0.csproj
mcs/class/System.Json/System.Json-tests-net_4_5.csproj
mcs/class/System.Json/System.Json.dll.sources
mcs/class/System.Json/System.Json/ChangeLog [new file with mode: 0644]
mcs/class/System.Json/System.Json/JsonArray.cs [new file with mode: 0644]
mcs/class/System.Json/System.Json/JsonObject.cs [new file with mode: 0644]
mcs/class/System.Json/System.Json/JsonPrimitive.cs [new file with mode: 0644]
mcs/class/System.Json/System.Json/JsonType.cs [new file with mode: 0644]
mcs/class/System.Json/System.Json/JsonValue.cs [new file with mode: 0644]
mcs/class/System.Json/Test/System.Json/JsonValueTest.cs
mcs/class/System.Reactive.Core/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Core/Strings_Core.resources.prebuilt [new file with mode: 0644]
mcs/class/System.Reactive.Core/Strings_Core.resx [new file with mode: 0644]
mcs/class/System.Reactive.Core/System.Reactive.Core.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Core/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Debugger/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Debugger/System.Reactive.Debugger.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Debugger/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Experimental/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Experimental/System.Reactive.Experimental.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Experimental/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Interfaces/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Interfaces/System.Reactive.Interfaces.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Interfaces/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Linq/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Linq/Strings_Linq.resources.prebuilt [new file with mode: 0644]
mcs/class/System.Reactive.Linq/Strings_Linq.resx [new file with mode: 0644]
mcs/class/System.Reactive.Linq/System.Reactive.Linq.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Linq/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.PlatformServices/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resources.prebuilt [new file with mode: 0644]
mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resx [new file with mode: 0644]
mcs/class/System.Reactive.PlatformServices/System.Reactive.PlatformServices.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.PlatformServices/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Providers/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Providers/Strings_Providers.resources.prebuilt [new file with mode: 0644]
mcs/class/System.Reactive.Providers/Strings_Providers.resx [new file with mode: 0644]
mcs/class/System.Reactive.Providers/System.Reactive.Providers.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Providers/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Runtime.Remoting/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Runtime.Remoting/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Forms/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Forms/more_build_args [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Threading/Makefile [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resources.prebuilt [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.dll.sources [new file with mode: 0644]
mcs/class/System.Reactive.Windows.Threading/more_build_args [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/WebOperationContext.cs
mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
mcs/class/System.ServiceModel/Makefile
mcs/class/System.ServiceModel/System.ServiceModel-net_4_5.csproj
mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElementImporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/MtomMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/PolicyImportHelper.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Channels/SslStreamSecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/StandardBindingImporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElementImporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/WindowsStreamSecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BindingsSection.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/HttpBindingBaseElement.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Description/CustomPolicyConversionContext.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataImporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/PolicyConversionContext.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlImporter.cs
mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel/AllEnums.cs
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsSecurity.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs
mcs/class/System.ServiceModel/System.ServiceModel/HttpBindingBase.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel/NetTcpBinding.cs
mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
mcs/class/System.ServiceModel/Test/MetadataTests/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/BindingTestAssertions.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ExportTests.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.csproj [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_CreateMetadata.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_LoadMetadata.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_RoundTrip.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/MetadataSamples.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.csproj [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.sln [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/MiscImportTests.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/README.txt [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_MessageSecurity.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom_EmbeddedPolicy.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_NtlmAuth.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Operation.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportSecurity.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportWithMessageCredential.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_Certificate.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_NtlmAuth.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_TransportWithMessageCredential.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_MessageSecurity.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_Operation.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_ReliableSession.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransferMode.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportSecurity.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportWithMessageCredential.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/Resources/http-error.xml [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/TestContext.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/MetadataTests/TestLabel.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/CustomBindingTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/HttpTransportBindingElementTest.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/WsdlImporterTest.cs
mcs/class/System.ServiceModel/net_4_5_System.ServiceModel.dll.sources
mcs/class/System.Web.Abstractions/System.Web/HttpContextWrapper.cs
mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs
mcs/class/System.Web.Routing/System.Web.Routing/HttpMethodConstraint.cs
mcs/class/System.Web.Routing/System.Web.Routing/PatternParser.cs
mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
mcs/class/System.Web.Routing/Test/System.Web.Routing/HttpMethodConstraintTest.cs
mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs
mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs
mcs/class/System.Web/System.Web.Util/HttpEncoder.cs
mcs/class/System.Web/System.Web/HttpUtility.cs
mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
mcs/class/System.XML/Test/System.Xml.Serialization/DeserializeTests.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
mcs/class/System/Documentation/en/System.Threading/SemaphoreFullException.xml [deleted file]
mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
mcs/class/System/Mono.Http/NtlmClient.cs
mcs/class/System/System.Collections.Concurrent/BlockingCollection.cs
mcs/class/System/System.Collections.Concurrent/ConcurrentBag.cs
mcs/class/System/System.Collections.Generic/ISet.cs
mcs/class/System/System.Configuration/ApplicationSettingsBase.cs
mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs
mcs/class/System/System.Configuration/SettingsPropertyValue.cs
mcs/class/System/System.Diagnostics/Win32EventLog.cs
mcs/class/System/System.IO.Ports/WinSerialStream.cs
mcs/class/System/System.Media/AudioData.cs
mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
mcs/class/System/System.Net.Sockets/NetworkStream.cs
mcs/class/System/System.Net/MacProxy.cs
mcs/class/System/System.Net/WebConnection.cs
mcs/class/System/System.Net/WebConnectionStream.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs
mcs/class/System/System.Text.RegularExpressions/Regex.cs
mcs/class/System/System.Threading/Barrier.cs
mcs/class/System/System.Threading/BarrierPostPhaseException.cs
mcs/class/System/System.dll.sources
mcs/class/System/System/Uri.cs
mcs/class/System/Test/System.ComponentModel/BindingListTest.cs
mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
mcs/class/System/Test/System/UriTest3.cs
mcs/class/System/mobile_System.dll.sources
mcs/class/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs
mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs
mcs/class/WindowsBase/System.ComponentModel/IEditableCollectionViewAddNewItem.cs [new file with mode: 0644]
mcs/class/WindowsBase/WindowsBase-net_4_0.csproj
mcs/class/WindowsBase/WindowsBase-net_4_5.csproj
mcs/class/WindowsBase/WindowsBase.dll.sources
mcs/class/build-rx-dll-sources.sh [new file with mode: 0644]
mcs/class/corlib/Documentation/en/System/Action.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Action`1.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Action`2.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Action`3.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Action`4.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Func`1.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Func`2.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Func`3.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Func`4.xml [deleted file]
mcs/class/corlib/Documentation/en/System/Func`5.xml [deleted file]
mcs/class/corlib/Documentation/en/System/InvalidTimeZoneException.xml [deleted file]
mcs/class/corlib/Documentation/en/System/TimeZoneInfo+AdjustmentRule.xml [deleted file]
mcs/class/corlib/Documentation/en/System/TimeZoneInfo+TransitionTime.xml [deleted file]
mcs/class/corlib/Documentation/en/System/TimeZoneInfo.xml [deleted file]
mcs/class/corlib/Documentation/en/System/TimeZoneNotFoundException.xml [deleted file]
mcs/class/corlib/Mono.Interop/ComInteropProxy.cs
mcs/class/corlib/Mono.Interop/IDispatch.cs
mcs/class/corlib/Mono.Interop/IUnknown.cs
mcs/class/corlib/Mono/DataConverter.cs
mcs/class/corlib/System.Diagnostics/Debugger.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
mcs/class/corlib/System.Reflection.Emit/DerivedTypes.cs
mcs/class/corlib/System.Reflection.Emit/DynamicILInfo.cs
mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
mcs/class/corlib/System.Reflection.Emit/EventOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/EventToken.cs
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
mcs/class/corlib/System.Reflection.Emit/FieldOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
mcs/class/corlib/System.Reflection.Emit/Label.cs
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/MethodRental.cs
mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
mcs/class/corlib/System.Reflection.Emit/OpCode.cs
mcs/class/corlib/System.Reflection.Emit/OpCodeNames.cs
mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
mcs/class/corlib/System.Reflection.Emit/OperandType.cs
mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs
mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
mcs/class/corlib/System.Reflection.Emit/StringToken.cs
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
mcs/class/corlib/System.Reflection/Assembly.cs
mcs/class/corlib/System.Reflection/AssemblyName.cs
mcs/class/corlib/System.Reflection/Binder.cs
mcs/class/corlib/System.Reflection/EventInfo.cs
mcs/class/corlib/System.Reflection/MethodBase.cs
mcs/class/corlib/System.Reflection/MonoAssembly.cs
mcs/class/corlib/System.Reflection/MonoGenericClass.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Reflection/ParameterInfo.cs
mcs/class/corlib/System.Runtime.InteropServices.ComTypes/EXCEPINFO.cs
mcs/class/corlib/System.Runtime.InteropServices/DispatchWrapper.cs
mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs
mcs/class/corlib/System.Runtime.InteropServices/ErrorWrapper.cs
mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs
mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
mcs/class/corlib/System.Runtime.InteropServices/RegistrationServices.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibConverter.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibImportClassAttribute.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibImporterFlags.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs
mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIBindCtx.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIConnectionPoint.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIConnectionPointContainer.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIEnumConnectionPoints.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIEnumConnections.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIEnumMoniker.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIEnumString.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIEnumVARIANT.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIMoniker.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIPersistFile.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIRunningObjectTable.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMIStream.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMITypeComp.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMITypeInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/UCOMITypeLib.cs
mcs/class/corlib/System.Runtime.InteropServices/_Activator.cs
mcs/class/corlib/System.Runtime.InteropServices/_Assembly.cs
mcs/class/corlib/System.Runtime.InteropServices/_AssemblyBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_AssemblyName.cs
mcs/class/corlib/System.Runtime.InteropServices/_Attribute.cs
mcs/class/corlib/System.Runtime.InteropServices/_ConstructorBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_ConstructorInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_CustomAttributeBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_EnumBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_EventBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_EventInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_FieldBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_FieldInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_ILGenerator.cs
mcs/class/corlib/System.Runtime.InteropServices/_LocalBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_MemberInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_MethodBase.cs
mcs/class/corlib/System.Runtime.InteropServices/_MethodBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_MethodInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_MethodRental.cs
mcs/class/corlib/System.Runtime.InteropServices/_Module.cs
mcs/class/corlib/System.Runtime.InteropServices/_ModuleBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_ParameterBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_ParameterInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_PropertyBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/_PropertyInfo.cs
mcs/class/corlib/System.Runtime.InteropServices/_SignatureHelper.cs
mcs/class/corlib/System.Runtime.InteropServices/_Thread.cs
mcs/class/corlib/System.Runtime.InteropServices/_Type.cs
mcs/class/corlib/System.Runtime.InteropServices/_TypeBuilder.cs
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs [new file with mode: 0755]
mcs/class/corlib/System.Security.Cryptography/DES.cs
mcs/class/corlib/System.Security.Cryptography/DSA.cs
mcs/class/corlib/System.Security.Cryptography/HMAC.cs
mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs
mcs/class/corlib/System.Security.Cryptography/KeyedHashAlgorithm.cs
mcs/class/corlib/System.Security.Cryptography/MD5.cs
mcs/class/corlib/System.Security.Cryptography/RC2.cs
mcs/class/corlib/System.Security.Cryptography/RIPEMD160.cs
mcs/class/corlib/System.Security.Cryptography/RSA.cs
mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
mcs/class/corlib/System.Security.Cryptography/SHA1.cs
mcs/class/corlib/System.Security.Cryptography/SHA256.cs
mcs/class/corlib/System.Security.Cryptography/SHA384.cs
mcs/class/corlib/System.Security.Cryptography/SHA512.cs
mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
mcs/class/corlib/System.Security.Cryptography/TripleDES.cs
mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
mcs/class/corlib/System.Security/SecurityManager_mobile.cs
mcs/class/corlib/System.Threading.Tasks/Parallel.cs
mcs/class/corlib/System.Threading.Tasks/Task.cs
mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs
mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs
mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
mcs/class/corlib/System.Threading/NativeOverlapped.cs
mcs/class/corlib/System/AppDomain.cs
mcs/class/corlib/System/Array.cs
mcs/class/corlib/System/Console.cs
mcs/class/corlib/System/Delegate.cs
mcs/class/corlib/System/Guid.cs
mcs/class/corlib/System/MonoCustomAttrs.cs
mcs/class/corlib/System/String.cs
mcs/class/corlib/System/Type.cs
mcs/class/corlib/System/Variant.cs
mcs/class/corlib/System/_AppDomain.cs
mcs/class/corlib/System/__ComObject.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs
mcs/class/corlib/Test/System/StringTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/class/reactive.pub [new file with mode: 0644]
mcs/docs/Makefile
mcs/errors/CS0012-17-lib.il [new file with mode: 0644]
mcs/errors/CS0012-18-lib.il [new file with mode: 0644]
mcs/errors/CS1070-lib.il [new file with mode: 0644]
mcs/errors/Makefile
mcs/errors/cs0012-17.cs [new file with mode: 0644]
mcs/errors/cs0012-18.cs [new file with mode: 0644]
mcs/errors/cs0135-7.cs [new file with mode: 0644]
mcs/errors/cs0214-16.cs [new file with mode: 0644]
mcs/errors/cs0411-23.cs [new file with mode: 0644]
mcs/errors/cs0572-2.cs
mcs/errors/cs0572-3.cs [new file with mode: 0644]
mcs/errors/cs0572.cs
mcs/errors/cs1070.cs [new file with mode: 0644]
mcs/errors/cs2002.cs
mcs/ilasm/codegen/ExternTable.cs
mcs/ilasm/parser/ILParser.jay
mcs/ilasm/scanner/ILTables.cs
mcs/mcs/Makefile
mcs/mcs/assembly.cs
mcs/mcs/class.cs
mcs/mcs/cs-tokenizer.cs
mcs/mcs/decl.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/generic.cs
mcs/mcs/ikvm.cs
mcs/mcs/import.cs
mcs/mcs/mcs.csproj
mcs/mcs/mcs.exe.sources
mcs/mcs/membercache.cs
mcs/mcs/method.cs
mcs/mcs/namespace.cs
mcs/mcs/pending.cs
mcs/mcs/reflection.cs
mcs/mcs/settings.cs
mcs/mcs/typespec.cs
mcs/tests/Makefile
mcs/tests/dtest-011.cs
mcs/tests/dtest-015.cs
mcs/tests/dtest-016.cs
mcs/tests/dtest-017.cs
mcs/tests/dtest-018.cs
mcs/tests/dtest-044.cs
mcs/tests/dtest-045.cs
mcs/tests/dtest-057.cs
mcs/tests/dtest-collectioninit-01.cs
mcs/tests/dtest-iter-01.cs
mcs/tests/gen-cast-test.cs
mcs/tests/gen-check.cs
mcs/tests/gtest-001.cs
mcs/tests/gtest-002.cs
mcs/tests/gtest-003.cs
mcs/tests/gtest-004.cs
mcs/tests/gtest-005.cs
mcs/tests/gtest-006.cs
mcs/tests/gtest-007.cs
mcs/tests/gtest-008.cs
mcs/tests/gtest-009.cs
mcs/tests/gtest-010.cs
mcs/tests/gtest-011.cs
mcs/tests/gtest-012.cs
mcs/tests/gtest-013.cs
mcs/tests/gtest-014.cs
mcs/tests/gtest-015.cs
mcs/tests/gtest-016.cs
mcs/tests/gtest-017.cs
mcs/tests/gtest-018.cs
mcs/tests/gtest-019.cs
mcs/tests/gtest-020.cs
mcs/tests/gtest-021.cs
mcs/tests/gtest-022.cs
mcs/tests/gtest-023.cs
mcs/tests/gtest-024.cs
mcs/tests/gtest-025.cs
mcs/tests/gtest-026.cs
mcs/tests/gtest-027.cs
mcs/tests/gtest-028.cs
mcs/tests/gtest-029.cs
mcs/tests/gtest-030.cs
mcs/tests/gtest-031.cs
mcs/tests/gtest-032.cs
mcs/tests/gtest-033.cs
mcs/tests/gtest-034.cs
mcs/tests/gtest-035.cs
mcs/tests/gtest-036.cs
mcs/tests/gtest-037.cs
mcs/tests/gtest-038.cs
mcs/tests/gtest-039.cs
mcs/tests/gtest-040.cs
mcs/tests/gtest-041.cs
mcs/tests/gtest-042.cs
mcs/tests/gtest-043.cs
mcs/tests/gtest-044.cs
mcs/tests/gtest-045.cs
mcs/tests/gtest-046.cs
mcs/tests/gtest-047.cs
mcs/tests/gtest-048.cs
mcs/tests/gtest-049.cs
mcs/tests/gtest-050.cs
mcs/tests/gtest-051.cs
mcs/tests/gtest-052.cs
mcs/tests/gtest-053.cs
mcs/tests/gtest-054.cs
mcs/tests/gtest-055.cs
mcs/tests/gtest-056.cs
mcs/tests/gtest-057.cs
mcs/tests/gtest-058.cs
mcs/tests/gtest-059.cs
mcs/tests/gtest-060.cs
mcs/tests/gtest-061.cs
mcs/tests/gtest-062.cs
mcs/tests/gtest-063.cs
mcs/tests/gtest-064.cs
mcs/tests/gtest-066.cs
mcs/tests/gtest-067.cs
mcs/tests/gtest-068.cs
mcs/tests/gtest-069.cs
mcs/tests/gtest-070.cs
mcs/tests/gtest-071.cs
mcs/tests/gtest-072.cs
mcs/tests/gtest-073.cs
mcs/tests/gtest-074.cs
mcs/tests/gtest-075.cs
mcs/tests/gtest-076.cs
mcs/tests/gtest-079.cs
mcs/tests/gtest-080.cs
mcs/tests/gtest-081.cs
mcs/tests/gtest-082.cs
mcs/tests/gtest-083.cs
mcs/tests/gtest-084.cs
mcs/tests/gtest-085.cs
mcs/tests/gtest-086.cs
mcs/tests/gtest-087.cs
mcs/tests/gtest-088.cs
mcs/tests/gtest-089.cs
mcs/tests/gtest-090.cs
mcs/tests/gtest-091.cs
mcs/tests/gtest-092.cs
mcs/tests/gtest-093.cs
mcs/tests/gtest-094.cs
mcs/tests/gtest-095.cs
mcs/tests/gtest-096.cs
mcs/tests/gtest-097.cs
mcs/tests/gtest-098.cs
mcs/tests/gtest-100.cs
mcs/tests/gtest-101.cs
mcs/tests/gtest-103.cs
mcs/tests/gtest-104.cs
mcs/tests/gtest-105.cs
mcs/tests/gtest-107.cs
mcs/tests/gtest-108.cs
mcs/tests/gtest-109.cs
mcs/tests/gtest-110.cs
mcs/tests/gtest-111.cs
mcs/tests/gtest-112.cs
mcs/tests/gtest-113.cs
mcs/tests/gtest-114.cs
mcs/tests/gtest-116.cs
mcs/tests/gtest-117.cs
mcs/tests/gtest-119.cs
mcs/tests/gtest-120.cs
mcs/tests/gtest-122.cs
mcs/tests/gtest-123.cs
mcs/tests/gtest-124.cs
mcs/tests/gtest-126.cs
mcs/tests/gtest-129.cs
mcs/tests/gtest-135.cs
mcs/tests/gtest-136.cs
mcs/tests/gtest-138.cs
mcs/tests/gtest-140.cs
mcs/tests/gtest-141.cs
mcs/tests/gtest-142.cs
mcs/tests/gtest-143.cs
mcs/tests/gtest-146.cs
mcs/tests/gtest-147.cs
mcs/tests/gtest-148.cs
mcs/tests/gtest-149.cs
mcs/tests/gtest-151.cs
mcs/tests/gtest-152.cs
mcs/tests/gtest-153.cs
mcs/tests/gtest-155.cs
mcs/tests/gtest-157.cs
mcs/tests/gtest-158.cs
mcs/tests/gtest-160.cs
mcs/tests/gtest-162.cs
mcs/tests/gtest-163.cs
mcs/tests/gtest-164.cs
mcs/tests/gtest-168.cs
mcs/tests/gtest-169.cs
mcs/tests/gtest-172.cs
mcs/tests/gtest-173.cs
mcs/tests/gtest-174.cs
mcs/tests/gtest-177.cs
mcs/tests/gtest-178.cs
mcs/tests/gtest-179.cs
mcs/tests/gtest-180.cs
mcs/tests/gtest-181.cs
mcs/tests/gtest-184.cs
mcs/tests/gtest-190.cs
mcs/tests/gtest-191.cs
mcs/tests/gtest-192.cs
mcs/tests/gtest-193.cs
mcs/tests/gtest-194.cs
mcs/tests/gtest-195.cs
mcs/tests/gtest-197.cs
mcs/tests/gtest-201.cs
mcs/tests/gtest-204.cs
mcs/tests/gtest-205.cs
mcs/tests/gtest-207.cs
mcs/tests/gtest-208.cs
mcs/tests/gtest-209.cs
mcs/tests/gtest-212.cs
mcs/tests/gtest-213.cs
mcs/tests/gtest-214.cs
mcs/tests/gtest-218.cs
mcs/tests/gtest-220.cs
mcs/tests/gtest-221.cs
mcs/tests/gtest-225.cs
mcs/tests/gtest-227.cs
mcs/tests/gtest-229.cs
mcs/tests/gtest-230.cs
mcs/tests/gtest-231.cs
mcs/tests/gtest-233.cs
mcs/tests/gtest-234.cs
mcs/tests/gtest-236.cs
mcs/tests/gtest-237.cs
mcs/tests/gtest-238.cs
mcs/tests/gtest-239.cs
mcs/tests/gtest-240.cs
mcs/tests/gtest-241.cs
mcs/tests/gtest-245.cs
mcs/tests/gtest-246.cs
mcs/tests/gtest-247.cs
mcs/tests/gtest-248.cs
mcs/tests/gtest-249.cs
mcs/tests/gtest-250.cs
mcs/tests/gtest-251.cs
mcs/tests/gtest-252.cs
mcs/tests/gtest-253.cs
mcs/tests/gtest-254.cs
mcs/tests/gtest-255.cs
mcs/tests/gtest-256.cs
mcs/tests/gtest-258.cs
mcs/tests/gtest-259.cs
mcs/tests/gtest-260.cs
mcs/tests/gtest-262.cs
mcs/tests/gtest-263.cs
mcs/tests/gtest-266.cs
mcs/tests/gtest-267.cs
mcs/tests/gtest-268.cs
mcs/tests/gtest-269.cs
mcs/tests/gtest-270.cs
mcs/tests/gtest-271.cs
mcs/tests/gtest-272.cs
mcs/tests/gtest-273.cs
mcs/tests/gtest-274.cs
mcs/tests/gtest-277.cs
mcs/tests/gtest-279.cs
mcs/tests/gtest-282.cs
mcs/tests/gtest-284.cs
mcs/tests/gtest-287.cs
mcs/tests/gtest-288.cs
mcs/tests/gtest-289.cs
mcs/tests/gtest-291.cs
mcs/tests/gtest-292.cs
mcs/tests/gtest-293.cs
mcs/tests/gtest-294.cs
mcs/tests/gtest-295.cs
mcs/tests/gtest-297.cs
mcs/tests/gtest-298.cs
mcs/tests/gtest-299.cs
mcs/tests/gtest-302.cs
mcs/tests/gtest-307.cs
mcs/tests/gtest-308.cs
mcs/tests/gtest-309.cs
mcs/tests/gtest-311.cs
mcs/tests/gtest-313.cs
mcs/tests/gtest-315.cs
mcs/tests/gtest-316.cs
mcs/tests/gtest-317.cs
mcs/tests/gtest-318.cs
mcs/tests/gtest-319.cs
mcs/tests/gtest-320.cs
mcs/tests/gtest-322.cs
mcs/tests/gtest-323.cs
mcs/tests/gtest-324.cs
mcs/tests/gtest-325.cs
mcs/tests/gtest-326.cs
mcs/tests/gtest-327.cs
mcs/tests/gtest-331.cs
mcs/tests/gtest-333.cs
mcs/tests/gtest-337.cs
mcs/tests/gtest-338.cs
mcs/tests/gtest-339.cs
mcs/tests/gtest-347.cs
mcs/tests/gtest-349.cs
mcs/tests/gtest-352.cs
mcs/tests/gtest-353.cs
mcs/tests/gtest-357.cs
mcs/tests/gtest-359.cs
mcs/tests/gtest-364.cs
mcs/tests/gtest-365.cs
mcs/tests/gtest-366.cs
mcs/tests/gtest-367.cs
mcs/tests/gtest-371.cs
mcs/tests/gtest-372.cs
mcs/tests/gtest-375.cs
mcs/tests/gtest-381.cs
mcs/tests/gtest-383.cs
mcs/tests/gtest-388.cs
mcs/tests/gtest-390.cs
mcs/tests/gtest-392.cs
mcs/tests/gtest-395.cs
mcs/tests/gtest-396.cs
mcs/tests/gtest-397.cs
mcs/tests/gtest-399.cs
mcs/tests/gtest-400.cs
mcs/tests/gtest-402.cs
mcs/tests/gtest-408.cs
mcs/tests/gtest-409.cs
mcs/tests/gtest-410.cs
mcs/tests/gtest-412.cs
mcs/tests/gtest-413.cs
mcs/tests/gtest-415.cs
mcs/tests/gtest-417.cs
mcs/tests/gtest-419.cs
mcs/tests/gtest-420.cs
mcs/tests/gtest-423.cs
mcs/tests/gtest-430.cs
mcs/tests/gtest-431.cs
mcs/tests/gtest-433.cs
mcs/tests/gtest-434.cs
mcs/tests/gtest-435.cs
mcs/tests/gtest-442.cs
mcs/tests/gtest-445.cs
mcs/tests/gtest-449.cs
mcs/tests/gtest-450.cs
mcs/tests/gtest-455.cs
mcs/tests/gtest-457.cs
mcs/tests/gtest-459.cs
mcs/tests/gtest-462.cs
mcs/tests/gtest-466.cs
mcs/tests/gtest-469.cs
mcs/tests/gtest-483.cs
mcs/tests/gtest-488.cs
mcs/tests/gtest-495.cs
mcs/tests/gtest-496.cs
mcs/tests/gtest-497.cs
mcs/tests/gtest-500.cs
mcs/tests/gtest-514.cs
mcs/tests/gtest-525.cs
mcs/tests/gtest-527.cs
mcs/tests/gtest-531.cs
mcs/tests/gtest-536.cs
mcs/tests/gtest-542.cs
mcs/tests/gtest-546.cs
mcs/tests/gtest-554.cs
mcs/tests/gtest-556.cs
mcs/tests/gtest-557.cs
mcs/tests/gtest-568.cs
mcs/tests/gtest-571.cs [new file with mode: 0644]
mcs/tests/gtest-anontype-01.cs
mcs/tests/gtest-anontype-02.cs
mcs/tests/gtest-anontype-03.cs
mcs/tests/gtest-anontype-04.cs
mcs/tests/gtest-anontype-05.cs
mcs/tests/gtest-anontype-06.cs
mcs/tests/gtest-anontype-07.cs
mcs/tests/gtest-anontype-11.cs
mcs/tests/gtest-anontype-13.cs
mcs/tests/gtest-autoproperty-01.cs
mcs/tests/gtest-autoproperty-02.cs
mcs/tests/gtest-autoproperty-03.cs
mcs/tests/gtest-autoproperty-06.cs
mcs/tests/gtest-collectioninit-01.cs
mcs/tests/gtest-collectioninit-03.cs
mcs/tests/gtest-etree-03.cs
mcs/tests/gtest-etree-04.cs
mcs/tests/gtest-etree-05.cs
mcs/tests/gtest-etree-10.cs
mcs/tests/gtest-etree-11.cs
mcs/tests/gtest-etree-13.cs
mcs/tests/gtest-etree-14.cs
mcs/tests/gtest-etree-16.cs
mcs/tests/gtest-etree-18.cs
mcs/tests/gtest-etree-25.cs
mcs/tests/gtest-etree-26.cs
mcs/tests/gtest-exmethod-12.cs
mcs/tests/gtest-exmethod-16.cs
mcs/tests/gtest-exmethod-18.cs
mcs/tests/gtest-exmethod-19.cs
mcs/tests/gtest-exmethod-20.cs
mcs/tests/gtest-exmethod-21.cs
mcs/tests/gtest-exmethod-27.cs
mcs/tests/gtest-exmethod-28.cs
mcs/tests/gtest-exmethod-44.cs
mcs/tests/gtest-exmethod-45-lib.il [new file with mode: 0644]
mcs/tests/gtest-exmethod-45.cs [new file with mode: 0644]
mcs/tests/gtest-friend-01.cs
mcs/tests/gtest-friend-02.cs
mcs/tests/gtest-friend-03.cs
mcs/tests/gtest-friend-04.cs
mcs/tests/gtest-friend-05.cs
mcs/tests/gtest-friend-06.cs
mcs/tests/gtest-friend-07.cs
mcs/tests/gtest-friend-08.cs
mcs/tests/gtest-friend-09.cs
mcs/tests/gtest-friend-10.cs
mcs/tests/gtest-friend-11.cs
mcs/tests/gtest-friend-12.cs
mcs/tests/gtest-friend-13.cs
mcs/tests/gtest-implicitarray-01.cs
mcs/tests/gtest-implicitarray-02.cs
mcs/tests/gtest-initialize-01.cs
mcs/tests/gtest-initialize-02.cs
mcs/tests/gtest-initialize-03.cs
mcs/tests/gtest-initialize-10.cs
mcs/tests/gtest-iter-03.cs
mcs/tests/gtest-iter-10.cs
mcs/tests/gtest-iter-11.cs
mcs/tests/gtest-iter-14.cs
mcs/tests/gtest-iter-17.cs
mcs/tests/gtest-iter-20.cs
mcs/tests/gtest-iter-27.cs
mcs/tests/gtest-lambda-01.cs
mcs/tests/gtest-lambda-02.cs
mcs/tests/gtest-lambda-03.cs
mcs/tests/gtest-lambda-04.cs
mcs/tests/gtest-lambda-06.cs
mcs/tests/gtest-lambda-12.cs
mcs/tests/gtest-lambda-13.cs
mcs/tests/gtest-lambda-15.cs
mcs/tests/gtest-lambda-16.cs
mcs/tests/gtest-lambda-21.cs
mcs/tests/gtest-lambda-26.cs
mcs/tests/gtest-linq-08.cs
mcs/tests/gtest-linq-13.cs
mcs/tests/gtest-linq-14.cs
mcs/tests/gtest-linq-18.cs
mcs/tests/gtest-linq-21.cs
mcs/tests/gtest-linq-26.cs
mcs/tests/gtest-named-04.cs
mcs/tests/gtest-optional-09.cs
mcs/tests/gtest-optional-10.cs
mcs/tests/gtest-optional-15.cs
mcs/tests/gtest-var-04.cs
mcs/tests/gtest-variance-1.cs
mcs/tests/gtest-variance-10.cs
mcs/tests/gtest-variance-18.cs
mcs/tests/gtest-variance-19.cs
mcs/tests/gtest-variance-2.cs
mcs/tests/gtest-variance-3.cs
mcs/tests/gtest-variance-4.cs
mcs/tests/gtest-variance-5.cs
mcs/tests/gtest-variance-6.cs
mcs/tests/known-issues-mt [new file with mode: 0644]
mcs/tests/projects/MonoTouch/AppDelegate.cs [new file with mode: 0644]
mcs/tests/projects/MonoTouch/Info.plist [new file with mode: 0644]
mcs/tests/projects/MonoTouch/Main.cs [new file with mode: 0644]
mcs/tests/projects/MonoTouch/MonoTouch.csproj.template [new file with mode: 0644]
mcs/tests/projects/MonoTouch/MonoTouch.sln [new file with mode: 0644]
mcs/tests/projects/MonoTouch/ivt.cs [new file with mode: 0644]
mcs/tests/property-il.il [deleted file]
mcs/tests/property-main.cs [deleted file]
mcs/tests/test-1.cs
mcs/tests/test-10.cs
mcs/tests/test-100.cs
mcs/tests/test-101.cs
mcs/tests/test-105.cs
mcs/tests/test-107.cs
mcs/tests/test-108.cs
mcs/tests/test-109.cs
mcs/tests/test-111.cs
mcs/tests/test-112.cs
mcs/tests/test-116.cs
mcs/tests/test-118.cs
mcs/tests/test-119.cs
mcs/tests/test-12.cs
mcs/tests/test-120.cs
mcs/tests/test-121.cs
mcs/tests/test-123.cs
mcs/tests/test-126.cs
mcs/tests/test-127.cs
mcs/tests/test-129.cs
mcs/tests/test-130.cs
mcs/tests/test-132.cs
mcs/tests/test-133.cs
mcs/tests/test-134.cs
mcs/tests/test-135.cs
mcs/tests/test-136.cs
mcs/tests/test-137.cs
mcs/tests/test-138.cs
mcs/tests/test-139.cs
mcs/tests/test-14.cs
mcs/tests/test-143.cs
mcs/tests/test-15.cs
mcs/tests/test-153.cs
mcs/tests/test-156.cs
mcs/tests/test-157.cs
mcs/tests/test-158.cs
mcs/tests/test-160.cs
mcs/tests/test-161.cs
mcs/tests/test-164.cs
mcs/tests/test-166.cs
mcs/tests/test-167.cs
mcs/tests/test-168.cs
mcs/tests/test-169.cs
mcs/tests/test-170.cs
mcs/tests/test-171.cs
mcs/tests/test-172.cs
mcs/tests/test-173.cs
mcs/tests/test-174.cs
mcs/tests/test-175.cs
mcs/tests/test-176.cs
mcs/tests/test-18.cs
mcs/tests/test-181.cs
mcs/tests/test-182.cs
mcs/tests/test-183.cs
mcs/tests/test-184.cs
mcs/tests/test-185.cs
mcs/tests/test-186.cs
mcs/tests/test-187.cs
mcs/tests/test-190.cs
mcs/tests/test-191.cs
mcs/tests/test-192.cs
mcs/tests/test-193.cs
mcs/tests/test-195.cs
mcs/tests/test-196.cs
mcs/tests/test-198.cs
mcs/tests/test-2.cs
mcs/tests/test-20.cs
mcs/tests/test-214.cs
mcs/tests/test-216.cs
mcs/tests/test-217.cs
mcs/tests/test-218.cs
mcs/tests/test-22.cs
mcs/tests/test-221.cs
mcs/tests/test-223.cs
mcs/tests/test-225.cs
mcs/tests/test-23.cs
mcs/tests/test-230.cs
mcs/tests/test-231.cs
mcs/tests/test-233.cs
mcs/tests/test-234.cs
mcs/tests/test-238.cs
mcs/tests/test-239.cs
mcs/tests/test-24.cs
mcs/tests/test-240.cs
mcs/tests/test-243.cs
mcs/tests/test-244.cs
mcs/tests/test-245.cs
mcs/tests/test-246.cs
mcs/tests/test-247.cs
mcs/tests/test-248.cs
mcs/tests/test-249.cs
mcs/tests/test-25.cs
mcs/tests/test-251.cs
mcs/tests/test-257.cs
mcs/tests/test-258.cs
mcs/tests/test-261.cs
mcs/tests/test-262.cs
mcs/tests/test-265.cs
mcs/tests/test-268.cs
mcs/tests/test-269.cs
mcs/tests/test-270.cs
mcs/tests/test-271.cs
mcs/tests/test-272.cs
mcs/tests/test-277.cs
mcs/tests/test-278.cs
mcs/tests/test-279.cs
mcs/tests/test-28.cs
mcs/tests/test-280.cs
mcs/tests/test-281.cs
mcs/tests/test-282.cs
mcs/tests/test-283.cs
mcs/tests/test-285.cs
mcs/tests/test-29.cs
mcs/tests/test-290.cs
mcs/tests/test-292.cs
mcs/tests/test-296.cs
mcs/tests/test-297.cs
mcs/tests/test-30.cs
mcs/tests/test-31.cs
mcs/tests/test-311.cs
mcs/tests/test-312.cs
mcs/tests/test-313.cs
mcs/tests/test-314.cs
mcs/tests/test-315.cs
mcs/tests/test-316.cs
mcs/tests/test-317.cs
mcs/tests/test-319.cs
mcs/tests/test-320.cs
mcs/tests/test-321.cs
mcs/tests/test-322.cs
mcs/tests/test-323.cs
mcs/tests/test-326.cs
mcs/tests/test-327.cs
mcs/tests/test-328.cs
mcs/tests/test-329.cs
mcs/tests/test-33.cs
mcs/tests/test-330.cs
mcs/tests/test-334.cs
mcs/tests/test-335.cs
mcs/tests/test-336.cs
mcs/tests/test-339.cs
mcs/tests/test-343.cs
mcs/tests/test-344.cs
mcs/tests/test-346.cs
mcs/tests/test-349.cs
mcs/tests/test-35.cs
mcs/tests/test-350.cs
mcs/tests/test-351.cs
mcs/tests/test-354.cs
mcs/tests/test-356.cs
mcs/tests/test-357.cs
mcs/tests/test-36.cs
mcs/tests/test-361.cs
mcs/tests/test-362.cs
mcs/tests/test-364.cs
mcs/tests/test-365.cs
mcs/tests/test-366.cs
mcs/tests/test-367.cs
mcs/tests/test-368.cs
mcs/tests/test-369.cs
mcs/tests/test-37.cs
mcs/tests/test-371.cs
mcs/tests/test-374.cs
mcs/tests/test-375.cs
mcs/tests/test-38.cs
mcs/tests/test-380.cs
mcs/tests/test-382.cs
mcs/tests/test-384.cs
mcs/tests/test-385.cs
mcs/tests/test-387.cs
mcs/tests/test-393.cs
mcs/tests/test-394.cs
mcs/tests/test-395.cs
mcs/tests/test-398.cs
mcs/tests/test-399.cs
mcs/tests/test-4.cs
mcs/tests/test-400.cs
mcs/tests/test-401.cs
mcs/tests/test-402.cs
mcs/tests/test-404.cs
mcs/tests/test-405.cs
mcs/tests/test-406.cs
mcs/tests/test-408.cs
mcs/tests/test-409.cs
mcs/tests/test-41.cs
mcs/tests/test-419.cs
mcs/tests/test-42.cs
mcs/tests/test-420.cs
mcs/tests/test-423.cs
mcs/tests/test-426.cs
mcs/tests/test-427.cs
mcs/tests/test-428.cs
mcs/tests/test-429.cs
mcs/tests/test-43.cs
mcs/tests/test-430.cs
mcs/tests/test-431.cs
mcs/tests/test-432.cs
mcs/tests/test-433.cs
mcs/tests/test-434.cs
mcs/tests/test-435.cs
mcs/tests/test-436.cs
mcs/tests/test-44.cs
mcs/tests/test-442.cs
mcs/tests/test-447.cs
mcs/tests/test-449.cs
mcs/tests/test-451.cs
mcs/tests/test-452.cs
mcs/tests/test-455.cs
mcs/tests/test-456.cs
mcs/tests/test-457.cs
mcs/tests/test-46.cs
mcs/tests/test-462.cs
mcs/tests/test-463.cs
mcs/tests/test-468.cs [deleted file]
mcs/tests/test-469.cs
mcs/tests/test-47.cs
mcs/tests/test-470.cs
mcs/tests/test-472.cs
mcs/tests/test-474.cs
mcs/tests/test-479.cs
mcs/tests/test-482.cs
mcs/tests/test-487.cs
mcs/tests/test-488.cs
mcs/tests/test-489.cs
mcs/tests/test-49.cs
mcs/tests/test-490.cs
mcs/tests/test-492.cs
mcs/tests/test-493.cs
mcs/tests/test-494.cs
mcs/tests/test-495.cs
mcs/tests/test-497.cs
mcs/tests/test-498.cs
mcs/tests/test-5.cs
mcs/tests/test-502.cs
mcs/tests/test-503.cs
mcs/tests/test-505.cs
mcs/tests/test-506.cs
mcs/tests/test-51.cs
mcs/tests/test-513.cs
mcs/tests/test-514.cs
mcs/tests/test-515.cs
mcs/tests/test-516.cs
mcs/tests/test-518.cs
mcs/tests/test-519.cs
mcs/tests/test-52.cs
mcs/tests/test-523.cs
mcs/tests/test-526.cs
mcs/tests/test-527.cs
mcs/tests/test-53.cs
mcs/tests/test-530.cs
mcs/tests/test-533.cs
mcs/tests/test-534.cs
mcs/tests/test-535.cs
mcs/tests/test-537.cs
mcs/tests/test-539.cs
mcs/tests/test-54.cs
mcs/tests/test-542.cs
mcs/tests/test-543.cs
mcs/tests/test-544.cs
mcs/tests/test-545.cs
mcs/tests/test-547.cs
mcs/tests/test-549.cs
mcs/tests/test-556.cs
mcs/tests/test-558.cs
mcs/tests/test-56.cs
mcs/tests/test-562.cs
mcs/tests/test-567.cs
mcs/tests/test-574.cs
mcs/tests/test-575.cs
mcs/tests/test-576.cs
mcs/tests/test-579.cs
mcs/tests/test-583.cs
mcs/tests/test-585.cs
mcs/tests/test-586.cs
mcs/tests/test-587.cs
mcs/tests/test-59.cs
mcs/tests/test-590.cs
mcs/tests/test-592.cs
mcs/tests/test-594.cs
mcs/tests/test-595.cs
mcs/tests/test-6.cs
mcs/tests/test-60.cs
mcs/tests/test-603.cs
mcs/tests/test-604.cs
mcs/tests/test-606.cs
mcs/tests/test-607.cs
mcs/tests/test-61.cs
mcs/tests/test-611.cs
mcs/tests/test-612.cs
mcs/tests/test-614.cs
mcs/tests/test-619.cs
mcs/tests/test-62.cs
mcs/tests/test-620.cs
mcs/tests/test-621.cs
mcs/tests/test-622.cs
mcs/tests/test-623.cs
mcs/tests/test-624.cs
mcs/tests/test-625.cs
mcs/tests/test-626.cs
mcs/tests/test-627.cs
mcs/tests/test-628.cs
mcs/tests/test-63.cs
mcs/tests/test-632.cs
mcs/tests/test-635.cs
mcs/tests/test-636.cs
mcs/tests/test-638.cs
mcs/tests/test-639.cs
mcs/tests/test-64.cs
mcs/tests/test-641.cs
mcs/tests/test-643.cs
mcs/tests/test-644.cs
mcs/tests/test-646.cs
mcs/tests/test-65.cs
mcs/tests/test-650.cs
mcs/tests/test-654.cs
mcs/tests/test-655.cs
mcs/tests/test-656.cs
mcs/tests/test-657.cs
mcs/tests/test-659.cs
mcs/tests/test-66.cs
mcs/tests/test-661.cs
mcs/tests/test-668.cs
mcs/tests/test-669.cs
mcs/tests/test-671.cs
mcs/tests/test-672.cs
mcs/tests/test-678.cs
mcs/tests/test-68.cs
mcs/tests/test-684.cs
mcs/tests/test-686.cs
mcs/tests/test-690.cs
mcs/tests/test-691.cs
mcs/tests/test-695.cs
mcs/tests/test-696.cs
mcs/tests/test-70.cs
mcs/tests/test-700.cs
mcs/tests/test-701.cs
mcs/tests/test-702.cs
mcs/tests/test-704.cs
mcs/tests/test-71.cs
mcs/tests/test-712.cs
mcs/tests/test-714.cs
mcs/tests/test-716.cs
mcs/tests/test-72.cs
mcs/tests/test-720.cs
mcs/tests/test-721.cs
mcs/tests/test-722.cs
mcs/tests/test-73.cs
mcs/tests/test-730.cs
mcs/tests/test-74.cs
mcs/tests/test-740.cs
mcs/tests/test-742.cs
mcs/tests/test-75.cs
mcs/tests/test-755.cs
mcs/tests/test-756.cs
mcs/tests/test-762.cs
mcs/tests/test-763.cs
mcs/tests/test-77.cs
mcs/tests/test-772.cs
mcs/tests/test-773.cs
mcs/tests/test-776.cs
mcs/tests/test-78.cs
mcs/tests/test-788.cs
mcs/tests/test-789.cs
mcs/tests/test-79.cs
mcs/tests/test-792-lib.il
mcs/tests/test-792.cs
mcs/tests/test-793.cs
mcs/tests/test-799.cs
mcs/tests/test-8.cs
mcs/tests/test-80.cs
mcs/tests/test-808.cs
mcs/tests/test-815.cs
mcs/tests/test-816.cs
mcs/tests/test-817.cs
mcs/tests/test-818.cs
mcs/tests/test-824.cs
mcs/tests/test-827.cs
mcs/tests/test-828.cs
mcs/tests/test-83.cs
mcs/tests/test-831.cs
mcs/tests/test-832.cs
mcs/tests/test-84.cs
mcs/tests/test-848.cs
mcs/tests/test-849.cs
mcs/tests/test-85.cs
mcs/tests/test-853.cs
mcs/tests/test-855.cs [new file with mode: 0644]
mcs/tests/test-856.cs [new file with mode: 0644]
mcs/tests/test-857.cs [new file with mode: 0644]
mcs/tests/test-858-lib.il [new file with mode: 0644]
mcs/tests/test-858.cs [new file with mode: 0644]
mcs/tests/test-859-lib.il [new file with mode: 0644]
mcs/tests/test-859.cs [new file with mode: 0644]
mcs/tests/test-87.cs
mcs/tests/test-88.cs
mcs/tests/test-89.cs
mcs/tests/test-9.cs
mcs/tests/test-90.cs
mcs/tests/test-91.cs
mcs/tests/test-94.cs
mcs/tests/test-95.cs
mcs/tests/test-96.cs
mcs/tests/test-97.cs
mcs/tests/test-99.cs
mcs/tests/test-anon-01.cs
mcs/tests/test-anon-02.cs
mcs/tests/test-anon-03.cs
mcs/tests/test-anon-04.cs
mcs/tests/test-anon-05.cs
mcs/tests/test-anon-06.cs
mcs/tests/test-anon-07.cs
mcs/tests/test-anon-08.cs
mcs/tests/test-anon-09.cs
mcs/tests/test-anon-10.cs
mcs/tests/test-anon-101.cs
mcs/tests/test-anon-102.cs
mcs/tests/test-anon-103.cs
mcs/tests/test-anon-105.cs
mcs/tests/test-anon-106.cs
mcs/tests/test-anon-107.cs
mcs/tests/test-anon-108.cs
mcs/tests/test-anon-109.cs
mcs/tests/test-anon-11.cs
mcs/tests/test-anon-110.cs
mcs/tests/test-anon-112.cs
mcs/tests/test-anon-113.cs
mcs/tests/test-anon-114.cs
mcs/tests/test-anon-115.cs
mcs/tests/test-anon-116.cs
mcs/tests/test-anon-12.cs
mcs/tests/test-anon-13.cs
mcs/tests/test-anon-130.cs
mcs/tests/test-anon-134.cs
mcs/tests/test-anon-136.cs
mcs/tests/test-anon-138.cs
mcs/tests/test-anon-14.cs
mcs/tests/test-anon-147.cs
mcs/tests/test-anon-149.cs
mcs/tests/test-anon-151.cs
mcs/tests/test-anon-153.cs
mcs/tests/test-anon-156.cs
mcs/tests/test-anon-157.cs
mcs/tests/test-anon-16.cs
mcs/tests/test-anon-161.cs
mcs/tests/test-anon-169.cs
mcs/tests/test-anon-17.cs
mcs/tests/test-anon-18.cs
mcs/tests/test-anon-19.cs
mcs/tests/test-anon-20.cs
mcs/tests/test-anon-21.cs
mcs/tests/test-anon-22.cs
mcs/tests/test-anon-23.cs
mcs/tests/test-anon-24.cs
mcs/tests/test-anon-25.cs
mcs/tests/test-anon-27.cs
mcs/tests/test-anon-28.cs
mcs/tests/test-anon-30.cs
mcs/tests/test-anon-31.cs
mcs/tests/test-anon-33.cs
mcs/tests/test-anon-34.cs
mcs/tests/test-anon-38.cs
mcs/tests/test-anon-39.cs
mcs/tests/test-anon-40.cs
mcs/tests/test-anon-41.cs
mcs/tests/test-anon-42.cs
mcs/tests/test-anon-43.cs
mcs/tests/test-anon-44.cs
mcs/tests/test-anon-45.cs
mcs/tests/test-anon-46.cs
mcs/tests/test-anon-47.cs
mcs/tests/test-anon-48.cs
mcs/tests/test-anon-50.cs
mcs/tests/test-anon-52.cs
mcs/tests/test-anon-53.cs
mcs/tests/test-anon-54.cs
mcs/tests/test-anon-55.cs
mcs/tests/test-anon-56.cs
mcs/tests/test-anon-62.cs
mcs/tests/test-anon-63.cs
mcs/tests/test-anon-64.cs
mcs/tests/test-anon-65.cs
mcs/tests/test-anon-69.cs
mcs/tests/test-anon-73.cs
mcs/tests/test-anon-76.cs
mcs/tests/test-anon-80.cs
mcs/tests/test-anon-85.cs
mcs/tests/test-anon-96.cs
mcs/tests/test-anon-97.cs
mcs/tests/test-anon-99.cs
mcs/tests/test-async-01.cs
mcs/tests/test-async-06.cs
mcs/tests/test-async-07.cs
mcs/tests/test-async-09.cs
mcs/tests/test-async-24.cs
mcs/tests/test-async-25.cs
mcs/tests/test-async-26.cs
mcs/tests/test-async-32.cs
mcs/tests/test-async-33.cs
mcs/tests/test-async-35.cs
mcs/tests/test-async-39.cs
mcs/tests/test-async-41.cs [new file with mode: 0644]
mcs/tests/test-cls-03.cs
mcs/tests/test-com-01.cs [new file with mode: 0644]
mcs/tests/test-debug-04-ref.xml
mcs/tests/test-debug-23-ref.xml
mcs/tests/test-debug-23.cs
mcs/tests/test-debug-25.cs
mcs/tests/test-externalias-01.cs
mcs/tests/test-externalias-02.cs
mcs/tests/test-externalias-03.cs
mcs/tests/test-externalias-04.cs
mcs/tests/test-externalias-05.cs
mcs/tests/test-externalias-06.cs
mcs/tests/test-externalias-07.cs
mcs/tests/test-externalias-08.cs
mcs/tests/test-externalias-09.cs
mcs/tests/test-iter-01.cs
mcs/tests/test-iter-02.cs
mcs/tests/test-iter-03.cs
mcs/tests/test-iter-04.cs
mcs/tests/test-iter-05.cs
mcs/tests/test-iter-06.cs
mcs/tests/test-iter-07.cs
mcs/tests/test-iter-08.cs
mcs/tests/test-iter-10.cs
mcs/tests/test-iter-11.cs
mcs/tests/test-iter-12.cs
mcs/tests/test-iter-14.cs
mcs/tests/test-iter-15.cs
mcs/tests/test-iter-16.cs
mcs/tests/test-iter-17.cs
mcs/tests/test-iter-21.cs
mcs/tests/test-iter-23.cs
mcs/tests/test-iter-25.cs
mcs/tests/test-partial-01.cs
mcs/tests/test-partial-02.cs
mcs/tests/test-partial-03.cs
mcs/tests/test-partial-04.cs
mcs/tests/test-partial-05.cs
mcs/tests/test-partial-06.cs
mcs/tests/test-partial-07.cs
mcs/tests/test-partial-10.cs
mcs/tests/test-partial-12.cs
mcs/tests/test-partial-13.cs
mcs/tests/test-partial-26.cs
mcs/tests/test-partial-28.cs
mcs/tests/test-partial-29.cs
mcs/tests/test-var-01.cs
mcs/tests/test-var-02.cs
mcs/tests/test-var-03.cs
mcs/tests/test-var-05.cs
mcs/tests/test-var-06.cs
mcs/tests/test-var-08.cs
mcs/tests/ver-il-net_4_5.xml
mcs/tools/compiler-tester/App.config [new file with mode: 0644]
mcs/tools/compiler-tester/CompilerTester.csproj
mcs/tools/compiler-tester/compiler-tester.cs
mcs/tools/csharp/getline.cs
mcs/tools/csharp/repl.cs
mcs/tools/linker/Mono.Linker/LinkContext.cs
mcs/tools/mdoc/Mono.Documentation/ecmadoc.cs
mcs/tools/mdoc/Mono.Documentation/monodocer.cs
mcs/tools/monkeydoc/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Makefile [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaDesc.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParser.jay [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParserDriver.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlTokenizer.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/HelpSource.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/Node.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/Provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/RootTree.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/SearchableDocument.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/SearchableIndex.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/Tree.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/TypeUtils.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/cache.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/caches/FileCache.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/caches/NullCache.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generator.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/HtmlGenerator.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Addin2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecma2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecmaspec2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Error2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Idem.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Man2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/MonoBook2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/generators/html/Toc2Html.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/index.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/addins-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/ecma-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/ecmaspec-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/error-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/man-provider.cs [new file with mode: 0755]
mcs/tools/monkeydoc/Monkeydoc/providers/simple-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/providers/xhtml-provider.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/storage.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Monkeydoc/storage/ZipStorage.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Mono.Documentation/ManifestResourceResolver.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Mono.Documentation/XmlDocUtils.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Mono.Utilities/LRUCache.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Mono.Utilities/MemoryLRU.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Mono.Utilities/colorizer.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/.gitattributes [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/Lminus.gif [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/Lplus.gif [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/base.css [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/ecmaspec-html-css.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/ecmaspec-html.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/ecmaspec.css [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/helper.js [new file with mode: 0755]
mcs/tools/monkeydoc/Resources/home.html [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/bc_bg.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/bc_separator.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/error.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/hatch.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/headerbg.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/help.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/house.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/members.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/namespace.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privclass.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privdelegate.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privenumeration.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privevent.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privextension.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privfield.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privinterface.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privmethod.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privproperty.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/privstructure.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protclass.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protdelegate.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protenumeration.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protevent.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protextension.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protfield.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protinterface.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protmethod.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protproperty.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/protstructure.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubclass.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubdelegate.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubenumeration.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubevent.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubextension.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubfield.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubinterface.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubmethod.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubproperty.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/pubstructure.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/reference.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/images/treebg.png [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mdoc-html-format.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mdoc-html-utils.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mdoc-sections-css.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mdoc-sections.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mono-ecma-css.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mono-ecma-impl.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mono-ecma.css [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/mono-ecma.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Resources/toc-html.xsl [new file with mode: 0644]
mcs/tools/monkeydoc/Test/Monkeydoc.Ecma/EcmaUrlTests.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Test/Monkeydoc/HelpSourceTests.cs [new file with mode: 0644]
mcs/tools/monkeydoc/Test/monodoc/monodoc.xml [new file with mode: 0644]
mcs/tools/monkeydoc/monkeydoc.dll.config.in [new file with mode: 0644]
mcs/tools/monkeydoc/monkeydoc.dll.sources [new file with mode: 0644]
mcs/tools/monkeydoc/monkeydoc_test.dll.sources [new file with mode: 0644]
mcs/tools/monodoc/Makefile
mcs/tools/monodoc/Monodoc/ecma-provider.cs
mcs/tools/monodoc/Monodoc/provider.cs
mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs
mono-core.spec.in
mono/Makefile.am
mono/arch/arm/arm-vfp-codegen.h
mono/dis/Makefile.am
mono/io-layer/processes.c
mono/io-layer/wthreads.c
mono/metadata/Makefile.am
mono/metadata/assembly.c
mono/metadata/boehm-gc.c
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/cominterop.c
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/metadata/file-io.c
mono/metadata/gc.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/metadata-verify.c
mono/metadata/metadata.c
mono/metadata/monitor.c
mono/metadata/mono-debug.c
mono/metadata/mono-perfcounters.c
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/pedump.c
mono/metadata/sgen-alloc.c
mono/metadata/sgen-archdep.h
mono/metadata/sgen-cardtable.c
mono/metadata/sgen-conf.h
mono/metadata/sgen-copy-object.h
mono/metadata/sgen-debug.c
mono/metadata/sgen-descriptor.c
mono/metadata/sgen-descriptor.h
mono/metadata/sgen-fin-weak-hash.c
mono/metadata/sgen-gc.c
mono/metadata/sgen-gc.h
mono/metadata/sgen-gray.c
mono/metadata/sgen-los.c
mono/metadata/sgen-major-copy-object.h
mono/metadata/sgen-major-copying.c
mono/metadata/sgen-major-scan-object.h
mono/metadata/sgen-marksweep-fixed-par.c
mono/metadata/sgen-marksweep-fixed.c
mono/metadata/sgen-marksweep-par.c
mono/metadata/sgen-marksweep.c
mono/metadata/sgen-memory-governor.c
mono/metadata/sgen-minor-copy-object.h
mono/metadata/sgen-minor-scan-object.h
mono/metadata/sgen-nursery-allocator.c
mono/metadata/sgen-os-mach.c
mono/metadata/sgen-os-posix.c
mono/metadata/sgen-pinned-allocator.c
mono/metadata/sgen-pinning.c
mono/metadata/sgen-simple-nursery.c
mono/metadata/sgen-split-nursery.c
mono/metadata/sgen-ssb.c
mono/metadata/sgen-stw.c
mono/metadata/sgen-toggleref.c
mono/metadata/socket-io.c
mono/metadata/threadpool.c
mono/metadata/threads.c
mono/mini/Makefile.am
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/debugger-agent.c
mono/mini/debugger-agent.h
mono/mini/dwarfwriter.c
mono/mini/exceptions-x86.c
mono/mini/iltests.il.in
mono/mini/image-writer.c
mono/mini/mdb-debug-info32-darwin.s
mono/mini/method-to-ir.c
mono/mini/mini-amd64.h
mono/mini/mini-arm.c
mono/mini/mini-darwin.c
mono/mini/mini-exceptions.c
mono/mini/mini-gc.c
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm.c
mono/mini/mini-ops.h
mono/mini/mini-x86.c
mono/mini/mini.c
mono/mini/mini.h
mono/mini/trace.c
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/mini/tramp-x86.c
mono/monograph/Makefile.am
mono/profiler/Makefile.am
mono/tests/Makefile.am
mono/tests/finalizer-exception.cs
mono/tests/sgen-domain-unload.cs [new file with mode: 0644]
mono/utils/Makefile.am
mono/utils/lock-free-alloc.c
mono/utils/lock-free-queue.h
mono/utils/mach-support-amd64.c
mono/utils/mach-support-arm.c
mono/utils/mach-support-unknown.c [new file with mode: 0644]
mono/utils/mach-support-x86.c
mono/utils/mach-support.h
mono/utils/memcheck.h
mono/utils/mono-compiler.h
mono/utils/mono-context.c
mono/utils/mono-context.h
mono/utils/mono-dl.c
mono/utils/mono-logger-internal.h
mono/utils/mono-sigcontext.h
mono/utils/valgrind.h
po/mcs/de.po
po/mcs/es.po
po/mcs/ja.po
po/mcs/mcs.pot
po/mcs/pt_BR.po
runtime/Makefile.am

index 31b22e7b4e1eac0af0822625155db223a877a6c0..3ee5ea042627b33b17fee862c53e248a524b08f7 100644 (file)
 [submodule "external/entityframework"]
        path = external/entityframework
        url = git://github.com/mono/entityframework.git
+[submodule "external/rx"]
+       path = external/rx
+       url = git://github.com/mono/rx.git
+[submodule "external/ikvm"]
+       path = external/ikvm
+       url = git://github.com/mono/ikvm-fork.git
+[submodule "external/Lucene.Net"]
+       path = external/Lucene.Net
+       url = git://github.com/apache/lucene.net.git
diff --git a/LICENSE b/LICENSE
index 0c52cc7dc9580339505658e89441c8d48e7cdf82..19ed03acc968af23c3286bfdfc912c29babce367 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -51,6 +51,13 @@ For comments, corrections and updates, please contact mono@xamarin.com
        Contact mono@xamarin.com for details on obtaining the Mono
        runtime under other terms.
 
+** mono/support: MonoPosixHelper and support code
+
+       This code is dual licensed under the LGPL or commercial licenses, with
+       the same guidelines as mono/mono code.
+
+       The ZLib files are included under a "new BSD"-style license.
+
 ** mono/eglib: Mono's X11 glib implementation
 
        This is a minimal subset of glib that is to be licensed under
index b90fd6741967e1218550ed9fc46f3b1884643ce2..a533344a76cdf090a72054c826ae79ccf5d9933e 100644 (file)
@@ -1,6 +1,7 @@
 ACLOCAL_AMFLAGS = -I m4
 
 MOONLIGHT_SUBDIRS = $(libgc_dir) eglib/src mono
+MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
 
 if CROSS_COMPILING
 SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) data runtime scripts man samples msvc $(docs_dir)
@@ -8,6 +9,9 @@ SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) data runtime scripts man
 ## 'tools' is not normally built
 DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native data runtime scripts man samples tools msvc docs
 else
+if ONLY_MONOTOUCH
+SUBDIRS = $(MONOTOUCH_SUBDIRS) runtime
+else
 if ONLY_MOONLIGHT
 SUBDIRS = $(MOONLIGHT_SUBDIRS) runtime
 else
@@ -17,6 +21,7 @@ SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scr
 DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native support data runtime scripts man samples tools msvc docs
 endif
 endif
+endif
 
 all: update_submodules
 
@@ -112,6 +117,31 @@ moon-do-clean:
 
 endif
 
+if INSTALL_MONOTOUCH
+monotouch-do-build: config.h
+       @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
+         case "x$$subdir" in \
+               xmono ) target="monotouch-do-build";; \
+               * ) target="all";; \
+         esac; \
+         echo "Making $$target in $$subdir"; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+        done;
+       (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-build)
+
+monotouch-do-clean:
+       @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
+         case "x$$subdir" in \
+               xmono ) target="monotouch-do-clean";; \
+               * ) target="clean";; \
+         esac; \
+         echo "Making $$target in $$subdir"; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+        done;
+       (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-clean)
+
+endif
+
 win32getdeps:
        wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
        wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
index 479425a5dc00d56ba395859cdb26579487a44829..c25a1f72c2003a3a0c45ebe1f0e941115e4a1bf3 100755 (executable)
@@ -103,7 +103,7 @@ if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
 fi
 
 echo "Running aclocal -I m4 -I . $ACLOCAL_FLAGS ..."
-aclocal -W none -I m4 -I . $ACLOCAL_FLAGS || {
+aclocal -Wnone -I m4 -I . $ACLOCAL_FLAGS || {
   echo
   echo "**Error**: aclocal failed. This may mean that you have not"
   echo "installed all of the packages you need, or you may need to"
index f3ad820db5fb4e1de29444f84220847f4225406d..1af6871b2f0bd01349039d20801550c3666c1178 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 #AC_PREREQ([2.62])
 
-AC_INIT(mono, [3.0.1],
+AC_INIT(mono, [3.0.3],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README])
@@ -89,6 +89,7 @@ esac
 host_win32=no
 target_win32=no
 platform_android=no
+platform_darwin=no
 case "$host" in
        *-mingw*|*-*-cygwin*)
                AC_DEFINE(HOST_WIN32,1,[Host Platform is Win32])
@@ -295,8 +296,6 @@ case "$host" in
                CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
                CPPFLAGS="$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent"
                libmono_cflags="-D_THREAD_SAFE"
-               LDFLAGS="$LDFLAGS -pthread"
-               libmono_ldflags="-pthread"
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID)
                AC_DEFINE(USE_MACH_SEMA, 1, [...])
@@ -313,7 +312,7 @@ case "$host" in
                case "$host" in
                        dnl Snow Leopard and newer config.guess reports as this
                        i*86-*-darwin*)
-                               BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE -mmacosx-version-min=10.5"
+                               BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE"
                                CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
                                CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
                                CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
@@ -323,6 +322,9 @@ case "$host" in
                                CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
                                CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
                                ;;
+                       arm*-darwin*)
+                               has_dtrace=no
+                               ;;                      
                esac
                ;;
        *-*-haiku*)
@@ -490,7 +492,7 @@ AC_CHECK_SIZEOF(void *, 4)
 
 WARN=''
 if test x"$GCC" = xyes; then
-        WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch-enum'
+        WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value'
                # The runtime code does not respect ANSI C strict aliasing rules
                CFLAGS="$CFLAGS -fno-strict-aliasing"
 
@@ -533,14 +535,12 @@ CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
 
 AC_CACHE_CHECK([for clang],
        mono_cv_clang,[
-       AC_TRY_RUN([
-               int main () {
-                       #ifdef __clang__
-                               return 0;
-                       #else
-                               return 1;
-                       #endif
-               }
+       AC_TRY_COMPILE([], [
+               #ifdef __clang__
+               #else
+               #error "FAILED"
+               #endif
+               return 0;
        ],
        [mono_cv_clang=yes],
        [mono_cv_clang=no],
@@ -694,6 +694,8 @@ if test "x$enable_libraries" = "xno"; then
    with_shared_mono=no
 fi
 
+AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
+
 case $host in
 *nacl* ) with_shared_mono=yes;;
 esac
@@ -738,7 +740,8 @@ DISABLED_FEATURES=none
 
 AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsystems.
      LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
-     reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping, shared_perfcounters.],
+     reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters,
+        sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
 [
        for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
                eval "mono_feature_disable_$feature='yes'"
@@ -853,6 +856,10 @@ if test "x$mono_feature_disable_soft_debug" = "xyes"; then
        AC_MSG_NOTICE([Disabled Soft Debugger.])
 fi
 
+if test "x$mono_feature_disable_perfcounters" = "xyes"; then
+       AC_DEFINE(DISABLE_PERFCOUNTERS, 1, [Disable Performance Counters.])
+       AC_MSG_NOTICE([Disabled Performance Counters.])
+fi
 if test "x$mono_feature_disable_normalization" = "xyes"; then
        AC_DEFINE(DISABLE_NORMALIZATION, 1, [Disable String normalization support.])
        AC_MSG_NOTICE([Disabled String normalization support.])
@@ -868,6 +875,31 @@ if test "x$mono_feature_disable_shared_perfcounters" = "xyes"; then
        AC_MSG_NOTICE([Disabled Shared perfcounters.])
 fi
 
+if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
+       AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
+       AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_par" = "xyes"; then
+       AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_PAR, 1, [Disable major=marksweep-par support in SGEN.])
+       AC_MSG_NOTICE([Disabled major=marksweep-par support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_fixed" = "xyes"; then
+       AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED, 1, [Disable major=marksweep-fixed support in SGEN.])
+       AC_MSG_NOTICE([Disabled major=marksweep-fixed support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_marksweep_fixed_par" = "xyes"; then
+       AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED_PAR, 1, [Disable major=marksweep-fixed-par support in SGEN.])
+       AC_MSG_NOTICE([Disabled major=marksweep-fixed-par support in SGEN.])
+fi
+
+if test "x$mono_feature_disable_sgen_copying" = "xyes"; then
+       AC_DEFINE(DISABLE_SGEN_MAJOR_COPYING, 1, [Disable major=copying support in SGEN.])
+       AC_MSG_NOTICE([Disabled major=copying support in SGEN.])
+fi
+
 AC_ARG_ENABLE(executables, [  --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
 AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
 
@@ -1553,11 +1585,11 @@ if test x$target_win32 = xno; then
                                        return 0;
                                }
 
-                               for (i = 0; i < 3; ++i) {
-                                       sleep (1);
+                               for (i = 0; i < 300; ++i) {
                                        waitpid (son, &status, WNOHANG);
                                        if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
                                                return 0;
+                                       usleep (10000);
                                }
 
                                kill (son, SIGKILL);
@@ -1659,9 +1691,21 @@ if test x$target_win32 = xno; then
        havekqueue=no
         AC_CHECK_FUNCS(kqueue, , AC_MSG_CHECKING(for kqueue in sys/event.h)
                 AC_TRY_LINK([#include <sys/event.h>], 
-                [ kqueue(); ], 
-                AC_DEFINE(HAVE_KQUEUE, 1, [Have kqueue]) AC_MSG_RESULT(yes),
-                AC_MSG_RESULT(no)))
+                [ kqueue(); ],[havekqueue=yes],[]))
+
+       dnl **************************************
+       dnl * Darwin has a race that prevents us from using reliably:
+       dnl * http://lists.apple.com/archives/darwin-dev/2011/Jun/msg00016.html
+       dnl * Since kqueue is mostly used for scaling large web servers, 
+       dnl * and very few folks run Mono on large web servers on OSX, falling
+       dnl * back 
+       dnl **************************************
+       if test x$havekqueue = xyes; then
+               if x$platform_darwin = xno; then
+                       AC_DEFINE(USE_KQUEUE_FOR_THREADPOOL, 1, [Use kqueue for the threadpool])
+               fi
+       fi
+
        dnl ******************************
        dnl *** Checks for SIOCGIFCONF ***
        dnl ******************************
@@ -2168,13 +2212,21 @@ if test "x$enable_llvm" = "xyes"; then
          AC_MSG_ERROR([llvm-config not found.])
    fi
 
+   llvm_codegen="x86codegen"
+   case "$target" in
+   arm*)
+               llvm_codegen="armcodegen"
+               ;;
+   esac
+
+
    # The output of --cflags seems to include optimizations flags too
    LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
    # LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
    # from LLVM classes.
    LLVM_CXXFLAGS="`$LLVM_CONFIG --cxxflags` -fno-rtti"
    LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
-   LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit x86codegen`
+   LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit $llvm_codegen`
    LLVM_LIBS="$LLVM_LDFLAGS $LLVM_LIBS -lstdc++"
 
    # Should be something like '2.6' or '2.7svn'
@@ -2444,6 +2496,17 @@ if test "x$host" != "x$target"; then
    AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
    enable_mcs_build=no
    case "$target" in
+   arm*-darwin*)
+               TARGET=ARM;
+               arch_target=arm;
+               ACCESS_UNALIGNED="no"
+               JIT_SUPPORTED=yes
+               CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
+               jit_wanted=true
+               # Can't use tls, since it depends on the runtime detection of tls offsets
+               # in mono-compiler.h
+               with_tls=pthread
+               ;;
    powerpc64-ps3-linux-gnu)
                TARGET=POWERPC64
                arch_target=powerpc64
@@ -2478,7 +2541,7 @@ if test "x$host" != "x$target"; then
                AC_DEFINE(TARGET_X86, 1, [...])
                sizeof_register=4
                ;;
-   arm*-unknown-linux-gnueabi*)
+   arm*-unknown-linux-*)
                TARGET=ARM;
                arch_target=arm;
                AC_DEFINE(TARGET_ARM, 1, [...])
@@ -2533,6 +2596,21 @@ MIPS)
 esac
 
 if test "x$target_mach" = "xyes"; then
+       AC_TRY_COMPILE([#include "TargetConditionals.h"],[
+       #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
+       #error fail this for ios
+       #endif
+       return 0;
+       ], [
+               AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
+               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_OSX"
+               CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_OSX"
+       ], [
+               AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
+               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
+               CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
+       ])
+
    AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
 fi
 
@@ -2720,6 +2798,11 @@ if test "x$icall_tables" = "xno"; then
    AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
 fi
 
+if test "x$mono_cv_clang" = "xyes"; then
+   # FIXME: This causes many compilation errors
+   with_tls=pthread
+fi
+
 if test "x$with_tls" = "x__thread"; then
        AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
        # Pass the information to libgc
@@ -2816,6 +2899,7 @@ AC_ARG_WITH(profile4,  [  --with-profile4=yes,no          If you want to install
 AC_ARG_WITH(profile4_5,[  --with-profile4_5=yes,no        If you want to install the 4.5 FX (defaults to yes)],                [], [with_profile4_5=yes])
 AC_ARG_WITH(monodroid, [  --with-monodroid=yes,no         If you want to build the MonoDroid assemblies (defaults to no)],     [], [with_monodroid=no])
 AC_ARG_WITH(monotouch, [  --with-monotouch=yes,no,only    If you want to build the MonoTouch assemblies (defaults to no)],     [], [with_monotouch=no])
+AC_ARG_WITH(mobile,    [  --with-mobile=yes,no            If you want to build the Mobile assemblies (defaults to no)],        [], [with_mobile=no])
 
 OPROFILE=no
 AC_ARG_WITH(oprofile,[  --with-oprofile=no,<oprofile install dir>   Enable oprofile support (defaults to no)],[
@@ -2864,6 +2948,12 @@ AC_ARG_WITH(moon_gc, [  --with-moon-gc=boehm,sgen                Select the gc to use with Moo
        fi
 ], [with_moon_gc=boehm])
 
+AC_ARG_WITH(lazy_gc_thread_creation, [  --with-lazy-gc-thread-creation=yes|no      Enable lazy runtime thread creation, embedding host must do it explicitly (defaults to no)],[
+       if test x$with_lazy_gc_thread_creation != xno ; then
+               AC_DEFINE(LAZY_GC_THREAD_CREATION,1,[Enable lazy gc thread creation by the embedding host.])
+       fi
+], [with_lazy_gc_thread_creation=no])
+
 AC_CHECK_HEADER([malloc.h], 
                [AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1], 
                        [Define to 1 if you have /usr/include/malloc.h.])],,)
@@ -2878,7 +2968,7 @@ fi
 
 # When --disable-shared is used, libtool transforms libmono-2.0.la into libmono-2.0.so
 # instead of libmono-static.a
-if test "x$enable_shared" = "xno"; then
+if test "x$enable_shared" = "xno" -a "x$enable_executables" = "xyes"; then
    LIBMONO_LA=libmini-static.la
 else
    LIBMONO_LA=libmono-$API_VER.la
@@ -2924,6 +3014,8 @@ AM_CONDITIONAL(INSTALL_4_0, [test "x$with_profile4" = xyes])
 AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
 AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
 AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
+AM_CONDITIONAL(INSTALL_MOBILE, [test "x$with_mobile" = xyes])
+AM_CONDITIONAL(ONLY_MONOTOUCH, [test "x$with_monotouch" = "xonly"])
 
 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
@@ -2944,6 +3036,7 @@ AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
 AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
 AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
 AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
+AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
 
 AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
 AM_CONDITIONAL(INTERP_SUPPORTED, test x$interp_wanted = xtrue)
diff --git a/docs/reactive-extension-bundle.txt b/docs/reactive-extension-bundle.txt
new file mode 100644 (file)
index 0000000..175818a
--- /dev/null
@@ -0,0 +1,49 @@
+With this change, we bundle Reactive Extensions from Microsoft.
+
+Steps to do:
+
+- Until we add submodule, check out Rx sources from http://rx.codeplex.com:
+
+       $ cd external
+       $ git clone git://github.com/atsushieno/rx.git
+       $ cd rx
+       $ git checkout rx-oss-v1.0
+       $ cd ../..
+
+  Note that the original repo at rx.codeplex.com will *fail* on Linux!
+  codeplex.codeplex.com/workitem/26133
+  Also note that rx.codeplex.com is huge and takes very long time to checkout.
+
+- expand rx-mono-changes-3.tar.bz2
+
+       $ tar jxvf rx-mono-changes-3.tar.bz2
+
+- Apply changes to mcs/class/Makefile:
+
+       $ cd mcs/class
+       $ patch -i add-rx-libs.patch -p3
+       $ cd ../..
+
+Then it should be done.
+
+Note that this does not include Mono.Reactive.Testing into the build yet -
+this library depends on nunit.framework.dll but it wouldn't be built before
+this assembly is built. This needs to be resolved.
+
+** Current Status
+
+- We don't have Microsoft.Reactive.Testing.dll. Instead, I created an
+  alternative Mono.Reactive.Testing.dll which *mostly* uses MS sources for
+  that assembly but uses NUnit.Framework instead.
+
+  To make it happen, I added a small script that automatically replaces
+  MSTest dependency parts with that for NUnit (replacer.sh under rx tree).
+
+  (We'll also have to rename namespaces and have more source changes, but
+  so far it is to get things runnable.)
+
+- To check the build sanity, I imported unit tests (as explained above)
+  and it is supposed to run by "make run-test" in Mono.Reactive.Testing
+  directory (the tests were all in one place in MS tests, so I made it
+  in Mono.Reactive.Testing directory instead).
+
diff --git a/docs/sources/mono-api-decimal.html b/docs/sources/mono-api-decimal.html
new file mode 100644 (file)
index 0000000..41c9347
--- /dev/null
@@ -0,0 +1,19 @@
+<h1>Decimal Support</h1>
+
+       <p>You can use the mono_decimal functions to access and
+       manipulate <tt>System.Decimal</tt> types from C.
+       
+<h4><a name="api:mono_decimal2double">mono_decimal2double</a></h4>
+<h4><a name="api:mono_decimal2Int64">mono_decimal2Int64</a></h4>
+<h4><a name="api:mono_decimal2string">mono_decimal2string</a></h4>
+<h4><a name="api:mono_decimal2UInt64">mono_decimal2UInt64</a></h4>
+<h4><a name="api:mono_decimalCompare">mono_decimalCompare</a></h4>
+<h4><a name="api:mono_decimalDiv">mono_decimalDiv</a></h4>
+<h4><a name="api:mono_decimalFloorAndTrunc">mono_decimalFloorAndTrunc</a></h4>
+<h4><a name="api:mono_decimalIncr">mono_decimalIncr</a></h4>
+<h4><a name="api:mono_decimalIntDiv">mono_decimalIntDiv</a></h4>
+<h4><a name="api:mono_decimalMult">mono_decimalMult</a></h4>
+<h4><a name="api:mono_decimalRound">mono_decimalRound</a></h4>
+<h4><a name="api:mono_decimalSetExponent">mono_decimalSetExponent</a></h4>
+<h4><a name="api:mono_double2decimal">mono_double2decimal</a></h4>
+<h4><a name="api:mono_string2decimal">mono_string2decimal</a></h4>
index 4b03a191ed0c9128e9bb471f84d52fe5b0732c5a..69122ddda62b8fe188ccc3f6473e8d68a1a37683 100644 (file)
@@ -58,6 +58,30 @@ out_vfprintf (FILE *ignore, const gchar *format, va_list args)
        /* TODO: provide a proper app name */
        __android_log_vprint (ANDROID_LOG_ERROR, "mono", format, args);
 }
+#elif MONOTOUCH && defined(__arm__)
+#include <asl.h>
+
+static int
+to_asl_priority (GLogLevelFlags log_level)
+{
+       switch (log_level & G_LOG_LEVEL_MASK)
+       {
+               case G_LOG_LEVEL_ERROR:     return ASL_LEVEL_CRIT;
+               case G_LOG_LEVEL_CRITICAL:  return ASL_LEVEL_ERR;
+               case G_LOG_LEVEL_WARNING:   return ASL_LEVEL_WARNING;
+               case G_LOG_LEVEL_MESSAGE:   return ASL_LEVEL_NOTICE;
+               case G_LOG_LEVEL_INFO:      return ASL_LEVEL_INFO;
+               case G_LOG_LEVEL_DEBUG:     return ASL_LEVEL_DEBUG;
+       }
+       return ASL_LEVEL_ERR;
+}
+
+static void
+out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+{
+       asl_vlog (NULL, NULL, ASL_LEVEL_WARNING, format, args);
+}
+
 #else
 static void 
 out_vfprintf (FILE *file, const gchar *format, va_list args)
@@ -116,6 +140,8 @@ g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format,
 {
 #if PLATFORM_ANDROID
        __android_log_vprint (to_android_priority (log_level), log_domain, format, args);
+#elif MONOTOUCH && defined(__arm__)
+       asl_vlog (NULL, NULL, to_asl_priority (log_level), format, args);
 #else
        char *msg;
        
diff --git a/external/Lucene.Net b/external/Lucene.Net
new file mode 160000 (submodule)
index 0000000..88fb67b
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 88fb67b07621dfed054d8d75fd50672fb26349df
diff --git a/external/ikvm b/external/ikvm
new file mode 160000 (submodule)
index 0000000..3db6121
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 3db612102e06332eebebd128cd06be68b03c2f0e
diff --git a/external/rx b/external/rx
new file mode 160000 (submodule)
index 0000000..7c59a20
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 7c59a20c72adc9b4c7568ce0395fe33e0a4bf8ea
index ceea56c962f81f09757d3dece2921baf0e3f7db1..4cfc38728ee74a080205c7574d13d6953f32824b 100755 (executable)
@@ -87,6 +87,7 @@ if grep "^AC_PROG_LIBTOOL" configure.in >/dev/null; then
   fi
 fi
 
+ACLOCAL_FLAGS="$ACLOCAL_FLAGS -Wnone"
 echo "Running aclocal $ACLOCAL_FLAGS ..."
 aclocal $ACLOCAL_FLAGS || {
   echo
@@ -104,7 +105,7 @@ if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
 fi
 
 echo "Running automake --gnu $am_opt ..."
-automake --add-missing --gnu $am_opt ||
+automake --add-missing --gnu -Wno-obsolete $am_opt ||
   { echo "**Error**: automake failed."; exit 1; }
 echo "Running autoconf ..."
 autoconf || { echo "**Error**: autoconf failed."; exit 1; }
index a1051f5ac4e0e80b1af6af6198d78fa799907766..a53cda354a63aa9e1740fb355aede651a6d68095 100644 (file)
@@ -115,7 +115,7 @@ void GC_push_all_stacks() {
        if(r != KERN_SUCCESS) continue;
        
 #if defined(I386)
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
 
        lo = state.__esp;
 
@@ -391,7 +391,7 @@ void GC_push_all_stacks() {
                             (natural_t *)&info, &outCount);
        if(r != KERN_SUCCESS) continue;
 
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
        lo = (void*)info.__esp;
        hi = (ptr_t)FindTopOfStack(info.__esp);
 
index da15e905c58e169fd292040949bf693ef5229e78..ec53e3a95eab84e5de67b9b3247c96516ee74e70 100644 (file)
 #   define mach_type_known
 # endif
 # ifdef DARWIN
+#    include "TargetConditionals.h"
 #   if defined(__ppc__)  || defined(__ppc64__)
 #    define POWERPC
 #    define mach_type_known
 #    define mach_type_known
 #    define DARWIN_DONT_PARSE_STACK
 #    define OS_TYPE "DARWIN"
-#    define DYNAMIC_LOADING
+#    if TARGET_IPHONE_SIMULATOR == 0
+#     define DYNAMIC_LOADING
+#    endif
      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
         These aren't used when dyld support is enabled (it is by default) */
 #    define DATASTART ((ptr_t) get_etext())
index bc31c9733a7d40e77e2c7ed3156516401901d576..ccafb3b1169e96fa6847a794ea4b01d1421ba8b1 100644 (file)
@@ -66,6 +66,7 @@
     --> Macro replaced by USE_COMPILER_TLS
 # endif
 
+#ifndef USE_COMPILER_TLS
 # if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
       defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) || \
       defined(GC_NETBSD_THREADS) && !defined(USE_PTHREAD_SPECIFIC) || \
@@ -73,6 +74,7 @@
       defined(GC_OPENBSD_THREADS)
 #   define USE_PTHREAD_SPECIFIC
 # endif
+#endif
 
 # if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE)
 #   define _POSIX4A_DRAFT10_SOURCE 1
index ad8d8e04604bde9c718863270f1e4a8d798c279c..768149e9d1066b1ba99eab7e122d86dfef6181d7 100644 (file)
@@ -310,7 +310,7 @@ $(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag
 Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";)
 # net_2_0 is needed because monodoc is only compiled in that profile
 MDOC_UP  =$(Q_MDOC_UP) \
-               MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe \
+               MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(DEFAULT_PROFILE)/mdoc.exe \
                update --delete -o Documentation/en $(the_lib)
 
 doc-update-local: $(the_libdir)/.doc-stamp
index 5a33a9f0627ace4dfb57cc2aa6384ca44ccf084c..8c9b36f5dff59818514b7609eb96bb185644b553 100644 (file)
@@ -5,11 +5,14 @@ BOOTSTRAP_PROFILE = build
 BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
 MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
 
+# Use system resgen as we don't want local System.Windows.Forms dependency
+RESGEN = resgen2
+
 profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:MOBILE -d:MONOTOUCH -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE -d:MONOTOUCH -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
 FRAMEWORK_VERSION = 2.1
 NO_TEST = yes
 
index c153792f1b9f0fda4279aa4f96b6d6953848e58b..a6540aa52a26751ef20783b2cc41c99bf7d879ee 100644 (file)
@@ -14,3 +14,6 @@ DEFAULT_REFERENCES = -r:mscorlib.dll
 PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_3_0 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
 
 FRAMEWORK_VERSION = 4.5
+
+# This is utility build only
+NO_INSTALL = yes
index a6e19404b371f929586c30c7ff59ec39b32a1bdd..009c03b6bb71a48e39602cf3a5c7a9a7d41689a6 100755 (executable)
@@ -83,8 +83,8 @@ namespace Commons.Xml.Relaxng
                        RelaxngGrammar g = null;
                        RelaxngPattern p;
                        try {
-                               if (grammar.IsSourceCompactSyntax) {
-                                       p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, BaseUri, nsContext);
+                               if (uri.AbsolutePath.EndsWith(".rnc", StringComparison.InvariantCultureIgnoreCase)) {
+                                       p = RncParser.ParseRnc (new StreamReader ((Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream))), null, uri.AbsoluteUri, nsContext);
                                } else {
                                        xtr = new XmlTextReader (uri.AbsoluteUri, (Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream)));
                                        RelaxngReader r = new RelaxngReader (xtr, nsContext, grammar.Resolver);
diff --git a/mcs/class/IKVM.Reflection/AmbiguousMatchException.cs b/mcs/class/IKVM.Reflection/AmbiguousMatchException.cs
deleted file mode 100644 (file)
index 121d69f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
-       [Serializable]
-       public sealed class AmbiguousMatchException : Exception
-       {
-               public AmbiguousMatchException()
-               {
-               }
-
-               public AmbiguousMatchException(string message)
-                       : base(message)
-               {
-               }
-
-               public AmbiguousMatchException(string message, Exception inner)
-                       : base(message, inner)
-               {
-               }
-
-               private AmbiguousMatchException(SerializationInfo info, StreamingContext context)
-                       : base(info, context)
-               {
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Assembly.cs b/mcs/class/IKVM.Reflection/Assembly.cs
deleted file mode 100644 (file)
index 715e774..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
-       public abstract class Assembly : ICustomAttributeProvider
-       {
-               internal readonly Universe universe;
-               protected string fullName;      // AssemblyBuilder needs access to this field to clear it when the name changes
-
-               internal Assembly(Universe universe)
-               {
-                       this.universe = universe;
-               }
-
-               public sealed override string ToString()
-               {
-                       return FullName;
-               }
-
-               public abstract Type[] GetTypes();
-               public abstract AssemblyName GetName();
-               public abstract string ImageRuntimeVersion { get; }
-               public abstract Module ManifestModule { get; }
-               public abstract MethodInfo EntryPoint { get; }
-               public abstract string Location { get; }
-               public abstract AssemblyName[] GetReferencedAssemblies();
-               public abstract Module[] GetModules(bool getResourceModules);
-               public abstract Module[] GetLoadedModules(bool getResourceModules);
-               public abstract Module GetModule(string name);
-               public abstract string[] GetManifestResourceNames();
-               public abstract ManifestResourceInfo GetManifestResourceInfo(string resourceName);
-               public abstract System.IO.Stream GetManifestResourceStream(string name);
-
-               internal abstract Type FindType(TypeName name);
-               internal abstract Type FindTypeIgnoreCase(TypeName lowerCaseName);
-
-               // The differences between ResolveType and FindType are:
-               // - ResolveType is only used when a type is assumed to exist (because another module's metadata claims it)
-               // - ResolveType can return a MissingType
-               internal Type ResolveType(TypeName typeName)
-               {
-                       return FindType(typeName) ?? universe.GetMissingTypeOrThrow(this.ManifestModule, null, typeName);
-               }
-
-               public string FullName
-               {
-                       get { return fullName ?? (fullName = GetName().FullName); }
-               }
-
-               public Module[] GetModules()
-               {
-                       return GetModules(true);
-               }
-
-               public Module[] GetLoadedModules()
-               {
-                       return GetLoadedModules(true);
-               }
-
-               public AssemblyName GetName(bool copiedName)
-               {
-                       return GetName();
-               }
-
-               public bool ReflectionOnly
-               {
-                       get { return true; }
-               }
-
-               public Type[] GetExportedTypes()
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (Type type in GetTypes())
-                       {
-                               if (type.IsVisible)
-                               {
-                                       list.Add(type);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public Type GetType(string name)
-               {
-                       return GetType(name, false);
-               }
-
-               public Type GetType(string name, bool throwOnError)
-               {
-                       return GetType(name, throwOnError, false);
-               }
-
-               public Type GetType(string name, bool throwOnError, bool ignoreCase)
-               {
-                       TypeNameParser parser = TypeNameParser.Parse(name, throwOnError);
-                       if (parser.Error)
-                       {
-                               return null;
-                       }
-                       if (parser.AssemblyName != null)
-                       {
-                               if (throwOnError)
-                               {
-                                       throw new ArgumentException("Type names passed to Assembly.GetType() must not specify an assembly.");
-                               }
-                               else
-                               {
-                                       return null;
-                               }
-                       }
-                       TypeName typeName = TypeName.Split(TypeNameParser.Unescape(parser.FirstNamePart));
-                       Type type = ignoreCase
-                               ? FindTypeIgnoreCase(typeName.ToLowerInvariant())
-                               : FindType(typeName);
-                       if (type == null && __IsMissing)
-                       {
-                               throw new MissingAssemblyException((MissingAssembly)this);
-                       }
-                       return parser.Expand(type, this, throwOnError, name, false, ignoreCase);
-               }
-
-               public virtual Module LoadModule(string moduleName, byte[] rawModule)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public Module LoadModule(string moduleName, byte[] rawModule, byte[] rawSymbolStore)
-               {
-                       return LoadModule(moduleName, rawModule);
-               }
-
-               public bool IsDefined(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
-               }
-
-               public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
-               }
-
-               public static string CreateQualifiedName(string assemblyName, string typeName)
-               {
-                       return typeName + ", " + assemblyName;
-               }
-
-               public static Assembly GetAssembly(Type type)
-               {
-                       return type.Assembly;
-               }
-
-               public string CodeBase
-               {
-                       get
-                       {
-                               string path = this.Location.Replace(System.IO.Path.DirectorySeparatorChar, '/');
-                               if (!path.StartsWith("/"))
-                               {
-                                       path = "/" + path;
-                               }
-                               return "file://" + path;
-                       }
-               }
-
-               public virtual bool __IsMissing
-               {
-                       get { return false; }
-               }
-
-               public virtual AssemblyNameFlags __AssemblyFlags
-               {
-                       get { return GetName().Flags; }
-               }
-
-               internal abstract IList<CustomAttributeData> GetCustomAttributesData(Type attributeType);
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/AssemblyName.cs b/mcs/class/IKVM.Reflection/AssemblyName.cs
deleted file mode 100644 (file)
index 0812194..0000000
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Globalization;
-using System.Configuration.Assemblies;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       public sealed class AssemblyName : ICloneable
-       {
-               private string name;
-               private string culture;
-               private Version version;
-               private byte[] publicKeyToken;
-               private byte[] publicKey;
-               private StrongNameKeyPair keyPair;
-               private AssemblyNameFlags flags;
-               private AssemblyHashAlgorithm hashAlgorithm;
-               private AssemblyVersionCompatibility versionCompatibility = AssemblyVersionCompatibility.SameMachine;
-               private string codeBase;
-               internal byte[] hash;
-
-               public AssemblyName()
-               {
-               }
-
-               public AssemblyName(string assemblyName)
-               {
-                       if (assemblyName == null)
-                       {
-                               throw new ArgumentNullException("assemblyName");
-                       }
-                       if (assemblyName == "")
-                       {
-                               throw new ArgumentException();
-                       }
-                       ParsedAssemblyName parsed;
-                       switch (Fusion.ParseAssemblyName(assemblyName, out parsed))
-                       {
-                               case ParseAssemblyResult.GenericError:
-                                       throw new FileLoadException();
-                               case ParseAssemblyResult.DuplicateKey:
-                                       throw new System.Runtime.InteropServices.COMException();
-                       }
-                       name = parsed.Name;
-                       if (parsed.Culture != null)
-                       {
-                               if (parsed.Culture.Equals("neutral", StringComparison.InvariantCultureIgnoreCase))
-                               {
-                                       culture = "";
-                               }
-                               else if (parsed.Culture == "")
-                               {
-                                       throw new FileLoadException();
-                               }
-                               else
-                               {
-                                       culture = new CultureInfo(parsed.Culture).Name;
-                               }
-                       }
-                       if (parsed.Version != null && parsed.Version.Major != 65535 && parsed.Version.Minor != 65535)
-                       {
-                               // our Fusion parser returns -1 for build and revision for incomplete version numbers (and we want 65535)
-                               version = new Version(parsed.Version.Major, parsed.Version.Minor, parsed.Version.Build & 0xFFFF, parsed.Version.Revision & 0xFFFF);
-                       }
-                       if (parsed.PublicKeyToken != null)
-                       {
-                               if (parsed.PublicKeyToken.Equals("null", StringComparison.InvariantCultureIgnoreCase))
-                               {
-                                       publicKeyToken = Empty<byte>.Array;
-                               }
-                               else if (parsed.PublicKeyToken.Length != 16)
-                               {
-                                       throw new FileLoadException();
-                               }
-                               else
-                               {
-                                       publicKeyToken = new byte[8];
-                                       for (int i = 0, pos = 0; i < publicKeyToken.Length; i++, pos += 2)
-                                       {
-                                               publicKeyToken[i] = (byte)("0123456789abcdef".IndexOf(char.ToLowerInvariant(parsed.PublicKeyToken[pos])) * 16
-                                                       + "0123456789abcdef".IndexOf(char.ToLowerInvariant(parsed.PublicKeyToken[pos + 1])));
-                                       }
-                               }
-                       }
-                       if (parsed.Retargetable.HasValue)
-                       {
-                               if (parsed.Culture == null || parsed.PublicKeyToken == null || parsed.Version == null || parsed.Version.Build == -1 || parsed.Version.Revision == -1)
-                               {
-                                       throw new FileLoadException();
-                               }
-                               if (parsed.Retargetable.Value)
-                               {
-                                       flags |= AssemblyNameFlags.Retargetable;
-                               }
-                       }
-                       ProcessorArchitecture = parsed.ProcessorArchitecture;
-                       if (parsed.WindowsRuntime)
-                       {
-                               ContentType = AssemblyContentType.WindowsRuntime;
-                       }
-               }
-
-               public override string ToString()
-               {
-                       return FullName;
-               }
-
-               public string Name
-               {
-                       get { return name; }
-                       set { name = value; }
-               }
-
-               public CultureInfo CultureInfo
-               {
-                       get { return culture == null ? null : new CultureInfo(culture); }
-                       set { culture = value == null ? null : value.Name; }
-               }
-
-               internal string Culture
-               {
-                       get { return culture; }
-                       set { culture = value; }
-               }
-
-               public Version Version
-               {
-                       get { return version; }
-                       set { version = value; }
-               }
-
-               public StrongNameKeyPair KeyPair
-               {
-                       get { return keyPair; }
-                       set { keyPair = value; }
-               }
-
-               public string CodeBase
-               {
-                       get { return codeBase; }
-                       set { codeBase = value; }
-               }
-
-               public string EscapedCodeBase
-               {
-                       get
-                       {
-                               // HACK use the real AssemblyName to escape the codebase
-                               System.Reflection.AssemblyName tmp = new System.Reflection.AssemblyName();
-                               tmp.CodeBase = codeBase;
-                               return tmp.EscapedCodeBase;
-                       }
-               }
-
-               public ProcessorArchitecture ProcessorArchitecture
-               {
-                       get { return (ProcessorArchitecture)(((int)flags & 0x70) >> 4); }
-                       set
-                       {
-                               if (value >= ProcessorArchitecture.None && value <= ProcessorArchitecture.Arm)
-                               {
-                                       flags = (flags & ~(AssemblyNameFlags)0x70) | (AssemblyNameFlags)((int)value << 4);
-                               }
-                       }
-               }
-
-               public AssemblyNameFlags Flags
-               {
-                       get { return flags & (AssemblyNameFlags)~0xEF0; }
-                       set { flags = (flags & (AssemblyNameFlags)0xEF0) | (value & (AssemblyNameFlags)~0xEF0); }
-               }
-
-               public AssemblyVersionCompatibility VersionCompatibility
-               {
-                       get { return versionCompatibility; }
-                       set { versionCompatibility = value; }
-               }
-
-               public AssemblyContentType ContentType
-               {
-                       get { return (AssemblyContentType)(((int)flags & 0xE00) >> 9); }
-                       set
-                       {
-                               if (value >= AssemblyContentType.Default && value <= AssemblyContentType.WindowsRuntime)
-                               {
-                                       flags = (flags & ~(AssemblyNameFlags)0xE00) | (AssemblyNameFlags)((int)value << 9);
-                               }
-                       }
-               }
-
-               public byte[] GetPublicKey()
-               {
-                       return publicKey;
-               }
-
-               public void SetPublicKey(byte[] publicKey)
-               {
-                       this.publicKey = publicKey;
-                       flags = (flags & ~AssemblyNameFlags.PublicKey) | (publicKey == null ? 0 : AssemblyNameFlags.PublicKey);
-               }
-
-               public byte[] GetPublicKeyToken()
-               {
-                       if (publicKeyToken == null && publicKey != null)
-                       {
-                               // note that GetPublicKeyToken() has a side effect in this case, because we retain this token even after the public key subsequently gets changed
-                               publicKeyToken = ComputePublicKeyToken(publicKey);
-                       }
-                       return publicKeyToken;
-               }
-
-               public void SetPublicKeyToken(byte[] publicKeyToken)
-               {
-                       this.publicKeyToken = publicKeyToken;
-               }
-
-               public AssemblyHashAlgorithm HashAlgorithm
-               {
-                       get { return hashAlgorithm; }
-                       set { hashAlgorithm = value; }
-               }
-
-               public byte[] __Hash
-               {
-                       get { return hash; }
-               }
-
-               public string FullName
-               {
-                       get
-                       {
-                               if (name == null)
-                               {
-                                       return "";
-                               }
-                               StringBuilder sb = new StringBuilder();
-                               bool doubleQuotes = name.StartsWith(" ") || name.EndsWith(" ") || name.IndexOf('\'') != -1;
-                               bool singleQuotes = name.IndexOf('"') != -1;
-                               if (singleQuotes)
-                               {
-                                       sb.Append('\'');
-                               }
-                               else if (doubleQuotes)
-                               {
-                                       sb.Append('"');
-                               }
-                               if (name.IndexOf(',') != -1 || name.IndexOf('\\') != -1 || name.IndexOf('=') != -1 || (singleQuotes && name.IndexOf('\'') != -1))
-                               {
-                                       for (int i = 0; i < name.Length; i++)
-                                       {
-                                               char c = name[i];
-                                               if (c == ',' || c == '\\' || c == '=' || (singleQuotes && c == '\''))
-                                               {
-                                                       sb.Append('\\');
-                                               }
-                                               sb.Append(c);
-                                       }
-                               }
-                               else
-                               {
-                                       sb.Append(name);
-                               }
-                               if (singleQuotes)
-                               {
-                                       sb.Append('\'');
-                               }
-                               else if (doubleQuotes)
-                               {
-                                       sb.Append('"');
-                               }
-                               if (version != null)
-                               {
-                                       if ((version.Major & 0xFFFF) != 0xFFFF)
-                                       {
-                                               sb.Append(", Version=").Append(version.Major & 0xFFFF);
-                                               if ((version.Minor & 0xFFFF) != 0xFFFF)
-                                               {
-                                                       sb.Append('.').Append(version.Minor & 0xFFFF);
-                                                       if ((version.Build & 0xFFFF) != 0xFFFF)
-                                                       {
-                                                               sb.Append('.').Append(version.Build & 0xFFFF);
-                                                               if ((version.Revision & 0xFFFF) != 0xFFFF)
-                                                               {
-                                                                       sb.Append('.').Append(version.Revision & 0xFFFF);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                               if (culture != null)
-                               {
-                                       sb.Append(", Culture=").Append(culture == "" ? "neutral" : culture);
-                               }
-                               byte[] publicKeyToken = this.publicKeyToken;
-                               if ((publicKeyToken == null || publicKeyToken.Length == 0) && publicKey != null)
-                               {
-                                       publicKeyToken = ComputePublicKeyToken(publicKey);
-                               }
-                               if (publicKeyToken != null)
-                               {
-                                       sb.Append(", PublicKeyToken=");
-                                       if (publicKeyToken.Length == 0)
-                                       {
-                                               sb.Append("null");
-                                       }
-                                       else
-                                       {
-                                               AppendPublicKey(sb, publicKeyToken);
-                                       }
-                               }
-                               if ((Flags & AssemblyNameFlags.Retargetable) != 0)
-                               {
-                                       sb.Append(", Retargetable=Yes");
-                               }
-                               if (ContentType == AssemblyContentType.WindowsRuntime)
-                               {
-                                       sb.Append(", ContentType=WindowsRuntime");
-                               }
-                               return sb.ToString();
-                       }
-               }
-
-               private static byte[] ComputePublicKeyToken(byte[] publicKey)
-               {
-                       if (publicKey.Length == 0)
-                       {
-                               return publicKey;
-                       }
-                       // HACK use the real AssemblyName to convert PublicKey to PublicKeyToken
-                       StringBuilder sb = new StringBuilder("Foo, PublicKey=", 20 + publicKey.Length * 2);
-                       AppendPublicKey(sb, publicKey);
-                       string str = sb.ToString();
-                       if (str == "Foo, PublicKey=00000000000000000400000000000000")
-                       {
-                               // MONOBUG workaround Mono 2.10 bug (fixed in 2.11)
-                               // it does not return the correct public key token for the ECMA key
-                               return new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89 };
-                       }
-                       return new System.Reflection.AssemblyName(str).GetPublicKeyToken();
-               }
-
-               private static void AppendPublicKey(StringBuilder sb, byte[] publicKey)
-               {
-                       for (int i = 0; i < publicKey.Length; i++)
-                       {
-                               sb.Append("0123456789abcdef"[publicKey[i] >> 4]);
-                               sb.Append("0123456789abcdef"[publicKey[i] & 0x0F]);
-                       }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       AssemblyName other = obj as AssemblyName;
-                       return other != null && other.FullName == this.FullName;
-               }
-
-               public override int GetHashCode()
-               {
-                       return FullName.GetHashCode();
-               }
-
-               public object Clone()
-               {
-                       AssemblyName copy = (AssemblyName)MemberwiseClone();
-                       copy.publicKey = Copy(publicKey);
-                       copy.publicKeyToken = Copy(publicKeyToken);
-                       return copy;
-               }
-
-               private static byte[] Copy(byte[] b)
-               {
-                       return b == null || b.Length == 0 ? b : (byte[])b.Clone();
-               }
-
-               public static bool ReferenceMatchesDefinition(AssemblyName reference, AssemblyName definition)
-               {
-                       // HACK use the real AssemblyName to implement the (broken) ReferenceMatchesDefinition method
-                       return System.Reflection.AssemblyName.ReferenceMatchesDefinition(new System.Reflection.AssemblyName(reference.FullName), new System.Reflection.AssemblyName(definition.FullName));
-               }
-
-               public static AssemblyName GetAssemblyName(string path)
-               {
-                       try
-                       {
-                               path = Path.GetFullPath(path);
-                               using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
-                               {
-                                       ModuleReader module = new ModuleReader(null, null, fs, path);
-                                       if (module.Assembly == null)
-                                       {
-                                               throw new BadImageFormatException("Module does not contain a manifest");
-                                       }
-                                       return module.Assembly.GetName();
-                               }
-                       }
-                       catch (IOException x)
-                       {
-                               throw new FileNotFoundException(x.Message, x);
-                       }
-                       catch (UnauthorizedAccessException x)
-                       {
-                               throw new FileNotFoundException(x.Message, x);
-                       }
-               }
-
-               internal AssemblyNameFlags RawFlags
-               {
-                       get { return flags; }
-                       set { flags = value; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/BadImageFormatException.cs b/mcs/class/IKVM.Reflection/BadImageFormatException.cs
deleted file mode 100644 (file)
index 330f983..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
-       [Serializable]
-       public sealed class BadImageFormatException : Exception
-       {
-               public BadImageFormatException()
-               {
-               }
-
-               public BadImageFormatException(string message)
-                       : base(message)
-               {
-               }
-
-               public BadImageFormatException(string message, Exception inner)
-                       : base(message, inner)
-               {
-               }
-
-               private BadImageFormatException(SerializationInfo info, StreamingContext context)
-                       : base(info, context)
-               {
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Binder.cs b/mcs/class/IKVM.Reflection/Binder.cs
deleted file mode 100644 (file)
index a079451..0000000
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
-  Copyright (C) 2010-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Globalization;
-
-namespace IKVM.Reflection
-{
-       public abstract class Binder
-       {
-               protected Binder()
-               {
-               }
-
-               public virtual MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public virtual FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public virtual object ChangeType(object value, Type type, CultureInfo culture)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public virtual void ReorderArgumentArray(ref object[] args, object state)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
-               public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
-       }
-
-       sealed class DefaultBinder : Binder
-       {
-               public override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
-               {
-                       int matchCount = 0;
-                       foreach (MethodBase method in match)
-                       {
-                               if (MatchParameterTypes(method.GetParameters(), types))
-                               {
-                                       match[matchCount++] = method;
-                               }
-                       }
-
-                       if (matchCount == 0)
-                       {
-                               return null;
-                       }
-
-                       if (matchCount == 1)
-                       {
-                               return match[0];
-                       }
-
-                       MethodBase bestMatch = match[0];
-                       bool ambiguous = false;
-                       for (int i = 1; i < matchCount; i++)
-                       {
-                               bestMatch = SelectBestMatch(bestMatch, match[i], types, ref ambiguous);
-                       }
-                       if (ambiguous)
-                       {
-                               throw new AmbiguousMatchException();
-                       }
-                       return bestMatch;
-               }
-
-               private static bool MatchParameterTypes(ParameterInfo[] parameters, Type[] types)
-               {
-                       if (parameters.Length != types.Length)
-                       {
-                               return false;
-                       }
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               Type sourceType = types[i];
-                               Type targetType = parameters[i].ParameterType;
-                               if (sourceType != targetType
-                                       && !targetType.IsAssignableFrom(sourceType)
-                                       && !IsAllowedPrimitiveConversion(sourceType, targetType))
-                               {
-                                       return false;
-                               }
-                       }
-                       return true;
-               }
-
-               private static MethodBase SelectBestMatch(MethodBase mb1, MethodBase mb2, Type[] types, ref bool ambiguous)
-               {
-                       switch (MatchSignatures(mb1.MethodSignature, mb2.MethodSignature, types))
-                       {
-                               case 1:
-                                       return mb1;
-                               case 2:
-                                       return mb2;
-                       }
-
-                       if (mb1.MethodSignature.MatchParameterTypes(mb2.MethodSignature))
-                       {
-                               int depth1 = GetInheritanceDepth(mb1.DeclaringType);
-                               int depth2 = GetInheritanceDepth(mb2.DeclaringType);
-                               if (depth1 > depth2)
-                               {
-                                       return mb1;
-                               }
-                               else if (depth1 < depth2)
-                               {
-                                       return mb2;
-                               }
-                       }
-
-                       ambiguous = true;
-                       return mb1;
-               }
-
-               private static int GetInheritanceDepth(Type type)
-               {
-                       int depth = 0;
-                       while (type != null)
-                       {
-                               depth++;
-                               type = type.BaseType;
-                       }
-                       return depth;
-               }
-
-               private static int MatchSignatures(MethodSignature sig1, MethodSignature sig2, Type[] types)
-               {
-                       for (int i = 0; i < sig1.GetParameterCount(); i++)
-                       {
-                               Type type1 = sig1.GetParameterType(i);
-                               Type type2 = sig2.GetParameterType(i);
-                               if (type1 != type2)
-                               {
-                                       return MatchTypes(type1, type2, types[i]);
-                               }
-                       }
-                       return 0;
-               }
-
-               private static int MatchSignatures(PropertySignature sig1, PropertySignature sig2, Type[] types)
-               {
-                       for (int i = 0; i < sig1.ParameterCount; i++)
-                       {
-                               Type type1 = sig1.GetParameter(i);
-                               Type type2 = sig2.GetParameter(i);
-                               if (type1 != type2)
-                               {
-                                       return MatchTypes(type1, type2, types[i]);
-                               }
-                       }
-                       return 0;
-               }
-
-               private static int MatchTypes(Type type1, Type type2, Type type)
-               {
-                       if (type1 == type)
-                       {
-                               return 1;
-                       }
-                       if (type2 == type)
-                       {
-                               return 2;
-                       }
-                       bool conv = type1.IsAssignableFrom(type2);
-                       return conv == type2.IsAssignableFrom(type1) ? 0 : conv ? 2 : 1;
-               }
-
-               private static bool IsAllowedPrimitiveConversion(Type source, Type target)
-               {
-                       // we need to check for primitives, because GetTypeCode will return the underlying type for enums
-                       if (!source.IsPrimitive || !target.IsPrimitive)
-                       {
-                               return false;
-                       }
-                       TypeCode sourceType = Type.GetTypeCode(source);
-                       TypeCode targetType = Type.GetTypeCode(target);
-                       switch (sourceType)
-                       {
-                               case TypeCode.Char:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.UInt16:
-                                               case TypeCode.UInt32:
-                                               case TypeCode.Int32:
-                                               case TypeCode.UInt64:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.Byte:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Char:
-                                               case TypeCode.UInt16:
-                                               case TypeCode.Int16:
-                                               case TypeCode.UInt32:
-                                               case TypeCode.Int32:
-                                               case TypeCode.UInt64:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.SByte:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Int16:
-                                               case TypeCode.Int32:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.UInt16:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.UInt32:
-                                               case TypeCode.Int32:
-                                               case TypeCode.UInt64:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.Int16:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Int32:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.UInt32:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.UInt64:
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.Int32:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Int64:
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.UInt64:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.Int64:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Single:
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               case TypeCode.Single:
-                                       switch (targetType)
-                                       {
-                                               case TypeCode.Double:
-                                                       return true;
-                                               default:
-                                                       return false;
-                                       }
-                               default:
-                                       return false;
-                       }
-               }
-
-               public override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers)
-               {
-                       int matchCount = 0;
-                       foreach (PropertyInfo property in match)
-                       {
-                               if (indexes == null || MatchParameterTypes(property.GetIndexParameters(), indexes))
-                               {
-                                       if (returnType != null)
-                                       {
-                                               if (property.PropertyType.IsPrimitive)
-                                               {
-                                                       if (!IsAllowedPrimitiveConversion(returnType, property.PropertyType))
-                                                       {
-                                                               continue;
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       if (!property.PropertyType.IsAssignableFrom(returnType))
-                                                       {
-                                                               continue;
-                                                       }
-                                               }
-                                       }
-                                       match[matchCount++] = property;
-                               }
-                       }
-
-                       if (matchCount == 0)
-                       {
-                               return null;
-                       }
-
-                       if (matchCount == 1)
-                       {
-                               return match[0];
-                       }
-
-                       PropertyInfo bestMatch = match[0];
-                       bool ambiguous = false;
-                       for (int i = 1; i < matchCount; i++)
-                       {
-                               int best = MatchTypes(bestMatch.PropertyType, match[i].PropertyType, returnType);
-                               if (best == 0 && indexes != null)
-                               {
-                                       best = MatchSignatures(bestMatch.PropertySignature, match[i].PropertySignature, indexes);
-                               }
-                               if (best == 0)
-                               {
-                                       int depth1 = GetInheritanceDepth(bestMatch.DeclaringType);
-                                       int depth2 = GetInheritanceDepth(match[i].DeclaringType);
-                                       if (bestMatch.Name == match[i].Name && depth1 != depth2)
-                                       {
-                                               if (depth1 > depth2)
-                                               {
-                                                       best = 1;
-                                               }
-                                               else
-                                               {
-                                                       best = 2;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               ambiguous = true;
-                                       }
-                               }
-                               if (best == 2)
-                               {
-                                       ambiguous = false;
-                                       bestMatch = match[i];
-                               }
-                       }
-                       if (ambiguous)
-                       {
-                               throw new AmbiguousMatchException();
-                       }
-                       return bestMatch;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/ConstructorInfo.cs b/mcs/class/IKVM.Reflection/ConstructorInfo.cs
deleted file mode 100644 (file)
index 11d18a7..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
-       public abstract class ConstructorInfo : MethodBase
-       {
-               // prevent external subclasses
-               internal ConstructorInfo()
-               {
-               }
-
-               public sealed override string ToString()
-               {
-                       return GetMethodInfo().ToString();
-               }
-
-               public static readonly string ConstructorName = ".ctor";
-               public static readonly string TypeConstructorName = ".cctor";
-
-               internal abstract MethodInfo GetMethodInfo();
-
-               internal override MethodBase BindTypeParameters(Type type)
-               {
-                       return new ConstructorInfoImpl((MethodInfo)GetMethodInfo().BindTypeParameters(type));
-               }
-
-               public sealed override MethodBase __GetMethodOnTypeDefinition()
-               {
-                       return new ConstructorInfoImpl((MethodInfo)GetMethodInfo().__GetMethodOnTypeDefinition());
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return MemberTypes.Constructor; }
-               }
-
-               public sealed override int __MethodRVA
-               {
-                       get { return GetMethodInfo().__MethodRVA; }
-               }
-
-               public sealed override bool ContainsGenericParameters
-               {
-                       get { return GetMethodInfo().ContainsGenericParameters; }
-               }
-
-               public ParameterInfo __ReturnParameter
-               {
-                       get { return new ParameterInfoWrapper(this, GetMethodInfo().ReturnParameter); }
-               }
-
-               public sealed override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameters = GetMethodInfo().GetParameters();
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
-                       }
-                       return parameters;
-               }
-
-               public sealed override CallingConventions CallingConvention
-               {
-                       get { return GetMethodInfo().CallingConvention; }
-               }
-
-               public sealed override MethodAttributes Attributes
-               {
-                       get { return GetMethodInfo().Attributes; }
-               }
-
-               public sealed override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return GetMethodInfo().GetMethodImplementationFlags();
-               }
-
-               public sealed override Type DeclaringType
-               {
-                       get { return GetMethodInfo().DeclaringType; }
-               }
-
-               public sealed override string Name
-               {
-                       get { return GetMethodInfo().Name; }
-               }
-
-               public sealed override int MetadataToken
-               {
-                       get { return GetMethodInfo().MetadataToken; }
-               }
-
-               public sealed override Module Module
-               {
-                       get { return GetMethodInfo().Module; }
-               }
-
-               public sealed override MethodBody GetMethodBody()
-               {
-                       return GetMethodInfo().GetMethodBody();
-               }
-
-               public sealed override bool __IsMissing
-               {
-                       get { return GetMethodInfo().__IsMissing; }
-               }
-
-               internal sealed override int ParameterCount
-               {
-                       get { return GetMethodInfo().ParameterCount; }
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       return new ConstructorInfoWithReflectedType(type, this);
-               }
-
-               internal sealed override int GetCurrentToken()
-               {
-                       return GetMethodInfo().GetCurrentToken();
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       return GetMethodInfo().GetPseudoCustomAttributes(attributeType);
-               }
-
-               internal sealed override bool IsBaked
-               {
-                       get { return GetMethodInfo().IsBaked; }
-               }
-
-               internal sealed override MethodSignature MethodSignature
-               {
-                       get { return GetMethodInfo().MethodSignature; }
-               }
-
-               internal sealed override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       return GetMethodInfo().ImportTo(module);
-               }
-       }
-
-       sealed class ConstructorInfoImpl : ConstructorInfo
-       {
-               private readonly MethodInfo method;
-
-               internal ConstructorInfoImpl(MethodInfo method)
-               {
-                       this.method = method;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       ConstructorInfoImpl other = obj as ConstructorInfoImpl;
-                       return other != null && other.method.Equals(method);
-               }
-
-               public override int GetHashCode()
-               {
-                       return method.GetHashCode();
-               }
-
-               internal override MethodInfo GetMethodInfo()
-               {
-                       return method;
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return method.GetMethodOnTypeDefinition();
-               }
-       }
-
-       sealed class ConstructorInfoWithReflectedType : ConstructorInfo
-       {
-               private readonly Type reflectedType;
-               private readonly ConstructorInfo ctor;
-
-               internal ConstructorInfoWithReflectedType(Type reflectedType, ConstructorInfo ctor)
-               {
-                       Debug.Assert(reflectedType != ctor.DeclaringType);
-                       this.reflectedType = reflectedType;
-                       this.ctor = ctor;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       ConstructorInfoWithReflectedType other = obj as ConstructorInfoWithReflectedType;
-                       return other != null
-                               && other.reflectedType == reflectedType
-                               && other.ctor == ctor;
-               }
-
-               public override int GetHashCode()
-               {
-                       return reflectedType.GetHashCode() ^ ctor.GetHashCode();
-               }
-
-               public override Type ReflectedType
-               {
-                       get { return reflectedType; }
-               }
-
-               internal override MethodInfo GetMethodInfo()
-               {
-                       return ctor.GetMethodInfo();
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return ctor.GetMethodOnTypeDefinition();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/CustomAttributeData.cs b/mcs/class/IKVM.Reflection/CustomAttributeData.cs
deleted file mode 100644 (file)
index 72026fb..0000000
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
-       public sealed class CustomAttributeData
-       {
-               internal static readonly IList<CustomAttributeData> EmptyList = new List<CustomAttributeData>(0).AsReadOnly();
-
-               /*
-                * There are several states a CustomAttributeData object can be in:
-                * 
-                * 1) Unresolved Custom Attribute
-                *    - customAttributeIndex >= 0
-                *    - declSecurityIndex == -1
-                *    - declSecurityBlob == null
-                *    - lazyConstructor = null
-                *    - lazyConstructorArguments = null
-                *    - lazyNamedArguments = null
-                * 
-                * 2) Resolved Custom Attribute
-                *    - customAttributeIndex >= 0
-                *    - declSecurityIndex == -1
-                *    - declSecurityBlob == null
-                *    - lazyConstructor != null
-                *    - lazyConstructorArguments != null
-                *    - lazyNamedArguments != null
-                *    
-                * 3) Pre-resolved Custom Attribute
-                *    - customAttributeIndex = -1
-                *    - declSecurityIndex == -1
-                *    - declSecurityBlob == null
-                *    - lazyConstructor != null
-                *    - lazyConstructorArguments != null
-                *    - lazyNamedArguments != null
-                *    
-                * 4) Pseudo Custom Attribute, .NET 1.x declarative security or result of CustomAttributeBuilder.ToData()
-                *    - customAttributeIndex = -1
-                *    - declSecurityIndex == -1
-                *    - declSecurityBlob == null
-                *    - lazyConstructor != null
-                *    - lazyConstructorArguments != null
-                *    - lazyNamedArguments != null
-                *    
-                * 5) Unresolved declarative security
-                *    - customAttributeIndex = -1
-                *    - declSecurityIndex >= 0
-                *    - declSecurityBlob != null
-                *    - lazyConstructor != null
-                *    - lazyConstructorArguments != null
-                *    - lazyNamedArguments == null
-                * 
-                * 6) Resolved declarative security
-                *    - customAttributeIndex = -1
-                *    - declSecurityIndex >= 0
-                *    - declSecurityBlob == null
-                *    - lazyConstructor != null
-                *    - lazyConstructorArguments != null
-                *    - lazyNamedArguments != null
-                * 
-                */
-               private readonly Module module;
-               private readonly int customAttributeIndex;
-               private readonly int declSecurityIndex;
-               private readonly byte[] declSecurityBlob;
-               private ConstructorInfo lazyConstructor;
-               private IList<CustomAttributeTypedArgument> lazyConstructorArguments;
-               private IList<CustomAttributeNamedArgument> lazyNamedArguments;
-
-               // 1) Unresolved Custom Attribute
-               internal CustomAttributeData(Module module, int index)
-               {
-                       this.module = module;
-                       this.customAttributeIndex = index;
-                       this.declSecurityIndex = -1;
-               }
-
-               // 4) Pseudo Custom Attribute, .NET 1.x declarative security
-               internal CustomAttributeData(Module module, ConstructorInfo constructor, object[] args, List<CustomAttributeNamedArgument> namedArguments)
-                       : this(module, constructor, WrapConstructorArgs(args, constructor.MethodSignature), namedArguments)
-               {
-               }
-
-               private static List<CustomAttributeTypedArgument> WrapConstructorArgs(object[] args, MethodSignature sig)
-               {
-                       List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
-                       for (int i = 0; i < args.Length; i++)
-                       {
-                               list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i]));
-                       }
-                       return list;
-               }
-
-               // 4) Pseudo Custom Attribute, .NET 1.x declarative security or result of CustomAttributeBuilder.ToData()
-               internal CustomAttributeData(Module module, ConstructorInfo constructor, List<CustomAttributeTypedArgument> constructorArgs, List<CustomAttributeNamedArgument> namedArguments)
-               {
-                       this.module = module;
-                       this.customAttributeIndex = -1;
-                       this.declSecurityIndex = -1;
-                       this.lazyConstructor = constructor;
-                       lazyConstructorArguments = constructorArgs.AsReadOnly();
-                       if (namedArguments == null)
-                       {
-                               this.lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
-                       }
-                       else
-                       {
-                               this.lazyNamedArguments = namedArguments.AsReadOnly();
-                       }
-               }
-
-               // 3) Pre-resolved Custom Attribute
-               internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, ByteReader br)
-               {
-                       this.module = asm.ManifestModule;
-                       this.customAttributeIndex = -1;
-                       this.declSecurityIndex = -1;
-                       this.lazyConstructor = constructor;
-                       if (br.Length == 0)
-                       {
-                               // it's legal to have an empty blob
-                               lazyConstructorArguments = Empty<CustomAttributeTypedArgument>.Array;
-                               lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
-                       }
-                       else
-                       {
-                               if (br.ReadUInt16() != 1)
-                               {
-                                       throw new BadImageFormatException();
-                               }
-                               lazyConstructorArguments = ReadConstructorArguments(asm, br, constructor);
-                               lazyNamedArguments = ReadNamedArguments(asm, br, br.ReadUInt16(), constructor.DeclaringType);
-                       }
-               }
-
-               public override string ToString()
-               {
-                       StringBuilder sb = new StringBuilder();
-                       sb.Append('[');
-                       sb.Append(Constructor.DeclaringType.FullName);
-                       sb.Append('(');
-                       string sep = "";
-                       ParameterInfo[] parameters = Constructor.GetParameters();
-                       IList<CustomAttributeTypedArgument> args = ConstructorArguments;
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               sb.Append(sep);
-                               sep = ", ";
-                               AppendValue(sb, parameters[i].ParameterType, args[i]);
-                       }
-                       foreach (CustomAttributeNamedArgument named in NamedArguments)
-                       {
-                               sb.Append(sep);
-                               sep = ", ";
-                               sb.Append(named.MemberInfo.Name);
-                               sb.Append(" = ");
-                               FieldInfo fi = named.MemberInfo as FieldInfo;
-                               Type type = fi != null ? fi.FieldType : ((PropertyInfo)named.MemberInfo).PropertyType;
-                               AppendValue(sb, type, named.TypedValue);
-                       }
-                       sb.Append(')');
-                       sb.Append(']');
-                       return sb.ToString();
-               }
-
-               private static void AppendValue(StringBuilder sb, Type type, CustomAttributeTypedArgument arg)
-               {
-                       if (arg.ArgumentType == arg.ArgumentType.Module.universe.System_String)
-                       {
-                               sb.Append('"').Append(arg.Value).Append('"');
-                       }
-                       else if (arg.ArgumentType.IsArray)
-                       {
-                               Type elementType = arg.ArgumentType.GetElementType();
-                               string elementTypeName;
-                               if (elementType.IsPrimitive
-                                       || elementType == type.Module.universe.System_Object
-                                       || elementType == type.Module.universe.System_String
-                                       || elementType == type.Module.universe.System_Type)
-                               {
-                                       elementTypeName = elementType.Name;
-                               }
-                               else
-                               {
-                                       elementTypeName = elementType.FullName;
-                               }
-                               sb.Append("new ").Append(elementTypeName).Append("[").Append(((Array)arg.Value).Length).Append("] { ");
-                               string sep = "";
-                               foreach (CustomAttributeTypedArgument elem in (CustomAttributeTypedArgument[])arg.Value)
-                               {
-                                       sb.Append(sep);
-                                       sep = ", ";
-                                       AppendValue(sb, elementType, elem);
-                               }
-                               sb.Append(" }");
-                       }
-                       else
-                       {
-                               if (arg.ArgumentType != type || (type.IsEnum && !arg.Value.Equals(0)))
-                               {
-                                       sb.Append('(');
-                                       sb.Append(arg.ArgumentType.FullName);
-                                       sb.Append(')');
-                               }
-                               sb.Append(arg.Value);
-                       }
-               }
-
-               internal static void ReadDeclarativeSecurity(Module module, int index, List<CustomAttributeData> list)
-               {
-                       Universe u = module.universe;
-                       Assembly asm = module.Assembly;
-                       int action = module.DeclSecurity.records[index].Action;
-                       ByteReader br = module.GetBlob(module.DeclSecurity.records[index].PermissionSet);
-                       if (br.PeekByte() == '.')
-                       {
-                               br.ReadByte();
-                               int count = br.ReadCompressedInt();
-                               for (int j = 0; j < count; j++)
-                               {
-                                       Type type = ReadType(asm, br);
-                                       ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
-                                       // LAMESPEC there is an additional length here (probably of the named argument list)
-                                       byte[] blob = br.ReadBytes(br.ReadCompressedInt());
-                                       list.Add(new CustomAttributeData(asm, constructor, action, blob, index));
-                               }
-                       }
-                       else
-                       {
-                               // .NET 1.x format (xml)
-                               char[] buf = new char[br.Length / 2];
-                               for (int i = 0; i < buf.Length; i++)
-                               {
-                                       buf[i] = br.ReadChar();
-                               }
-                               string xml = new String(buf);
-                               ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
-                               List<CustomAttributeNamedArgument> args = new List<CustomAttributeNamedArgument>();
-                               args.Add(new CustomAttributeNamedArgument(GetProperty(u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
-                                       new CustomAttributeTypedArgument(u.System_String, xml)));
-                               list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
-                       }
-               }
-
-               // 5) Unresolved declarative security
-               internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, int securityAction, byte[] blob, int index)
-               {
-                       this.module = asm.ManifestModule;
-                       this.customAttributeIndex = -1;
-                       this.declSecurityIndex = index;
-                       Universe u = constructor.Module.universe;
-                       this.lazyConstructor = constructor;
-                       List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>();
-                       list.Add(new CustomAttributeTypedArgument(u.System_Security_Permissions_SecurityAction, securityAction));
-                       this.lazyConstructorArguments =  list.AsReadOnly();
-                       this.declSecurityBlob = blob;
-               }
-
-               private static Type ReadFieldOrPropType(Assembly asm, ByteReader br)
-               {
-                       Universe u = asm.universe;
-                       switch (br.ReadByte())
-                       {
-                               case Signature.ELEMENT_TYPE_BOOLEAN:
-                                       return u.System_Boolean;
-                               case Signature.ELEMENT_TYPE_CHAR:
-                                       return u.System_Char;
-                               case Signature.ELEMENT_TYPE_I1:
-                                       return u.System_SByte;
-                               case Signature.ELEMENT_TYPE_U1:
-                                       return u.System_Byte;
-                               case Signature.ELEMENT_TYPE_I2:
-                                       return u.System_Int16;
-                               case Signature.ELEMENT_TYPE_U2:
-                                       return u.System_UInt16;
-                               case Signature.ELEMENT_TYPE_I4:
-                                       return u.System_Int32;
-                               case Signature.ELEMENT_TYPE_U4:
-                                       return u.System_UInt32;
-                               case Signature.ELEMENT_TYPE_I8:
-                                       return u.System_Int64;
-                               case Signature.ELEMENT_TYPE_U8:
-                                       return u.System_UInt64;
-                               case Signature.ELEMENT_TYPE_R4:
-                                       return u.System_Single;
-                               case Signature.ELEMENT_TYPE_R8:
-                                       return u.System_Double;
-                               case Signature.ELEMENT_TYPE_STRING:
-                                       return u.System_String;
-                               case Signature.ELEMENT_TYPE_SZARRAY:
-                                       return ReadFieldOrPropType(asm, br).MakeArrayType();
-                               case 0x55:
-                                       return ReadType(asm, br);
-                               case 0x50:
-                                       return u.System_Type;
-                               case 0x51:
-                                       return u.System_Object;
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               private static CustomAttributeTypedArgument ReadFixedArg(Assembly asm, ByteReader br, Type type)
-               {
-                       Universe u = asm.universe;
-                       if (type == u.System_String)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadString());
-                       }
-                       else if (type == u.System_Boolean)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadByte() != 0);
-                       }
-                       else if (type == u.System_Char)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadChar());
-                       }
-                       else if (type == u.System_Single)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadSingle());
-                       }
-                       else if (type == u.System_Double)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadDouble());
-                       }
-                       else if (type == u.System_SByte)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadSByte());
-                       }
-                       else if (type == u.System_Int16)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadInt16());
-                       }
-                       else if (type == u.System_Int32)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadInt32());
-                       }
-                       else if (type == u.System_Int64)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadInt64());
-                       }
-                       else if (type == u.System_Byte)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadByte());
-                       }
-                       else if (type == u.System_UInt16)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadUInt16());
-                       }
-                       else if (type == u.System_UInt32)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadUInt32());
-                       }
-                       else if (type == u.System_UInt64)
-                       {
-                               return new CustomAttributeTypedArgument(type, br.ReadUInt64());
-                       }
-                       else if (type == u.System_Type)
-                       {
-                               return new CustomAttributeTypedArgument(type, ReadType(asm, br));
-                       }
-                       else if (type == u.System_Object)
-                       {
-                               return ReadFixedArg(asm, br, ReadFieldOrPropType(asm, br));
-                       }
-                       else if (type.IsArray)
-                       {
-                               int length = br.ReadInt32();
-                               if (length == -1)
-                               {
-                                       return new CustomAttributeTypedArgument(type, null);
-                               }
-                               Type elementType = type.GetElementType();
-                               CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[length];
-                               for (int i = 0; i < length; i++)
-                               {
-                                       array[i] = ReadFixedArg(asm, br, elementType);
-                               }
-                               return new CustomAttributeTypedArgument(type, array);
-                       }
-                       else if (type.IsEnum)
-                       {
-                               return new CustomAttributeTypedArgument(type, ReadFixedArg(asm, br, type.GetEnumUnderlyingTypeImpl()).Value);
-                       }
-                       else
-                       {
-                               throw new InvalidOperationException();
-                       }
-               }
-
-               private static Type ReadType(Assembly asm, ByteReader br)
-               {
-                       string typeName = br.ReadString();
-                       if (typeName == null)
-                       {
-                               return null;
-                       }
-                       if (typeName.Length > 0 && typeName[typeName.Length - 1] == 0)
-                       {
-                               // there are broken compilers that emit an extra NUL character after the type name
-                               typeName = typeName.Substring(0, typeName.Length - 1);
-                       }
-                       return TypeNameParser.Parse(typeName, true).GetType(asm.universe, asm, true, typeName, true, false);
-               }
-
-               private static IList<CustomAttributeTypedArgument> ReadConstructorArguments(Assembly asm, ByteReader br, ConstructorInfo constructor)
-               {
-                       MethodSignature sig = constructor.MethodSignature;
-                       int count = sig.GetParameterCount();
-                       List<CustomAttributeTypedArgument> list = new List<CustomAttributeTypedArgument>(count);
-                       for (int i = 0; i < count; i++)
-                       {
-                               list.Add(ReadFixedArg(asm, br, sig.GetParameterType(i)));
-                       }
-                       return list.AsReadOnly();
-               }
-
-               private static IList<CustomAttributeNamedArgument> ReadNamedArguments(Assembly asm, ByteReader br, int named, Type type)
-               {
-                       List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>(named);
-                       for (int i = 0; i < named; i++)
-                       {
-                               byte fieldOrProperty = br.ReadByte();
-                               Type fieldOrPropertyType = ReadFieldOrPropType(asm, br);
-                               string name = br.ReadString();
-                               CustomAttributeTypedArgument value = ReadFixedArg(asm, br, fieldOrPropertyType);
-                               MemberInfo member;
-                               switch (fieldOrProperty)
-                               {
-                                       case 0x53:
-                                               member = GetField(type, name, fieldOrPropertyType);
-                                               break;
-                                       case 0x54:
-                                               member = GetProperty(type, name, fieldOrPropertyType);
-                                               break;
-                                       default:
-                                               throw new BadImageFormatException();
-                               }
-                               list.Add(new CustomAttributeNamedArgument(member, value));
-                       }
-                       return list.AsReadOnly();
-               }
-
-               private static FieldInfo GetField(Type type, string name, Type fieldType)
-               {
-                       Type org = type;
-                       for (; type != null && !type.__IsMissing; type = type.BaseType)
-                       {
-                               foreach (FieldInfo field in type.__GetDeclaredFields())
-                               {
-                                       if (field.IsPublic && !field.IsStatic && field.Name == name)
-                                       {
-                                               return field;
-                                       }
-                               }
-                       }
-                       // if the field is missing, we stick the missing field on the first missing base type
-                       if (type == null)
-                       {
-                               type = org;
-                       }
-                       FieldSignature sig = FieldSignature.Create(fieldType, new CustomModifiers());
-                       return type.FindField(name, sig)
-                               ?? type.Module.universe.GetMissingFieldOrThrow(type, name, sig);
-               }
-
-               private static PropertyInfo GetProperty(Type type, string name, Type propertyType)
-               {
-                       Type org = type;
-                       for (; type != null && !type.__IsMissing; type = type.BaseType)
-                       {
-                               foreach (PropertyInfo property in type.__GetDeclaredProperties())
-                               {
-                                       if (property.IsPublic && !property.IsStatic && property.Name == name)
-                                       {
-                                               return property;
-                                       }
-                               }
-                       }
-                       // if the property is missing, we stick the missing property on the first missing base type
-                       if (type == null)
-                       {
-                               type = org;
-                       }
-                       return type.Module.universe.GetMissingPropertyOrThrow(type, name, PropertySignature.Create(CallingConventions.Standard | CallingConventions.HasThis, propertyType, null, new PackedCustomModifiers()));
-               }
-
-               [Obsolete("Use AttributeType property instead.")]
-               internal bool __TryReadTypeName(out string ns, out string name)
-               {
-                       if (Constructor.DeclaringType.IsNested)
-                       {
-                               ns = null;
-                               name = null;
-                               return false;
-                       }
-                       ns = Constructor.DeclaringType.__Namespace;
-                       name = Constructor.DeclaringType.__Name;
-                       return true;
-               }
-
-               public byte[] __GetBlob()
-               {
-                       if (declSecurityBlob != null)
-                       {
-                               return (byte[])declSecurityBlob.Clone();
-                       }
-                       else if (customAttributeIndex == -1)
-                       {
-                               return __ToBuilder().GetBlob(module.Assembly);
-                       }
-                       else
-                       {
-                               return ((ModuleReader)module).GetBlobCopy(module.CustomAttribute.records[customAttributeIndex].Value);
-                       }
-               }
-
-               public int __Parent
-               {
-                       get
-                       {
-                               return customAttributeIndex >= 0
-                                       ? module.CustomAttribute.records[customAttributeIndex].Parent
-                                       : declSecurityIndex >= 0
-                                               ? module.DeclSecurity.records[declSecurityIndex].Parent
-                                               : 0;
-                       }
-               }
-
-               // .NET 4.5 API
-               public Type AttributeType
-               {
-                       get { return Constructor.DeclaringType; }
-               }
-
-               public ConstructorInfo Constructor
-               {
-                       get
-                       {
-                               if (lazyConstructor == null)
-                               {
-                                       lazyConstructor = (ConstructorInfo)module.ResolveMethod(module.CustomAttribute.records[customAttributeIndex].Type);
-                               }
-                               return lazyConstructor;
-                       }
-               }
-
-               public IList<CustomAttributeTypedArgument> ConstructorArguments
-               {
-                       get
-                       {
-                               if (lazyConstructorArguments == null)
-                               {
-                                       LazyParseArguments();
-                               }
-                               return lazyConstructorArguments;
-                       }
-               }
-
-               public IList<CustomAttributeNamedArgument> NamedArguments
-               {
-                       get
-                       {
-                               if (lazyNamedArguments == null)
-                               {
-                                       if (customAttributeIndex >= 0)
-                                       {
-                                               // 1) Unresolved Custom Attribute
-                                               LazyParseArguments();
-                                       }
-                                       else
-                                       {
-                                               // 5) Unresolved declarative security
-                                               ByteReader br = new ByteReader(declSecurityBlob, 0, declSecurityBlob.Length);
-                                               // LAMESPEC the count of named arguments is a compressed integer (instead of UInt16 as NumNamed in custom attributes)
-                                               lazyNamedArguments = ReadNamedArguments(module.Assembly, br, br.ReadCompressedInt(), Constructor.DeclaringType);
-                                       }
-                               }
-                               return lazyNamedArguments;
-                       }
-               }
-
-               private void LazyParseArguments()
-               {
-                       ByteReader br = module.GetBlob(module.CustomAttribute.records[customAttributeIndex].Value);
-                       if (br.Length == 0)
-                       {
-                               // it's legal to have an empty blob
-                               lazyConstructorArguments = Empty<CustomAttributeTypedArgument>.Array;
-                               lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
-                       }
-                       else
-                       {
-                               if (br.ReadUInt16() != 1)
-                               {
-                                       throw new BadImageFormatException();
-                               }
-                               lazyConstructorArguments = ReadConstructorArguments(module.Assembly, br, Constructor);
-                               lazyNamedArguments = ReadNamedArguments(module.Assembly, br, br.ReadUInt16(), Constructor.DeclaringType);
-                       }
-               }
-
-               public CustomAttributeBuilder __ToBuilder()
-               {
-                       ParameterInfo[] parameters = Constructor.GetParameters();
-                       object[] args = new object[ConstructorArguments.Count];
-                       for (int i = 0; i < args.Length; i++)
-                       {
-                               args[i] = RewrapArray(parameters[i].ParameterType, ConstructorArguments[i]);
-                       }
-                       List<PropertyInfo> namedProperties = new List<PropertyInfo>();
-                       List<object> propertyValues = new List<object>();
-                       List<FieldInfo> namedFields = new List<FieldInfo>();
-                       List<object> fieldValues = new List<object>();
-                       foreach (CustomAttributeNamedArgument named in NamedArguments)
-                       {
-                               PropertyInfo pi = named.MemberInfo as PropertyInfo;
-                               if (pi != null)
-                               {
-                                       namedProperties.Add(pi);
-                                       propertyValues.Add(RewrapArray(pi.PropertyType, named.TypedValue));
-                               }
-                               else
-                               {
-                                       FieldInfo fi = (FieldInfo)named.MemberInfo;
-                                       namedFields.Add(fi);
-                                       fieldValues.Add(RewrapArray(fi.FieldType, named.TypedValue));
-                               }
-                       }
-                       return new CustomAttributeBuilder(Constructor, args, namedProperties.ToArray(), propertyValues.ToArray(), namedFields.ToArray(), fieldValues.ToArray());
-               }
-
-               private static object RewrapArray(Type type, CustomAttributeTypedArgument arg)
-               {
-                       IList<CustomAttributeTypedArgument> list = arg.Value as IList<CustomAttributeTypedArgument>;
-                       if (list != null)
-                       {
-                               Type elementType = arg.ArgumentType.GetElementType();
-                               object[] arr = new object[list.Count];
-                               for (int i = 0; i < arr.Length; i++)
-                               {
-                                       arr[i] = RewrapArray(elementType, list[i]);
-                               }
-                               if (type == type.Module.universe.System_Object)
-                               {
-                                       return CustomAttributeBuilder.__MakeTypedArgument(arg.ArgumentType, arr);
-                               }
-                               return arr;
-                       }
-                       else
-                       {
-                               return arg.Value;
-                       }
-               }
-
-               public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo member)
-               {
-                       return __GetCustomAttributes(member, null, false);
-               }
-
-               public static IList<CustomAttributeData> GetCustomAttributes(Assembly assembly)
-               {
-                       return assembly.GetCustomAttributesData(null);
-               }
-
-               public static IList<CustomAttributeData> GetCustomAttributes(Module module)
-               {
-                       return __GetCustomAttributes(module, null, false);
-               }
-
-               public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo parameter)
-               {
-                       return __GetCustomAttributes(parameter, null, false);
-               }
-
-               public static IList<CustomAttributeData> __GetCustomAttributes(Assembly assembly, Type attributeType, bool inherit)
-               {
-                       return assembly.GetCustomAttributesData(attributeType);
-               }
-
-               public static IList<CustomAttributeData> __GetCustomAttributes(Module module, Type attributeType, bool inherit)
-               {
-                       if (module.__IsMissing)
-                       {
-                               throw new MissingModuleException((MissingModule)module);
-                       }
-                       return GetCustomAttributesImpl(null, module, 0x00000001, attributeType) ?? EmptyList;
-               }
-
-               public static IList<CustomAttributeData> __GetCustomAttributes(ParameterInfo parameter, Type attributeType, bool inherit)
-               {
-                       Module module = parameter.Module;
-                       List<CustomAttributeData> list = null;
-                       if (module.universe.ReturnPseudoCustomAttributes)
-                       {
-                               if (attributeType == null || attributeType.IsAssignableFrom(parameter.Module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
-                               {
-                                       FieldMarshal spec;
-                                       if (parameter.__TryGetFieldMarshal(out spec))
-                                       {
-                                               if (list == null)
-                                               {
-                                                       list = new List<CustomAttributeData>();
-                                               }
-                                               list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(parameter.Module, spec));
-                                       }
-                               }
-                       }
-                       ModuleBuilder mb = module as ModuleBuilder;
-                       int token = parameter.MetadataToken;
-                       if (mb != null && mb.IsSaved && mb.IsPseudoToken(token))
-                       {
-                               token = mb.ResolvePseudoToken(token);
-                       }
-                       return GetCustomAttributesImpl(list, module, token, attributeType) ?? EmptyList;
-               }
-
-               public static IList<CustomAttributeData> __GetCustomAttributes(MemberInfo member, Type attributeType, bool inherit)
-               {
-                       if (!member.IsBaked)
-                       {
-                               // like .NET we we don't return custom attributes for unbaked members
-                               throw new NotImplementedException();
-                       }
-                       if (!inherit || !IsInheritableAttribute(attributeType))
-                       {
-                               return GetCustomAttributesImpl(null, member, attributeType) ?? EmptyList;
-                       }
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       for (; ; )
-                       {
-                               GetCustomAttributesImpl(list, member, attributeType);
-                               Type type = member as Type;
-                               if (type != null)
-                               {
-                                       type = type.BaseType;
-                                       if (type == null)
-                                       {
-                                               return list;
-                                       }
-                                       member = type;
-                                       continue;
-                               }
-                               MethodInfo method = member as MethodInfo;
-                               if (method != null)
-                               {
-                                       MemberInfo prev = member;
-                                       method = method.GetBaseDefinition();
-                                       if (method == null || method == prev)
-                                       {
-                                               return list;
-                                       }
-                                       member = method;
-                                       continue;
-                               }
-                               return list;
-                       }
-               }
-
-               private static List<CustomAttributeData> GetCustomAttributesImpl(List<CustomAttributeData> list, MemberInfo member, Type attributeType)
-               {
-                       if (member.Module.universe.ReturnPseudoCustomAttributes)
-                       {
-                               List<CustomAttributeData> pseudo = member.GetPseudoCustomAttributes(attributeType);
-                               if (list == null)
-                               {
-                                       list = pseudo;
-                               }
-                               else if (pseudo != null)
-                               {
-                                       list.AddRange(pseudo);
-                               }
-                       }
-                       return GetCustomAttributesImpl(list, member.Module, member.GetCurrentToken(), attributeType);
-               }
-
-               internal static List<CustomAttributeData> GetCustomAttributesImpl(List<CustomAttributeData> list, Module module, int token, Type attributeType)
-               {
-                       foreach (int i in module.CustomAttribute.Filter(token))
-                       {
-                               if (attributeType == null)
-                               {
-                                       if (list == null)
-                                       {
-                                               list = new List<CustomAttributeData>();
-                                       }
-                                       list.Add(new CustomAttributeData(module, i));
-                               }
-                               else
-                               {
-                                       if (attributeType.IsAssignableFrom(module.ResolveMethod(module.CustomAttribute.records[i].Type).DeclaringType))
-                                       {
-                                               if (list == null)
-                                               {
-                                                       list = new List<CustomAttributeData>();
-                                               }
-                                               list.Add(new CustomAttributeData(module, i));
-                                       }
-                               }
-                       }
-                       return list;
-               }
-
-               public static IList<CustomAttributeData> __GetCustomAttributes(Type type, Type interfaceType, Type attributeType, bool inherit)
-               {
-                       Module module = type.Module;
-                       foreach (int i in module.InterfaceImpl.Filter(type.MetadataToken))
-                       {
-                               if (module.ResolveType(module.InterfaceImpl.records[i].Interface, type) == interfaceType)
-                               {
-                                       return GetCustomAttributesImpl(null, module, (InterfaceImplTable.Index << 24) | (i + 1), attributeType) ?? EmptyList;
-                               }
-                       }
-                       return EmptyList;
-               }
-
-               public static IList<CustomAttributeData> __GetDeclarativeSecurity(Assembly assembly)
-               {
-                       if (assembly.__IsMissing)
-                       {
-                               throw new MissingAssemblyException((MissingAssembly)assembly);
-                       }
-                       return assembly.ManifestModule.GetDeclarativeSecurity(0x20000001);
-               }
-
-               public static IList<CustomAttributeData> __GetDeclarativeSecurity(Type type)
-               {
-                       if ((type.Attributes & TypeAttributes.HasSecurity) != 0)
-                       {
-                               return type.Module.GetDeclarativeSecurity(type.MetadataToken);
-                       }
-                       else
-                       {
-                               return EmptyList;
-                       }
-               }
-
-               public static IList<CustomAttributeData> __GetDeclarativeSecurity(MethodBase method)
-               {
-                       if ((method.Attributes & MethodAttributes.HasSecurity) != 0)
-                       {
-                               return method.Module.GetDeclarativeSecurity(method.MetadataToken);
-                       }
-                       else
-                       {
-                               return EmptyList;
-                       }
-               }
-
-               private static bool IsInheritableAttribute(Type attribute)
-               {
-                       Type attributeUsageAttribute = attribute.Module.universe.System_AttributeUsageAttribute;
-                       IList<CustomAttributeData> attr = __GetCustomAttributes(attribute, attributeUsageAttribute, false);
-                       if (attr.Count != 0)
-                       {
-                               foreach (CustomAttributeNamedArgument named in attr[0].NamedArguments)
-                               {
-                                       if (named.MemberInfo.Name == "Inherited")
-                                       {
-                                               return (bool)named.TypedValue.Value;
-                                       }
-                               }
-                       }
-                       return true;
-               }
-
-               internal static CustomAttributeData CreateDllImportPseudoCustomAttribute(Module module, ImplMapFlags flags, string entryPoint, string dllName, MethodImplAttributes attr)
-               {
-                       Type type = module.universe.System_Runtime_InteropServices_DllImportAttribute;
-                       ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_String);
-                       List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>();
-                       System.Runtime.InteropServices.CharSet charSet;
-                       switch (flags & ImplMapFlags.CharSetMask)
-                       {
-                               case ImplMapFlags.CharSetAnsi:
-                                       charSet = System.Runtime.InteropServices.CharSet.Ansi;
-                                       break;
-                               case ImplMapFlags.CharSetUnicode:
-                                       charSet = System.Runtime.InteropServices.CharSet.Unicode;
-                                       break;
-                               case ImplMapFlags.CharSetAuto:
-                                       charSet = System.Runtime.InteropServices.CharSet.Auto;
-                                       break;
-                               case ImplMapFlags.CharSetNotSpec:
-                               default:
-                                       charSet = System.Runtime.InteropServices.CharSet.None;
-                                       break;
-                       }
-                       System.Runtime.InteropServices.CallingConvention callingConvention;
-                       switch (flags & ImplMapFlags.CallConvMask)
-                       {
-                               case ImplMapFlags.CallConvCdecl:
-                                       callingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
-                                       break;
-                               case ImplMapFlags.CallConvFastcall:
-                                       callingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
-                                       break;
-                               case ImplMapFlags.CallConvStdcall:
-                                       callingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
-                                       break;
-                               case ImplMapFlags.CallConvThiscall:
-                                       callingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
-                                       break;
-                               case ImplMapFlags.CallConvWinapi:
-                                       callingConvention = System.Runtime.InteropServices.CallingConvention.Winapi;
-                                       break;
-                               default:
-                                       callingConvention = 0;
-                                       break;
-                       }
-                       AddNamedArgument(list, type, "EntryPoint", entryPoint);
-                       AddNamedArgument(list, type, "CharSet", module.universe.System_Runtime_InteropServices_CharSet, (int)charSet);
-                       AddNamedArgument(list, type, "ExactSpelling", (int)flags, (int)ImplMapFlags.NoMangle);
-                       AddNamedArgument(list, type, "SetLastError", (int)flags, (int)ImplMapFlags.SupportsLastError);
-                       AddNamedArgument(list, type, "PreserveSig", (int)attr, (int)MethodImplAttributes.PreserveSig);
-                       AddNamedArgument(list, type, "CallingConvention", module.universe.System_Runtime_InteropServices_CallingConvention, (int)callingConvention);
-                       AddNamedArgument(list, type, "BestFitMapping", (int)flags, (int)ImplMapFlags.BestFitOn);
-                       AddNamedArgument(list, type, "ThrowOnUnmappableChar", (int)flags, (int)ImplMapFlags.CharMapErrorOn);
-                       return new CustomAttributeData(module, constructor, new object[] { dllName }, list);
-               }
-
-               internal static CustomAttributeData CreateMarshalAsPseudoCustomAttribute(Module module, FieldMarshal fm)
-               {
-                       Type typeofMarshalAs = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
-                       Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
-                       Type typeofVarEnum = module.universe.System_Runtime_InteropServices_VarEnum;
-                       Type typeofType = module.universe.System_Type;
-                       List<CustomAttributeNamedArgument> named = new List<CustomAttributeNamedArgument>();
-                       AddNamedArgument(named, typeofMarshalAs, "ArraySubType", typeofUnmanagedType, (int)(fm.ArraySubType ?? 0));
-                       AddNamedArgument(named, typeofMarshalAs, "SizeParamIndex", module.universe.System_Int16, fm.SizeParamIndex ?? 0);
-                       AddNamedArgument(named, typeofMarshalAs, "SizeConst", module.universe.System_Int32, fm.SizeConst ?? 0);
-                       AddNamedArgument(named, typeofMarshalAs, "IidParameterIndex", module.universe.System_Int32, fm.IidParameterIndex ?? 0);
-                       AddNamedArgument(named, typeofMarshalAs, "SafeArraySubType", typeofVarEnum, (int)(fm.SafeArraySubType ?? 0));
-                       if (fm.SafeArrayUserDefinedSubType != null)
-                       {
-                               AddNamedArgument(named, typeofMarshalAs, "SafeArrayUserDefinedSubType", typeofType, fm.SafeArrayUserDefinedSubType);
-                       }
-                       if (fm.MarshalType != null)
-                       {
-                               AddNamedArgument(named, typeofMarshalAs, "MarshalType", module.universe.System_String, fm.MarshalType);
-                       }
-                       if (fm.MarshalTypeRef != null)
-                       {
-                               AddNamedArgument(named, typeofMarshalAs, "MarshalTypeRef", module.universe.System_Type, fm.MarshalTypeRef);
-                       }
-                       if (fm.MarshalCookie != null)
-                       {
-                               AddNamedArgument(named, typeofMarshalAs, "MarshalCookie", module.universe.System_String, fm.MarshalCookie);
-                       }
-                       ConstructorInfo constructor = typeofMarshalAs.GetPseudoCustomAttributeConstructor(typeofUnmanagedType);
-                       return new CustomAttributeData(module, constructor, new object[] { (int)fm.UnmanagedType }, named);
-               }
-
-               private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type type, string fieldName, string value)
-               {
-                       AddNamedArgument(list, type, fieldName, type.Module.universe.System_String, value);
-               }
-
-               private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type type, string fieldName, int flags, int flagMask)
-               {
-                       AddNamedArgument(list, type, fieldName, type.Module.universe.System_Boolean, (flags & flagMask) != 0);
-               }
-
-               private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type attributeType, string fieldName, Type valueType, object value)
-               {
-                       // some fields are not available on the .NET Compact Framework version of DllImportAttribute/MarshalAsAttribute
-                       FieldInfo field = attributeType.FindField(fieldName, FieldSignature.Create(valueType, new CustomModifiers()));
-                       if (field != null)
-                       {
-                               list.Add(new CustomAttributeNamedArgument(field, new CustomAttributeTypedArgument(valueType, value)));
-                       }
-               }
-
-               internal static CustomAttributeData CreateFieldOffsetPseudoCustomAttribute(Module module, int offset)
-               {
-                       Type type = module.universe.System_Runtime_InteropServices_FieldOffsetAttribute;
-                       ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_Int32);
-                       return new CustomAttributeData(module, constructor, new object[] { offset }, null);
-               }
-
-               internal static CustomAttributeData CreatePreserveSigPseudoCustomAttribute(Module module)
-               {
-                       Type type = module.universe.System_Runtime_InteropServices_PreserveSigAttribute;
-                       ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor();
-                       return new CustomAttributeData(module, constructor, Empty<object>.Array, null);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/CustomAttributeNamedArgument.cs b/mcs/class/IKVM.Reflection/CustomAttributeNamedArgument.cs
deleted file mode 100644 (file)
index d9a84b7..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       public struct CustomAttributeNamedArgument
-       {
-               private readonly MemberInfo member;
-               private readonly CustomAttributeTypedArgument value;
-
-               internal CustomAttributeNamedArgument(MemberInfo member, CustomAttributeTypedArgument value)
-               {
-                       this.member = member;
-                       this.value = value;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return this == obj as CustomAttributeNamedArgument?;
-               }
-
-               public override int GetHashCode()
-               {
-                       return member.GetHashCode() ^ 53 * value.GetHashCode();
-               }
-
-               public MemberInfo MemberInfo
-               {
-                       get { return member; }
-               }
-
-               public CustomAttributeTypedArgument TypedValue
-               {
-                       get { return value; }
-               }
-
-               public static bool operator ==(CustomAttributeNamedArgument arg1, CustomAttributeNamedArgument arg2)
-               {
-                       return arg1.member.Equals(arg2.member) && arg1.value == arg2.value;
-               }
-
-               public static bool operator !=(CustomAttributeNamedArgument arg1, CustomAttributeNamedArgument arg2)
-               {
-                       return !(arg1 == arg2);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/CustomAttributeTypedArgument.cs b/mcs/class/IKVM.Reflection/CustomAttributeTypedArgument.cs
deleted file mode 100644 (file)
index 3403135..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       public struct CustomAttributeTypedArgument
-       {
-               private readonly Type type;
-               private readonly object value;
-
-               internal CustomAttributeTypedArgument(Type type, object value)
-               {
-                       this.type = type;
-                       this.value = value;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return this == obj as CustomAttributeTypedArgument?;
-               }
-
-               public override int GetHashCode()
-               {
-                       return type.GetHashCode() ^ 77 * (value == null ? 0 : value.GetHashCode());
-               }
-
-               public Type ArgumentType
-               {
-                       get { return type; }
-               }
-
-               public Object Value
-               {
-                       get { return value; }
-               }
-
-               public static bool operator ==(CustomAttributeTypedArgument arg1, CustomAttributeTypedArgument arg2)
-               {
-                       return arg1.type.Equals(arg2.type) && (arg1.value == arg2.value || (arg1.value != null && arg1.value.Equals(arg2.value)));
-               }
-
-               public static bool operator !=(CustomAttributeTypedArgument arg1, CustomAttributeTypedArgument arg2)
-               {
-                       return !(arg1 == arg2);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/CustomModifiers.cs b/mcs/class/IKVM.Reflection/CustomModifiers.cs
deleted file mode 100644 (file)
index e867061..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
-  Copyright (C) 2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       public struct CustomModifiers : IEquatable<CustomModifiers>, IEnumerable<CustomModifiers.Entry>
-       {
-               // note that FromReqOpt assumes that Initial == ModOpt
-               private static Type Initial { get { return MarkerType.ModOpt; } }
-               private readonly Type[] types;
-
-               internal CustomModifiers(List<CustomModifiersBuilder.Item> list)
-               {
-                       bool required = Initial == MarkerType.ModReq;
-                       int count = list.Count;
-                       foreach (CustomModifiersBuilder.Item item in list)
-                       {
-                               if (item.required != required)
-                               {
-                                       required = item.required;
-                                       count++;
-                               }
-                       }
-                       types = new Type[count];
-                       required = Initial == MarkerType.ModReq;
-                       int index = 0;
-                       foreach (CustomModifiersBuilder.Item item in list)
-                       {
-                               if (item.required != required)
-                               {
-                                       required = item.required;
-                                       types[index++] = required ? MarkerType.ModReq : MarkerType.ModOpt;
-                               }
-                               types[index++] = item.type;
-                       }
-               }
-
-               private CustomModifiers(Type[] types)
-               {
-                       Debug.Assert(types == null || types.Length != 0);
-                       this.types = types;
-               }
-
-               public struct Enumerator : IEnumerator<Entry>
-               {
-                       private readonly Type[] types;
-                       private int index;
-                       private bool required;
-
-                       internal Enumerator(Type[] types)
-                       {
-                               this.types = types;
-                               this.index = -1;
-                               this.required = Initial == MarkerType.ModReq;
-                       }
-
-                       void System.Collections.IEnumerator.Reset()
-                       {
-                               this.index = -1;
-                               this.required = Initial == MarkerType.ModReq;
-                       }
-
-                       public Entry Current
-                       {
-                               get { return new Entry(types[index], required); }
-                       }
-
-                       public bool MoveNext()
-                       {
-                               if (types == null || index == types.Length)
-                               {
-                                       return false;
-                               }
-                               index++;
-                               if (index == types.Length)
-                               {
-                                       return false;
-                               }
-                               else if (types[index] == MarkerType.ModOpt)
-                               {
-                                       required = false;
-                                       index++;
-                               }
-                               else if (types[index] == MarkerType.ModReq)
-                               {
-                                       required = true;
-                                       index++;
-                               }
-                               return true;
-                       }
-
-                       object System.Collections.IEnumerator.Current
-                       {
-                               get { return Current; }
-                       }
-
-                       void IDisposable.Dispose()
-                       {
-                       }
-               }
-
-               public struct Entry
-               {
-                       private readonly Type type;
-                       private readonly bool required;
-
-                       internal Entry(Type type, bool required)
-                       {
-                               this.type = type;
-                               this.required = required;
-                       }
-
-                       public Type Type
-                       {
-                               get { return type; }
-                       }
-
-                       public bool IsRequired
-                       {
-                               get { return required; }
-                       }
-               }
-
-               public Enumerator GetEnumerator()
-               {
-                       return new Enumerator(types);
-               }
-
-               IEnumerator<Entry> IEnumerable<Entry>.GetEnumerator()
-               {
-                       return GetEnumerator();
-               }
-
-               System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
-               {
-                       return GetEnumerator();
-               }
-
-               public bool IsEmpty
-               {
-                       get { return types == null; }
-               }
-
-               public bool Equals(CustomModifiers other)
-               {
-                       return Util.ArrayEquals(types, other.types);
-               }
-
-               public override bool Equals(object obj)
-               {
-                       CustomModifiers? other = obj as CustomModifiers?;
-                       return other != null && Equals(other.Value);
-               }
-
-               public override int GetHashCode()
-               {
-                       return Util.GetHashCode(types);
-               }
-
-               public override string ToString()
-               {
-                       if (types == null)
-                       {
-                               return string.Empty;
-                       }
-                       StringBuilder sb = new StringBuilder();
-                       string sep = "";
-                       foreach (Entry e in this)
-                       {
-                               sb.Append(sep).Append(e.IsRequired ? "modreq(" : "modopt(").Append(e.Type.FullName).Append(')');
-                               sep = " ";
-                       }
-                       return sb.ToString();
-               }
-
-               private Type[] GetRequiredOrOptional(bool required)
-               {
-                       if (types == null)
-                       {
-                               return Type.EmptyTypes;
-                       }
-                       int count = 0;
-                       foreach (Entry e in this)
-                       {
-                               if (e.IsRequired == required)
-                               {
-                                       count++;
-                               }
-                       }
-                       Type[] result = new Type[count];
-                       foreach (Entry e in this)
-                       {
-                               if (e.IsRequired == required)
-                               {
-                                       // FXBUG reflection (and ildasm) return custom modifiers in reverse order
-                                       // while SRE writes them in the specified order
-                                       result[--count] = e.Type;
-                               }
-                       }
-                       return result;
-               }
-
-               internal Type[] GetRequired()
-               {
-                       return GetRequiredOrOptional(true);
-               }
-
-               internal Type[] GetOptional()
-               {
-                       return GetRequiredOrOptional(false);
-               }
-
-               internal CustomModifiers Bind(IGenericBinder binder)
-               {
-                       if (types == null)
-                       {
-                               return this;
-                       }
-                       Type[] result = types;
-                       for (int i = 0; i < types.Length; i++)
-                       {
-                               if (types[i] == MarkerType.ModOpt || types[i] == MarkerType.ModReq)
-                               {
-                                       continue;
-                               }
-                               Type type = types[i].BindTypeParameters(binder);
-                               if (!ReferenceEquals(type, types[i]))
-                               {
-                                       if (result == types)
-                                       {
-                                               result = (Type[])types.Clone();
-                                       }
-                                       result[i] = type;
-                               }
-                       }
-                       return new CustomModifiers(result);
-               }
-
-               internal static CustomModifiers Read(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       byte b = br.PeekByte();
-                       if (!IsCustomModifier(b))
-                       {
-                               return new CustomModifiers();
-                       }
-                       List<Type> list = new List<Type>();
-                       Type mode = Initial;
-                       do
-                       {
-                               Type cmod = br.ReadByte() == Signature.ELEMENT_TYPE_CMOD_REQD ? MarkerType.ModReq : MarkerType.ModOpt;
-                               if (mode != cmod)
-                               {
-                                       mode = cmod;
-                                       list.Add(mode);
-                               }
-                               list.Add(Signature.ReadTypeDefOrRefEncoded(module, br, context));
-                               b = br.PeekByte();
-                       }
-                       while (IsCustomModifier(b));
-                       return new CustomModifiers(list.ToArray());
-               }
-
-               internal static void Skip(ByteReader br)
-               {
-                       byte b = br.PeekByte();
-                       while (IsCustomModifier(b))
-                       {
-                               br.ReadByte();
-                               br.ReadCompressedInt();
-                               b = br.PeekByte();
-                       }
-               }
-
-               internal static CustomModifiers FromReqOpt(Type[] req, Type[] opt)
-               {
-                       List<Type> list = null;
-                       if (opt != null && opt.Length != 0)
-                       {
-                               Debug.Assert(Initial == MarkerType.ModOpt);
-                               list = new List<Type>(opt);
-                       }
-                       if (req != null && req.Length != 0)
-                       {
-                               if (list == null)
-                               {
-                                       list = new List<Type>();
-                               }
-                               list.Add(MarkerType.ModReq);
-                               list.AddRange(req);
-                       }
-                       if (list == null)
-                       {
-                               return new CustomModifiers();
-                       }
-                       else
-                       {
-                               return new CustomModifiers(list.ToArray());
-                       }
-               }
-
-               private static bool IsCustomModifier(byte b)
-               {
-                       return b == Signature.ELEMENT_TYPE_CMOD_OPT || b == Signature.ELEMENT_TYPE_CMOD_REQD;
-               }
-
-               internal static CustomModifiers Combine(CustomModifiers mods1, CustomModifiers mods2)
-               {
-                       if (mods1.IsEmpty)
-                       {
-                               return mods2;
-                       }
-                       else if (mods2.IsEmpty)
-                       {
-                               return mods1;
-                       }
-                       else
-                       {
-                               Type[] combo = new Type[mods1.types.Length + mods2.types.Length];
-                               Array.Copy(mods1.types, combo, mods1.types.Length);
-                               Array.Copy(mods2.types, 0, combo, mods1.types.Length, mods2.types.Length);
-                               return new CustomModifiers(combo);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/AssemblyBuilder.cs b/mcs/class/IKVM.Reflection/Emit/AssemblyBuilder.cs
deleted file mode 100644 (file)
index ceabeac..0000000
+++ /dev/null
@@ -1,812 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Configuration.Assemblies;
-using System.IO;
-using System.Diagnostics;
-using System.Globalization;
-using System.Resources;
-using System.Security.Cryptography;
-using System.Security;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class AssemblyBuilder : Assembly
-       {
-               private readonly string name;
-               private ushort majorVersion;
-               private ushort minorVersion;
-               private ushort buildVersion;
-               private ushort revisionVersion;
-               private string culture;
-               private AssemblyNameFlags flags;
-               private AssemblyHashAlgorithm hashAlgorithm;
-               private StrongNameKeyPair keyPair;
-               private byte[] publicKey;
-               internal readonly string dir;
-               private readonly PermissionSet requiredPermissions;
-               private readonly PermissionSet optionalPermissions;
-               private readonly PermissionSet refusedPermissions;
-               private PEFileKinds fileKind = PEFileKinds.Dll;
-               private MethodInfo entryPoint;
-               private VersionInfo versionInfo;
-               private byte[] win32icon;
-               private byte[] win32manifest;
-               private byte[] win32resources;
-               private string imageRuntimeVersion;
-               internal int mdStreamVersion = 0x20000;
-               private Module pseudoManifestModule;
-               private readonly List<ResourceFile> resourceFiles = new List<ResourceFile>();
-               private readonly List<ModuleBuilder> modules = new List<ModuleBuilder>();
-               private readonly List<Module> addedModules = new List<Module>();
-               private readonly List<CustomAttributeBuilder> customAttributes = new List<CustomAttributeBuilder>();
-               private readonly List<CustomAttributeBuilder> declarativeSecurity = new List<CustomAttributeBuilder>();
-               private readonly List<Type> typeForwarders = new List<Type>();
-
-               private struct ResourceFile
-               {
-                       internal string Name;
-                       internal string FileName;
-                       internal ResourceAttributes Attributes;
-                       internal ResourceWriter Writer;
-               }
-
-               internal AssemblyBuilder(Universe universe, AssemblyName name, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
-                       : base(universe)
-               {
-                       this.name = name.Name;
-                       SetVersionHelper(name.Version);
-                       if (!string.IsNullOrEmpty(name.Culture))
-                       {
-                               this.culture = name.Culture;
-                       }
-                       this.flags = name.RawFlags;
-                       this.hashAlgorithm = name.HashAlgorithm;
-                       if (this.hashAlgorithm == AssemblyHashAlgorithm.None)
-                       {
-                               this.hashAlgorithm = AssemblyHashAlgorithm.SHA1;
-                       }
-                       this.keyPair = name.KeyPair;
-                       if (this.keyPair != null)
-                       {
-                               this.publicKey = this.keyPair.PublicKey;
-                       }
-                       else
-                       {
-                               byte[] publicKey = name.GetPublicKey();
-                               if (publicKey != null && publicKey.Length != 0)
-                               {
-                                       this.publicKey = (byte[])publicKey.Clone();
-                               }
-                       }
-                       this.dir = dir ?? ".";
-                       this.requiredPermissions = requiredPermissions;
-                       this.optionalPermissions = optionalPermissions;
-                       this.refusedPermissions = refusedPermissions;
-                       if (universe.HasMscorlib && !universe.Mscorlib.__IsMissing && universe.Mscorlib.ImageRuntimeVersion != null)
-                       {
-                               this.imageRuntimeVersion = universe.Mscorlib.ImageRuntimeVersion;
-                       }
-                       else
-                       {
-                               this.imageRuntimeVersion = typeof(object).Assembly.ImageRuntimeVersion;
-                       }
-               }
-
-               private void SetVersionHelper(Version version)
-               {
-                       if (version == null)
-                       {
-                               majorVersion = 0;
-                               minorVersion = 0;
-                               buildVersion = 0;
-                               revisionVersion = 0;
-                       }
-                       else
-                       {
-                               majorVersion = (ushort)version.Major;
-                               minorVersion = (ushort)version.Minor;
-                               buildVersion = version.Build == -1 ? (ushort)0 : (ushort)version.Build;
-                               revisionVersion = version.Revision == -1 ? (ushort)0 : (ushort)version.Revision;
-                       }
-               }
-
-               private void Rename(AssemblyName oldName)
-               {
-                       this.fullName = null;
-                       universe.RenameAssembly(this, oldName);
-               }
-
-               public void __SetAssemblyVersion(Version version)
-               {
-                       AssemblyName oldName = GetName();
-                       SetVersionHelper(version);
-                       Rename(oldName);
-               }
-
-               public void __SetAssemblyCulture(string cultureName)
-               {
-                       AssemblyName oldName = GetName();
-                       this.culture = cultureName;
-                       Rename(oldName);
-               }
-
-               public void __SetAssemblyKeyPair(StrongNameKeyPair keyPair)
-               {
-                       AssemblyName oldName = GetName();
-                       this.keyPair = keyPair;
-                       if (keyPair != null)
-                       {
-                               this.publicKey = keyPair.PublicKey;
-                       }
-                       Rename(oldName);
-               }
-
-               // this is used in combination with delay signing
-               public void __SetAssemblyPublicKey(byte[] publicKey)
-               {
-                       AssemblyName oldName = GetName();
-                       this.publicKey = publicKey == null ? null : (byte[])publicKey.Clone();
-                       Rename(oldName);
-               }
-
-               public void __SetAssemblyAlgorithmId(AssemblyHashAlgorithm hashAlgorithm)
-               {
-                       this.hashAlgorithm = hashAlgorithm;
-               }
-
-               public void __SetAssemblyFlags(AssemblyNameFlags flags)
-               {
-                       AssemblyName oldName = GetName();
-                       this.flags = flags;
-                       Rename(oldName);
-               }
-
-               public override AssemblyNameFlags __AssemblyFlags
-               {
-                       get { return flags; }
-               }
-
-               internal string Name
-               {
-                       get { return name; }
-               }
-
-               public override AssemblyName GetName()
-               {
-                       AssemblyName n = new AssemblyName();
-                       n.Name = name;
-                       n.Version = new Version(majorVersion, minorVersion, buildVersion, revisionVersion);
-                       n.Culture = culture ?? "";
-                       n.HashAlgorithm = hashAlgorithm;
-                       n.RawFlags = flags;
-                       n.SetPublicKey(publicKey != null ? (byte[])publicKey.Clone() : Empty<byte>.Array);
-                       n.KeyPair = keyPair;
-                       return n;
-               }
-
-               public override string Location
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public ModuleBuilder DefineDynamicModule(string name, string fileName)
-               {
-                       return DefineDynamicModule(name, fileName, false);
-               }
-
-               public ModuleBuilder DefineDynamicModule(string name, string fileName, bool emitSymbolInfo)
-               {
-                       ModuleBuilder module = new ModuleBuilder(this, name, fileName, emitSymbolInfo);
-                       modules.Add(module);
-                       return module;
-               }
-
-               public ModuleBuilder GetDynamicModule(string name)
-               {
-                       foreach (ModuleBuilder module in modules)
-                       {
-                               if (module.Name == name)
-                               {
-                                       return module;
-                               }
-                       }
-                       return null;
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       customAttributes.Add(customBuilder);
-               }
-
-               public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
-               {
-                       declarativeSecurity.Add(customBuilder);
-               }
-
-               public void __AddTypeForwarder(Type type)
-               {
-                       typeForwarders.Add(type);
-               }
-
-               public void SetEntryPoint(MethodInfo entryMethod)
-               {
-                       SetEntryPoint(entryMethod, PEFileKinds.ConsoleApplication);
-               }
-
-               public void SetEntryPoint(MethodInfo entryMethod, PEFileKinds fileKind)
-               {
-                       this.entryPoint = entryMethod;
-                       this.fileKind = fileKind;
-               }
-
-               public void __Save(Stream stream, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek || stream.Position != 0)
-                       {
-                               throw new ArgumentException("Stream must support read/write/seek and current position must be zero.", "stream");
-                       }
-                       if (modules.Count != 1)
-                       {
-                               throw new NotSupportedException("Saving to a stream is only supported for single module assemblies.");
-                       }
-                       SaveImpl(modules[0].fileName, stream, portableExecutableKind, imageFileMachine);
-               }
-
-               public void Save(string assemblyFileName)
-               {
-                       Save(assemblyFileName, PortableExecutableKinds.ILOnly, ImageFileMachine.I386);
-               }
-
-               public void Save(string assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       SaveImpl(assemblyFileName, null, portableExecutableKind, imageFileMachine);
-               }
-
-               private void SaveImpl(string assemblyFileName, Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       ModuleBuilder manifestModule = null;
-
-                       foreach (ModuleBuilder moduleBuilder in modules)
-                       {
-                               moduleBuilder.SetIsSaved();
-                               moduleBuilder.PopulatePropertyAndEventTables();
-
-                               if (manifestModule == null
-                                       && string.Compare(moduleBuilder.fileName, assemblyFileName, StringComparison.OrdinalIgnoreCase) == 0)
-                               {
-                                       manifestModule = moduleBuilder;
-                               }
-                       }
-
-                       if (manifestModule == null)
-                       {
-                               manifestModule = DefineDynamicModule("RefEmit_OnDiskManifestModule", assemblyFileName, false);
-                       }
-
-                       AssemblyTable.Record assemblyRecord = new AssemblyTable.Record();
-                       assemblyRecord.HashAlgId = (int)hashAlgorithm;
-                       assemblyRecord.Name = manifestModule.Strings.Add(name);
-                       assemblyRecord.MajorVersion = majorVersion;
-                       assemblyRecord.MinorVersion = minorVersion;
-                       assemblyRecord.BuildNumber = buildVersion;
-                       assemblyRecord.RevisionNumber = revisionVersion;
-                       if (publicKey != null)
-                       {
-                               assemblyRecord.PublicKey = manifestModule.Blobs.Add(ByteBuffer.Wrap(publicKey));
-                               assemblyRecord.Flags = (int)(flags | AssemblyNameFlags.PublicKey);
-                       }
-                       else
-                       {
-                               assemblyRecord.Flags = (int)(flags & ~AssemblyNameFlags.PublicKey);
-                       }
-                       if (culture != null)
-                       {
-                               assemblyRecord.Culture = manifestModule.Strings.Add(culture);
-                       }
-                       int token = 0x20000000 + manifestModule.AssemblyTable.AddRecord(assemblyRecord);
-
-#pragma warning disable 618
-                       // this values are obsolete, but we already know that so we disable the warning
-                       System.Security.Permissions.SecurityAction requestMinimum = System.Security.Permissions.SecurityAction.RequestMinimum;
-                       System.Security.Permissions.SecurityAction requestOptional = System.Security.Permissions.SecurityAction.RequestOptional;
-                       System.Security.Permissions.SecurityAction requestRefuse = System.Security.Permissions.SecurityAction.RequestRefuse;
-#pragma warning restore 618
-                       if (requiredPermissions != null)
-                       {
-                               manifestModule.AddDeclarativeSecurity(token, requestMinimum, requiredPermissions);
-                       }
-                       if (optionalPermissions != null)
-                       {
-                               manifestModule.AddDeclarativeSecurity(token, requestOptional, optionalPermissions);
-                       }
-                       if (refusedPermissions != null)
-                       {
-                               manifestModule.AddDeclarativeSecurity(token, requestRefuse, refusedPermissions);
-                       }
-
-                       ResourceSection unmanagedResources = versionInfo != null || win32icon != null || win32manifest != null || win32resources != null
-                               ? new ResourceSection()
-                               : null;
-
-                       if (versionInfo != null)
-                       {
-                               versionInfo.SetName(GetName());
-                               versionInfo.SetFileName(assemblyFileName);
-                               foreach (CustomAttributeBuilder cab in customAttributes)
-                               {
-                                       // .NET doesn't support copying blob custom attributes into the version info
-                                       if (!cab.HasBlob)
-                                       {
-                                               versionInfo.SetAttribute(cab);
-                                       }
-                               }
-                               ByteBuffer versionInfoData = new ByteBuffer(512);
-                               versionInfo.Write(versionInfoData);
-                               unmanagedResources.AddVersionInfo(versionInfoData);
-                       }
-
-                       if (win32icon != null)
-                       {
-                               unmanagedResources.AddIcon(win32icon);
-                       }
-
-                       if (win32manifest != null)
-                       {
-                               unmanagedResources.AddManifest(win32manifest, fileKind == PEFileKinds.Dll ? (ushort)2 : (ushort)1);
-                       }
-
-                       if (win32resources != null)
-                       {
-                               unmanagedResources.ExtractResources(win32resources);
-                       }
-
-                       foreach (CustomAttributeBuilder cab in customAttributes)
-                       {
-                               // we intentionally don't filter out the version info (pseudo) custom attributes (to be compatible with .NET)
-                               manifestModule.SetCustomAttribute(0x20000001, cab);
-                       }
-
-                       manifestModule.AddDeclarativeSecurity(0x20000001, declarativeSecurity);
-
-                       foreach (Type type in typeForwarders)
-                       {
-                               manifestModule.AddTypeForwarder(type);
-                       }
-
-                       foreach (ResourceFile resfile in resourceFiles)
-                       {
-                               if (resfile.Writer != null)
-                               {
-                                       resfile.Writer.Generate();
-                                       resfile.Writer.Close();
-                               }
-                               int fileToken = AddFile(manifestModule, resfile.FileName, 1 /*ContainsNoMetaData*/);
-                               ManifestResourceTable.Record rec = new ManifestResourceTable.Record();
-                               rec.Offset = 0;
-                               rec.Flags = (int)resfile.Attributes;
-                               rec.Name = manifestModule.Strings.Add(resfile.Name);
-                               rec.Implementation = fileToken;
-                               manifestModule.ManifestResource.AddRecord(rec);
-                       }
-
-                       int entryPointToken = 0;
-
-                       foreach (ModuleBuilder moduleBuilder in modules)
-                       {
-                               moduleBuilder.FillAssemblyRefTable();
-                               moduleBuilder.EmitResources();
-                               if (moduleBuilder != manifestModule)
-                               {
-                                       int fileToken;
-                                       if (entryPoint != null && entryPoint.Module == moduleBuilder)
-                                       {
-                                               ModuleWriter.WriteModule(null, null, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, moduleBuilder.unmanagedResources, entryPoint.MetadataToken);
-                                               entryPointToken = fileToken = AddFile(manifestModule, moduleBuilder.fileName, 0 /*ContainsMetaData*/);
-                                       }
-                                       else
-                                       {
-                                               ModuleWriter.WriteModule(null, null, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, moduleBuilder.unmanagedResources, 0);
-                                               fileToken = AddFile(manifestModule, moduleBuilder.fileName, 0 /*ContainsMetaData*/);
-                                       }
-                                       moduleBuilder.ExportTypes(fileToken, manifestModule);
-                               }
-                       }
-
-                       foreach (Module module in addedModules)
-                       {
-                               int fileToken = AddFile(manifestModule, module.FullyQualifiedName, 0 /*ContainsMetaData*/);
-                               module.ExportTypes(fileToken, manifestModule);
-                       }
-
-                       if (entryPointToken == 0 && entryPoint != null)
-                       {
-                               entryPointToken = entryPoint.MetadataToken;
-                       }
-
-                       // finally, write the manifest module
-                       ModuleWriter.WriteModule(keyPair, publicKey, manifestModule, fileKind, portableExecutableKind, imageFileMachine, unmanagedResources ?? manifestModule.unmanagedResources, entryPointToken, streamOrNull);
-               }
-
-               private int AddFile(ModuleBuilder manifestModule, string fileName, int flags)
-               {
-                       SHA1Managed hash = new SHA1Managed();
-                       string fullPath = fileName;
-                       if (dir != null)
-                       {
-                               fullPath = Path.Combine(dir, fileName);
-                       }
-                       using (FileStream fs = new FileStream(fullPath, FileMode.Open, FileAccess.Read))
-                       {
-                               using (CryptoStream cs = new CryptoStream(Stream.Null, hash, CryptoStreamMode.Write))
-                               {
-                                       byte[] buf = new byte[8192];
-                                       ModuleWriter.HashChunk(fs, cs, buf, (int)fs.Length);
-                               }
-                       }
-                       return manifestModule.__AddModule(flags, Path.GetFileName(fileName), hash.Hash);
-               }
-
-               public void AddResourceFile(string name, string fileName)
-               {
-                       AddResourceFile(name, fileName, ResourceAttributes.Public);
-               }
-
-               public void AddResourceFile(string name, string fileName, ResourceAttributes attribs)
-               {
-                       ResourceFile resfile = new ResourceFile();
-                       resfile.Name = name;
-                       resfile.FileName = fileName;
-                       resfile.Attributes = attribs;
-                       resourceFiles.Add(resfile);
-               }
-
-               public IResourceWriter DefineResource(string name, string description, string fileName)
-               {
-                       return DefineResource(name, description, fileName, ResourceAttributes.Public);
-               }
-
-               public IResourceWriter DefineResource(string name, string description, string fileName, ResourceAttributes attribute)
-               {
-                       // FXBUG we ignore the description, because there is no such thing
-
-                       string fullPath = fileName;
-                       if (dir != null)
-                       {
-                               fullPath = Path.Combine(dir, fileName);
-                       }
-                       ResourceWriter rw = new ResourceWriter(fullPath);
-                       ResourceFile resfile;
-                       resfile.Name = name;
-                       resfile.FileName = fileName;
-                       resfile.Attributes = attribute;
-                       resfile.Writer = rw;
-                       resourceFiles.Add(resfile);
-                       return rw;
-               }
-
-               public void DefineVersionInfoResource()
-               {
-                       if (versionInfo != null || win32resources != null)
-                       {
-                               throw new ArgumentException("Native resource has already been defined.");
-                       }
-                       versionInfo = new VersionInfo();
-               }
-
-               public void DefineVersionInfoResource(string product, string productVersion, string company, string copyright, string trademark)
-               {
-                       if (versionInfo != null || win32resources != null)
-                       {
-                               throw new ArgumentException("Native resource has already been defined.");
-                       }
-                       versionInfo = new VersionInfo();
-                       versionInfo.product = product;
-                       versionInfo.informationalVersion = productVersion;
-                       versionInfo.company = company;
-                       versionInfo.copyright = copyright;
-                       versionInfo.trademark = trademark;
-               }
-
-               public void __DefineIconResource(byte[] iconFile)
-               {
-                       if (win32icon != null || win32resources != null)
-                       {
-                               throw new ArgumentException("Native resource has already been defined.");
-                       }
-                       win32icon = (byte[])iconFile.Clone();
-               }
-
-               public void __DefineManifestResource(byte[] manifest)
-               {
-                       if (win32manifest != null || win32resources != null)
-                       {
-                               throw new ArgumentException("Native resource has already been defined.");
-                       }
-                       win32manifest = (byte[])manifest.Clone();
-               }
-
-               public void __DefineUnmanagedResource(byte[] resource)
-               {
-                       if (versionInfo != null || win32icon != null || win32manifest != null || win32resources != null)
-                       {
-                               throw new ArgumentException("Native resource has already been defined.");
-                       }
-                       // The standard .NET DefineUnmanagedResource(byte[]) is useless, because it embeds "resource" (as-is) as the .rsrc section,
-                       // but it doesn't set the PE file Resource Directory entry to point to it. That's why we have a renamed version, which behaves
-                       // like DefineUnmanagedResource(string).
-                       win32resources = (byte[])resource.Clone();
-               }
-
-               public void DefineUnmanagedResource(string resourceFileName)
-               {
-                       // This method reads the specified resource file (Win32 .res file) and converts it into the appropriate format and embeds it in the .rsrc section,
-                       // also setting the Resource Directory entry.
-                       __DefineUnmanagedResource(File.ReadAllBytes(resourceFileName));
-               }
-
-               public override Type[] GetTypes()
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (ModuleBuilder module in modules)
-                       {
-                               module.GetTypesImpl(list);
-                       }
-                       foreach (Module module in addedModules)
-                       {
-                               module.GetTypesImpl(list);
-                       }
-                       return list.ToArray();
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       foreach (ModuleBuilder mb in modules)
-                       {
-                               Type type = mb.FindType(typeName);
-                               if (type != null)
-                               {
-                                       return type;
-                               }
-                       }
-                       foreach (Module module in addedModules)
-                       {
-                               Type type = module.FindType(typeName);
-                               if (type != null)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       foreach (ModuleBuilder mb in modules)
-                       {
-                               Type type = mb.FindTypeIgnoreCase(lowerCaseName);
-                               if (type != null)
-                               {
-                                       return type;
-                               }
-                       }
-                       foreach (Module module in addedModules)
-                       {
-                               Type type = module.FindTypeIgnoreCase(lowerCaseName);
-                               if (type != null)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               public override string ImageRuntimeVersion
-               {
-                       get { return imageRuntimeVersion; }
-               }
-
-               public void __SetImageRuntimeVersion(string imageRuntimeVersion, int mdStreamVersion)
-               {
-                       this.imageRuntimeVersion = imageRuntimeVersion;
-                       this.mdStreamVersion = mdStreamVersion;
-               }
-
-               public override Module ManifestModule
-               {
-                       get
-                       {
-                               if (pseudoManifestModule == null)
-                               {
-                                       pseudoManifestModule = new ManifestModule(this);
-                               }
-                               return pseudoManifestModule;
-                       }
-               }
-
-               public override MethodInfo EntryPoint
-               {
-                       get { return entryPoint; }
-               }
-
-               public override AssemblyName[] GetReferencedAssemblies()
-               {
-                       return Empty<AssemblyName>.Array;
-               }
-
-               public override Module[] GetLoadedModules(bool getResourceModules)
-               {
-                       return GetModules(getResourceModules);
-               }
-
-               public override Module[] GetModules(bool getResourceModules)
-               {
-                       List<Module> list = new List<Module>();
-                       foreach (ModuleBuilder module in modules)
-                       {
-                               if (getResourceModules || !module.IsResource())
-                               {
-                                       list.Add(module);
-                               }
-                       }
-                       foreach (Module module in addedModules)
-                       {
-                               if (getResourceModules || !module.IsResource())
-                               {
-                                       list.Add(module);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public override Module GetModule(string name)
-               {
-                       foreach (ModuleBuilder module in modules)
-                       {
-                               if (module.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
-                               {
-                                       return module;
-                               }
-                       }
-                       foreach (Module module in addedModules)
-                       {
-                               if (module.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
-                               {
-                                       return module;
-                               }
-                       }
-                       return null;
-               }
-
-               public Module __AddModule(RawModule module)
-               {
-                       Module mod = module.ToModule(this);
-                       addedModules.Add(mod);
-                       return mod;
-               }
-
-               public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public override string[] GetManifestResourceNames()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public override Stream GetManifestResourceStream(string resourceName)
-               {
-                       throw new NotSupportedException();
-               }
-
-               internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
-               {
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       foreach (CustomAttributeBuilder cab in customAttributes)
-                       {
-                               if (attributeType == null || attributeType.IsAssignableFrom(cab.Constructor.DeclaringType))
-                               {
-                                       list.Add(cab.ToData(this));
-                               }
-                       }
-                       return list;
-               }
-
-               internal bool IsWindowsRuntime
-               {
-                       get { return (flags & (AssemblyNameFlags)0x200) != 0; }
-               }
-       }
-
-       sealed class ManifestModule : NonPEModule
-       {
-               private readonly AssemblyBuilder assembly;
-               private readonly Guid guid = Guid.NewGuid();
-
-               internal ManifestModule(AssemblyBuilder assembly)
-                       : base(assembly.universe)
-               {
-                       this.assembly = assembly;
-               }
-
-               public override int MDStreamVersion
-               {
-                       get { return assembly.mdStreamVersion; }
-               }
-
-               public override Assembly Assembly
-               {
-                       get { return assembly; }
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       return null;
-               }
-
-               internal override void  GetTypesImpl(List<Type> list)
-               {
-               }
-
-               public override string FullyQualifiedName
-               {
-                       get { return Path.Combine(assembly.dir, "RefEmit_InMemoryManifestModule"); }
-               }
-
-               public override string Name
-               {
-                       get { return "<In Memory Module>"; }
-               }
-
-               public override Guid ModuleVersionId
-               {
-                       get { return guid; }
-               }
-
-               public override string ScopeName
-               {
-                       get { return "RefEmit_InMemoryManifestModule"; }
-               }
-
-               protected override Exception NotSupportedException()
-               {
-                       return new InvalidOperationException();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/ConstructorBuilder.cs b/mcs/class/IKVM.Reflection/Emit/ConstructorBuilder.cs
deleted file mode 100644 (file)
index 308679d..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class ConstructorBuilder : ConstructorInfo
-       {
-               private readonly MethodBuilder methodBuilder;
-
-               internal ConstructorBuilder(MethodBuilder mb)
-               {
-                       this.methodBuilder = mb;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       ConstructorBuilder other = obj as ConstructorBuilder;
-                       return other != null && other.methodBuilder.Equals(methodBuilder);
-               }
-
-               public override int GetHashCode()
-               {
-                       return methodBuilder.GetHashCode();
-               }
-
-               public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       methodBuilder.__SetSignature(returnType, returnTypeCustomModifiers, parameterTypes, parameterTypeCustomModifiers);
-               }
-
-               [Obsolete("Please use __SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
-               public void __SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       methodBuilder.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
-               }
-
-               public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
-               {
-                       return methodBuilder.DefineParameter(position, attributes, strParamName);
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       methodBuilder.SetCustomAttribute(customBuilder);
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con,     byte[] binaryAttribute)
-               {
-                       methodBuilder.SetCustomAttribute(con, binaryAttribute);
-               }
-
-               public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
-               {
-                       methodBuilder.__AddDeclarativeSecurity(customBuilder);
-               }
-
-               public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
-               {
-                       methodBuilder.AddDeclarativeSecurity(securityAction, permissionSet);
-               }
-
-               public void SetImplementationFlags(MethodImplAttributes attributes)
-               {
-                       methodBuilder.SetImplementationFlags(attributes);
-               }
-
-               public ILGenerator GetILGenerator()
-               {
-                       return methodBuilder.GetILGenerator();
-               }
-
-               public ILGenerator GetILGenerator(int streamSize)
-               {
-                       return methodBuilder.GetILGenerator(streamSize);
-               }
-
-               public void __ReleaseILGenerator()
-               {
-                       methodBuilder.__ReleaseILGenerator();
-               }
-
-               public Type ReturnType
-               {
-                       get { return methodBuilder.ReturnType; }
-               }
-
-               public Module GetModule()
-               {
-                       return methodBuilder.GetModule();
-               }
-
-               public MethodToken GetToken()
-               {
-                       return methodBuilder.GetToken();
-               }
-
-               public bool InitLocals
-               {
-                       get { return methodBuilder.InitLocals; }
-                       set { methodBuilder.InitLocals = value; }
-               }
-
-               internal override MethodInfo GetMethodInfo()
-               {
-                       return methodBuilder;
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return methodBuilder;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/CustomAttributeBuilder.cs b/mcs/class/IKVM.Reflection/Emit/CustomAttributeBuilder.cs
deleted file mode 100644 (file)
index 12be4a4..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class CustomAttributeBuilder
-       {
-               private readonly ConstructorInfo con;
-               private readonly byte[] blob;
-               private readonly object[] constructorArgs;
-               private readonly PropertyInfo[] namedProperties;
-               private readonly object[] propertyValues;
-               private readonly FieldInfo[] namedFields;
-               private readonly object[] fieldValues;
-
-               internal CustomAttributeBuilder(ConstructorInfo con, byte[] blob)
-               {
-                       this.con = con;
-                       this.blob = blob;
-               }
-
-               private CustomAttributeBuilder(ConstructorInfo con, int securityAction, byte[] blob)
-               {
-                       this.con = con;
-                       this.blob = blob;
-                       this.constructorArgs = new object[] { securityAction };
-               }
-
-               public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs)
-                       : this(con, constructorArgs, null, null, null,null)
-               {
-               }
-
-               public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, FieldInfo[] namedFields, object[] fieldValues)
-                       : this(con, constructorArgs, null, null, namedFields, fieldValues)
-               {
-               }
-
-               public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues)
-                       : this(con, constructorArgs, namedProperties, propertyValues, null, null)
-               {
-               }
-
-               public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues)
-               {
-                       this.con = con;
-                       this.constructorArgs = constructorArgs;
-                       this.namedProperties = namedProperties;
-                       this.propertyValues = propertyValues;
-                       this.namedFields = namedFields;
-                       this.fieldValues = fieldValues;
-               }
-
-               public static CustomAttributeBuilder __FromBlob(ConstructorInfo con, byte[] blob)
-               {
-                       return new CustomAttributeBuilder(con, blob);
-               }
-
-               public static CustomAttributeBuilder __FromBlob(ConstructorInfo con, int securityAction, byte[] blob)
-               {
-                       return new CustomAttributeBuilder(con, securityAction, blob);
-               }
-
-               public static CustomAttributeTypedArgument __MakeTypedArgument(Type type, object value)
-               {
-                       return new CustomAttributeTypedArgument(type, value);
-               }
-
-               private sealed class BlobWriter
-               {
-                       private readonly Assembly assembly;
-                       private readonly CustomAttributeBuilder cab;
-                       private readonly ByteBuffer bb;
-
-                       internal BlobWriter(Assembly assembly, CustomAttributeBuilder cab, ByteBuffer bb)
-                       {
-                               this.assembly = assembly;
-                               this.cab = cab;
-                               this.bb = bb;
-                       }
-
-                       internal void WriteCustomAttributeBlob()
-                       {
-                               // prolog
-                               WriteUInt16(1);
-                               ParameterInfo[] pi = cab.con.GetParameters();
-                               for (int i = 0; i < pi.Length; i++)
-                               {
-                                       WriteFixedArg(pi[i].ParameterType, cab.constructorArgs[i]);
-                               }
-                               WriteNamedArguments(false);
-                       }
-
-                       internal void WriteNamedArguments(bool forDeclSecurity)
-                       {
-                               // NumNamed
-                               int named = 0;
-                               if (cab.namedFields != null)
-                               {
-                                       named += cab.namedFields.Length;
-                               }
-                               if (cab.namedProperties != null)
-                               {
-                                       named += cab.namedProperties.Length;
-                               }
-                               if (forDeclSecurity)
-                               {
-                                       WritePackedLen(named);
-                               }
-                               else
-                               {
-                                       WriteUInt16((ushort)named);
-                               }
-                               if (cab.namedFields != null)
-                               {
-                                       for (int i = 0; i < cab.namedFields.Length; i++)
-                                       {
-                                               WriteNamedArg(0x53, cab.namedFields[i].FieldType, cab.namedFields[i].Name, cab.fieldValues[i]);
-                                       }
-                               }
-                               if (cab.namedProperties != null)
-                               {
-                                       for (int i = 0; i < cab.namedProperties.Length; i++)
-                                       {
-                                               WriteNamedArg(0x54, cab.namedProperties[i].PropertyType, cab.namedProperties[i].Name, cab.propertyValues[i]);
-                                       }
-                               }
-                       }
-
-                       private void WriteNamedArg(byte fieldOrProperty, Type type, string name, object value)
-                       {
-                               WriteByte(fieldOrProperty);
-                               WriteFieldOrPropType(type);
-                               WriteString(name);
-                               WriteFixedArg(type, value);
-                       }
-
-                       private void WriteByte(byte value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteUInt16(ushort value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteInt32(int value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteFixedArg(Type type, object value)
-                       {
-                               Universe u = assembly.universe;
-                               if (type == u.System_String)
-                               {
-                                       WriteString((string)value);
-                               }
-                               else if (type == u.System_Boolean)
-                               {
-                                       WriteByte((bool)value ? (byte)1 : (byte)0);
-                               }
-                               else if (type == u.System_Char)
-                               {
-                                       WriteUInt16((char)value);
-                               }
-                               else if (type == u.System_SByte)
-                               {
-                                       WriteByte((byte)(sbyte)value);
-                               }
-                               else if (type == u.System_Byte)
-                               {
-                                       WriteByte((byte)value);
-                               }
-                               else if (type == u.System_Int16)
-                               {
-                                       WriteUInt16((ushort)(short)value);
-                               }
-                               else if (type == u.System_UInt16)
-                               {
-                                       WriteUInt16((ushort)value);
-                               }
-                               else if (type == u.System_Int32)
-                               {
-                                       WriteInt32((int)value);
-                               }
-                               else if (type == u.System_UInt32)
-                               {
-                                       WriteInt32((int)(uint)value);
-                               }
-                               else if (type == u.System_Int64)
-                               {
-                                       WriteInt64((long)value);
-                               }
-                               else if (type == u.System_UInt64)
-                               {
-                                       WriteInt64((long)(ulong)value);
-                               }
-                               else if (type == u.System_Single)
-                               {
-                                       WriteSingle((float)value);
-                               }
-                               else if (type == u.System_Double)
-                               {
-                                       WriteDouble((double)value);
-                               }
-                               else if (type == u.System_Type)
-                               {
-                                       WriteTypeName((Type)value);
-                               }
-                               else if (type == u.System_Object)
-                               {
-                                       if (value == null)
-                                       {
-                                               type = u.System_String;
-                                       }
-                                       else if (value is Type)
-                                       {
-                                               // value.GetType() would return a subclass of Type, but we don't want to deal with that
-                                               type = u.System_Type;
-                                       }
-                                       else if (value is CustomAttributeTypedArgument)
-                                       {
-                                               CustomAttributeTypedArgument cta = (CustomAttributeTypedArgument)value;
-                                               value = cta.Value;
-                                               type = cta.ArgumentType;
-                                       }
-                                       else
-                                       {
-                                               type = u.Import(value.GetType());
-                                       }
-                                       WriteFieldOrPropType(type);
-                                       WriteFixedArg(type, value);
-                               }
-                               else if (type.IsArray)
-                               {
-                                       if (value == null)
-                                       {
-                                               WriteInt32(-1);
-                                       }
-                                       else
-                                       {
-                                               Array array = (Array)value;
-                                               Type elemType = type.GetElementType();
-                                               WriteInt32(array.Length);
-                                               foreach (object val in array)
-                                               {
-                                                       WriteFixedArg(elemType, val);
-                                               }
-                                       }
-                               }
-                               else if (type.IsEnum)
-                               {
-                                       WriteFixedArg(type.GetEnumUnderlyingTypeImpl(), value);
-                               }
-                               else
-                               {
-                                       throw new ArgumentException();
-                               }
-                       }
-
-                       private void WriteInt64(long value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteSingle(float value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteDouble(double value)
-                       {
-                               bb.Write(value);
-                       }
-
-                       private void WriteTypeName(Type type)
-                       {
-                               string name = null;
-                               if (type != null)
-                               {
-                                       StringBuilder sb = new StringBuilder();
-                                       GetTypeName(sb, type, false);
-                                       name = sb.ToString();
-                               }
-                               WriteString(name);
-                       }
-
-                       private void GetTypeName(StringBuilder sb, Type type, bool isTypeParam)
-                       {
-                               bool v1 = !assembly.ManifestModule.__IsMissing && assembly.ManifestModule.MDStreamVersion < 0x20000;
-                               bool includeAssemblyName = type.Assembly != assembly && (!v1 || type.Assembly != type.Module.universe.Mscorlib);
-                               if (isTypeParam && includeAssemblyName)
-                               {
-                                       sb.Append('[');
-                               }
-                               GetTypeNameImpl(sb, type);
-                               if (includeAssemblyName)
-                               {
-                                       if (v1)
-                                       {
-                                               sb.Append(',');
-                                       }
-                                       else
-                                       {
-                                               sb.Append(", ");
-                                       }
-                                       if (isTypeParam)
-                                       {
-                                               sb.Append(type.Assembly.FullName.Replace("]", "\\]")).Append(']');
-                                       }
-                                       else
-                                       {
-                                               sb.Append(type.Assembly.FullName);
-                                       }
-                               }
-                       }
-
-                       private void GetTypeNameImpl(StringBuilder sb, Type type)
-                       {
-                               if (type.HasElementType)
-                               {
-                                       GetTypeNameImpl(sb, type.GetElementType());
-                                       sb.Append(((ElementHolderType)type).GetSuffix());
-                               }
-                               else if (type.IsConstructedGenericType)
-                               {
-                                       sb.Append(type.GetGenericTypeDefinition().FullName);
-                                       sb.Append('[');
-                                       string sep = "";
-                                       foreach (Type typeParam in type.GetGenericArguments())
-                                       {
-                                               sb.Append(sep);
-                                               GetTypeName(sb, typeParam, true);
-                                               sep = ",";
-                                       }
-                                       sb.Append(']');
-                               }
-                               else
-                               {
-                                       sb.Append(type.FullName);
-                               }
-                       }
-       
-                       private void WriteString(string val)
-                       {
-                               bb.Write(val);
-                       }
-
-                       private void WritePackedLen(int len)
-                       {
-                               bb.WriteCompressedInt(len);
-                       }
-
-                       private void WriteFieldOrPropType(Type type)
-                       {
-                               Universe u = type.Module.universe;
-                               if (type == u.System_Type)
-                               {
-                                       WriteByte(0x50);
-                               }
-                               else if (type == u.System_Object)
-                               {
-                                       WriteByte(0x51);
-                               }
-                               else if (type == u.System_Boolean)
-                               {
-                                       WriteByte(0x02);
-                               }
-                               else if (type == u.System_Char)
-                               {
-                                       WriteByte(0x03);
-                               }
-                               else if (type == u.System_SByte)
-                               {
-                                       WriteByte(0x04);
-                               }
-                               else if (type == u.System_Byte)
-                               {
-                                       WriteByte(0x05);
-                               }
-                               else if (type == u.System_Int16)
-                               {
-                                       WriteByte(0x06);
-                               }
-                               else if (type == u.System_UInt16)
-                               {
-                                       WriteByte(0x07);
-                               }
-                               else if (type == u.System_Int32)
-                               {
-                                       WriteByte(0x08);
-                               }
-                               else if (type == u.System_UInt32)
-                               {
-                                       WriteByte(0x09);
-                               }
-                               else if (type == u.System_Int64)
-                               {
-                                       WriteByte(0x0A);
-                               }
-                               else if (type == u.System_UInt64)
-                               {
-                                       WriteByte(0x0B);
-                               }
-                               else if (type == u.System_Single)
-                               {
-                                       WriteByte(0x0C);
-                               }
-                               else if (type == u.System_Double)
-                               {
-                                       WriteByte(0x0D);
-                               }
-                               else if (type == u.System_String)
-                               {
-                                       WriteByte(0x0E);
-                               }
-                               else if (type.IsArray)
-                               {
-                                       WriteByte(0x1D);
-                                       WriteFieldOrPropType(type.GetElementType());
-                               }
-                               else if (type.IsEnum)
-                               {
-                                       WriteByte(0x55);
-                                       WriteTypeName(type);
-                               }
-                               else
-                               {
-                                       throw new ArgumentException();
-                               }
-                       }
-               }
-
-               internal bool IsPseudoCustomAttribute
-               {
-                       get { return con.DeclaringType.IsPseudoCustomAttribute; }
-               }
-
-               internal ConstructorInfo Constructor
-               {
-                       get { return con; }
-               }
-
-               internal int WriteBlob(ModuleBuilder moduleBuilder)
-               {
-                       ByteBuffer bb;
-                       if (blob != null)
-                       {
-                               bb = ByteBuffer.Wrap(blob);
-                       }
-                       else
-                       {
-                               bb = new ByteBuffer(100);
-                               BlobWriter bw = new BlobWriter(moduleBuilder.Assembly, this, bb);
-                               bw.WriteCustomAttributeBlob();
-                       }
-                       return moduleBuilder.Blobs.Add(bb);
-               }
-
-               internal object GetConstructorArgument(int pos)
-               {
-                       return constructorArgs[pos];
-               }
-
-               internal int ConstructorArgumentCount
-               {
-                       get { return constructorArgs == null ? 0 : constructorArgs.Length; }
-               }
-
-               internal T? GetFieldValue<T>(string name) where T : struct
-               {
-                       object val = GetFieldValue(name);
-                       if (val is T)
-                       {
-                               return (T)val;
-                       }
-                       else if (val != null)
-                       {
-                               if (typeof(T).IsEnum)
-                               {
-                                       Debug.Assert(Enum.GetUnderlyingType(typeof(T)) == val.GetType());
-                                       return (T)Enum.ToObject(typeof(T), val);
-                               }
-                               else
-                               {
-                                       Debug.Assert(Enum.GetUnderlyingType(val.GetType()) == typeof(T));
-                                       return (T)Convert.ChangeType(val, typeof(T));
-                               }
-                       }
-                       else
-                       {
-                               return null;
-                       }
-               }
-
-               internal object GetFieldValue(string name)
-               {
-                       if (namedFields != null)
-                       {
-                               for (int i = 0; i < namedFields.Length; i++)
-                               {
-                                       if (namedFields[i].Name == name)
-                                       {
-                                               return fieldValues[i];
-                                       }
-                               }
-                       }
-                       return null;
-               }
-
-               internal string GetLegacyDeclSecurity()
-               {
-                       if (con.DeclaringType == con.Module.universe.System_Security_Permissions_PermissionSetAttribute
-                               && blob == null
-                               && (namedFields == null || namedFields.Length == 0)
-                               && namedProperties != null
-                               && namedProperties.Length == 1
-                               && namedProperties[0].Name == "XML")
-                       {
-                               return propertyValues[0] as string;
-                       }
-                       return null;
-               }
-
-               internal void WriteNamedArgumentsForDeclSecurity(ModuleBuilder moduleBuilder, ByteBuffer bb)
-               {
-                       if (blob != null)
-                       {
-                               bb.Write(blob);
-                       }
-                       else
-                       {
-                               BlobWriter bw = new BlobWriter(moduleBuilder.Assembly, this, bb);
-                               bw.WriteNamedArguments(true);
-                       }
-               }
-
-               internal CustomAttributeData ToData(Assembly asm)
-               {
-                       if (blob != null)
-                       {
-                               if (constructorArgs != null)
-                               {
-                                       return new CustomAttributeData(asm, con, (int)constructorArgs[0], blob, -1);
-                               }
-                               return new CustomAttributeData(asm, con, new IKVM.Reflection.Reader.ByteReader(blob, 0, blob.Length));
-                       }
-                       else
-                       {
-                               List<CustomAttributeNamedArgument> namedArgs = new List<CustomAttributeNamedArgument>();
-                               if (namedProperties != null)
-                               {
-                                       for (int i = 0; i < namedProperties.Length; i++)
-                                       {
-                                               namedArgs.Add(new CustomAttributeNamedArgument(namedProperties[i], RewrapValue(namedProperties[i].PropertyType, propertyValues[i])));
-                                       }
-                               }
-                               if (namedFields != null)
-                               {
-                                       for (int i = 0; i < namedFields.Length; i++)
-                                       {
-                                               namedArgs.Add(new CustomAttributeNamedArgument(namedFields[i], RewrapValue(namedFields[i].FieldType, fieldValues[i])));
-                                       }
-                               }
-                               List<CustomAttributeTypedArgument> args = new List<CustomAttributeTypedArgument>(constructorArgs.Length);
-                               ParameterInfo[] parameters = this.Constructor.GetParameters();
-                               for (int i = 0; i < constructorArgs.Length; i++)
-                               {
-                                       args.Add(RewrapValue(parameters[i].ParameterType, constructorArgs[i]));
-                               }
-                               return new CustomAttributeData(asm.ManifestModule, con, args, namedArgs);
-                       }
-               }
-
-               private static CustomAttributeTypedArgument RewrapValue(Type type, object value)
-               {
-                       if (value is Array)
-                       {
-                               Array array = (Array)value;
-                               Type arrayType = type.Module.universe.Import(array.GetType());
-                               return RewrapArray(arrayType, array);
-                       }
-                       else if (value is CustomAttributeTypedArgument)
-                       {
-                               CustomAttributeTypedArgument arg = (CustomAttributeTypedArgument)value;
-                               if (arg.Value is Array)
-                               {
-                                       return RewrapArray(arg.ArgumentType, (Array)arg.Value);
-                               }
-                               return arg;
-                       }
-                       else
-                       {
-                               return new CustomAttributeTypedArgument(type, value);
-                       }
-               }
-
-               private static CustomAttributeTypedArgument RewrapArray(Type arrayType, Array array)
-               {
-                       Type elementType = arrayType.GetElementType();
-                       CustomAttributeTypedArgument[] newArray = new CustomAttributeTypedArgument[array.Length];
-                       for (int i = 0; i < newArray.Length; i++)
-                       {
-                               newArray[i] = RewrapValue(elementType, array.GetValue(i));
-                       }
-                       return new CustomAttributeTypedArgument(arrayType, newArray);
-               }
-
-               internal bool HasBlob
-               {
-                       get { return blob != null; }
-               }
-
-               internal CustomAttributeBuilder DecodeBlob(Assembly asm)
-               {
-                       if (blob == null)
-                       {
-                               return this;
-                       }
-                       else
-                       {
-                               return ToData(asm).__ToBuilder();
-                       }
-               }
-
-               internal byte[] GetBlob(Assembly asm)
-               {
-                       ByteBuffer bb = new ByteBuffer(100);
-                       BlobWriter bw = new BlobWriter(asm, this, bb);
-                       bw.WriteCustomAttributeBlob();
-                       return bb.ToArray();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/CustomModifiersBuilder.cs b/mcs/class/IKVM.Reflection/Emit/CustomModifiersBuilder.cs
deleted file mode 100644 (file)
index 91f5b83..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-  Copyright (C) 2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class CustomModifiersBuilder
-       {
-               private readonly List<Item> list = new List<Item>();
-
-               internal struct Item
-               {
-                       internal Type type;
-                       internal bool required;
-               }
-
-               public void AddRequired(Type type)
-               {
-                       Item item;
-                       item.type = type;
-                       item.required = true;
-                       list.Add(item);
-               }
-
-               public void AddOptional(Type type)
-               {
-                       Item item;
-                       item.type = type;
-                       item.required = false;
-                       list.Add(item);
-               }
-
-               // this adds the custom modifiers in the same order as the normal SRE APIs
-               // (the advantage over using the SRE APIs is that a CustomModifiers object is slightly more efficient,
-               // because unlike the Type arrays it doesn't need to be copied)
-               public void Add(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       foreach (CustomModifiers.Entry entry in CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers))
-                       {
-                               Item item;
-                               item.type = entry.Type;
-                               item.required = entry.IsRequired;
-                               list.Add(item);
-                       }
-               }
-
-               public CustomModifiers Create()
-               {
-                       return new CustomModifiers(list);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/EnumBuilder.cs b/mcs/class/IKVM.Reflection/Emit/EnumBuilder.cs
deleted file mode 100644 (file)
index e93e7e7..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-  Copyright (C) 2010 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class EnumBuilder : TypeInfo
-       {
-               private readonly TypeBuilder typeBuilder;
-               private readonly FieldBuilder fieldBuilder;
-
-               internal EnumBuilder(TypeBuilder typeBuilder, FieldBuilder fieldBuilder)
-                       : base(typeBuilder)
-               {
-                       this.typeBuilder = typeBuilder;
-                       this.fieldBuilder = fieldBuilder;
-               }
-
-               public override string __Name
-               {
-                       get { return typeBuilder.__Name; }
-               }
-
-               public override string __Namespace
-               {
-                       get { return typeBuilder.__Namespace; }
-               }
-
-               public override string Name
-               {
-                       get { return typeBuilder.Name; }
-               }
-
-               public override string FullName
-               {
-                       get { return typeBuilder.FullName; }
-               }
-
-               public override Type BaseType
-               {
-                       get { return typeBuilder.BaseType; }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return typeBuilder.Attributes; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeBuilder.Module; }
-               }
-
-               public FieldBuilder DefineLiteral(string literalName, object literalValue)
-               {
-                       FieldBuilder fb = typeBuilder.DefineField(literalName, typeBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
-                       fb.SetConstant(literalValue);
-                       return fb;
-               }
-
-               public Type CreateType()
-               {
-                       return typeBuilder.CreateType();
-               }
-
-               public TypeToken TypeToken
-               {
-                       get { return typeBuilder.TypeToken; }
-               }
-
-               public FieldBuilder UnderlyingField
-               {
-                       get { return fieldBuilder; }
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       typeBuilder.SetCustomAttribute(con, binaryAttribute);
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       typeBuilder.SetCustomAttribute(customBuilder);
-               }
-
-               public override Type GetEnumUnderlyingType()
-               {
-                       return fieldBuilder.FieldType;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return typeBuilder.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/Enums.cs b/mcs/class/IKVM.Reflection/Emit/Enums.cs
deleted file mode 100644 (file)
index 7c85a55..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-
-namespace IKVM.Reflection.Emit
-{
-       public enum AssemblyBuilderAccess
-       {
-               Save = 2,
-               ReflectionOnly = 6,
-       }
-
-       public enum OpCodeType
-       {
-               Annotation = 0,
-               Macro = 1,
-               Nternal = 2,
-               Objmodel = 3,
-               Prefix = 4,
-               Primitive = 5,
-       }
-       
-       public enum OperandType
-       {
-               InlineBrTarget = 0,
-               InlineField = 1,
-               InlineI = 2,
-               InlineI8 = 3,
-               InlineMethod = 4,
-               InlineNone = 5,
-               InlinePhi = 6,
-               InlineR = 7,
-               InlineSig = 9,
-               InlineString = 10,
-               InlineSwitch = 11,
-               InlineTok = 12,
-               InlineType = 13,
-               InlineVar = 14,
-               ShortInlineBrTarget = 15,
-               ShortInlineI = 16,
-               ShortInlineR = 17,
-               ShortInlineVar = 18,
-       }
-
-       public enum FlowControl
-       {
-               Branch = 0,
-               Break = 1,
-               Call = 2,
-               Cond_Branch = 3,
-               Meta = 4,
-               Next = 5,
-               Return = 7,
-               Throw = 8,
-       }
-
-       public enum PackingSize
-       {
-               Unspecified = 0,
-               Size1 = 1,
-               Size2 = 2,
-               Size4 = 4,
-               Size8 = 8,
-               Size16 = 16,
-               Size32 = 32,
-               Size64 = 64,
-               Size128 = 128,
-       }
-
-       public enum PEFileKinds
-       {
-               Dll = 1,
-               ConsoleApplication = 2,
-               WindowApplication = 3,
-       }
-
-       public enum StackBehaviour
-       {
-               Pop0 = 0,
-               Pop1 = 1,
-               Pop1_pop1 = 2,
-               Popi = 3,
-               Popi_pop1 = 4,
-               Popi_popi = 5,
-               Popi_popi8 = 6,
-               Popi_popi_popi = 7,
-               Popi_popr4 = 8,
-               Popi_popr8 = 9,
-               Popref = 10,
-               Popref_pop1 = 11,
-               Popref_popi = 12,
-               Popref_popi_popi = 13,
-               Popref_popi_popi8 = 14,
-               Popref_popi_popr4 = 15,
-               Popref_popi_popr8 = 16,
-               Popref_popi_popref = 17,
-               Push0 = 18,
-               Push1 = 19,
-               Push1_push1 = 20,
-               Pushi = 21,
-               Pushi8 = 22,
-               Pushr4 = 23,
-               Pushr8 = 24,
-               Pushref = 25,
-               Varpop = 26,
-               Varpush = 27,
-               Popref_popi_pop1 = 28,
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/EventBuilder.cs b/mcs/class/IKVM.Reflection/Emit/EventBuilder.cs
deleted file mode 100644 (file)
index 6e98d37..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class EventBuilder : EventInfo
-       {
-               private readonly TypeBuilder typeBuilder;
-               private readonly string name;
-               private EventAttributes attributes;
-               private readonly int eventtype;
-               private MethodBuilder addOnMethod;
-               private MethodBuilder removeOnMethod;
-               private MethodBuilder fireMethod;
-               private readonly List<Accessor> accessors = new List<Accessor>();
-               private int lazyPseudoToken;
-
-               private struct Accessor
-               {
-                       internal short Semantics;
-                       internal MethodBuilder Method;
-               }
-
-               internal EventBuilder(TypeBuilder typeBuilder, string name, EventAttributes attributes, Type eventtype)
-               {
-                       this.typeBuilder = typeBuilder;
-                       this.name = name;
-                       this.attributes = attributes;
-                       this.eventtype = typeBuilder.ModuleBuilder.GetTypeTokenForMemberRef(eventtype);
-               }
-
-               public void SetAddOnMethod(MethodBuilder mdBuilder)
-               {
-                       addOnMethod = mdBuilder;
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.AddOn;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void SetRemoveOnMethod(MethodBuilder mdBuilder)
-               {
-                       removeOnMethod = mdBuilder;
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.RemoveOn;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void SetRaiseMethod(MethodBuilder mdBuilder)
-               {
-                       fireMethod = mdBuilder;
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.Fire;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void AddOtherMethod(MethodBuilder mdBuilder)
-               {
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.Other;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       Universe u = typeBuilder.ModuleBuilder.universe;
-                       if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
-                       {
-                               attributes |= EventAttributes.SpecialName;
-                       }
-                       else
-                       {
-                               if (lazyPseudoToken == 0)
-                               {
-                                       lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
-                               }
-                               typeBuilder.ModuleBuilder.SetCustomAttribute(lazyPseudoToken, customBuilder);
-                       }
-               }
-
-               public override EventAttributes Attributes
-               {
-                       get { return attributes; }
-               }
-
-               public override MethodInfo GetAddMethod(bool nonPublic)
-               {
-                       return nonPublic || (addOnMethod != null && addOnMethod.IsPublic) ? addOnMethod : null;
-               }
-
-               public override MethodInfo GetRemoveMethod(bool nonPublic)
-               {
-                       return nonPublic || (removeOnMethod != null && removeOnMethod.IsPublic) ? removeOnMethod : null;
-               }
-
-               public override MethodInfo GetRaiseMethod(bool nonPublic)
-               {
-                       return nonPublic || (fireMethod != null && fireMethod.IsPublic) ? fireMethod : null;
-               }
-
-               public override MethodInfo[] GetOtherMethods(bool nonPublic)
-               {
-                       List<MethodInfo> list = new List<MethodInfo>();
-                       foreach (Accessor acc in accessors)
-                       {
-                               if (acc.Semantics == MethodSemanticsTable.Other && (nonPublic || acc.Method.IsPublic))
-                               {
-                                       list.Add(acc.Method);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public override MethodInfo[] __GetMethods()
-               {
-                       List<MethodInfo> list = new List<MethodInfo>();
-                       foreach (Accessor acc in accessors)
-                       {
-                               list.Add(acc.Method);
-                       }
-                       return list.ToArray();
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeBuilder; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeBuilder.ModuleBuilder; }
-               }
-
-               public EventToken GetEventToken()
-               {
-                       if (lazyPseudoToken == 0)
-                       {
-                               lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
-                       }
-                       return new EventToken(lazyPseudoToken);
-               }
-
-               public override Type EventHandlerType
-               {
-                       get { return typeBuilder.ModuleBuilder.ResolveType(eventtype); }
-               }
-
-               internal void Bake()
-               {
-                       EventTable.Record rec = new EventTable.Record();
-                       rec.EventFlags = (short)attributes;
-                       rec.Name = typeBuilder.ModuleBuilder.Strings.Add(name);
-                       rec.EventType = eventtype;
-                       int token = 0x14000000 | typeBuilder.ModuleBuilder.Event.AddRecord(rec);
-
-                       if (lazyPseudoToken == 0)
-                       {
-                               lazyPseudoToken = token;
-                       }
-                       else
-                       {
-                               typeBuilder.ModuleBuilder.RegisterTokenFixup(lazyPseudoToken, token);
-                       }
-
-                       foreach (Accessor acc in accessors)
-                       {
-                               AddMethodSemantics(acc.Semantics, acc.Method.MetadataToken, token);
-                       }
-               }
-
-               private void AddMethodSemantics(short semantics, int methodToken, int propertyToken)
-               {
-                       MethodSemanticsTable.Record rec = new MethodSemanticsTable.Record();
-                       rec.Semantics = semantics;
-                       rec.Method = methodToken;
-                       rec.Association = propertyToken;
-                       typeBuilder.ModuleBuilder.MethodSemantics.AddRecord(rec);
-               }
-
-               internal override bool IsPublic
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if (acc.Method.IsPublic)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if ((acc.Method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsStatic
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if (acc.Method.IsStatic)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return typeBuilder.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       if (typeBuilder.ModuleBuilder.IsSaved && typeBuilder.ModuleBuilder.IsPseudoToken(lazyPseudoToken))
-                       {
-                               return typeBuilder.ModuleBuilder.ResolvePseudoToken(lazyPseudoToken);
-                       }
-                       else
-                       {
-                               return lazyPseudoToken;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/FieldBuilder.cs b/mcs/class/IKVM.Reflection/Emit/FieldBuilder.cs
deleted file mode 100644 (file)
index cbee210..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class FieldBuilder : FieldInfo
-       {
-               private readonly TypeBuilder typeBuilder;
-               private readonly string name;
-               private readonly int pseudoToken;
-               private FieldAttributes attribs;
-               private readonly int nameIndex;
-               private readonly int signature;
-               private readonly FieldSignature fieldSig;
-
-               internal FieldBuilder(TypeBuilder type, string name, Type fieldType, CustomModifiers customModifiers, FieldAttributes attribs)
-               {
-                       this.typeBuilder = type;
-                       this.name = name;
-                       this.pseudoToken = type.ModuleBuilder.AllocPseudoToken();
-                       this.nameIndex = type.ModuleBuilder.Strings.Add(name);
-                       this.fieldSig = FieldSignature.Create(fieldType, customModifiers);
-                       ByteBuffer sig = new ByteBuffer(5);
-                       fieldSig.WriteSig(this.typeBuilder.ModuleBuilder, sig);
-                       this.signature = this.typeBuilder.ModuleBuilder.Blobs.Add(sig);
-                       this.attribs = attribs;
-                       this.typeBuilder.ModuleBuilder.Field.AddVirtualRecord();
-               }
-
-               public void SetConstant(object defaultValue)
-               {
-                       attribs |= FieldAttributes.HasDefault;
-                       typeBuilder.ModuleBuilder.AddConstant(pseudoToken, defaultValue);
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       if (!typeBuilder.IsCreated())
-                       {
-                               // the .NET FieldBuilder doesn't support this method
-                               // (since we dont' have a different FieldInfo object after baking, we will support it once we're baked)
-                               throw new NotSupportedException();
-                       }
-                       return typeBuilder.Module.Constant.GetRawConstantValue(typeBuilder.Module, GetCurrentToken());
-               }
-
-               public void __SetDataAndRVA(byte[] data)
-               {
-                       SetDataAndRvaImpl(data, typeBuilder.ModuleBuilder.initializedData, 0);
-               }
-
-               public void __SetReadOnlyDataAndRVA(byte[] data)
-               {
-                       SetDataAndRvaImpl(data, typeBuilder.ModuleBuilder.methodBodies, unchecked((int)0x80000000));
-               }
-
-               private void SetDataAndRvaImpl(byte[] data, ByteBuffer bb, int readonlyMarker)
-               {
-                       attribs |= FieldAttributes.HasFieldRVA;
-                       FieldRVATable.Record rec = new FieldRVATable.Record();
-                       bb.Align(8);
-                       rec.RVA = bb.Position + readonlyMarker;
-                       rec.Field = pseudoToken;
-                       typeBuilder.ModuleBuilder.FieldRVA.AddRecord(rec);
-                       bb.Write(data);
-               }
-
-               public override void __GetDataFromRVA(byte[] data, int offset, int length)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override int __FieldRVA
-               {
-                       get { throw new NotImplementedException(); }
-               }
-
-               public override bool __TryGetFieldOffset(out int offset)
-               {
-                       int pseudoTokenOrIndex = pseudoToken;
-                       if (typeBuilder.ModuleBuilder.IsSaved)
-                       {
-                               pseudoTokenOrIndex = typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken) & 0xFFFFFF;
-                       }
-                       foreach (int i in this.Module.FieldLayout.Filter(pseudoTokenOrIndex))
-                       {
-                               offset = this.Module.FieldLayout.records[i].Offset;
-                               return true;
-                       }
-                       offset = 0;
-                       return false;
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       Universe u = this.Module.universe;
-                       if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_FieldOffsetAttribute)
-                       {
-                               customBuilder = customBuilder.DecodeBlob(this.Module.Assembly);
-                               SetOffset((int)customBuilder.GetConstructorArgument(0));
-                       }
-                       else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
-                       {
-                               FieldMarshal.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
-                               attribs |= FieldAttributes.HasFieldMarshal;
-                       }
-                       else if (customBuilder.Constructor.DeclaringType == u.System_NonSerializedAttribute)
-                       {
-                               attribs |= FieldAttributes.NotSerialized;
-                       }
-                       else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
-                       {
-                               attribs |= FieldAttributes.SpecialName;
-                       }
-                       else
-                       {
-                               typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
-                       }
-               }
-
-               public void SetOffset(int iOffset)
-               {
-                       FieldLayoutTable.Record rec = new FieldLayoutTable.Record();
-                       rec.Offset = iOffset;
-                       rec.Field = pseudoToken;
-                       typeBuilder.ModuleBuilder.FieldLayout.AddRecord(rec);
-               }
-
-               public override FieldAttributes Attributes
-               {
-                       get { return attribs; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeBuilder.IsModulePseudoType ? null : typeBuilder; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return pseudoToken; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeBuilder.Module; }
-               }
-
-               public FieldToken GetToken()
-               {
-                       return new FieldToken(pseudoToken);
-               }
-
-               internal void WriteFieldRecords(MetadataWriter mw)
-               {
-                       mw.Write((short)attribs);
-                       mw.WriteStringIndex(nameIndex);
-                       mw.WriteBlobIndex(signature);
-               }
-
-               internal void FixupToken(int token)
-               {
-                       typeBuilder.ModuleBuilder.RegisterTokenFixup(this.pseudoToken, token);
-               }
-
-               internal override FieldSignature FieldSignature
-               {
-                       get { return fieldSig; }
-               }
-
-               internal override int ImportTo(ModuleBuilder other)
-               {
-                       return other.ImportMethodOrField(typeBuilder, name, fieldSig);
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       if (typeBuilder.ModuleBuilder.IsSaved)
-                       {
-                               return typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken);
-                       }
-                       else
-                       {
-                               return pseudoToken;
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return typeBuilder.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs b/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs
deleted file mode 100644 (file)
index 7fddd7b..0000000
+++ /dev/null
@@ -1,1178 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Collections.Generic;
-using System.Diagnostics.SymbolStore;
-using System.Diagnostics;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public struct Label
-       {
-               // 1-based here, to make sure that an uninitialized Label isn't valid
-               private readonly int index1;
-
-               internal Label(int index)
-               {
-                       this.index1 = index + 1;
-               }
-
-               internal int Index
-               {
-                       get { return index1 - 1; }
-               }
-
-               public bool Equals(Label other)
-               {
-                       return other.index1 == index1;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return this == obj as Label?;
-               }
-
-               public override int GetHashCode()
-               {
-                       return index1;
-               }
-
-               public static bool operator ==(Label arg1, Label arg2)
-               {
-                       return arg1.index1 == arg2.index1;
-               }
-
-               public static bool operator !=(Label arg1, Label arg2)
-               {
-                       return !(arg1 == arg2);
-               }
-       }
-
-       public sealed class LocalBuilder
-       {
-               private readonly Type localType;
-               private readonly int index;
-               private readonly bool pinned;
-               internal string name;
-               internal int startOffset;
-               internal int endOffset;
-
-               internal LocalBuilder(Type localType, int index, bool pinned)
-               {
-                       this.localType = localType;
-                       this.index = index;
-                       this.pinned = pinned;
-               }
-
-               public void SetLocalSymInfo(string name)
-               {
-                       this.name = name;
-               }
-
-               public void SetLocalSymInfo(string name, int startOffset, int endOffset)
-               {
-                       this.name = name;
-                       this.startOffset = startOffset;
-                       this.endOffset = endOffset;
-               }
-
-               public Type LocalType
-               {
-                       get { return localType; }
-               }
-
-               public int LocalIndex
-               {
-                       get { return index; }
-               }
-
-               public bool IsPinned
-               {
-                       get { return pinned; }
-               }
-       }
-
-       public sealed class ILGenerator
-       {
-               private readonly ModuleBuilder moduleBuilder;
-               private readonly ByteBuffer code;
-               private readonly SignatureHelper locals;
-               private int localsCount;
-               private readonly List<int> tokenFixups = new List<int>();
-               private readonly List<int> labels = new List<int>();
-               private readonly List<int> labelStackHeight = new List<int>();
-               private readonly List<LabelFixup> labelFixups = new List<LabelFixup>();
-               private readonly List<SequencePoint> sequencePoints = new List<SequencePoint>();
-               private readonly List<ExceptionBlock> exceptions = new List<ExceptionBlock>();
-               private readonly Stack<ExceptionBlock> exceptionStack = new Stack<ExceptionBlock>();
-               private ushort maxStack;
-               private bool fatHeader;
-               private int stackHeight;
-               private Scope scope;
-               private byte exceptionBlockAssistanceMode = EBAM_COMPAT;
-               private const byte EBAM_COMPAT = 0;
-               private const byte EBAM_DISABLE = 1;
-               private const byte EBAM_CLEVER = 2;
-
-               private struct LabelFixup
-               {
-                       internal int label;
-                       internal int offset;
-               }
-
-               private sealed class ExceptionBlock : IComparer<ExceptionBlock>
-               {
-                       internal readonly int ordinal;
-                       internal Label labelEnd;
-                       internal int tryOffset;
-                       internal int tryLength;
-                       internal int handlerOffset;
-                       internal int handlerLength;
-                       internal Type exceptionType;    // MarkerType.Finally = finally block, MarkerType.Filter = handler with filter, MarkerType.Fault = fault block
-                       internal int filterOffset;
-
-                       internal ExceptionBlock(int ordinal)
-                       {
-                               this.ordinal = ordinal;
-                       }
-
-                       int IComparer<ExceptionBlock>.Compare(ExceptionBlock x, ExceptionBlock y)
-                       {
-                               // Mono's sort insists on doing unnecessary comparisons
-                               if (x == y)
-                               {
-                                       return 0;
-                               }
-                               else if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
-                               {
-                                       return x.ordinal < y.ordinal ? -1 : 1;
-                               }
-                               else if (x.tryOffset >= y.tryOffset && x.handlerOffset + x.handlerLength <= y.handlerOffset + y.handlerLength)
-                               {
-                                       return -1;
-                               }
-                               else if (y.tryOffset >= x.tryOffset && y.handlerOffset + y.handlerLength <= x.handlerOffset + x.handlerLength)
-                               {
-                                       return 1;
-                               }
-                               else
-                               {
-                                       return x.ordinal < y.ordinal ? -1 : 1;
-                               }
-                       }
-               }
-
-               private struct SequencePoint
-               {
-                       internal ISymbolDocumentWriter document;
-                       internal int offset;
-                       internal int startLine;
-                       internal int startColumn;
-                       internal int endLine;
-                       internal int endColumn;
-               }
-
-               private sealed class Scope
-               {
-                       internal readonly Scope parent;
-                       internal readonly List<Scope> children = new List<Scope>();
-                       internal readonly List<LocalBuilder> locals = new List<LocalBuilder>();
-                       internal int startOffset;
-                       internal int endOffset;
-
-                       internal Scope(Scope parent)
-                       {
-                               this.parent = parent;
-                       }
-               }
-
-               internal ILGenerator(ModuleBuilder moduleBuilder, int initialCapacity)
-               {
-                       this.code = new ByteBuffer(initialCapacity);
-                       this.moduleBuilder = moduleBuilder;
-                       this.locals = SignatureHelper.GetLocalVarSigHelper(moduleBuilder);
-                       if (moduleBuilder.symbolWriter != null)
-                       {
-                               scope = new Scope(null);
-                       }
-               }
-
-               // non-standard API
-               public void __DisableExceptionBlockAssistance()
-               {
-                       exceptionBlockAssistanceMode = EBAM_DISABLE;
-               }
-
-               // non-standard API
-               public void __CleverExceptionBlockAssistance()
-               {
-                       exceptionBlockAssistanceMode = EBAM_CLEVER;
-               }
-
-               // non-standard API
-               public int __MaxStackSize
-               {
-                       get { return maxStack; }
-                       set
-                       {
-                               maxStack = (ushort)value;
-                               fatHeader = true;
-                       }
-               }
-
-               // non-standard API
-               // returns -1 if the current position is currently unreachable
-               public int __StackHeight
-               {
-                       get { return stackHeight; }
-               }
-
-               // new in .NET 4.0
-               public int ILOffset
-               {
-                       get { return code.Position; }
-               }
-
-               public void BeginCatchBlock(Type exceptionType)
-               {
-                       ExceptionBlock block = exceptionStack.Peek();
-                       if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
-                       {
-                               if (exceptionType == null)
-                               {
-                                       Emit(OpCodes.Endfilter);
-                               }
-                               else
-                               {
-                                       Emit(OpCodes.Leave, block.labelEnd);
-                               }
-                       }
-                       stackHeight = 0;
-                       UpdateStack(1);
-                       if (exceptionType == null)
-                       {
-                               if (block.exceptionType != MarkerType.Filter || block.handlerOffset != 0)
-                               {
-                                       throw new ArgumentNullException("exceptionType");
-                               }
-                               block.handlerOffset = code.Position;
-                       }
-                       else
-                       {
-                               if (block.tryLength == 0)
-                               {
-                                       block.tryLength = code.Position - block.tryOffset;
-                               }
-                               else
-                               {
-                                       block.handlerLength = code.Position - block.handlerOffset;
-                                       exceptionStack.Pop();
-                                       ExceptionBlock newBlock = new ExceptionBlock(exceptions.Count);
-                                       newBlock.labelEnd = block.labelEnd;
-                                       newBlock.tryOffset = block.tryOffset;
-                                       newBlock.tryLength = block.tryLength;
-                                       block = newBlock;
-                                       exceptions.Add(block);
-                                       exceptionStack.Push(block);
-                               }
-                               block.exceptionType = exceptionType;
-                               if (exceptionType == MarkerType.Filter)
-                               {
-                                       block.filterOffset = code.Position;
-                               }
-                               else
-                               {
-                                       block.handlerOffset = code.Position;
-                               }
-                       }
-               }
-
-               public Label BeginExceptionBlock()
-               {
-                       ExceptionBlock block = new ExceptionBlock(exceptions.Count);
-                       block.labelEnd = DefineLabel();
-                       block.tryOffset = code.Position;
-                       exceptionStack.Push(block);
-                       exceptions.Add(block);
-                       stackHeight = 0;
-                       return block.labelEnd;
-               }
-
-               public void BeginExceptFilterBlock()
-               {
-                       BeginCatchBlock(MarkerType.Filter);
-               }
-
-               public void BeginFaultBlock()
-               {
-                       BeginFinallyFaultBlock(MarkerType.Fault);
-               }
-
-               public void BeginFinallyBlock()
-               {
-                       BeginFinallyFaultBlock(MarkerType.Finally);
-               }
-
-               private void BeginFinallyFaultBlock(Type type)
-               {
-                       ExceptionBlock block = exceptionStack.Peek();
-                       if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
-                       {
-                               Emit(OpCodes.Leave, block.labelEnd);
-                       }
-                       if (block.handlerOffset == 0)
-                       {
-                               block.tryLength = code.Position - block.tryOffset;
-                       }
-                       else
-                       {
-                               block.handlerLength = code.Position - block.handlerOffset;
-                               Label labelEnd;
-                               if (exceptionBlockAssistanceMode != EBAM_COMPAT)
-                               {
-                                       labelEnd = block.labelEnd;
-                               }
-                               else
-                               {
-                                       MarkLabel(block.labelEnd);
-                                       labelEnd = DefineLabel();
-                                       Emit(OpCodes.Leave, labelEnd);
-                               }
-                               exceptionStack.Pop();
-                               ExceptionBlock newBlock = new ExceptionBlock(exceptions.Count);
-                               newBlock.labelEnd = labelEnd;
-                               newBlock.tryOffset = block.tryOffset;
-                               newBlock.tryLength = code.Position - block.tryOffset;
-                               block = newBlock;
-                               exceptions.Add(block);
-                               exceptionStack.Push(block);
-                       }
-                       block.handlerOffset = code.Position;
-                       block.exceptionType = type;
-                       stackHeight = 0;
-               }
-
-               public void EndExceptionBlock()
-               {
-                       ExceptionBlock block = exceptionStack.Pop();
-                       if (exceptionBlockAssistanceMode == EBAM_COMPAT || (exceptionBlockAssistanceMode == EBAM_CLEVER && stackHeight != -1))
-                       {
-                               if (block.filterOffset != 0 || (block.exceptionType != MarkerType.Finally && block.exceptionType != MarkerType.Fault))
-                               {
-                                       Emit(OpCodes.Leave, block.labelEnd);
-                               }
-                               else
-                               {
-                                       Emit(OpCodes.Endfinally);
-                               }
-                       }
-                       MarkLabel(block.labelEnd);
-                       block.handlerLength = code.Position - block.handlerOffset;
-               }
-
-               public void BeginScope()
-               {
-                       Scope newScope = new Scope(scope);
-                       scope.children.Add(newScope);
-                       scope = newScope;
-                       scope.startOffset = code.Position;
-               }
-
-               public void UsingNamespace(string usingNamespace)
-               {
-                       if (moduleBuilder.symbolWriter != null)
-                       {
-                               moduleBuilder.symbolWriter.UsingNamespace(usingNamespace);
-                       }
-               }
-
-               public LocalBuilder DeclareLocal(Type localType)
-               {
-                       return DeclareLocal(localType, false);
-               }
-
-               public LocalBuilder DeclareLocal(Type localType, bool pinned)
-               {
-                       LocalBuilder local = new LocalBuilder(localType, localsCount++, pinned);
-                       locals.AddArgument(localType, pinned);
-                       if (scope != null)
-                       {
-                               scope.locals.Add(local);
-                       }
-                       return local;
-               }
-
-               public LocalBuilder __DeclareLocal(Type localType, bool pinned, CustomModifiers customModifiers)
-               {
-                       LocalBuilder local = new LocalBuilder(localType, localsCount++, pinned);
-                       locals.__AddArgument(localType, pinned, customModifiers);
-                       if (scope != null)
-                       {
-                               scope.locals.Add(local);
-                       }
-                       return local;
-               }
-
-               public Label DefineLabel()
-               {
-                       Label label = new Label(labels.Count);
-                       labels.Add(-1);
-                       labelStackHeight.Add(-1);
-                       return label;
-               }
-
-               public void Emit(OpCode opc)
-               {
-                       Debug.Assert(opc != OpCodes.Ret || (opc == OpCodes.Ret && stackHeight <= 1));
-                       if (opc.Value < 0)
-                       {
-                               code.Write((byte)(opc.Value >> 8));
-                       }
-                       code.Write((byte)opc.Value);
-                       switch (opc.FlowControl)
-                       {
-                               case FlowControl.Branch:
-                               case FlowControl.Break:
-                               case FlowControl.Return:
-                               case FlowControl.Throw:
-                                       stackHeight = -1;
-                                       break;
-                               default:
-                                       UpdateStack(opc.StackDiff);
-                                       break;
-                       }
-               }
-
-               private void UpdateStack(int stackdiff)
-               {
-                       if (stackHeight == -1)
-                       {
-                               // we're about to emit code that is either unreachable or reachable only via a backward branch
-                               stackHeight = 0;
-                       }
-                       Debug.Assert(stackHeight >= 0 && stackHeight <= ushort.MaxValue);
-                       stackHeight += stackdiff;
-                       Debug.Assert(stackHeight >= 0 && stackHeight <= ushort.MaxValue);
-                       maxStack = Math.Max(maxStack, (ushort)stackHeight);
-               }
-
-               public void Emit(OpCode opc, byte arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, double arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, FieldInfo field)
-               {
-                       Emit(opc);
-                       WriteToken(moduleBuilder.GetFieldToken(field));
-               }
-
-               public void Emit(OpCode opc, short arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, int arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, long arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, Label label)
-               {
-                       // We need special stackHeight handling for unconditional branches,
-                       // because the branch and next flows have differing stack heights.
-                       // Note that this assumes that unconditional branches do not push/pop.
-                       int flowStackHeight = this.stackHeight;
-                       Emit(opc);
-                       if (opc == OpCodes.Leave || opc == OpCodes.Leave_S)
-                       {
-                               flowStackHeight = 0;
-                       }
-                       else if (opc.FlowControl != FlowControl.Branch)
-                       {
-                               flowStackHeight = this.stackHeight;
-                       }
-                       // if the label has already been marked, we can emit the branch offset directly
-                       if (labels[label.Index] != -1)
-                       {
-                               if (labelStackHeight[label.Index] != flowStackHeight && (labelStackHeight[label.Index] != 0 || flowStackHeight != -1))
-                               {
-                                       // the "backward branch constraint" prohibits this, so we don't need to support it
-                                       throw new NotSupportedException("'Backward branch constraints' violated");
-                               }
-                               if (opc.OperandType == OperandType.ShortInlineBrTarget)
-                               {
-                                       WriteByteBranchOffset(labels[label.Index] - (code.Position + 1));
-                               }
-                               else
-                               {
-                                       code.Write(labels[label.Index] - (code.Position + 4));
-                               }
-                       }
-                       else
-                       {
-                               Debug.Assert(labelStackHeight[label.Index] == -1 || labelStackHeight[label.Index] == flowStackHeight || (flowStackHeight == -1 && labelStackHeight[label.Index] == 0));
-                               labelStackHeight[label.Index] = flowStackHeight;
-                               LabelFixup fix = new LabelFixup();
-                               fix.label = label.Index;
-                               fix.offset = code.Position;
-                               labelFixups.Add(fix);
-                               if (opc.OperandType == OperandType.ShortInlineBrTarget)
-                               {
-                                       code.Write((byte)1);
-                               }
-                               else
-                               {
-                                       code.Write(4);
-                               }
-                       }
-               }
-
-               private void WriteByteBranchOffset(int offset)
-               {
-                       if (offset < -128 || offset > 127)
-                       {
-                               throw new NotSupportedException("Branch offset of " + offset + " does not fit in one-byte branch target at position " + code.Position);
-                       }
-                       code.Write((byte)offset);
-               }
-
-               public void Emit(OpCode opc, Label[] labels)
-               {
-                       Emit(opc);
-                       LabelFixup fix = new LabelFixup();
-                       fix.label = -1;
-                       fix.offset = code.Position;
-                       labelFixups.Add(fix);
-                       code.Write(labels.Length);
-                       foreach (Label label in labels)
-                       {
-                               code.Write(label.Index);
-                               if (this.labels[label.Index] != -1)
-                               {
-                                       if (labelStackHeight[label.Index] != stackHeight)
-                                       {
-                                               // the "backward branch constraint" prohibits this, so we don't need to support it
-                                               throw new NotSupportedException();
-                                       }
-                               }
-                               else
-                               {
-                                       Debug.Assert(labelStackHeight[label.Index] == -1 || labelStackHeight[label.Index] == stackHeight);
-                                       labelStackHeight[label.Index] = stackHeight;
-                               }
-                       }
-               }
-
-               public void Emit(OpCode opc, LocalBuilder local)
-               {
-                       if ((opc == OpCodes.Ldloc || opc == OpCodes.Ldloca || opc == OpCodes.Stloc) && local.LocalIndex < 256)
-                       {
-                               if (opc == OpCodes.Ldloc)
-                               {
-                                       switch (local.LocalIndex)
-                                       {
-                                               case 0:
-                                                       Emit(OpCodes.Ldloc_0);
-                                                       break;
-                                               case 1:
-                                                       Emit(OpCodes.Ldloc_1);
-                                                       break;
-                                               case 2:
-                                                       Emit(OpCodes.Ldloc_2);
-                                                       break;
-                                               case 3:
-                                                       Emit(OpCodes.Ldloc_3);
-                                                       break;
-                                               default:
-                                                       Emit(OpCodes.Ldloc_S);
-                                                       code.Write((byte)local.LocalIndex);
-                                                       break;
-                                       }
-                               }
-                               else if (opc == OpCodes.Ldloca)
-                               {
-                                       Emit(OpCodes.Ldloca_S);
-                                       code.Write((byte)local.LocalIndex);
-                               }
-                               else if (opc == OpCodes.Stloc)
-                               {
-                                       switch (local.LocalIndex)
-                                       {
-                                               case 0:
-                                                       Emit(OpCodes.Stloc_0);
-                                                       break;
-                                               case 1:
-                                                       Emit(OpCodes.Stloc_1);
-                                                       break;
-                                               case 2:
-                                                       Emit(OpCodes.Stloc_2);
-                                                       break;
-                                               case 3:
-                                                       Emit(OpCodes.Stloc_3);
-                                                       break;
-                                               default:
-                                                       Emit(OpCodes.Stloc_S);
-                                                       code.Write((byte)local.LocalIndex);
-                                                       break;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               Emit(opc);
-                               switch (opc.OperandType)
-                               {
-                                       case OperandType.InlineVar:
-                                               code.Write((ushort)local.LocalIndex);
-                                               break;
-                                       case OperandType.ShortInlineVar:
-                                               code.Write((byte)local.LocalIndex);
-                                               break;
-                               }
-                       }
-               }
-
-               private void WriteToken(FieldToken token)
-               {
-                       if (token.IsPseudoToken)
-                       {
-                               tokenFixups.Add(code.Position);
-                       }
-                       code.Write(token.Token);
-               }
-
-               private void WriteToken(MethodToken token)
-               {
-                       if (token.IsPseudoToken)
-                       {
-                               tokenFixups.Add(code.Position);
-                       }
-                       code.Write(token.Token);
-               }
-
-               private void UpdateStack(OpCode opc, bool hasthis, Type returnType, int parameterCount)
-               {
-                       if (opc == OpCodes.Jmp)
-                       {
-                               stackHeight = -1;
-                       }
-                       else if (opc.FlowControl == FlowControl.Call)
-                       {
-                               int stackdiff = 0;
-                               if ((hasthis && opc != OpCodes.Newobj) || opc == OpCodes.Calli)
-                               {
-                                       // pop this
-                                       stackdiff--;
-                               }
-                               // pop parameters
-                               stackdiff -= parameterCount;
-                               if (returnType != moduleBuilder.universe.System_Void)
-                               {
-                                       // push return value
-                                       stackdiff++;
-                               }
-                               UpdateStack(stackdiff);
-                       }
-               }
-
-               public void Emit(OpCode opc, MethodInfo method)
-               {
-                       UpdateStack(opc, method.HasThis, method.ReturnType, method.ParameterCount);
-                       Emit(opc);
-                       WriteToken(moduleBuilder.GetMethodTokenForIL(method));
-               }
-
-               public void Emit(OpCode opc, ConstructorInfo constructor)
-               {
-                       Emit(opc, constructor.GetMethodInfo());
-               }
-
-               public void Emit(OpCode opc, sbyte arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, float arg)
-               {
-                       Emit(opc);
-                       code.Write(arg);
-               }
-
-               public void Emit(OpCode opc, string str)
-               {
-                       Emit(opc);
-                       code.Write(moduleBuilder.GetStringConstant(str).Token);
-               }
-
-               public void Emit(OpCode opc, Type type)
-               {
-                       Emit(opc);
-                       if (opc == OpCodes.Ldtoken)
-                       {
-                               code.Write(moduleBuilder.GetTypeToken(type).Token);
-                       }
-                       else
-                       {
-                               code.Write(moduleBuilder.GetTypeTokenForMemberRef(type));
-                       }
-               }
-
-               public void Emit(OpCode opcode, SignatureHelper signature)
-               {
-                       Emit(opcode);
-                       UpdateStack(opcode, signature.HasThis, signature.ReturnType, signature.ParameterCount);
-                       code.Write(moduleBuilder.GetSignatureToken(signature).Token);
-               }
-
-               public void EmitCall(OpCode opc, MethodInfo method, Type[] optionalParameterTypes)
-               {
-                       __EmitCall(opc, method, optionalParameterTypes, null);
-               }
-
-               public void __EmitCall(OpCode opc, MethodInfo method, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
-               {
-                       if (optionalParameterTypes == null || optionalParameterTypes.Length == 0)
-                       {
-                               Emit(opc, method);
-                       }
-                       else
-                       {
-                               Emit(opc);
-                               UpdateStack(opc, method.HasThis, method.ReturnType, method.ParameterCount + optionalParameterTypes.Length);
-                               code.Write(moduleBuilder.__GetMethodToken(method, optionalParameterTypes, customModifiers).Token);
-                       }
-               }
-
-               public void __EmitCall(OpCode opc, ConstructorInfo constructor, Type[] optionalParameterTypes)
-               {
-                       EmitCall(opc, constructor.GetMethodInfo(), optionalParameterTypes);
-               }
-
-               public void __EmitCall(OpCode opc, ConstructorInfo constructor, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
-               {
-                       __EmitCall(opc, constructor.GetMethodInfo(), optionalParameterTypes, customModifiers);
-               }
-
-               public void EmitCalli(OpCode opc, CallingConvention callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       SignatureHelper sig = SignatureHelper.GetMethodSigHelper(moduleBuilder, callingConvention, returnType);
-                       sig.AddArguments(parameterTypes, null, null);
-                       Emit(opc, sig);
-               }
-
-               public void EmitCalli(OpCode opc, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes)
-               {
-                       SignatureHelper sig = SignatureHelper.GetMethodSigHelper(moduleBuilder, callingConvention, returnType);
-                       sig.AddArguments(parameterTypes, null, null);
-                       sig.AddSentinel();
-                       sig.AddArguments(optionalParameterTypes, null, null);
-                       Emit(opc, sig);
-               }
-
-               public void __EmitCalli(OpCode opc, __StandAloneMethodSig sig)
-               {
-                       Emit(opc);
-                       if (sig.IsUnmanaged)
-                       {
-                               UpdateStack(opc, false, sig.ReturnType, sig.ParameterCount);
-                       }
-                       else
-                       {
-                               CallingConventions callingConvention = sig.CallingConvention;
-                               UpdateStack(opc, (callingConvention & CallingConventions.HasThis | CallingConventions.ExplicitThis) == CallingConventions.HasThis, sig.ReturnType, sig.ParameterCount);
-                       }
-                       ByteBuffer bb = new ByteBuffer(16);
-                       Signature.WriteStandAloneMethodSig(moduleBuilder, bb, sig);
-                       code.Write(0x11000000 | moduleBuilder.StandAloneSig.FindOrAddRecord(moduleBuilder.Blobs.Add(bb)));
-               }
-
-               public void EmitWriteLine(string text)
-               {
-                       Universe u = moduleBuilder.universe;
-                       Emit(OpCodes.Ldstr, text);
-                       Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("WriteLine", new Type[] { u.System_String }));
-               }
-
-               public void EmitWriteLine(FieldInfo field)
-               {
-                       Universe u = moduleBuilder.universe;
-                       Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("get_Out"));
-                       if (field.IsStatic)
-                       {
-                               Emit(OpCodes.Ldsfld, field);
-                       }
-                       else
-                       {
-                               Emit(OpCodes.Ldarg_0);
-                               Emit(OpCodes.Ldfld, field);
-                       }
-                       Emit(OpCodes.Callvirt, u.Import(typeof(System.IO.TextWriter)).GetMethod("WriteLine", new Type[] { field.FieldType }));
-               }
-
-               public void EmitWriteLine(LocalBuilder local)
-               {
-                       Universe u = moduleBuilder.universe;
-                       Emit(OpCodes.Call, u.Import(typeof(Console)).GetMethod("get_Out"));
-                       Emit(OpCodes.Ldloc, local);
-                       Emit(OpCodes.Callvirt, u.Import(typeof(System.IO.TextWriter)).GetMethod("WriteLine", new Type[] { local.LocalType }));
-               }
-
-               public void EndScope()
-               {
-                       scope.endOffset = code.Position;
-                       scope = scope.parent;
-               }
-
-               public void MarkLabel(Label loc)
-               {
-                       Debug.Assert(stackHeight == -1 || labelStackHeight[loc.Index] == -1 || stackHeight == labelStackHeight[loc.Index]);
-                       labels[loc.Index] = code.Position;
-                       if (labelStackHeight[loc.Index] == -1)
-                       {
-                               if (stackHeight == -1)
-                               {
-                                       // We're at a location that can only be reached by a backward branch,
-                                       // so according to the "backward branch constraint" that must mean the stack is empty,
-                                       // but note that this may be an unused label followed by another label that is used and
-                                       // that does have a non-zero stack height, so we don't yet set stackHeight here.
-                                       labelStackHeight[loc.Index] = 0;
-                               }
-                               else
-                               {
-                                       labelStackHeight[loc.Index] = stackHeight;
-                               }
-                       }
-                       else
-                       {
-                               Debug.Assert(stackHeight == -1 || stackHeight == labelStackHeight[loc.Index]);
-                               stackHeight = labelStackHeight[loc.Index];
-                       }
-               }
-
-               public void MarkSequencePoint(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn)
-               {
-                       SequencePoint sp = new SequencePoint();
-                       sp.document = document;
-                       sp.offset = code.Position;
-                       sp.startLine = startLine;
-                       sp.startColumn = startColumn;
-                       sp.endLine = endLine;
-                       sp.endColumn = endColumn;
-                       sequencePoints.Add(sp);
-               }
-
-               public void ThrowException(Type excType)
-               {
-                       Emit(OpCodes.Newobj, excType.GetConstructor(Type.EmptyTypes));
-                       Emit(OpCodes.Throw);
-               }
-
-               internal int WriteBody(bool initLocals)
-               {
-                       if (moduleBuilder.symbolWriter != null)
-                       {
-                               Debug.Assert(scope != null && scope.parent == null);
-                               scope.endOffset = code.Position;
-                       }
-
-                       ResolveBranches();
-
-                       ByteBuffer bb = moduleBuilder.methodBodies;
-
-                       int localVarSigTok = 0;
-
-                       int rva;
-                       if (localsCount == 0 && exceptions.Count == 0 && maxStack <= 8 && code.Length < 64 && !fatHeader)
-                       {
-                               rva = WriteTinyHeaderAndCode(bb);
-                       }
-                       else
-                       {
-                               rva = WriteFatHeaderAndCode(bb, ref localVarSigTok, initLocals);
-                       }
-
-                       if (moduleBuilder.symbolWriter != null)
-                       {
-                               if (sequencePoints.Count != 0)
-                               {
-                                       ISymbolDocumentWriter document = sequencePoints[0].document;
-                                       int[] offsets = new int[sequencePoints.Count];
-                                       int[] lines = new int[sequencePoints.Count];
-                                       int[] columns = new int[sequencePoints.Count];
-                                       int[] endLines = new int[sequencePoints.Count];
-                                       int[] endColumns = new int[sequencePoints.Count];
-                                       for (int i = 0; i < sequencePoints.Count; i++)
-                                       {
-                                               if (sequencePoints[i].document != document)
-                                               {
-                                                       throw new NotImplementedException();
-                                               }
-                                               offsets[i] = sequencePoints[i].offset;
-                                               lines[i] = sequencePoints[i].startLine;
-                                               columns[i] = sequencePoints[i].startColumn;
-                                               endLines[i] = sequencePoints[i].endLine;
-                                               endColumns[i] = sequencePoints[i].endColumn;
-                                       }
-                                       moduleBuilder.symbolWriter.DefineSequencePoints(document, offsets, lines, columns, endLines, endColumns);
-                               }
-
-                               WriteScope(scope, localVarSigTok);
-                       }
-                       return rva;
-               }
-
-               private void ResolveBranches()
-               {
-                       foreach (LabelFixup fixup in labelFixups)
-                       {
-                               // is it a switch?
-                               if (fixup.label == -1)
-                               {
-                                       code.Position = fixup.offset;
-                                       int count = code.GetInt32AtCurrentPosition();
-                                       int offset = fixup.offset + 4 + 4 * count;
-                                       code.Position += 4;
-                                       for (int i = 0; i < count; i++)
-                                       {
-                                               int index = code.GetInt32AtCurrentPosition();
-                                               code.Write(labels[index] - offset);
-                                       }
-                               }
-                               else
-                               {
-                                       code.Position = fixup.offset;
-                                       byte size = code.GetByteAtCurrentPosition();
-                                       int branchOffset = labels[fixup.label] - (code.Position + size);
-                                       if (size == 1)
-                                       {
-                                               WriteByteBranchOffset(branchOffset);
-                                       }
-                                       else
-                                       {
-                                               code.Write(branchOffset);
-                                       }
-                               }
-                       }
-               }
-
-               private int WriteTinyHeaderAndCode(ByteBuffer bb)
-               {
-                       int rva = bb.Position;
-                       const byte CorILMethod_TinyFormat = 0x2;
-                       bb.Write((byte)(CorILMethod_TinyFormat | (code.Length << 2)));
-                       WriteCode(bb);
-                       return rva;
-               }
-
-               private int WriteFatHeaderAndCode(ByteBuffer bb, ref int localVarSigTok, bool initLocals)
-               {
-                       // fat headers require 4-byte alignment
-                       bb.Align(4);
-                       int rva = bb.Position;
-
-                       if (localsCount != 0)
-                       {
-                               localVarSigTok = moduleBuilder.GetSignatureToken(locals).Token;
-                       }
-
-                       const byte CorILMethod_FatFormat = 0x03;
-                       const byte CorILMethod_MoreSects = 0x08;
-                       const byte CorILMethod_InitLocals = 0x10;
-
-                       short flagsAndSize = (short)(CorILMethod_FatFormat | (3 << 12));
-                       if (initLocals)
-                       {
-                               flagsAndSize |= CorILMethod_InitLocals;
-                       }
-
-                       if (exceptions.Count > 0)
-                       {
-                               flagsAndSize |= CorILMethod_MoreSects;
-                       }
-
-                       bb.Write(flagsAndSize);
-                       bb.Write(maxStack);
-                       bb.Write(code.Length);
-                       bb.Write(localVarSigTok);
-
-                       WriteCode(bb);
-
-                       if (exceptions.Count > 0)
-                       {
-                               bb.Align(4);
-
-                               bool fat = false;
-                               foreach (ExceptionBlock block in exceptions)
-                               {
-                                       if (block.tryOffset > 65535 || block.tryLength > 255 || block.handlerOffset > 65535 || block.handlerLength > 255)
-                                       {
-                                               fat = true;
-                                               break;
-                                       }
-                               }
-                               exceptions.Sort(exceptions[0]);
-                               if (exceptions.Count * 12 + 4 > 255)
-                               {
-                                       fat = true;
-                               }
-                               const byte CorILMethod_Sect_EHTable = 0x1;
-                               const byte CorILMethod_Sect_FatFormat = 0x40;
-                               const short COR_ILEXCEPTION_CLAUSE_EXCEPTION = 0x0000;
-                               const short COR_ILEXCEPTION_CLAUSE_FILTER = 0x0001;
-                               const short COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002;
-                               const short COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004;
-
-                               if (fat)
-                               {
-                                       bb.Write((byte)(CorILMethod_Sect_EHTable | CorILMethod_Sect_FatFormat));
-                                       int dataSize = exceptions.Count * 24 + 4;
-                                       bb.Write((byte)dataSize);
-                                       bb.Write((short)(dataSize >> 8));
-                                       foreach (ExceptionBlock block in exceptions)
-                                       {
-                                               if (block.exceptionType == MarkerType.Fault)
-                                               {
-                                                       bb.Write((int)COR_ILEXCEPTION_CLAUSE_FAULT);
-                                               }
-                                               else if (block.exceptionType == MarkerType.Filter)
-                                               {
-                                                       bb.Write((int)COR_ILEXCEPTION_CLAUSE_FILTER);
-                                               }
-                                               else if (block.exceptionType == MarkerType.Finally)
-                                               {
-                                                       bb.Write((int)COR_ILEXCEPTION_CLAUSE_FINALLY);
-                                               }
-                                               else
-                                               {
-                                                       bb.Write((int)COR_ILEXCEPTION_CLAUSE_EXCEPTION);
-                                               }
-                                               bb.Write(block.tryOffset);
-                                               bb.Write(block.tryLength);
-                                               bb.Write(block.handlerOffset);
-                                               bb.Write(block.handlerLength);
-                                               if (block.exceptionType != MarkerType.Fault && block.exceptionType != MarkerType.Filter && block.exceptionType != MarkerType.Finally)
-                                               {
-                                                       bb.Write(moduleBuilder.GetTypeTokenForMemberRef(block.exceptionType));
-                                               }
-                                               else
-                                               {
-                                                       bb.Write(block.filterOffset);
-                                               }
-                                       }
-                               }
-                               else
-                               {
-                                       bb.Write(CorILMethod_Sect_EHTable);
-                                       bb.Write((byte)(exceptions.Count * 12 + 4));
-                                       bb.Write((short)0);
-                                       foreach (ExceptionBlock block in exceptions)
-                                       {
-                                               if (block.exceptionType == MarkerType.Fault)
-                                               {
-                                                       bb.Write(COR_ILEXCEPTION_CLAUSE_FAULT);
-                                               }
-                                               else if (block.exceptionType == MarkerType.Filter)
-                                               {
-                                                       bb.Write(COR_ILEXCEPTION_CLAUSE_FILTER);
-                                               }
-                                               else if (block.exceptionType == MarkerType.Finally)
-                                               {
-                                                       bb.Write(COR_ILEXCEPTION_CLAUSE_FINALLY);
-                                               }
-                                               else
-                                               {
-                                                       bb.Write(COR_ILEXCEPTION_CLAUSE_EXCEPTION);
-                                               }
-                                               bb.Write((short)block.tryOffset);
-                                               bb.Write((byte)block.tryLength);
-                                               bb.Write((short)block.handlerOffset);
-                                               bb.Write((byte)block.handlerLength);
-                                               if (block.exceptionType != MarkerType.Fault && block.exceptionType != MarkerType.Filter && block.exceptionType != MarkerType.Finally)
-                                               {
-                                                       bb.Write(moduleBuilder.GetTypeTokenForMemberRef(block.exceptionType));
-                                               }
-                                               else
-                                               {
-                                                       bb.Write(block.filterOffset);
-                                               }
-                                       }
-                               }
-                       }
-                       return rva;
-               }
-
-               private void WriteCode(ByteBuffer bb)
-               {
-                       int codeOffset = bb.Position;
-                       foreach (int fixup in this.tokenFixups)
-                       {
-                               moduleBuilder.tokenFixupOffsets.Add(fixup + codeOffset);
-                       }
-                       bb.Write(code);
-               }
-
-               private void WriteScope(Scope scope, int localVarSigTok)
-               {
-                       moduleBuilder.symbolWriter.OpenScope(scope.startOffset);
-                       foreach (LocalBuilder local in scope.locals)
-                       {
-                               if (local.name != null)
-                               {
-                                       int startOffset = local.startOffset;
-                                       int endOffset = local.endOffset;
-                                       if (startOffset == 0 && endOffset == 0)
-                                       {
-                                               startOffset = scope.startOffset;
-                                               endOffset = scope.endOffset;
-                                       }
-                                       moduleBuilder.symbolWriter.DefineLocalVariable2(local.name, 0, localVarSigTok, SymAddressKind.ILOffset, local.LocalIndex, 0, 0, startOffset, endOffset);
-                               }
-                       }
-                       foreach (Scope child in scope.children)
-                       {
-                               WriteScope(child, localVarSigTok);
-                       }
-                       moduleBuilder.symbolWriter.CloseScope(scope.endOffset);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/MethodBuilder.cs b/mcs/class/IKVM.Reflection/Emit/MethodBuilder.cs
deleted file mode 100644 (file)
index 89778ac..0000000
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using System.Diagnostics;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class MethodBuilder : MethodInfo
-       {
-               private readonly TypeBuilder typeBuilder;
-               private readonly string name;
-               private readonly int pseudoToken;
-               private int nameIndex;
-               private int signature;
-               private Type returnType;
-               private Type[] parameterTypes;
-               private PackedCustomModifiers customModifiers;
-               private MethodAttributes attributes;
-               private MethodImplAttributes implFlags;
-               private ILGenerator ilgen;
-               private int rva = -1;
-               private CallingConventions callingConvention;
-               private List<ParameterBuilder> parameters;
-               private GenericTypeParameterBuilder[] gtpb;
-               private List<CustomAttributeBuilder> declarativeSecurity;
-               private MethodSignature methodSignature;
-               private bool initLocals = true;
-
-               internal MethodBuilder(TypeBuilder typeBuilder, string name, MethodAttributes attributes, CallingConventions callingConvention)
-               {
-                       this.typeBuilder = typeBuilder;
-                       this.name = name;
-                       this.pseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
-                       this.attributes = attributes;
-                       if ((attributes & MethodAttributes.Static) == 0)
-                       {
-                               callingConvention |= CallingConventions.HasThis;
-                       }
-                       this.callingConvention = callingConvention;
-               }
-
-               public ILGenerator GetILGenerator()
-               {
-                       return GetILGenerator(16);
-               }
-
-               public ILGenerator GetILGenerator(int streamSize)
-               {
-                       if (rva != -1)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       if (ilgen == null)
-                       {
-                               ilgen = new ILGenerator(typeBuilder.ModuleBuilder, streamSize);
-                       }
-                       return ilgen;
-               }
-
-               public void __ReleaseILGenerator()
-               {
-                       if (ilgen != null)
-                       {
-                               if (this.ModuleBuilder.symbolWriter != null)
-                               {
-                                       this.ModuleBuilder.symbolWriter.OpenMethod(new SymbolToken(-pseudoToken | 0x06000000), this);
-                               }
-                               rva = ilgen.WriteBody(initLocals);
-                               if (this.ModuleBuilder.symbolWriter != null)
-                               {
-                                       this.ModuleBuilder.symbolWriter.CloseMethod();
-                               }
-                               ilgen = null;
-                       }
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               private void SetDllImportPseudoCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       CallingConvention? callingConvention = customBuilder.GetFieldValue<CallingConvention>("CallingConvention");
-                       CharSet? charSet = customBuilder.GetFieldValue<CharSet>("CharSet");
-                       SetDllImportPseudoCustomAttribute((string)customBuilder.GetConstructorArgument(0),
-                               (string)customBuilder.GetFieldValue("EntryPoint"),
-                               callingConvention,
-                               charSet,
-                               (bool?)customBuilder.GetFieldValue("BestFitMapping"),
-                               (bool?)customBuilder.GetFieldValue("ThrowOnUnmappableChar"),
-                               (bool?)customBuilder.GetFieldValue("SetLastError"),
-                               (bool?)customBuilder.GetFieldValue("PreserveSig"),
-                               (bool?)customBuilder.GetFieldValue("ExactSpelling"));
-               }
-
-               internal void SetDllImportPseudoCustomAttribute(string dllName, string entryName, CallingConvention? nativeCallConv, CharSet? nativeCharSet,
-                       bool? bestFitMapping, bool? throwOnUnmappableChar, bool? setLastError, bool? preserveSig, bool? exactSpelling)
-               {
-                       const short NoMangle = 0x0001;
-                       const short CharSetMask = 0x0006;
-                       const short CharSetNotSpec = 0x0000;
-                       const short CharSetAnsi = 0x0002;
-                       const short CharSetUnicode = 0x0004;
-                       const short CharSetAuto = 0x0006;
-                       const short SupportsLastError = 0x0040;
-                       const short CallConvMask = 0x0700;
-                       const short CallConvWinapi = 0x0100;
-                       const short CallConvCdecl = 0x0200;
-                       const short CallConvStdcall = 0x0300;
-                       const short CallConvThiscall = 0x0400;
-                       const short CallConvFastcall = 0x0500;
-                       // non-standard flags
-                       const short BestFitOn = 0x0010;
-                       const short BestFitOff = 0x0020;
-                       const short CharMapErrorOn = 0x1000;
-                       const short CharMapErrorOff = 0x2000;
-                       short flags = CharSetNotSpec | CallConvWinapi;
-                       if (bestFitMapping.HasValue)
-                       {
-                               flags |= bestFitMapping.Value ? BestFitOn : BestFitOff;
-                       }
-                       if (throwOnUnmappableChar.HasValue)
-                       {
-                               flags |= throwOnUnmappableChar.Value ? CharMapErrorOn : CharMapErrorOff;
-                       }
-                       if (nativeCallConv.HasValue)
-                       {
-                               flags &= ~CallConvMask;
-                               switch (nativeCallConv.Value)
-                               {
-                                       case System.Runtime.InteropServices.CallingConvention.Cdecl:
-                                               flags |= CallConvCdecl;
-                                               break;
-                                       case System.Runtime.InteropServices.CallingConvention.FastCall:
-                                               flags |= CallConvFastcall;
-                                               break;
-                                       case System.Runtime.InteropServices.CallingConvention.StdCall:
-                                               flags |= CallConvStdcall;
-                                               break;
-                                       case System.Runtime.InteropServices.CallingConvention.ThisCall:
-                                               flags |= CallConvThiscall;
-                                               break;
-                                       case System.Runtime.InteropServices.CallingConvention.Winapi:
-                                               flags |= CallConvWinapi;
-                                               break;
-                               }
-                       }
-                       if (nativeCharSet.HasValue)
-                       {
-                               flags &= ~CharSetMask;
-                               switch (nativeCharSet.Value)
-                               {
-                                       case CharSet.Ansi:
-                                       case CharSet.None:
-                                               flags |= CharSetAnsi;
-                                               break;
-                                       case CharSet.Auto:
-                                               flags |= CharSetAuto;
-                                               break;
-                                       case CharSet.Unicode:
-                                               flags |= CharSetUnicode;
-                                               break;
-                               }
-                       }
-                       if (exactSpelling.HasValue && exactSpelling.Value)
-                       {
-                               flags |= NoMangle;
-                       }
-                       if (!preserveSig.HasValue || preserveSig.Value)
-                       {
-                               implFlags |= MethodImplAttributes.PreserveSig;
-                       }
-                       if (setLastError.HasValue && setLastError.Value)
-                       {
-                               flags |= SupportsLastError;
-                       }
-                       ImplMapTable.Record rec = new ImplMapTable.Record();
-                       rec.MappingFlags = flags;
-                       rec.MemberForwarded = pseudoToken;
-                       rec.ImportName = this.ModuleBuilder.Strings.Add(entryName ?? name);
-                       rec.ImportScope = this.ModuleBuilder.ModuleRef.FindOrAddRecord(dllName == null ? 0 : this.ModuleBuilder.Strings.Add(dllName));
-                       this.ModuleBuilder.ImplMap.AddRecord(rec);
-               }
-
-               private void SetMethodImplAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       MethodImplOptions opt;
-                       switch (customBuilder.Constructor.ParameterCount)
-                       {
-                               case 0:
-                                       opt = 0;
-                                       break;
-                               case 1:
-                                       {
-                                               object val = customBuilder.GetConstructorArgument(0);
-                                               if (val is short)
-                                               {
-                                                       opt = (MethodImplOptions)(short)val;
-                                               }
-                                               else if (val is int)
-                                               {
-                                                       opt = (MethodImplOptions)(int)val;
-                                               }
-                                               else
-                                               {
-                                                       opt = (MethodImplOptions)val;
-                                               }
-                                               break;
-                                       }
-                               default:
-                                       throw new NotSupportedException();
-                       }
-                       MethodCodeType? type = customBuilder.GetFieldValue<MethodCodeType>("MethodCodeType");
-                       implFlags = (MethodImplAttributes)opt;
-                       if (type.HasValue)
-                       {
-                               implFlags |= (MethodImplAttributes)type;
-                       }
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       Universe u = this.ModuleBuilder.universe;
-                       Type type = customBuilder.Constructor.DeclaringType;
-                       if (type == u.System_Runtime_InteropServices_DllImportAttribute)
-                       {
-                               attributes |= MethodAttributes.PinvokeImpl;
-                               SetDllImportPseudoCustomAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
-                       }
-                       else if (type == u.System_Runtime_CompilerServices_MethodImplAttribute)
-                       {
-                               SetMethodImplAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
-                       }
-                       else if (type == u.System_Runtime_InteropServices_PreserveSigAttribute)
-                       {
-                               implFlags |= MethodImplAttributes.PreserveSig;
-                       }
-                       else if (type == u.System_Runtime_CompilerServices_SpecialNameAttribute)
-                       {
-                               attributes |= MethodAttributes.SpecialName;
-                       }
-                       else
-                       {
-                               if (type == u.System_Security_SuppressUnmanagedCodeSecurityAttribute)
-                               {
-                                       attributes |= MethodAttributes.HasSecurity;
-                               }
-                               this.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
-                       }
-               }
-
-               public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
-               {
-                       attributes |= MethodAttributes.HasSecurity;
-                       if (declarativeSecurity == null)
-                       {
-                               declarativeSecurity = new List<CustomAttributeBuilder>();
-                       }
-                       declarativeSecurity.Add(customBuilder);
-               }
-
-               public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
-               {
-                       this.ModuleBuilder.AddDeclarativeSecurity(pseudoToken, securityAction, permissionSet);
-                       this.attributes |= MethodAttributes.HasSecurity;
-               }
-
-               public void SetImplementationFlags(MethodImplAttributes attributes)
-               {
-                       implFlags = attributes;
-               }
-
-               public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
-               {
-                       if (parameters == null)
-                       {
-                               parameters = new List<ParameterBuilder>();
-                       }
-                       this.ModuleBuilder.Param.AddVirtualRecord();
-                       ParameterBuilder pb = new ParameterBuilder(this.ModuleBuilder, position, attributes, strParamName);
-                       if (parameters.Count == 0 || position > parameters[parameters.Count - 1].Position)
-                       {
-                               parameters.Add(pb);
-                       }
-                       else
-                       {
-                               for (int i = 0; i < parameters.Count; i++)
-                               {
-                                       if (parameters[i].Position > position)
-                                       {
-                                               parameters.Insert(i, pb);
-                                               break;
-                                       }
-                               }
-                       }
-                       return pb;
-               }
-
-               private void CheckSig()
-               {
-                       if (methodSignature != null)
-                       {
-                               throw new InvalidOperationException("The method signature can not be modified after it has been used.");
-                       }
-               }
-
-               public void SetParameters(params Type[] parameterTypes)
-               {
-                       CheckSig();
-                       this.parameterTypes = Util.Copy(parameterTypes);
-               }
-
-               public void SetReturnType(Type returnType)
-               {
-                       CheckSig();
-                       this.returnType = returnType ?? this.Module.universe.System_Void;
-               }
-
-               public void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       SetSignature(returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers,
-                               parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       SetSignature(returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               private void SetSignature(Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       CheckSig();
-                       this.returnType = returnType ?? this.Module.universe.System_Void;
-                       this.parameterTypes = Util.Copy(parameterTypes);
-                       this.customModifiers = customModifiers;
-               }
-
-               public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
-               {
-                       CheckSig();
-                       gtpb = new GenericTypeParameterBuilder[names.Length];
-                       for (int i = 0; i < names.Length; i++)
-                       {
-                               gtpb[i] = new GenericTypeParameterBuilder(names[i], null, this, i);
-                       }
-                       return (GenericTypeParameterBuilder[])gtpb.Clone();
-               }
-
-               public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       return new GenericMethodInstance(typeBuilder, this, typeArguments);
-               }
-
-               public override MethodInfo GetGenericMethodDefinition()
-               {
-                       if (gtpb == null)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       return this;
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       return Util.Copy(gtpb);
-               }
-
-               internal override Type GetGenericMethodArgument(int index)
-               {
-                       return gtpb[index];
-               }
-
-               internal override int GetGenericMethodArgumentCount()
-               {
-                       return gtpb == null ? 0 : gtpb.Length;
-               }
-
-               public override Type ReturnType
-               {
-                       get { return returnType; }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get { return new ParameterInfoImpl(this, -1); }
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return attributes; }
-               }
-
-               public void __SetAttributes(MethodAttributes attributes)
-               {
-                       this.attributes = attributes;
-               }
-
-               public void __SetCallingConvention(CallingConventions callingConvention)
-               {
-                       this.callingConvention = callingConvention;
-                       this.methodSignature = null;
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return implFlags;
-               }
-
-               private sealed class ParameterInfoImpl : ParameterInfo
-               {
-                       private readonly MethodBuilder method;
-                       private readonly int parameter;
-
-                       internal ParameterInfoImpl(MethodBuilder method, int parameter)
-                       {
-                               this.method = method;
-                               this.parameter = parameter;
-                       }
-
-                       private ParameterBuilder ParameterBuilder
-                       {
-                               get
-                               {
-                                       if (method.parameters != null)
-                                       {
-                                               foreach (ParameterBuilder pb in method.parameters)
-                                               {
-                                                       // ParameterBuilder.Position is 1-based
-                                                       if (pb.Position - 1 == parameter)
-                                                       {
-                                                               return pb;
-                                                       }
-                                               }
-                                       }
-                                       return null;
-                               }
-                       }
-
-                       public override string Name
-                       {
-                               get
-                               {
-                                       ParameterBuilder pb = this.ParameterBuilder;
-                                       return pb != null ? pb.Name : null;
-                               }
-                       }
-
-                       public override Type ParameterType
-                       {
-                               get { return parameter == -1 ? method.returnType : method.parameterTypes[parameter]; }
-                       }
-
-                       public override ParameterAttributes Attributes
-                       {
-                               get
-                               {
-                                       ParameterBuilder pb = this.ParameterBuilder;
-                                       return pb != null ? (ParameterAttributes)pb.Attributes : ParameterAttributes.None;
-                               }
-                       }
-
-                       public override int Position
-                       {
-                               get { return parameter; }
-                       }
-
-                       public override object RawDefaultValue
-                       {
-                               get
-                               {
-                                       ParameterBuilder pb = this.ParameterBuilder;
-                                       if (pb != null && (pb.Attributes & (int)ParameterAttributes.HasDefault) != 0)
-                                       {
-                                               return method.ModuleBuilder.Constant.GetRawConstantValue(method.ModuleBuilder, pb.PseudoToken);
-                                       }
-                                       if (pb != null && (pb.Attributes & (int)ParameterAttributes.Optional) != 0)
-                                       {
-                                               return Missing.Value;
-                                       }
-                                       return null;
-                               }
-                       }
-
-                       public override CustomModifiers __GetCustomModifiers()
-                       {
-                               return method.customModifiers.GetParameterCustomModifiers(parameter);
-                       }
-
-                       public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-                       {
-                               fieldMarshal = new FieldMarshal();
-                               return false;
-                       }
-
-                       public override MemberInfo Member
-                       {
-                               get { return method; }
-                       }
-
-                       public override int MetadataToken
-                       {
-                               get
-                               {
-                                       ParameterBuilder pb = this.ParameterBuilder;
-                                       return pb != null ? pb.PseudoToken : 0x08000000;
-                               }
-                       }
-
-                       internal override Module Module
-                       {
-                               get { return method.Module; }
-                       }
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameters = new ParameterInfo[parameterTypes.Length];
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoImpl(this, i);
-                       }
-                       return parameters;
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return parameterTypes.Length; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeBuilder.IsModulePseudoType ? null : typeBuilder; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return callingConvention; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return pseudoToken; }
-               }
-
-               public override bool IsGenericMethod
-               {
-                       get { return gtpb != null; }
-               }
-
-               public override bool IsGenericMethodDefinition
-               {
-                       get { return gtpb != null; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeBuilder.Module; }
-               }
-
-               public Module GetModule()
-               {
-                       return typeBuilder.Module;
-               }
-
-               public MethodToken GetToken()
-               {
-                       return new MethodToken(pseudoToken);
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public override int __MethodRVA
-               {
-                       get { throw new NotImplementedException(); }
-               }
-
-               public bool InitLocals
-               {
-                       get { return initLocals; }
-                       set { initLocals = value; }
-               }
-
-               public void __AddUnmanagedExport(string name, int ordinal)
-               {
-                       this.ModuleBuilder.AddUnmanagedExport(name, ordinal, this, new RelativeVirtualAddress(0xFFFFFFFF));
-               }
-
-               internal void Bake()
-               {
-                       this.nameIndex = this.ModuleBuilder.Strings.Add(name);
-                       this.signature = this.ModuleBuilder.GetSignatureBlobIndex(this.MethodSignature);
-
-                       __ReleaseILGenerator();
-
-                       if (declarativeSecurity != null)
-                       {
-                               this.ModuleBuilder.AddDeclarativeSecurity(pseudoToken, declarativeSecurity);
-                       }
-               }
-
-               internal ModuleBuilder ModuleBuilder
-               {
-                       get { return typeBuilder.ModuleBuilder; }
-               }
-
-               internal void WriteMethodDefRecord(int baseRVA, MetadataWriter mw, ref int paramList)
-               {
-                       if (rva != -1)
-                       {
-                               mw.Write(rva + baseRVA);
-                       }
-                       else
-                       {
-                               mw.Write(0);
-                       }
-                       mw.Write((short)implFlags);
-                       mw.Write((short)attributes);
-                       mw.WriteStringIndex(nameIndex);
-                       mw.WriteBlobIndex(signature);
-                       mw.WriteParam(paramList);
-                       if (parameters != null)
-                       {
-                               paramList += parameters.Count;
-                       }
-               }
-
-               internal void WriteParamRecords(MetadataWriter mw)
-               {
-                       if (parameters != null)
-                       {
-                               foreach (ParameterBuilder pb in parameters)
-                               {
-                                       pb.WriteParamRecord(mw);
-                               }
-                       }
-               }
-
-               internal void FixupToken(int token, ref int parameterToken)
-               {
-                       typeBuilder.ModuleBuilder.RegisterTokenFixup(this.pseudoToken, token);
-                       if (parameters != null)
-                       {
-                               foreach (ParameterBuilder pb in parameters)
-                               {
-                                       pb.FixupToken(parameterToken++);
-                               }
-                       }
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get
-                       {
-                               if (methodSignature == null)
-                               {
-                                       methodSignature = MethodSignature.MakeFromBuilder(returnType, parameterTypes, customModifiers, callingConvention, gtpb == null ? 0 : gtpb.Length);
-                               }
-                               return methodSignature;
-                       }
-               }
-
-               internal override int ImportTo(ModuleBuilder other)
-               {
-                       return other.ImportMethodOrField(typeBuilder, name, this.MethodSignature);
-               }
-
-               internal void CheckBaked()
-               {
-                       typeBuilder.CheckBaked();
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       if (typeBuilder.ModuleBuilder.IsSaved)
-                       {
-                               return typeBuilder.ModuleBuilder.ResolvePseudoToken(pseudoToken);
-                       }
-                       else
-                       {
-                               return pseudoToken;
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return typeBuilder.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/ModuleBuilder.cs b/mcs/class/IKVM.Reflection/Emit/ModuleBuilder.cs
deleted file mode 100644 (file)
index 8ffe17b..0000000
+++ /dev/null
@@ -1,1882 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Diagnostics;
-using System.Diagnostics.SymbolStore;
-using System.Security.Cryptography;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class ModuleBuilder : Module, ITypeOwner
-       {
-               private static readonly bool usePublicKeyAssemblyReference = false;
-               private Guid mvid = Guid.NewGuid();
-               private long imageBaseAddress = 0x00400000;
-               private long stackReserve = -1;
-               private int fileAlignment = 0x200;
-               private DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NoSEH | DllCharacteristics.NXCompat | DllCharacteristics.TerminalServerAware;
-               private readonly AssemblyBuilder asm;
-               internal readonly string moduleName;
-               internal readonly string fileName;
-               internal readonly ISymbolWriterImpl symbolWriter;
-               private readonly TypeBuilder moduleType;
-               private readonly List<TypeBuilder> types = new List<TypeBuilder>();
-               private readonly Dictionary<Type, int> typeTokens = new Dictionary<Type, int>();
-               private readonly Dictionary<Type, int> memberRefTypeTokens = new Dictionary<Type, int>();
-               internal readonly ByteBuffer methodBodies = new ByteBuffer(128 * 1024);
-               internal readonly List<int> tokenFixupOffsets = new List<int>();
-               internal readonly ByteBuffer initializedData = new ByteBuffer(512);
-               internal readonly ByteBuffer manifestResources = new ByteBuffer(512);
-               internal ResourceSection unmanagedResources;
-               private readonly Dictionary<MemberRefKey, int> importedMemberRefs = new Dictionary<MemberRefKey, int>();
-               private readonly Dictionary<MethodSpecKey, int> importedMethodSpecs = new Dictionary<MethodSpecKey, int>();
-               private readonly Dictionary<Assembly, int> referencedAssemblies = new Dictionary<Assembly, int>();
-               private List<AssemblyName> referencedAssemblyNames;
-               private int nextPseudoToken = -1;
-               private readonly List<int> resolvedTokens = new List<int>();
-               internal readonly TableHeap Tables = new TableHeap();
-               internal readonly StringHeap Strings = new StringHeap();
-               internal readonly UserStringHeap UserStrings = new UserStringHeap();
-               internal readonly GuidHeap Guids = new GuidHeap();
-               internal readonly BlobHeap Blobs = new BlobHeap();
-               internal readonly List<VTableFixups> vtablefixups = new List<VTableFixups>();
-               internal readonly List<UnmanagedExport> unmanagedExports = new List<UnmanagedExport>();
-               private List<InterfaceImplCustomAttribute> interfaceImplCustomAttributes;
-               private List<ResourceWriterRecord> resourceWriters;
-               private bool saved;
-
-               private struct ResourceWriterRecord
-               {
-                       private readonly string name;
-                       private readonly ResourceWriter rw;
-                       private readonly MemoryStream mem;
-                       private readonly ResourceAttributes attributes;
-
-                       internal ResourceWriterRecord(string name, ResourceWriter rw, MemoryStream mem, ResourceAttributes attributes)
-                       {
-                               this.name = name;
-                               this.rw = rw;
-                               this.mem = mem;
-                               this.attributes = attributes;
-                       }
-
-                       internal void Emit(ModuleBuilder mb)
-                       {
-                               rw.Generate();
-                               mem.Position = 0;
-                               mb.DefineManifestResource(name, mem, attributes);
-                               rw.Close();
-                       }
-               }
-
-               internal struct VTableFixups
-               {
-                       internal uint initializedDataOffset;
-                       internal ushort count;
-                       internal ushort type;
-
-                       internal int SlotWidth
-                       {
-                               get { return (type & 0x02) == 0 ? 4 : 8; }
-                       }
-               }
-
-               struct InterfaceImplCustomAttribute
-               {
-                       internal int type;
-                       internal int interfaceType;
-                       internal int pseudoToken;
-               }
-
-               struct MemberRefKey : IEquatable<MemberRefKey>
-               {
-                       private readonly Type type;
-                       private readonly string name;
-                       private readonly Signature signature;
-
-                       internal MemberRefKey(Type type, string name, Signature signature)
-                       {
-                               this.type = type;
-                               this.name = name;
-                               this.signature = signature;
-                       }
-
-                       public bool Equals(MemberRefKey other)
-                       {
-                               return other.type.Equals(type)
-                                       && other.name == name
-                                       && other.signature.Equals(signature);
-                       }
-
-                       public override bool Equals(object obj)
-                       {
-                               MemberRefKey? other = obj as MemberRefKey?;
-                               return other != null && Equals(other);
-                       }
-
-                       public override int GetHashCode()
-                       {
-                               return type.GetHashCode() + name.GetHashCode() + signature.GetHashCode();
-                       }
-
-                       internal MethodBase LookupMethod()
-                       {
-                               return type.FindMethod(name, (MethodSignature)signature);
-                       }
-               }
-
-               struct MethodSpecKey : IEquatable<MethodSpecKey>
-               {
-                       private readonly Type type;
-                       private readonly string name;
-                       private readonly MethodSignature signature;
-                       private readonly Type[] genericParameters;
-
-                       internal MethodSpecKey(Type type, string name, MethodSignature signature, Type[] genericParameters)
-                       {
-                               this.type = type;
-                               this.name = name;
-                               this.signature = signature;
-                               this.genericParameters = genericParameters;
-                       }
-
-                       public bool Equals(MethodSpecKey other)
-                       {
-                               return other.type.Equals(type)
-                                       && other.name == name
-                                       && other.signature.Equals(signature)
-                                       && Util.ArrayEquals(other.genericParameters, genericParameters);
-                       }
-
-                       public override bool Equals(object obj)
-                       {
-                               MethodSpecKey? other = obj as MethodSpecKey?;
-                               return other != null && Equals(other);
-                       }
-
-                       public override int GetHashCode()
-                       {
-                               return type.GetHashCode() + name.GetHashCode() + signature.GetHashCode() + Util.GetHashCode(genericParameters);
-                       }
-               }
-
-               internal ModuleBuilder(AssemblyBuilder asm, string moduleName, string fileName, bool emitSymbolInfo)
-                       : base(asm.universe)
-               {
-                       this.asm = asm;
-                       this.moduleName = moduleName;
-                       this.fileName = fileName;
-                       if (emitSymbolInfo)
-                       {
-                               symbolWriter = SymbolSupport.CreateSymbolWriterFor(this);
-                       }
-                       // <Module> must be the first record in the TypeDef table
-                       moduleType = new TypeBuilder(this, null, "<Module>");
-                       types.Add(moduleType);
-               }
-
-               internal void PopulatePropertyAndEventTables()
-               {
-                       // LAMESPEC the PropertyMap and EventMap tables are not required to be sorted by the CLI spec,
-                       // but .NET sorts them and Mono requires them to be sorted, so we have to populate the
-                       // tables in the right order
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.PopulatePropertyAndEventTables();
-                       }
-               }
-
-               internal void WriteTypeDefTable(MetadataWriter mw)
-               {
-                       int fieldList = 1;
-                       int methodList = 1;
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.WriteTypeDefRecord(mw, ref fieldList, ref methodList);
-                       }
-               }
-
-               internal void WriteMethodDefTable(int baseRVA, MetadataWriter mw)
-               {
-                       int paramList = 1;
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.WriteMethodDefRecords(baseRVA, mw, ref paramList);
-                       }
-               }
-
-               internal void WriteParamTable(MetadataWriter mw)
-               {
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.WriteParamRecords(mw);
-                       }
-               }
-
-               internal void WriteFieldTable(MetadataWriter mw)
-               {
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.WriteFieldRecords(mw);
-                       }
-               }
-
-               internal int AllocPseudoToken()
-               {
-                       return nextPseudoToken--;
-               }
-
-               public TypeBuilder DefineType(string name)
-               {
-                       return DefineType(name, TypeAttributes.Class);
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr)
-               {
-                       return DefineType(name, attr, null);
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent)
-               {
-                       return DefineType(name, attr, parent, PackingSize.Unspecified, 0);
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, int typesize)
-               {
-                       return DefineType(name, attr, parent, PackingSize.Unspecified, typesize);
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, PackingSize packsize)
-               {
-                       return DefineType(name, attr, parent, packsize, 0);
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
-               {
-                       TypeBuilder tb = DefineType(name, attr, parent);
-                       foreach (Type iface in interfaces)
-                       {
-                               tb.AddInterfaceImplementation(iface);
-                       }
-                       return tb;
-               }
-
-               public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, PackingSize packingSize, int typesize)
-               {
-                       string ns = null;
-                       int lastdot = name.LastIndexOf('.');
-                       if (lastdot > 0)
-                       {
-                               ns = name.Substring(0, lastdot);
-                               name = name.Substring(lastdot + 1);
-                       }
-                       TypeBuilder typeBuilder = __DefineType(ns, name);
-                       typeBuilder.__SetAttributes(attr);
-                       typeBuilder.SetParent(parent);
-                       if (packingSize != PackingSize.Unspecified || typesize != 0)
-                       {
-                               typeBuilder.__SetLayout((int)packingSize, typesize);
-                       }
-                       return typeBuilder;
-               }
-
-               public TypeBuilder __DefineType(string ns, string name)
-               {
-                       return DefineType(this, ns, name);
-               }
-
-               internal TypeBuilder DefineType(ITypeOwner owner, string ns, string name)
-               {
-                       TypeBuilder typeBuilder = new TypeBuilder(owner, ns, name);
-                       types.Add(typeBuilder);
-                       return typeBuilder;
-               }
-
-               public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType)
-               {
-                       TypeBuilder tb = DefineType(name, (visibility & TypeAttributes.VisibilityMask) | TypeAttributes.Sealed, universe.System_Enum);
-                       FieldBuilder fb = tb.DefineField("value__", underlyingType, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
-                       return new EnumBuilder(tb, fb);
-               }
-
-               public FieldBuilder __DefineField(string name, Type type, CustomModifiers customModifiers, FieldAttributes attributes)
-               {
-                       return moduleType.__DefineField(name, type, customModifiers, attributes);
-               }
-
-               [Obsolete("Please use __DefineField(string, Type, CustomModifiers, FieldAttributes) instead.")]
-               public FieldBuilder __DefineField(string name, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
-               {
-                       return moduleType.DefineField(name, type, requiredCustomModifiers, optionalCustomModifiers, attributes);
-               }
-
-               public ConstructorBuilder __DefineModuleInitializer(MethodAttributes visibility)
-               {
-                       return moduleType.DefineConstructor(visibility | MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, CallingConventions.Standard, Type.EmptyTypes);
-               }
-
-               public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes)
-               {
-                       return moduleType.DefineUninitializedData(name, size, attributes);
-               }
-
-               public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes)
-               {
-                       return moduleType.DefineInitializedData(name, data, attributes);
-               }
-
-               public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
-               {
-                       return moduleType.DefineMethod(name, attributes, returnType, parameterTypes);
-               }
-
-               public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       return moduleType.DefineMethod(name, attributes, callingConvention, returnType, parameterTypes);
-               }
-
-               public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
-               {
-                       return moduleType.DefineMethod(name, attributes, callingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
-               }
-
-               public MethodBuilder DefinePInvokeMethod(string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
-               {
-                       return moduleType.DefinePInvokeMethod(name, dllName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet);
-               }
-
-               public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
-               {
-                       return moduleType.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet);
-               }
-
-               public void CreateGlobalFunctions()
-               {
-                       moduleType.CreateType();
-               }
-
-               internal void AddTypeForwarder(Type type)
-               {
-                       ExportType(type);
-                       if (!type.__IsMissing)
-                       {
-                               foreach (Type nested in type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic))
-                               {
-                                       // we export all nested types (i.e. even the private ones)
-                                       // (this behavior is the same as the C# compiler)
-                                       AddTypeForwarder(nested);
-                               }
-                       }
-               }
-
-               private int ExportType(Type type)
-               {
-                       ExportedTypeTable.Record rec = new ExportedTypeTable.Record();
-                       rec.TypeDefId = type.MetadataToken;
-                       rec.TypeName = this.Strings.Add(type.__Name);
-                       string ns = type.__Namespace;
-                       rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
-                       if (type.IsNested)
-                       {
-                               rec.Flags = 0;
-                               rec.Implementation = ExportType(type.DeclaringType);
-                       }
-                       else
-                       {
-                               rec.Flags = 0x00200000; // CorTypeAttr.tdForwarder
-                               rec.Implementation = ImportAssemblyRef(type.Assembly);
-                       }
-                       return 0x27000000 | this.ExportedType.FindOrAddRecord(rec);
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       SetCustomAttribute(0x00000001, customBuilder);
-               }
-
-               internal void SetCustomAttribute(int token, CustomAttributeBuilder customBuilder)
-               {
-                       Debug.Assert(!customBuilder.IsPseudoCustomAttribute);
-                       CustomAttributeTable.Record rec = new CustomAttributeTable.Record();
-                       rec.Parent = token;
-                       rec.Type = asm.IsWindowsRuntime ? customBuilder.Constructor.ImportTo(this) : GetConstructorToken(customBuilder.Constructor).Token;
-                       rec.Value = customBuilder.WriteBlob(this);
-                       this.CustomAttribute.AddRecord(rec);
-               }
-
-               internal void AddDeclarativeSecurity(int token, System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
-               {
-                       DeclSecurityTable.Record rec = new DeclSecurityTable.Record();
-                       rec.Action = (short)securityAction;
-                       rec.Parent = token;
-                       // like Ref.Emit, we're using the .NET 1.x xml format
-                       rec.PermissionSet = this.Blobs.Add(ByteBuffer.Wrap(System.Text.Encoding.Unicode.GetBytes(permissionSet.ToXml().ToString())));
-                       this.DeclSecurity.AddRecord(rec);
-               }
-
-               internal void AddDeclarativeSecurity(int token, List<CustomAttributeBuilder> declarativeSecurity)
-               {
-                       Dictionary<int, List<CustomAttributeBuilder>> ordered = new Dictionary<int, List<CustomAttributeBuilder>>();
-                       foreach (CustomAttributeBuilder cab in declarativeSecurity)
-                       {
-                               int action;
-                               // check for HostProtectionAttribute without SecurityAction
-                               if (cab.ConstructorArgumentCount == 0)
-                               {
-                                       action = (int)System.Security.Permissions.SecurityAction.LinkDemand;
-                               }
-                               else
-                               {
-                                       action = (int)cab.GetConstructorArgument(0);
-                               }
-                               List<CustomAttributeBuilder> list;
-                               if (!ordered.TryGetValue(action, out list))
-                               {
-                                       list = new List<CustomAttributeBuilder>();
-                                       ordered.Add(action, list);
-                               }
-                               list.Add(cab);
-                       }
-                       foreach (KeyValuePair<int, List<CustomAttributeBuilder>> kv in ordered)
-                       {
-                               DeclSecurityTable.Record rec = new DeclSecurityTable.Record();
-                               rec.Action = (short)kv.Key;
-                               rec.Parent = token;
-                               rec.PermissionSet = WriteDeclSecurityBlob(kv.Value);
-                               this.DeclSecurity.AddRecord(rec);
-                       }
-               }
-
-               private int WriteDeclSecurityBlob(List<CustomAttributeBuilder> list)
-               {
-                       string xml;
-                       if (list.Count == 1 && (xml = list[0].GetLegacyDeclSecurity()) != null)
-                       {
-                               // write .NET 1.1 format
-                               return this.Blobs.Add(ByteBuffer.Wrap(System.Text.Encoding.Unicode.GetBytes(xml)));
-                       }
-                       ByteBuffer namedArgs = new ByteBuffer(100);
-                       ByteBuffer bb = new ByteBuffer(list.Count * 100);
-                       bb.Write((byte)'.');
-                       bb.WriteCompressedInt(list.Count);
-                       foreach (CustomAttributeBuilder cab in list)
-                       {
-                               bb.Write(cab.Constructor.DeclaringType.AssemblyQualifiedName);
-                               namedArgs.Clear();
-                               cab.WriteNamedArgumentsForDeclSecurity(this, namedArgs);
-                               bb.WriteCompressedInt(namedArgs.Length);
-                               bb.Write(namedArgs);
-                       }
-                       return this.Blobs.Add(bb);
-               }
-
-               public void DefineManifestResource(string name, Stream stream, ResourceAttributes attribute)
-               {
-                       manifestResources.Align(8);
-                       ManifestResourceTable.Record rec = new ManifestResourceTable.Record();
-                       rec.Offset = manifestResources.Position;
-                       rec.Flags = (int)attribute;
-                       rec.Name = this.Strings.Add(name);
-                       rec.Implementation = 0;
-                       this.ManifestResource.AddRecord(rec);
-                       manifestResources.Write(0);     // placeholder for the length
-                       manifestResources.Write(stream);
-                       int savePosition = manifestResources.Position;
-                       manifestResources.Position = rec.Offset;
-                       manifestResources.Write(savePosition - (manifestResources.Position + 4));
-                       manifestResources.Position = savePosition;
-               }
-
-               public IResourceWriter DefineResource(string name, string description)
-               {
-                       return DefineResource(name, description, ResourceAttributes.Public);
-               }
-
-               public IResourceWriter DefineResource(string name, string description, ResourceAttributes attribute)
-               {
-                       // FXBUG we ignore the description, because there is no such thing
-
-                       if (resourceWriters == null)
-                       {
-                               resourceWriters = new List<ResourceWriterRecord>();
-                       }
-                       MemoryStream mem = new MemoryStream();
-                       ResourceWriter rw = new ResourceWriter(mem);
-                       resourceWriters.Add(new ResourceWriterRecord(name, rw, mem, attribute));
-                       return rw;
-               }
-
-               internal void EmitResources()
-               {
-                       if (resourceWriters != null)
-                       {
-                               foreach (ResourceWriterRecord rwr in resourceWriters)
-                               {
-                                       rwr.Emit(this);
-                               }
-                       }
-               }
-
-               public override Assembly Assembly
-               {
-                       get { return asm; }
-               }
-
-               internal override Type FindType(TypeName name)
-               {
-                       foreach (Type type in types)
-                       {
-                               if (type.__Namespace == name.Namespace && type.__Name == name.Name)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       foreach (Type type in types)
-                       {
-                               if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               internal override void GetTypesImpl(List<Type> list)
-               {
-                       foreach (Type type in types)
-                       {
-                               if (type != moduleType)
-                               {
-                                       list.Add(type);
-                               }
-                       }
-               }
-
-               public ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
-               {
-                       return symbolWriter.DefineDocument(url, language, languageVendor, documentType);
-               }
-
-               public int __GetAssemblyToken(Assembly assembly)
-               {
-                       return ImportAssemblyRef(assembly);
-               }
-
-               public TypeToken GetTypeToken(string name)
-               {
-                       return new TypeToken(GetType(name, true, false).MetadataToken);
-               }
-
-               public TypeToken GetTypeToken(Type type)
-               {
-                       if (type.Module == this && !asm.IsWindowsRuntime)
-                       {
-                               return new TypeToken(type.GetModuleBuilderToken());
-                       }
-                       else
-                       {
-                               return new TypeToken(ImportType(type));
-                       }
-               }
-
-               internal int GetTypeTokenForMemberRef(Type type)
-               {
-                       if (type.__IsMissing)
-                       {
-                               return ImportType(type);
-                       }
-                       else if (type.IsGenericTypeDefinition)
-                       {
-                               int token;
-                               if (!memberRefTypeTokens.TryGetValue(type, out token))
-                               {
-                                       ByteBuffer spec = new ByteBuffer(5);
-                                       Signature.WriteTypeSpec(this, spec, type);
-                                       token = 0x1B000000 | this.TypeSpec.AddRecord(this.Blobs.Add(spec));
-                                       memberRefTypeTokens.Add(type, token);
-                               }
-                               return token;
-                       }
-                       else if (type.IsModulePseudoType)
-                       {
-                               return 0x1A000000 | this.ModuleRef.FindOrAddRecord(this.Strings.Add(type.Module.ScopeName));
-                       }
-                       else
-                       {
-                               return GetTypeToken(type).Token;
-                       }
-               }
-
-               private static bool IsFromGenericTypeDefinition(MemberInfo member)
-               {
-                       Type decl = member.DeclaringType;
-                       return decl != null && !decl.__IsMissing && decl.IsGenericTypeDefinition;
-               }
-
-               public FieldToken GetFieldToken(FieldInfo field)
-               {
-                       // NOTE for some reason, when TypeBuilder.GetFieldToken() is used on a field in a generic type definition,
-                       // a memberref token is returned (confirmed on .NET) unlike for Get(Method|Constructor)Token which always
-                       // simply returns the MethodDef token (if the method is from the same module).
-                       FieldBuilder fb = field as FieldBuilder;
-                       if (fb != null && fb.Module == this && !IsFromGenericTypeDefinition(fb))
-                       {
-                               return new FieldToken(fb.MetadataToken);
-                       }
-                       else
-                       {
-                               return new FieldToken(field.ImportTo(this));
-                       }
-               }
-
-               public MethodToken GetMethodToken(MethodInfo method)
-               {
-                       MethodBuilder mb = method as MethodBuilder;
-                       if (mb != null && mb.ModuleBuilder == this)
-                       {
-                               return new MethodToken(mb.MetadataToken);
-                       }
-                       else
-                       {
-                               return new MethodToken(method.ImportTo(this));
-                       }
-               }
-
-               // new in .NET 4.5
-               public MethodToken GetMethodToken(MethodInfo method, IEnumerable<Type> optionalParameterTypes)
-               {
-                       return __GetMethodToken(method, Util.ToArray(optionalParameterTypes), null);
-               }
-
-               public MethodToken __GetMethodToken(MethodInfo method, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
-               {
-                       ByteBuffer sig = new ByteBuffer(16);
-                       method.MethodSignature.WriteMethodRefSig(this, sig, optionalParameterTypes, customModifiers);
-                       MemberRefTable.Record record = new MemberRefTable.Record();
-                       if (method.Module == this)
-                       {
-                               record.Class = method.MetadataToken;
-                       }
-                       else
-                       {
-                               record.Class = GetTypeTokenForMemberRef(method.DeclaringType ?? method.Module.GetModuleType());
-                       }
-                       record.Name = Strings.Add(method.Name);
-                       record.Signature = Blobs.Add(sig);
-                       return new MethodToken(0x0A000000 | MemberRef.FindOrAddRecord(record));
-               }
-
-               // when we refer to a method on a generic type definition in the IL stream,
-               // we need to use a MemberRef (even if the method is in the same module)
-               internal MethodToken GetMethodTokenForIL(MethodInfo method)
-               {
-                       if (method.IsGenericMethodDefinition)
-                       {
-                               method = method.MakeGenericMethod(method.GetGenericArguments());
-                       }
-                       if (IsFromGenericTypeDefinition(method))
-                       {
-                               return new MethodToken(method.ImportTo(this));
-                       }
-                       else
-                       {
-                               return GetMethodToken(method);
-                       }
-               }
-
-               internal int GetMethodTokenWinRT(MethodInfo method)
-               {
-                       return asm.IsWindowsRuntime ? method.ImportTo(this) : GetMethodToken(method).Token;
-               }
-
-               public MethodToken GetConstructorToken(ConstructorInfo constructor)
-               {
-                       return GetMethodToken(constructor.GetMethodInfo());
-               }
-
-               // new in .NET 4.5
-               public MethodToken GetConstructorToken(ConstructorInfo constructor, IEnumerable<Type> optionalParameterTypes)
-               {
-                       return GetMethodToken(constructor.GetMethodInfo(), optionalParameterTypes);
-               }
-
-               public MethodToken __GetConstructorToken(ConstructorInfo constructor, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
-               {
-                       return __GetMethodToken(constructor.GetMethodInfo(), optionalParameterTypes, customModifiers);
-               }
-
-               internal int ImportMethodOrField(Type declaringType, string name, Signature sig)
-               {
-                       int token;
-                       MemberRefKey key = new MemberRefKey(declaringType, name, sig);
-                       if (!importedMemberRefs.TryGetValue(key, out token))
-                       {
-                               MemberRefTable.Record rec = new MemberRefTable.Record();
-                               rec.Class = GetTypeTokenForMemberRef(declaringType);
-                               rec.Name = this.Strings.Add(name);
-                               ByteBuffer bb = new ByteBuffer(16);
-                               sig.WriteSig(this, bb);
-                               rec.Signature = this.Blobs.Add(bb);
-                               token = 0x0A000000 | this.MemberRef.AddRecord(rec);
-                               importedMemberRefs.Add(key, token);
-                       }
-                       return token;
-               }
-
-               internal int ImportMethodSpec(Type declaringType, MethodInfo method, Type[] genericParameters)
-               {
-                       Debug.Assert(method.__IsMissing || method.GetMethodOnTypeDefinition() == method);
-                       int token;
-                       MethodSpecKey key = new MethodSpecKey(declaringType, method.Name, method.MethodSignature, genericParameters);
-                       if (!importedMethodSpecs.TryGetValue(key, out token))
-                       {
-                               MethodSpecTable.Record rec = new MethodSpecTable.Record();
-                               MethodBuilder mb = method as MethodBuilder;
-                               if (mb != null && mb.ModuleBuilder == this && !declaringType.IsGenericType)
-                               {
-                                       rec.Method = mb.MetadataToken;
-                               }
-                               else
-                               {
-                                       // we're calling ImportMethodOrField directly here, because 'method' may be a MethodDef on a generic TypeDef and 'declaringType' the type instance
-                                       // (in order words the method and type have already been decoupled by the caller)
-                                       rec.Method = ImportMethodOrField(declaringType, method.Name, method.MethodSignature);
-                               }
-                               Writer.ByteBuffer spec = new Writer.ByteBuffer(10);
-                               Signature.WriteMethodSpec(this, spec, genericParameters);
-                               rec.Instantiation = this.Blobs.Add(spec);
-                               token = 0x2B000000 | this.MethodSpec.FindOrAddRecord(rec);
-                               importedMethodSpecs.Add(key, token);
-                       }
-                       return token;
-               }
-
-               internal int ImportType(Type type)
-               {
-                       int token;
-                       if (!typeTokens.TryGetValue(type, out token))
-                       {
-                               if (type.HasElementType || type.IsConstructedGenericType || type.__IsFunctionPointer)
-                               {
-                                       ByteBuffer spec = new ByteBuffer(5);
-                                       Signature.WriteTypeSpec(this, spec, type);
-                                       token = 0x1B000000 | this.TypeSpec.AddRecord(this.Blobs.Add(spec));
-                               }
-                               else
-                               {
-                                       TypeRefTable.Record rec = new TypeRefTable.Record();
-                                       if (type.IsNested)
-                                       {
-                                               rec.ResolutionScope = GetTypeToken(type.DeclaringType).Token;
-                                       }
-                                       else if (type.Module == this)
-                                       {
-                                               rec.ResolutionScope = 1;
-                                       }
-                                       else
-                                       {
-                                               rec.ResolutionScope = ImportAssemblyRef(type.Assembly);
-                                       }
-                                       rec.TypeName = this.Strings.Add(type.__Name);
-                                       string ns = type.__Namespace;
-                                       rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
-                                       token = 0x01000000 | this.TypeRef.AddRecord(rec);
-                               }
-                               typeTokens.Add(type, token);
-                       }
-                       return token;
-               }
-
-               private int ImportAssemblyRef(Assembly asm)
-               {
-                       int token;
-                       if (!referencedAssemblies.TryGetValue(asm, out token))
-                       {
-                               // We can't write the AssemblyRef record here yet, because the identity of the assembly can still change
-                               // (if it's an AssemblyBuilder).
-                               token = AllocPseudoToken();
-                               referencedAssemblies.Add(asm, token);
-                       }
-                       return token;
-               }
-
-               internal void FillAssemblyRefTable()
-               {
-                       foreach (KeyValuePair<Assembly, int> kv in referencedAssemblies)
-                       {
-                               if (IsPseudoToken(kv.Value))
-                               {
-                                       RegisterTokenFixup(kv.Value, FindOrAddAssemblyRef(kv.Key.GetName(), false));
-                               }
-                       }
-               }
-
-               private int FindOrAddAssemblyRef(AssemblyName name, bool alwaysAdd)
-               {
-                       AssemblyRefTable.Record rec = new AssemblyRefTable.Record();
-                       Version ver = name.Version ?? new Version(0, 0, 0, 0);
-                       rec.MajorVersion = (ushort)ver.Major;
-                       rec.MinorVersion = (ushort)ver.Minor;
-                       rec.BuildNumber = (ushort)ver.Build;
-                       rec.RevisionNumber = (ushort)ver.Revision;
-                       rec.Flags = (int)(name.Flags & ~AssemblyNameFlags.PublicKey);
-                       const AssemblyNameFlags afPA_Specified = (AssemblyNameFlags)0x0080;
-                       const AssemblyNameFlags afPA_Mask = (AssemblyNameFlags)0x0070;
-                       if ((name.RawFlags & afPA_Specified) != 0)
-                       {
-                               rec.Flags |= (int)(name.RawFlags & afPA_Mask);
-                       }
-                       if (name.ContentType == AssemblyContentType.WindowsRuntime)
-                       {
-                               rec.Flags |= 0x0200;
-                       }
-                       byte[] publicKeyOrToken = null;
-                       if (usePublicKeyAssemblyReference)
-                       {
-                               publicKeyOrToken = name.GetPublicKey();
-                       }
-                       if (publicKeyOrToken == null || publicKeyOrToken.Length == 0)
-                       {
-                               publicKeyOrToken = name.GetPublicKeyToken() ?? Empty<byte>.Array;
-                       }
-                       else
-                       {
-                               const int PublicKey = 0x0001;
-                               rec.Flags |= PublicKey;
-                       }
-                       rec.PublicKeyOrToken = this.Blobs.Add(ByteBuffer.Wrap(publicKeyOrToken));
-                       rec.Name = this.Strings.Add(name.Name);
-                       rec.Culture = name.Culture == null ? 0 : this.Strings.Add(name.Culture);
-                       if (name.hash != null)
-                       {
-                               rec.HashValue = this.Blobs.Add(ByteBuffer.Wrap(name.hash));
-                       }
-                       else
-                       {
-                               rec.HashValue = 0;
-                       }
-                       return 0x23000000 | (alwaysAdd ? this.AssemblyRef.AddRecord(rec) : this.AssemblyRef.FindOrAddRecord(rec));
-               }
-
-               internal void WriteSymbolTokenMap()
-               {
-                       for (int i = 0; i < resolvedTokens.Count; i++)
-                       {
-                               int newToken = resolvedTokens[i];
-                               // The symbol API doesn't support remapping arbitrary integers, the types have to be the same,
-                               // so we copy the type from the newToken, because our pseudo tokens don't have a type.
-                               // (see MethodToken.SymbolToken)
-                               int oldToken = (i + 1) | (newToken & ~0xFFFFFF);
-                               SymbolSupport.RemapToken(symbolWriter, oldToken, newToken);
-                       }
-               }
-
-               internal void RegisterTokenFixup(int pseudoToken, int realToken)
-               {
-                       int index = -(pseudoToken + 1);
-                       while (resolvedTokens.Count <= index)
-                       {
-                               resolvedTokens.Add(0);
-                       }
-                       resolvedTokens[index] = realToken;
-               }
-
-               internal bool IsPseudoToken(int token)
-               {
-                       return token < 0;
-               }
-
-               internal int ResolvePseudoToken(int pseudoToken)
-               {
-                       int index = -(pseudoToken + 1);
-                       return resolvedTokens[index];
-               }
-
-               internal void ApplyUnmanagedExports(ImageFileMachine imageFileMachine)
-               {
-                       if (unmanagedExports.Count != 0)
-                       {
-                               int type;
-                               int size;
-                               if (imageFileMachine == ImageFileMachine.I386)
-                               {
-                                       type = 0x05;
-                                       size = 4;
-                               }
-                               else
-                               {
-                                       type = 0x06;
-                                       size = 8;
-                               }
-                               List<MethodBuilder> methods = new List<MethodBuilder>();
-                               for (int i = 0; i < unmanagedExports.Count; i++)
-                               {
-                                       if (unmanagedExports[i].mb != null)
-                                       {
-                                               methods.Add(unmanagedExports[i].mb);
-                                       }
-                               }
-                               if (methods.Count != 0)
-                               {
-                                       RelativeVirtualAddress rva = __AddVTableFixups(methods.ToArray(), type);
-                                       for (int i = 0; i < unmanagedExports.Count; i++)
-                                       {
-                                               if (unmanagedExports[i].mb != null)
-                                               {
-                                                       UnmanagedExport exp = unmanagedExports[i];
-                                                       exp.rva = new RelativeVirtualAddress(rva.initializedDataOffset + (uint)(methods.IndexOf(unmanagedExports[i].mb) * size));
-                                                       unmanagedExports[i] = exp;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               internal void FixupMethodBodyTokens()
-               {
-                       int methodToken = 0x06000001;
-                       int fieldToken = 0x04000001;
-                       int parameterToken = 0x08000001;
-                       foreach (TypeBuilder type in types)
-                       {
-                               type.ResolveMethodAndFieldTokens(ref methodToken, ref fieldToken, ref parameterToken);
-                       }
-                       foreach (int offset in tokenFixupOffsets)
-                       {
-                               methodBodies.Position = offset;
-                               int pseudoToken = methodBodies.GetInt32AtCurrentPosition();
-                               methodBodies.Write(ResolvePseudoToken(pseudoToken));
-                       }
-                       foreach (VTableFixups fixup in vtablefixups)
-                       {
-                               for (int i = 0; i < fixup.count; i++)
-                               {
-                                       initializedData.Position = (int)fixup.initializedDataOffset + i * fixup.SlotWidth;
-                                       initializedData.Write(ResolvePseudoToken(initializedData.GetInt32AtCurrentPosition()));
-                               }
-                       }
-               }
-
-               private int GetHeaderLength()
-               {
-                       return
-                               4 + // Signature
-                               2 + // MajorVersion
-                               2 + // MinorVersion
-                               4 + // Reserved
-                               4 + // ImageRuntimeVersion Length
-                               StringToPaddedUTF8Length(asm.ImageRuntimeVersion) +
-                               2 + // Flags
-                               2 + // Streams
-                               4 + // #~ Offset
-                               4 + // #~ Size
-                               4 + // StringToPaddedUTF8Length("#~")
-                               4 + // #Strings Offset
-                               4 + // #Strings Size
-                               12 + // StringToPaddedUTF8Length("#Strings")
-                               4 + // #US Offset
-                               4 + // #US Size
-                               4 + // StringToPaddedUTF8Length("#US")
-                               4 + // #GUID Offset
-                               4 + // #GUID Size
-                               8 + // StringToPaddedUTF8Length("#GUID")
-                               (Blobs.IsEmpty ? 0 :
-                               (
-                               4 + // #Blob Offset
-                               4 + // #Blob Size
-                               8   // StringToPaddedUTF8Length("#Blob")
-                               ));
-               }
-
-               internal int MetadataLength
-               {
-                       get
-                       {
-                               return GetHeaderLength() + (Blobs.IsEmpty ? 0 : Blobs.Length) + Tables.Length + Strings.Length + UserStrings.Length + Guids.Length;
-                       }
-               }
-
-               internal void WriteMetadata(MetadataWriter mw)
-               {
-                       mw.Write(0x424A5342);                   // Signature ("BSJB")
-                       mw.Write((ushort)1);                    // MajorVersion
-                       mw.Write((ushort)1);                    // MinorVersion
-                       mw.Write(0);                                    // Reserved
-                       byte[] version = StringToPaddedUTF8(asm.ImageRuntimeVersion);
-                       mw.Write(version.Length);               // Length
-                       mw.Write(version);
-                       mw.Write((ushort)0);                    // Flags
-                       // #Blob is the only optional heap
-                       if (Blobs.IsEmpty)
-                       {
-                               mw.Write((ushort)4);            // Streams
-                       }
-                       else
-                       {
-                               mw.Write((ushort)5);            // Streams
-                       }
-
-                       int offset = GetHeaderLength();
-
-                       // Streams
-                       mw.Write(offset);                               // Offset
-                       mw.Write(Tables.Length);                // Size
-                       mw.Write(StringToPaddedUTF8("#~"));
-                       offset += Tables.Length;
-
-                       mw.Write(offset);                               // Offset
-                       mw.Write(Strings.Length);               // Size
-                       mw.Write(StringToPaddedUTF8("#Strings"));
-                       offset += Strings.Length;
-
-                       mw.Write(offset);                               // Offset
-                       mw.Write(UserStrings.Length);   // Size
-                       mw.Write(StringToPaddedUTF8("#US"));
-                       offset += UserStrings.Length;
-
-                       mw.Write(offset);                               // Offset
-                       mw.Write(Guids.Length);                 // Size
-                       mw.Write(StringToPaddedUTF8("#GUID"));
-                       offset += Guids.Length;
-
-                       if (!Blobs.IsEmpty)
-                       {
-                               mw.Write(offset);                               // Offset
-                               mw.Write(Blobs.Length);                 // Size
-                               mw.Write(StringToPaddedUTF8("#Blob"));
-                       }
-
-                       Tables.Write(mw);
-                       Strings.Write(mw);
-                       UserStrings.Write(mw);
-                       Guids.Write(mw);
-                       if (!Blobs.IsEmpty)
-                       {
-                               Blobs.Write(mw);
-                       }
-               }
-
-               private static int StringToPaddedUTF8Length(string str)
-               {
-                       return (System.Text.Encoding.UTF8.GetByteCount(str) + 4) & ~3;
-               }
-
-               private static byte[] StringToPaddedUTF8(string str)
-               {
-                       byte[] buf = new byte[(System.Text.Encoding.UTF8.GetByteCount(str) + 4) & ~3];
-                       System.Text.Encoding.UTF8.GetBytes(str, 0, str.Length, buf, 0);
-                       return buf;
-               }
-
-               internal override void ExportTypes(int fileToken, ModuleBuilder manifestModule)
-               {
-                       manifestModule.ExportTypes(types.ToArray(), fileToken);
-               }
-
-               internal void ExportTypes(Type[] types, int fileToken)
-               {
-                       Dictionary<Type, int> declaringTypes = new Dictionary<Type, int>();
-                       foreach (Type type in types)
-                       {
-                               if (!type.IsModulePseudoType && IsVisible(type))
-                               {
-                                       ExportedTypeTable.Record rec = new ExportedTypeTable.Record();
-                                       rec.Flags = (int)type.Attributes;
-                                       // LAMESPEC ECMA says that TypeDefId is a row index, but it should be a token
-                                       rec.TypeDefId = type.MetadataToken;
-                                       rec.TypeName = this.Strings.Add(type.__Name);
-                                       string ns = type.__Namespace;
-                                       rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
-                                       if (type.IsNested)
-                                       {
-                                               rec.Implementation = declaringTypes[type.DeclaringType];
-                                       }
-                                       else
-                                       {
-                                               rec.Implementation = fileToken;
-                                       }
-                                       int exportTypeToken = 0x27000000 | this.ExportedType.AddRecord(rec);
-                                       declaringTypes.Add(type, exportTypeToken);
-                               }
-                       }
-               }
-
-               private static bool IsVisible(Type type)
-               {
-                       // NOTE this is not the same as Type.IsVisible, because that doesn't take into account family access
-                       return type.IsPublic || ((type.IsNestedFamily || type.IsNestedFamORAssem || type.IsNestedPublic) && IsVisible(type.DeclaringType));
-               }
-
-               internal void AddConstant(int parentToken, object defaultValue)
-               {
-                       ConstantTable.Record rec = new ConstantTable.Record();
-                       rec.Parent = parentToken;
-                       ByteBuffer val = new ByteBuffer(16);
-                       if (defaultValue == null)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_CLASS;
-                               val.Write((int)0);
-                       }
-                       else if (defaultValue is bool)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_BOOLEAN;
-                               val.Write((bool)defaultValue ? (byte)1 : (byte)0);
-                       }
-                       else if (defaultValue is char)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_CHAR;
-                               val.Write((char)defaultValue);
-                       }
-                       else if (defaultValue is sbyte)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_I1;
-                               val.Write((sbyte)defaultValue);
-                       }
-                       else if (defaultValue is byte)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_U1;
-                               val.Write((byte)defaultValue);
-                       }
-                       else if (defaultValue is short)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_I2;
-                               val.Write((short)defaultValue);
-                       }
-                       else if (defaultValue is ushort)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_U2;
-                               val.Write((ushort)defaultValue);
-                       }
-                       else if (defaultValue is int)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_I4;
-                               val.Write((int)defaultValue);
-                       }
-                       else if (defaultValue is uint)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_U4;
-                               val.Write((uint)defaultValue);
-                       }
-                       else if (defaultValue is long)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_I8;
-                               val.Write((long)defaultValue);
-                       }
-                       else if (defaultValue is ulong)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_U8;
-                               val.Write((ulong)defaultValue);
-                       }
-                       else if (defaultValue is float)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_R4;
-                               val.Write((float)defaultValue);
-                       }
-                       else if (defaultValue is double)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_R8;
-                               val.Write((double)defaultValue);
-                       }
-                       else if (defaultValue is string)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_STRING;
-                               foreach (char c in (string)defaultValue)
-                               {
-                                       val.Write(c);
-                               }
-                       }
-                       else if (defaultValue is DateTime)
-                       {
-                               rec.Type = Signature.ELEMENT_TYPE_I8;
-                               val.Write(((DateTime)defaultValue).Ticks);
-                       }
-                       else
-                       {
-                               throw new ArgumentException();
-                       }
-                       rec.Value = this.Blobs.Add(val);
-                       this.Constant.AddRecord(rec);
-               }
-
-               ModuleBuilder ITypeOwner.ModuleBuilder
-               {
-                       get { return this; }
-               }
-
-               internal override Type ResolveType(int metadataToken, IGenericContext context)
-               {
-                       if (metadataToken >> 24 != TypeDefTable.Index)
-                       {
-                               throw new NotImplementedException();
-                       }
-                       return types[(metadataToken & 0xFFFFFF) - 1];
-               }
-
-               public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       if (genericTypeArguments != null || genericMethodArguments != null)
-                       {
-                               throw new NotImplementedException();
-                       }
-                       // this method is inefficient, but since it isn't used we don't care
-                       if ((metadataToken >> 24) == MemberRefTable.Index)
-                       {
-                               foreach (KeyValuePair<MemberRefKey, int> kv in importedMemberRefs)
-                               {
-                                       if (kv.Value == metadataToken)
-                                       {
-                                               return kv.Key.LookupMethod();
-                                       }
-                               }
-                       }
-                       // HACK if we're given a SymbolToken, we need to convert back
-                       if ((metadataToken & 0xFF000000) == 0x06000000)
-                       {
-                               metadataToken = -(metadataToken & 0x00FFFFFF);
-                       }
-                       foreach (Type type in types)
-                       {
-                               MethodBase method = ((TypeBuilder)type).LookupMethod(metadataToken);
-                               if (method != null)
-                               {
-                                       return method;
-                               }
-                       }
-                       return ((TypeBuilder)moduleType).LookupMethod(metadataToken);
-               }
-
-               public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override string ResolveString(int metadataToken)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override string FullyQualifiedName
-               {
-                       get { return Path.GetFullPath(Path.Combine(asm.dir, fileName)); }
-               }
-
-               public override string Name
-               {
-                       get { return fileName; }
-               }
-
-               public override Guid ModuleVersionId
-               {
-                       get { return mvid; }
-               }
-
-               public void __SetModuleVersionId(Guid guid)
-               {
-                       mvid = guid;
-               }
-
-               public override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override string ScopeName
-               {
-                       get { return moduleName; }
-               }
-
-               public ISymbolWriter GetSymWriter()
-               {
-                       return symbolWriter;
-               }
-
-               public void DefineUnmanagedResource(string resourceFileName)
-               {
-                       // This method reads the specified resource file (Win32 .res file) and converts it into the appropriate format and embeds it in the .rsrc section,
-                       // also setting the Resource Directory entry.
-                       unmanagedResources = new ResourceSection();
-                       unmanagedResources.ExtractResources(System.IO.File.ReadAllBytes(resourceFileName));
-               }
-
-               public bool IsTransient()
-               {
-                       return false;
-               }
-
-               public void SetUserEntryPoint(MethodInfo entryPoint)
-               {
-                       int token = entryPoint.MetadataToken;
-                       if (token < 0)
-                       {
-                               token = -token | 0x06000000;
-                       }
-                       if (symbolWriter != null)
-                       {
-                               symbolWriter.SetUserEntryPoint(new SymbolToken(token));
-                       }
-               }
-
-               public StringToken GetStringConstant(string str)
-               {
-                       return new StringToken(this.UserStrings.Add(str) | (0x70 << 24));
-               }
-
-               public SignatureToken GetSignatureToken(SignatureHelper sigHelper)
-               {
-                       return new SignatureToken(this.StandAloneSig.FindOrAddRecord(this.Blobs.Add(sigHelper.GetSignature(this))) | (StandAloneSigTable.Index << 24));
-               }
-
-               public SignatureToken GetSignatureToken(byte[] sigBytes, int sigLength)
-               {
-                       return new SignatureToken(this.StandAloneSig.FindOrAddRecord(this.Blobs.Add(ByteBuffer.Wrap(sigBytes, sigLength))) | (StandAloneSigTable.Index << 24));
-               }
-
-               public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       return new ArrayMethod(this, arrayClass, methodName, callingConvention, returnType, parameterTypes);
-               }
-
-               public MethodToken GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       return GetMethodToken(GetArrayMethod(arrayClass, methodName, callingConvention, returnType, parameterTypes));
-               }
-
-               internal override Type GetModuleType()
-               {
-                       return moduleType;
-               }
-
-               internal override IKVM.Reflection.Reader.ByteReader GetBlob(int blobIndex)
-               {
-                       return Blobs.GetBlob(blobIndex);
-               }
-
-               internal int GetSignatureBlobIndex(Signature sig)
-               {
-                       ByteBuffer bb = new ByteBuffer(16);
-                       sig.WriteSig(this, bb);
-                       return this.Blobs.Add(bb);
-               }
-
-               // non-standard API
-               public new long __ImageBase
-               {
-                       get { return imageBaseAddress; }
-                       set { imageBaseAddress = value; }
-               }
-
-               protected override long GetImageBaseImpl()
-               {
-                       return imageBaseAddress;
-               }
-
-               public new long __StackReserve
-               {
-                       get { return stackReserve; }
-                       set { stackReserve = value; }
-               }
-
-               protected override long GetStackReserveImpl()
-               {
-                       return stackReserve;
-               }
-
-               [Obsolete("Use __StackReserve property.")]
-               public void __SetStackReserve(long stackReserve)
-               {
-                       __StackReserve = stackReserve;
-               }
-
-               internal ulong GetStackReserve(ulong defaultValue)
-               {
-                       return stackReserve == -1 ? defaultValue : (ulong)stackReserve;
-               }
-
-               public new int __FileAlignment
-               {
-                       get { return fileAlignment; }
-                       set { fileAlignment = value; }
-               }
-
-               protected override int GetFileAlignmentImpl()
-               {
-                       return fileAlignment;
-               }
-
-               public new DllCharacteristics __DllCharacteristics
-               {
-                       get { return dllCharacteristics; }
-                       set { dllCharacteristics = value; }
-               }
-
-               protected override DllCharacteristics GetDllCharacteristicsImpl()
-               {
-                       return dllCharacteristics;
-               }
-
-               public override int MDStreamVersion
-               {
-                       get { return asm.mdStreamVersion; }
-               }
-
-               private int AddTypeRefByName(int resolutionScope, string ns, string name)
-               {
-                       TypeRefTable.Record rec = new TypeRefTable.Record();
-                       rec.ResolutionScope = resolutionScope;
-                       rec.TypeName = this.Strings.Add(name);
-                       rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
-                       return 0x01000000 | this.TypeRef.AddRecord(rec);
-               }
-
-               public void __Save(PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       SaveImpl(null, portableExecutableKind, imageFileMachine);
-               }
-
-               public void __Save(Stream stream, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek || stream.Position != 0)
-                       {
-                               throw new ArgumentException("Stream must support read/write/seek and current position must be zero.", "stream");
-                       }
-                       SaveImpl(stream, portableExecutableKind, imageFileMachine);
-               }
-
-               private void SaveImpl(Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
-               {
-                       SetIsSaved();
-                       PopulatePropertyAndEventTables();
-                       IList<CustomAttributeData> attributes = asm.GetCustomAttributesData(null);
-                       if (attributes.Count > 0)
-                       {
-                               int mscorlib = ImportAssemblyRef(universe.Mscorlib);
-                               int[] placeholderTokens = new int[4];
-                               string[] placeholderTypeNames = new string[] { "AssemblyAttributesGoHere", "AssemblyAttributesGoHereM", "AssemblyAttributesGoHereS", "AssemblyAttributesGoHereSM" };
-                               foreach (CustomAttributeData cad in attributes)
-                               {
-                                       int index;
-                                       if (cad.Constructor.DeclaringType.BaseType == universe.System_Security_Permissions_CodeAccessSecurityAttribute)
-                                       {
-                                               if (cad.Constructor.DeclaringType.IsAllowMultipleCustomAttribute)
-                                               {
-                                                       index = 3;
-                                               }
-                                               else
-                                               {
-                                                       index = 2;
-                                               }
-                                       }
-                                       else if (cad.Constructor.DeclaringType.IsAllowMultipleCustomAttribute)
-                                       {
-                                               index = 1;
-                                       }
-                                       else
-                                       {
-                                               index = 0;
-                                       }
-                                       if (placeholderTokens[index] == 0)
-                                       {
-                                               // we manually add a TypeRef without looking it up in mscorlib, because Mono and Silverlight's mscorlib don't have these types
-                                               placeholderTokens[index] = AddTypeRefByName(mscorlib, "System.Runtime.CompilerServices", placeholderTypeNames[index]);
-                                       }
-                                       SetCustomAttribute(placeholderTokens[index], cad.__ToBuilder());
-                               }
-                       }
-                       FillAssemblyRefTable();
-                       EmitResources();
-                       ModuleWriter.WriteModule(null, null, this, PEFileKinds.Dll, portableExecutableKind, imageFileMachine, unmanagedResources, 0, streamOrNull);
-               }
-
-               public void __AddAssemblyReference(AssemblyName assemblyName)
-               {
-                       __AddAssemblyReference(assemblyName, null);
-               }
-
-               public void __AddAssemblyReference(AssemblyName assemblyName, Assembly assembly)
-               {
-                       if (referencedAssemblyNames == null)
-                       {
-                               referencedAssemblyNames = new List<AssemblyName>();
-                       }
-                       referencedAssemblyNames.Add((AssemblyName)assemblyName.Clone());
-                       int token = FindOrAddAssemblyRef(assemblyName, true);
-                       if (assembly != null)
-                       {
-                               referencedAssemblies.Add(assembly, token);
-                       }
-               }
-
-               public override AssemblyName[] __GetReferencedAssemblies()
-               {
-                       List<AssemblyName> list = new List<AssemblyName>();
-                       if (referencedAssemblyNames != null)
-                       {
-                               foreach (AssemblyName name in referencedAssemblyNames)
-                               {
-                                       if (!list.Contains(name))
-                                       {
-                                               list.Add(name);
-                                       }
-                               }
-                       }
-                       foreach (Assembly asm in referencedAssemblies.Keys)
-                       {
-                               AssemblyName name = asm.GetName();
-                               if (!list.Contains(name))
-                               {
-                                       list.Add(name);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public void __AddModuleReference(string module)
-               {
-                       this.ModuleRef.FindOrAddRecord(module == null ? 0 : this.Strings.Add(module));
-               }
-
-               public override string[] __GetReferencedModules()
-               {
-                       string[] arr = new string[this.ModuleRef.RowCount];
-                       for (int i = 0; i < arr.Length; i++)
-                       {
-                               arr[i] = this.Strings.Find(this.ModuleRef.records[i]);
-                       }
-                       return arr;
-               }
-
-               public override Type[] __GetReferencedTypes()
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (KeyValuePair<Type, int> kv in typeTokens)
-                       {
-                               if (kv.Value >> 24 == TypeRefTable.Index)
-                               {
-                                       list.Add(kv.Key);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public override Type[] __GetExportedTypes()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public int __AddModule(int flags, string name, byte[] hash)
-               {
-                       FileTable.Record file = new FileTable.Record();
-                       file.Flags = flags;
-                       file.Name = this.Strings.Add(name);
-                       file.HashValue = this.Blobs.Add(ByteBuffer.Wrap(hash));
-                       return 0x26000000 + this.File.AddRecord(file);
-               }
-
-               public int __AddManifestResource(int offset, ResourceAttributes flags, string name, int implementation)
-               {
-                       ManifestResourceTable.Record res = new ManifestResourceTable.Record();
-                       res.Offset = offset;
-                       res.Flags = (int)flags;
-                       res.Name = this.Strings.Add(name);
-                       res.Implementation = implementation;
-                       return 0x28000000 + this.ManifestResource.AddRecord(res);
-               }
-
-               public void __SetCustomAttributeFor(int token, CustomAttributeBuilder customBuilder)
-               {
-                       SetCustomAttribute(token, customBuilder);
-               }
-
-               public RelativeVirtualAddress __AddVTableFixups(MethodBuilder[] methods, int type)
-               {
-                       initializedData.Align(8);
-                       VTableFixups fixups;
-                       fixups.initializedDataOffset = (uint)initializedData.Position;
-                       fixups.count = (ushort)methods.Length;
-                       fixups.type = (ushort)type;
-                       foreach (MethodBuilder mb in methods)
-                       {
-                               initializedData.Write(mb.MetadataToken);
-                               if (fixups.SlotWidth == 8)
-                               {
-                                       initializedData.Write(0);
-                               }
-                       }
-                       vtablefixups.Add(fixups);
-                       return new RelativeVirtualAddress(fixups.initializedDataOffset);
-               }
-
-               public void __AddUnmanagedExportStub(string name, int ordinal, RelativeVirtualAddress rva)
-               {
-                       AddUnmanagedExport(name, ordinal, null, rva);
-               }
-
-               internal void AddUnmanagedExport(string name, int ordinal, MethodBuilder methodBuilder, RelativeVirtualAddress rva)
-               {
-                       UnmanagedExport export;
-                       export.name = name;
-                       export.ordinal = ordinal;
-                       export.mb = methodBuilder;
-                       export.rva = rva;
-                       unmanagedExports.Add(export);
-               }
-
-               internal void SetInterfaceImplementationCustomAttribute(TypeBuilder typeBuilder, Type interfaceType, CustomAttributeBuilder cab)
-               {
-                       // NOTE since interfaceimpls are extremely common and custom attributes on them are extremely rare,
-                       // we store (and resolve) the custom attributes in such away as to avoid impacting the common case performance
-                       if (interfaceImplCustomAttributes == null)
-                       {
-                               interfaceImplCustomAttributes = new List<InterfaceImplCustomAttribute>();
-                       }
-                       InterfaceImplCustomAttribute rec;
-                       rec.type = typeBuilder.MetadataToken;
-                       int token = GetTypeToken(interfaceType).Token;
-                       switch (token >> 24)
-                       {
-                               case TypeDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 0;
-                                       break;
-                               case TypeRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 1;
-                                       break;
-                               case TypeSpecTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 2;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       rec.interfaceType = token;
-                       rec.pseudoToken = AllocPseudoToken();
-                       interfaceImplCustomAttributes.Add(rec);
-                       SetCustomAttribute(rec.pseudoToken, cab);
-               }
-
-               internal void ResolveInterfaceImplPseudoTokens()
-               {
-                       if (interfaceImplCustomAttributes != null)
-                       {
-                               foreach (InterfaceImplCustomAttribute rec in interfaceImplCustomAttributes)
-                               {
-                                       for (int i = 0; i < InterfaceImpl.records.Length; i++)
-                                       {
-                                               if (InterfaceImpl.records[i].Class == rec.type && InterfaceImpl.records[i].Interface == rec.interfaceType)
-                                               {
-                                                       RegisterTokenFixup(rec.pseudoToken, (InterfaceImplTable.Index << 24) | (i + 1));
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               internal void FixupPseudoToken(ref int token)
-               {
-                       if (IsPseudoToken(token))
-                       {
-                               token = ResolvePseudoToken(token);
-                       }
-               }
-
-               internal void SetIsSaved()
-               {
-                       if (saved)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       saved = true;
-               }
-
-               internal bool IsSaved
-               {
-                       get { return saved; }
-               }
-
-               internal override string GetString(int index)
-               {
-                       return this.Strings.Find(index);
-               }
-       }
-
-       struct UnmanagedExport
-       {
-               internal string name;
-               internal int ordinal;
-               internal RelativeVirtualAddress rva;
-               internal MethodBuilder mb;
-       }
-
-       public struct RelativeVirtualAddress
-       {
-               internal readonly uint initializedDataOffset;
-
-               internal RelativeVirtualAddress(uint initializedDataOffset)
-               {
-                       this.initializedDataOffset = initializedDataOffset;
-               }
-
-               public static RelativeVirtualAddress operator +(RelativeVirtualAddress rva, int offset)
-               {
-                       return new RelativeVirtualAddress(rva.initializedDataOffset + (uint)offset);
-               }
-       }
-
-       class ArrayMethod : MethodInfo
-       {
-               private readonly Module module;
-               private readonly Type arrayClass;
-               private readonly string methodName;
-               private readonly CallingConventions callingConvention;
-               private readonly Type returnType;
-               protected readonly Type[] parameterTypes;
-               private MethodSignature methodSignature;
-
-               internal ArrayMethod(Module module, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       this.module = module;
-                       this.arrayClass = arrayClass;
-                       this.methodName = methodName;
-                       this.callingConvention = callingConvention;
-                       this.returnType = returnType ?? module.universe.System_Void;
-                       this.parameterTypes = Util.Copy(parameterTypes);
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public override int __MethodRVA
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       throw new NotSupportedException();
-               }
-
-               internal override int ImportTo(ModuleBuilder module)
-               {
-                       return module.ImportMethodOrField(arrayClass, methodName, MethodSignature);
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return callingConvention; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return arrayClass; }
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get
-                       {
-                               if (methodSignature == null)
-                               {
-                                       methodSignature = MethodSignature.MakeFromBuilder(returnType, parameterTypes, new PackedCustomModifiers(), callingConvention, 0);
-                               }
-                               return methodSignature;
-                       }
-               }
-
-               public override Module Module
-               {
-                       // FXBUG like .NET, we return the module that GetArrayMethod was called on, not the module associated with the array type
-                       get { return module; }
-               }
-
-               public override string Name
-               {
-                       get { return methodName; }
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return parameterTypes.Length; }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       // FXBUG like .NET, we throw NotImplementedException
-                       get { throw new NotImplementedException(); }
-               }
-
-               public override Type ReturnType
-               {
-                       get { return returnType; }
-               }
-
-               internal override bool HasThis
-               {
-                       get { return (callingConvention & (CallingConventions.HasThis | CallingConventions.ExplicitThis)) == CallingConventions.HasThis; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return arrayClass.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/OpCode.cs b/mcs/class/IKVM.Reflection/Emit/OpCode.cs
deleted file mode 100644 (file)
index 1d75a0a..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
-  Copyright (C) 2008, 2010 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Diagnostics;
-
-namespace IKVM.Reflection.Emit
-{
-       public struct OpCode
-       {
-               private const int ValueCount = 1024;
-               private const int OperandTypeCount = 19;
-               private const int FlowControlCount = 9;
-               private const int StackDiffCount = 5;
-               private const int OpCodeTypeCount = 6;
-               private const int StackBehaviourPopCount = 20;
-               private const int StackBehaviourPushCount = 9;
-               private static readonly StackBehaviour[] pop = {
-                       StackBehaviour.Pop0,
-                       StackBehaviour.Pop1,
-                       StackBehaviour.Pop1_pop1,
-                       StackBehaviour.Popi,
-                       StackBehaviour.Popi_pop1,
-                       StackBehaviour.Popi_popi,
-                       StackBehaviour.Popi_popi8,
-                       StackBehaviour.Popi_popi_popi,
-                       StackBehaviour.Popi_popr4,
-                       StackBehaviour.Popi_popr8,
-                       StackBehaviour.Popref,
-                       StackBehaviour.Popref_pop1,
-                       StackBehaviour.Popref_popi,
-                       StackBehaviour.Popref_popi_popi,
-                       StackBehaviour.Popref_popi_popi8,
-                       StackBehaviour.Popref_popi_popr4,
-                       StackBehaviour.Popref_popi_popr8,
-                       StackBehaviour.Popref_popi_popref,
-                       StackBehaviour.Varpop,
-                       StackBehaviour.Popref_popi_pop1
-               };
-               private static readonly StackBehaviour[] push = {
-                       StackBehaviour.Push0,
-                       StackBehaviour.Push1,
-                       StackBehaviour.Push1_push1,
-                       StackBehaviour.Pushi,
-                       StackBehaviour.Pushi8,
-                       StackBehaviour.Pushr4,
-                       StackBehaviour.Pushr8,
-                       StackBehaviour.Pushref,
-                       StackBehaviour.Varpush
-               };
-               private readonly int value;
-
-               internal OpCode(int value)
-               {
-                       this.value = value;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return this == obj as OpCode?;
-               }
-
-               public override int GetHashCode()
-               {
-                       return value;
-               }
-
-               public bool Equals(OpCode other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(OpCode a, OpCode b)
-               {
-                       return a.value == b.value;
-               }
-
-               public static bool operator !=(OpCode a, OpCode b)
-               {
-                       return !(a == b);
-               }
-
-               public short Value
-               {
-                       get { return (short)(value >> 22); }
-               }
-
-               public int Size
-               {
-                       get { return value < 0 ? 2 : 1; }
-               }
-
-#if !GENERATOR
-               public string Name
-               {
-                       get { return OpCodes.GetName(this.Value); }
-               }
-#endif
-
-               public OperandType OperandType
-               {
-                       get { return (OperandType)((value & 0x3FFFFF) % OperandTypeCount); }
-               }
-
-               public FlowControl FlowControl
-               {
-                       get { return (FlowControl)(((value & 0x3FFFFF) / OperandTypeCount) % FlowControlCount); }
-               }
-
-               internal int StackDiff
-               {
-                       get { return ((((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount)) % StackDiffCount) - 3); }
-               }
-
-               public OpCodeType OpCodeType
-               {
-                       get { return (OpCodeType)(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount)) % OpCodeTypeCount); }
-               }
-
-               public StackBehaviour StackBehaviourPop
-               {
-                       get { return pop[(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount * OpCodeTypeCount)) % StackBehaviourPopCount)]; }
-               }
-
-               public StackBehaviour StackBehaviourPush
-               {
-                       get { return push[(((value & 0x3FFFFF) / (OperandTypeCount * FlowControlCount * StackDiffCount * OpCodeTypeCount * StackBehaviourPopCount)) % StackBehaviourPushCount)]; }
-               }
-
-#if GENERATOR
-               static void Main(string[] args)
-               {
-                       Debug.Assert(pop.Length == StackBehaviourPopCount);
-                       Debug.Assert(push.Length == StackBehaviourPushCount);
-                       CheckEnumRange(typeof(FlowControl), FlowControlCount);
-                       CheckEnumRange(typeof(OpCodeType), OpCodeTypeCount);
-                       CheckEnumRange(typeof(OperandType), OperandTypeCount);
-                       foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
-                       {
-                               System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
-                               IKVM.Reflection.Emit.OpCode opc2 = new IKVM.Reflection.Emit.OpCode(Pack(opc1));
-                               Debug.Assert(opc1.Value == opc2.Value);
-                               Debug.Assert(opc1.Size == opc2.Size);
-                               Debug.Assert((int)opc1.FlowControl == (int)opc2.FlowControl);
-                               Debug.Assert((int)opc1.OpCodeType == (int)opc2.OpCodeType);
-                               Debug.Assert((int)opc1.OperandType == (int)opc2.OperandType);
-                               Debug.Assert((int)opc1.StackBehaviourPop == (int)opc2.StackBehaviourPop);
-                               Debug.Assert((int)opc1.StackBehaviourPush == (int)opc2.StackBehaviourPush);
-                               Console.WriteLine("\t\tpublic static readonly OpCode {0} = new OpCode({1});", field.Name, Pack(opc1));
-                       }
-                       Console.WriteLine();
-                       Console.WriteLine("\t\tinternal static string GetName(int value)");
-                       Console.WriteLine("\t\t{");
-                       Console.WriteLine("\t\t\tswitch (value)");
-                       Console.WriteLine("\t\t\t{");
-                       foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
-                       {
-                               System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
-                               Console.WriteLine("\t\t\t\tcase {0}:", opc1.Value);
-                               Console.WriteLine("\t\t\t\t\treturn \"{0}\";", opc1.Name);
-                       }
-                       Console.WriteLine("\t\t\t}");
-                       Console.WriteLine("\t\t\tthrow new ArgumentOutOfRangeException();");
-                       Console.WriteLine("\t\t}");
-                       Console.WriteLine();
-                       Console.WriteLine("\t\tpublic static bool TakesSingleByteArgument(OpCode inst)");
-                       Console.WriteLine("\t\t{");
-                       Console.WriteLine("\t\t\tswitch (inst.Value)");
-                       Console.WriteLine("\t\t\t{");
-                       foreach (var field in typeof(System.Reflection.Emit.OpCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
-                       {
-                               System.Reflection.Emit.OpCode opc1 = (System.Reflection.Emit.OpCode)field.GetValue(null);
-                               if (System.Reflection.Emit.OpCodes.TakesSingleByteArgument(opc1))
-                               {
-                                       Console.WriteLine("\t\t\t\tcase {0}:", opc1.Value);
-                               }
-                       }
-                       Console.WriteLine("\t\t\t\t\treturn true;");
-                       Console.WriteLine("\t\t\t\tdefault:");
-                       Console.WriteLine("\t\t\t\t\treturn false;");
-                       Console.WriteLine("\t\t\t}");
-                       Console.WriteLine("\t\t}");
-               }
-
-               private static void CheckEnumRange(System.Type type, int count)
-               {
-                       foreach (var field in type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
-                       {
-                               int value = (int)field.GetValue(null);
-                               Debug.Assert(value >= 0 && value < count);
-                       }
-               }
-
-               static int Pack(System.Reflection.Emit.OpCode opcode)
-               {
-                       int value = 0;
-                       value *= StackBehaviourPushCount;
-                       value += Map(push, opcode.StackBehaviourPush);
-                       value *= StackBehaviourPopCount;
-                       value += Map(pop, opcode.StackBehaviourPop);
-                       value *= OpCodeTypeCount;
-                       value += (int)opcode.OpCodeType;
-                       value *= StackDiffCount;
-                       value += 3 + GetStackDiff(opcode.StackBehaviourPush) + GetStackDiff(opcode.StackBehaviourPop);
-                       value *= FlowControlCount;
-                       value += (int)opcode.FlowControl;
-                       value *= OperandTypeCount;
-                       value += (int)opcode.OperandType;
-                       return (opcode.Value << 22) | value;
-               }
-
-               private static int Map(StackBehaviour[] array, System.Reflection.Emit.StackBehaviour stackBehaviour)
-               {
-                       for (int i = 0; i < array.Length; i++)
-                       {
-                               if ((int)array[i] == (int)stackBehaviour)
-                               {
-                                       return i;
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               static int GetStackDiff(System.Reflection.Emit.StackBehaviour sb)
-               {
-                       switch (sb)
-                       {
-                               case System.Reflection.Emit.StackBehaviour.Pop0:
-                               case System.Reflection.Emit.StackBehaviour.Push0:
-                               case System.Reflection.Emit.StackBehaviour.Varpop:
-                               case System.Reflection.Emit.StackBehaviour.Varpush:
-                                       return 0;
-                               case System.Reflection.Emit.StackBehaviour.Pop1:
-                               case System.Reflection.Emit.StackBehaviour.Popi:
-                               case System.Reflection.Emit.StackBehaviour.Popref:
-                                       return -1;
-                               case System.Reflection.Emit.StackBehaviour.Pop1_pop1:
-                               case System.Reflection.Emit.StackBehaviour.Popi_pop1:
-                               case System.Reflection.Emit.StackBehaviour.Popi_popi:
-                               case System.Reflection.Emit.StackBehaviour.Popi_popi8:
-                               case System.Reflection.Emit.StackBehaviour.Popi_popr4:
-                               case System.Reflection.Emit.StackBehaviour.Popi_popr8:
-                               case System.Reflection.Emit.StackBehaviour.Popref_pop1:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi:
-                                       return -2;
-                               case System.Reflection.Emit.StackBehaviour.Popi_popi_popi:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_pop1:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_popi:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_popi8:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_popr4:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_popr8:
-                               case System.Reflection.Emit.StackBehaviour.Popref_popi_popref:
-                                       return -3;
-                               case System.Reflection.Emit.StackBehaviour.Push1:
-                               case System.Reflection.Emit.StackBehaviour.Pushi:
-                               case System.Reflection.Emit.StackBehaviour.Pushi8:
-                               case System.Reflection.Emit.StackBehaviour.Pushr4:
-                               case System.Reflection.Emit.StackBehaviour.Pushr8:
-                               case System.Reflection.Emit.StackBehaviour.Pushref:
-                                       return 1;
-                               case System.Reflection.Emit.StackBehaviour.Push1_push1:
-                                       return 2;
-                       }
-                       throw new InvalidOperationException();
-               }
-#endif // GENERATOR
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/OpCodes.cs b/mcs/class/IKVM.Reflection/Emit/OpCodes.cs
deleted file mode 100644 (file)
index bb2ddd8..0000000
+++ /dev/null
@@ -1,749 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class OpCodes
-       {
-               public static readonly OpCode Nop = new OpCode(4888);
-               public static readonly OpCode Break = new OpCode(4199116);
-               public static readonly OpCode Ldarg_0 = new OpCode(8492847);
-               public static readonly OpCode Ldarg_1 = new OpCode(12687151);
-               public static readonly OpCode Ldarg_2 = new OpCode(16881455);
-               public static readonly OpCode Ldarg_3 = new OpCode(21075759);
-               public static readonly OpCode Ldloc_0 = new OpCode(25270063);
-               public static readonly OpCode Ldloc_1 = new OpCode(29464367);
-               public static readonly OpCode Ldloc_2 = new OpCode(33658671);
-               public static readonly OpCode Ldloc_3 = new OpCode(37852975);
-               public static readonly OpCode Stloc_0 = new OpCode(41949467);
-               public static readonly OpCode Stloc_1 = new OpCode(46143771);
-               public static readonly OpCode Stloc_2 = new OpCode(50338075);
-               public static readonly OpCode Stloc_3 = new OpCode(54532379);
-               public static readonly OpCode Ldarg_S = new OpCode(58824508);
-               public static readonly OpCode Ldarga_S = new OpCode(63224012);
-               public static readonly OpCode Starg_S = new OpCode(67115304);
-               public static readonly OpCode Ldloc_S = new OpCode(71407420);
-               public static readonly OpCode Ldloca_S = new OpCode(75806924);
-               public static readonly OpCode Stloc_S = new OpCode(79698216);
-               public static readonly OpCode Ldnull = new OpCode(84609339);
-               public static readonly OpCode Ldc_I4_M1 = new OpCode(88389823);
-               public static readonly OpCode Ldc_I4_0 = new OpCode(92584127);
-               public static readonly OpCode Ldc_I4_1 = new OpCode(96778431);
-               public static readonly OpCode Ldc_I4_2 = new OpCode(100972735);
-               public static readonly OpCode Ldc_I4_3 = new OpCode(105167039);
-               public static readonly OpCode Ldc_I4_4 = new OpCode(109361343);
-               public static readonly OpCode Ldc_I4_5 = new OpCode(113555647);
-               public static readonly OpCode Ldc_I4_6 = new OpCode(117749951);
-               public static readonly OpCode Ldc_I4_7 = new OpCode(121944255);
-               public static readonly OpCode Ldc_I4_8 = new OpCode(126138559);
-               public static readonly OpCode Ldc_I4_S = new OpCode(130332874);
-               public static readonly OpCode Ldc_I4 = new OpCode(134530584);
-               public static readonly OpCode Ldc_I8 = new OpCode(138827489);
-               public static readonly OpCode Ldc_R4 = new OpCode(143124407);
-               public static readonly OpCode Ldc_R8 = new OpCode(147421301);
-               public static readonly OpCode Dup = new OpCode(155404637);
-               public static readonly OpCode Pop = new OpCode(159393399);
-               public static readonly OpCode Jmp = new OpCode(163582686);
-               public static readonly OpCode Call = new OpCode(168690130);
-               public static readonly OpCode Calli = new OpCode(172884439);
-               public static readonly OpCode Ret = new OpCode(176258034);
-               public static readonly OpCode Br_S = new OpCode(180356455);
-               public static readonly OpCode Brfalse_S = new OpCode(184566035);
-               public static readonly OpCode Brtrue_S = new OpCode(188760339);
-               public static readonly OpCode Beq_S = new OpCode(192949342);
-               public static readonly OpCode Bge_S = new OpCode(197143646);
-               public static readonly OpCode Bgt_S = new OpCode(201337950);
-               public static readonly OpCode Ble_S = new OpCode(205532254);
-               public static readonly OpCode Blt_S = new OpCode(209726558);
-               public static readonly OpCode Bne_Un_S = new OpCode(213920862);
-               public static readonly OpCode Bge_Un_S = new OpCode(218115166);
-               public static readonly OpCode Bgt_Un_S = new OpCode(222309470);
-               public static readonly OpCode Ble_Un_S = new OpCode(226503774);
-               public static readonly OpCode Blt_Un_S = new OpCode(230698078);
-               public static readonly OpCode Br = new OpCode(234885812);
-               public static readonly OpCode Brfalse = new OpCode(239095392);
-               public static readonly OpCode Brtrue = new OpCode(243289696);
-               public static readonly OpCode Beq = new OpCode(247475279);
-               public static readonly OpCode Bge = new OpCode(251669583);
-               public static readonly OpCode Bgt = new OpCode(255863887);
-               public static readonly OpCode Ble = new OpCode(260058191);
-               public static readonly OpCode Blt = new OpCode(264252495);
-               public static readonly OpCode Bne_Un = new OpCode(268446799);
-               public static readonly OpCode Bge_Un = new OpCode(272641103);
-               public static readonly OpCode Bgt_Un = new OpCode(276835407);
-               public static readonly OpCode Ble_Un = new OpCode(281029711);
-               public static readonly OpCode Blt_Un = new OpCode(285224015);
-               public static readonly OpCode Switch = new OpCode(289427051);
-               public static readonly OpCode Ldind_I1 = new OpCode(293929358);
-               public static readonly OpCode Ldind_U1 = new OpCode(298123662);
-               public static readonly OpCode Ldind_I2 = new OpCode(302317966);
-               public static readonly OpCode Ldind_U2 = new OpCode(306512270);
-               public static readonly OpCode Ldind_I4 = new OpCode(310706574);
-               public static readonly OpCode Ldind_U4 = new OpCode(314900878);
-               public static readonly OpCode Ldind_I8 = new OpCode(319197782);
-               public static readonly OpCode Ldind_I = new OpCode(323289486);
-               public static readonly OpCode Ldind_R4 = new OpCode(327688990);
-               public static readonly OpCode Ldind_R8 = new OpCode(331985894);
-               public static readonly OpCode Ldind_Ref = new OpCode(336282798);
-               public static readonly OpCode Stind_Ref = new OpCode(339768820);
-               public static readonly OpCode Stind_I1 = new OpCode(343963124);
-               public static readonly OpCode Stind_I2 = new OpCode(348157428);
-               public static readonly OpCode Stind_I4 = new OpCode(352351732);
-               public static readonly OpCode Stind_I8 = new OpCode(356551166);
-               public static readonly OpCode Stind_R4 = new OpCode(360755730);
-               public static readonly OpCode Stind_R8 = new OpCode(364955164);
-               public static readonly OpCode Add = new OpCode(369216329);
-               public static readonly OpCode Sub = new OpCode(373410633);
-               public static readonly OpCode Mul = new OpCode(377604937);
-               public static readonly OpCode Div = new OpCode(381799241);
-               public static readonly OpCode Div_Un = new OpCode(385993545);
-               public static readonly OpCode Rem = new OpCode(390187849);
-               public static readonly OpCode Rem_Un = new OpCode(394382153);
-               public static readonly OpCode And = new OpCode(398576457);
-               public static readonly OpCode Or = new OpCode(402770761);
-               public static readonly OpCode Xor = new OpCode(406965065);
-               public static readonly OpCode Shl = new OpCode(411159369);
-               public static readonly OpCode Shr = new OpCode(415353673);
-               public static readonly OpCode Shr_Un = new OpCode(419547977);
-               public static readonly OpCode Neg = new OpCode(423737322);
-               public static readonly OpCode Not = new OpCode(427931626);
-               public static readonly OpCode Conv_I1 = new OpCode(432331130);
-               public static readonly OpCode Conv_I2 = new OpCode(436525434);
-               public static readonly OpCode Conv_I4 = new OpCode(440719738);
-               public static readonly OpCode Conv_I8 = new OpCode(445016642);
-               public static readonly OpCode Conv_R4 = new OpCode(449313546);
-               public static readonly OpCode Conv_R8 = new OpCode(453610450);
-               public static readonly OpCode Conv_U4 = new OpCode(457496954);
-               public static readonly OpCode Conv_U8 = new OpCode(461793858);
-               public static readonly OpCode Callvirt = new OpCode(466484004);
-               public static readonly OpCode Cpobj = new OpCode(469790542);
-               public static readonly OpCode Ldobj = new OpCode(474077528);
-               public static readonly OpCode Ldstr = new OpCode(478872210);
-               public static readonly OpCode Newobj = new OpCode(483158791);
-               public static readonly OpCode Castclass = new OpCode(487311950);
-               public static readonly OpCode Isinst = new OpCode(491095854);
-               public static readonly OpCode Conv_R_Un = new OpCode(495553490);
-               public static readonly OpCode Unbox = new OpCode(507874780);
-               public static readonly OpCode Throw = new OpCode(511759452);
-               public static readonly OpCode Ldfld = new OpCode(516056466);
-               public static readonly OpCode Ldflda = new OpCode(520455970);
-               public static readonly OpCode Stfld = new OpCode(524347262);
-               public static readonly OpCode Ldsfld = new OpCode(528588249);
-               public static readonly OpCode Ldsflda = new OpCode(532987753);
-               public static readonly OpCode Stsfld = new OpCode(536879045);
-               public static readonly OpCode Stobj = new OpCode(541090290);
-               public static readonly OpCode Conv_Ovf_I1_Un = new OpCode(545577338);
-               public static readonly OpCode Conv_Ovf_I2_Un = new OpCode(549771642);
-               public static readonly OpCode Conv_Ovf_I4_Un = new OpCode(553965946);
-               public static readonly OpCode Conv_Ovf_I8_Un = new OpCode(558262850);
-               public static readonly OpCode Conv_Ovf_U1_Un = new OpCode(562354554);
-               public static readonly OpCode Conv_Ovf_U2_Un = new OpCode(566548858);
-               public static readonly OpCode Conv_Ovf_U4_Un = new OpCode(570743162);
-               public static readonly OpCode Conv_Ovf_U8_Un = new OpCode(575040066);
-               public static readonly OpCode Conv_Ovf_I_Un = new OpCode(579131770);
-               public static readonly OpCode Conv_Ovf_U_Un = new OpCode(583326074);
-               public static readonly OpCode Box = new OpCode(587930786);
-               public static readonly OpCode Newarr = new OpCode(592133640);
-               public static readonly OpCode Ldlen = new OpCode(595953446);
-               public static readonly OpCode Ldelema = new OpCode(600157847);
-               public static readonly OpCode Ldelem_I1 = new OpCode(604352143);
-               public static readonly OpCode Ldelem_U1 = new OpCode(608546447);
-               public static readonly OpCode Ldelem_I2 = new OpCode(612740751);
-               public static readonly OpCode Ldelem_U2 = new OpCode(616935055);
-               public static readonly OpCode Ldelem_I4 = new OpCode(621129359);
-               public static readonly OpCode Ldelem_U4 = new OpCode(625323663);
-               public static readonly OpCode Ldelem_I8 = new OpCode(629620567);
-               public static readonly OpCode Ldelem_I = new OpCode(633712271);
-               public static readonly OpCode Ldelem_R4 = new OpCode(638111775);
-               public static readonly OpCode Ldelem_R8 = new OpCode(642408679);
-               public static readonly OpCode Ldelem_Ref = new OpCode(646705583);
-               public static readonly OpCode Stelem_I = new OpCode(650186475);
-               public static readonly OpCode Stelem_I1 = new OpCode(654380779);
-               public static readonly OpCode Stelem_I2 = new OpCode(658575083);
-               public static readonly OpCode Stelem_I4 = new OpCode(662769387);
-               public static readonly OpCode Stelem_I8 = new OpCode(666968821);
-               public static readonly OpCode Stelem_R4 = new OpCode(671168255);
-               public static readonly OpCode Stelem_R8 = new OpCode(675367689);
-               public static readonly OpCode Stelem_Ref = new OpCode(679567123);
-               public static readonly OpCode Ldelem = new OpCode(683838727);
-               public static readonly OpCode Stelem = new OpCode(687965999);
-               public static readonly OpCode Unbox_Any = new OpCode(692217246);
-               public static readonly OpCode Conv_Ovf_I1 = new OpCode(751098234);
-               public static readonly OpCode Conv_Ovf_U1 = new OpCode(755292538);
-               public static readonly OpCode Conv_Ovf_I2 = new OpCode(759486842);
-               public static readonly OpCode Conv_Ovf_U2 = new OpCode(763681146);
-               public static readonly OpCode Conv_Ovf_I4 = new OpCode(767875450);
-               public static readonly OpCode Conv_Ovf_U4 = new OpCode(772069754);
-               public static readonly OpCode Conv_Ovf_I8 = new OpCode(776366658);
-               public static readonly OpCode Conv_Ovf_U8 = new OpCode(780560962);
-               public static readonly OpCode Refanyval = new OpCode(814012802);
-               public static readonly OpCode Ckfinite = new OpCode(818514898);
-               public static readonly OpCode Mkrefany = new OpCode(830595078);
-               public static readonly OpCode Ldtoken = new OpCode(872728098);
-               public static readonly OpCode Conv_U2 = new OpCode(876927354);
-               public static readonly OpCode Conv_U1 = new OpCode(881121658);
-               public static readonly OpCode Conv_I = new OpCode(885315962);
-               public static readonly OpCode Conv_Ovf_I = new OpCode(889510266);
-               public static readonly OpCode Conv_Ovf_U = new OpCode(893704570);
-               public static readonly OpCode Add_Ovf = new OpCode(897698633);
-               public static readonly OpCode Add_Ovf_Un = new OpCode(901892937);
-               public static readonly OpCode Mul_Ovf = new OpCode(906087241);
-               public static readonly OpCode Mul_Ovf_Un = new OpCode(910281545);
-               public static readonly OpCode Sub_Ovf = new OpCode(914475849);
-               public static readonly OpCode Sub_Ovf_Un = new OpCode(918670153);
-               public static readonly OpCode Endfinally = new OpCode(922751806);
-               public static readonly OpCode Leave = new OpCode(926945972);
-               public static readonly OpCode Leave_S = new OpCode(931140291);
-               public static readonly OpCode Stind_I = new OpCode(935359988);
-               public static readonly OpCode Conv_U = new OpCode(939841914);
-               public static readonly OpCode Prefix7 = new OpCode(1040189696);
-               public static readonly OpCode Prefix6 = new OpCode(1044384000);
-               public static readonly OpCode Prefix5 = new OpCode(1048578304);
-               public static readonly OpCode Prefix4 = new OpCode(1052772608);
-               public static readonly OpCode Prefix3 = new OpCode(1056966912);
-               public static readonly OpCode Prefix2 = new OpCode(1061161216);
-               public static readonly OpCode Prefix1 = new OpCode(1065355520);
-               public static readonly OpCode Prefixref = new OpCode(1069549824);
-               public static readonly OpCode Arglist = new OpCode(-2147170789);
-               public static readonly OpCode Ceq = new OpCode(-2142966567);
-               public static readonly OpCode Cgt = new OpCode(-2138772263);
-               public static readonly OpCode Cgt_Un = new OpCode(-2134577959);
-               public static readonly OpCode Clt = new OpCode(-2130383655);
-               public static readonly OpCode Clt_Un = new OpCode(-2126189351);
-               public static readonly OpCode Ldftn = new OpCode(-2122004966);
-               public static readonly OpCode Ldvirtftn = new OpCode(-2117759533);
-               public static readonly OpCode Ldarg = new OpCode(-2109627244);
-               public static readonly OpCode Ldarga = new OpCode(-2105227740);
-               public static readonly OpCode Starg = new OpCode(-2101336448);
-               public static readonly OpCode Ldloc = new OpCode(-2097044332);
-               public static readonly OpCode Ldloca = new OpCode(-2092644828);
-               public static readonly OpCode Stloc = new OpCode(-2088753536);
-               public static readonly OpCode Localloc = new OpCode(-2084241010);
-               public static readonly OpCode Endfilter = new OpCode(-2076160335);
-               public static readonly OpCode Unaligned = new OpCode(-2071982151);
-               public static readonly OpCode Volatile = new OpCode(-2067787858);
-               public static readonly OpCode Tailcall = new OpCode(-2063593554);
-               public static readonly OpCode Initobj = new OpCode(-2059384859);
-               public static readonly OpCode Constrained = new OpCode(-2055204938);
-               public static readonly OpCode Cpblk = new OpCode(-2050974371);
-               public static readonly OpCode Initblk = new OpCode(-2046780067);
-               public static readonly OpCode Rethrow = new OpCode(-2038428509);
-               public static readonly OpCode Sizeof = new OpCode(-2029730269);
-               public static readonly OpCode Refanytype = new OpCode(-2025531014);
-               public static readonly OpCode Readonly = new OpCode(-2021650514);
-
-               internal static string GetName(int value)
-               {
-                       switch (value)
-                       {
-                               case 0:
-                                       return "nop";
-                               case 1:
-                                       return "break";
-                               case 2:
-                                       return "ldarg.0";
-                               case 3:
-                                       return "ldarg.1";
-                               case 4:
-                                       return "ldarg.2";
-                               case 5:
-                                       return "ldarg.3";
-                               case 6:
-                                       return "ldloc.0";
-                               case 7:
-                                       return "ldloc.1";
-                               case 8:
-                                       return "ldloc.2";
-                               case 9:
-                                       return "ldloc.3";
-                               case 10:
-                                       return "stloc.0";
-                               case 11:
-                                       return "stloc.1";
-                               case 12:
-                                       return "stloc.2";
-                               case 13:
-                                       return "stloc.3";
-                               case 14:
-                                       return "ldarg.s";
-                               case 15:
-                                       return "ldarga.s";
-                               case 16:
-                                       return "starg.s";
-                               case 17:
-                                       return "ldloc.s";
-                               case 18:
-                                       return "ldloca.s";
-                               case 19:
-                                       return "stloc.s";
-                               case 20:
-                                       return "ldnull";
-                               case 21:
-                                       return "ldc.i4.m1";
-                               case 22:
-                                       return "ldc.i4.0";
-                               case 23:
-                                       return "ldc.i4.1";
-                               case 24:
-                                       return "ldc.i4.2";
-                               case 25:
-                                       return "ldc.i4.3";
-                               case 26:
-                                       return "ldc.i4.4";
-                               case 27:
-                                       return "ldc.i4.5";
-                               case 28:
-                                       return "ldc.i4.6";
-                               case 29:
-                                       return "ldc.i4.7";
-                               case 30:
-                                       return "ldc.i4.8";
-                               case 31:
-                                       return "ldc.i4.s";
-                               case 32:
-                                       return "ldc.i4";
-                               case 33:
-                                       return "ldc.i8";
-                               case 34:
-                                       return "ldc.r4";
-                               case 35:
-                                       return "ldc.r8";
-                               case 37:
-                                       return "dup";
-                               case 38:
-                                       return "pop";
-                               case 39:
-                                       return "jmp";
-                               case 40:
-                                       return "call";
-                               case 41:
-                                       return "calli";
-                               case 42:
-                                       return "ret";
-                               case 43:
-                                       return "br.s";
-                               case 44:
-                                       return "brfalse.s";
-                               case 45:
-                                       return "brtrue.s";
-                               case 46:
-                                       return "beq.s";
-                               case 47:
-                                       return "bge.s";
-                               case 48:
-                                       return "bgt.s";
-                               case 49:
-                                       return "ble.s";
-                               case 50:
-                                       return "blt.s";
-                               case 51:
-                                       return "bne.un.s";
-                               case 52:
-                                       return "bge.un.s";
-                               case 53:
-                                       return "bgt.un.s";
-                               case 54:
-                                       return "ble.un.s";
-                               case 55:
-                                       return "blt.un.s";
-                               case 56:
-                                       return "br";
-                               case 57:
-                                       return "brfalse";
-                               case 58:
-                                       return "brtrue";
-                               case 59:
-                                       return "beq";
-                               case 60:
-                                       return "bge";
-                               case 61:
-                                       return "bgt";
-                               case 62:
-                                       return "ble";
-                               case 63:
-                                       return "blt";
-                               case 64:
-                                       return "bne.un";
-                               case 65:
-                                       return "bge.un";
-                               case 66:
-                                       return "bgt.un";
-                               case 67:
-                                       return "ble.un";
-                               case 68:
-                                       return "blt.un";
-                               case 69:
-                                       return "switch";
-                               case 70:
-                                       return "ldind.i1";
-                               case 71:
-                                       return "ldind.u1";
-                               case 72:
-                                       return "ldind.i2";
-                               case 73:
-                                       return "ldind.u2";
-                               case 74:
-                                       return "ldind.i4";
-                               case 75:
-                                       return "ldind.u4";
-                               case 76:
-                                       return "ldind.i8";
-                               case 77:
-                                       return "ldind.i";
-                               case 78:
-                                       return "ldind.r4";
-                               case 79:
-                                       return "ldind.r8";
-                               case 80:
-                                       return "ldind.ref";
-                               case 81:
-                                       return "stind.ref";
-                               case 82:
-                                       return "stind.i1";
-                               case 83:
-                                       return "stind.i2";
-                               case 84:
-                                       return "stind.i4";
-                               case 85:
-                                       return "stind.i8";
-                               case 86:
-                                       return "stind.r4";
-                               case 87:
-                                       return "stind.r8";
-                               case 88:
-                                       return "add";
-                               case 89:
-                                       return "sub";
-                               case 90:
-                                       return "mul";
-                               case 91:
-                                       return "div";
-                               case 92:
-                                       return "div.un";
-                               case 93:
-                                       return "rem";
-                               case 94:
-                                       return "rem.un";
-                               case 95:
-                                       return "and";
-                               case 96:
-                                       return "or";
-                               case 97:
-                                       return "xor";
-                               case 98:
-                                       return "shl";
-                               case 99:
-                                       return "shr";
-                               case 100:
-                                       return "shr.un";
-                               case 101:
-                                       return "neg";
-                               case 102:
-                                       return "not";
-                               case 103:
-                                       return "conv.i1";
-                               case 104:
-                                       return "conv.i2";
-                               case 105:
-                                       return "conv.i4";
-                               case 106:
-                                       return "conv.i8";
-                               case 107:
-                                       return "conv.r4";
-                               case 108:
-                                       return "conv.r8";
-                               case 109:
-                                       return "conv.u4";
-                               case 110:
-                                       return "conv.u8";
-                               case 111:
-                                       return "callvirt";
-                               case 112:
-                                       return "cpobj";
-                               case 113:
-                                       return "ldobj";
-                               case 114:
-                                       return "ldstr";
-                               case 115:
-                                       return "newobj";
-                               case 116:
-                                       return "castclass";
-                               case 117:
-                                       return "isinst";
-                               case 118:
-                                       return "conv.r.un";
-                               case 121:
-                                       return "unbox";
-                               case 122:
-                                       return "throw";
-                               case 123:
-                                       return "ldfld";
-                               case 124:
-                                       return "ldflda";
-                               case 125:
-                                       return "stfld";
-                               case 126:
-                                       return "ldsfld";
-                               case 127:
-                                       return "ldsflda";
-                               case 128:
-                                       return "stsfld";
-                               case 129:
-                                       return "stobj";
-                               case 130:
-                                       return "conv.ovf.i1.un";
-                               case 131:
-                                       return "conv.ovf.i2.un";
-                               case 132:
-                                       return "conv.ovf.i4.un";
-                               case 133:
-                                       return "conv.ovf.i8.un";
-                               case 134:
-                                       return "conv.ovf.u1.un";
-                               case 135:
-                                       return "conv.ovf.u2.un";
-                               case 136:
-                                       return "conv.ovf.u4.un";
-                               case 137:
-                                       return "conv.ovf.u8.un";
-                               case 138:
-                                       return "conv.ovf.i.un";
-                               case 139:
-                                       return "conv.ovf.u.un";
-                               case 140:
-                                       return "box";
-                               case 141:
-                                       return "newarr";
-                               case 142:
-                                       return "ldlen";
-                               case 143:
-                                       return "ldelema";
-                               case 144:
-                                       return "ldelem.i1";
-                               case 145:
-                                       return "ldelem.u1";
-                               case 146:
-                                       return "ldelem.i2";
-                               case 147:
-                                       return "ldelem.u2";
-                               case 148:
-                                       return "ldelem.i4";
-                               case 149:
-                                       return "ldelem.u4";
-                               case 150:
-                                       return "ldelem.i8";
-                               case 151:
-                                       return "ldelem.i";
-                               case 152:
-                                       return "ldelem.r4";
-                               case 153:
-                                       return "ldelem.r8";
-                               case 154:
-                                       return "ldelem.ref";
-                               case 155:
-                                       return "stelem.i";
-                               case 156:
-                                       return "stelem.i1";
-                               case 157:
-                                       return "stelem.i2";
-                               case 158:
-                                       return "stelem.i4";
-                               case 159:
-                                       return "stelem.i8";
-                               case 160:
-                                       return "stelem.r4";
-                               case 161:
-                                       return "stelem.r8";
-                               case 162:
-                                       return "stelem.ref";
-                               case 163:
-                                       return "ldelem";
-                               case 164:
-                                       return "stelem";
-                               case 165:
-                                       return "unbox.any";
-                               case 179:
-                                       return "conv.ovf.i1";
-                               case 180:
-                                       return "conv.ovf.u1";
-                               case 181:
-                                       return "conv.ovf.i2";
-                               case 182:
-                                       return "conv.ovf.u2";
-                               case 183:
-                                       return "conv.ovf.i4";
-                               case 184:
-                                       return "conv.ovf.u4";
-                               case 185:
-                                       return "conv.ovf.i8";
-                               case 186:
-                                       return "conv.ovf.u8";
-                               case 194:
-                                       return "refanyval";
-                               case 195:
-                                       return "ckfinite";
-                               case 198:
-                                       return "mkrefany";
-                               case 208:
-                                       return "ldtoken";
-                               case 209:
-                                       return "conv.u2";
-                               case 210:
-                                       return "conv.u1";
-                               case 211:
-                                       return "conv.i";
-                               case 212:
-                                       return "conv.ovf.i";
-                               case 213:
-                                       return "conv.ovf.u";
-                               case 214:
-                                       return "add.ovf";
-                               case 215:
-                                       return "add.ovf.un";
-                               case 216:
-                                       return "mul.ovf";
-                               case 217:
-                                       return "mul.ovf.un";
-                               case 218:
-                                       return "sub.ovf";
-                               case 219:
-                                       return "sub.ovf.un";
-                               case 220:
-                                       return "endfinally";
-                               case 221:
-                                       return "leave";
-                               case 222:
-                                       return "leave.s";
-                               case 223:
-                                       return "stind.i";
-                               case 224:
-                                       return "conv.u";
-                               case 248:
-                                       return "prefix7";
-                               case 249:
-                                       return "prefix6";
-                               case 250:
-                                       return "prefix5";
-                               case 251:
-                                       return "prefix4";
-                               case 252:
-                                       return "prefix3";
-                               case 253:
-                                       return "prefix2";
-                               case 254:
-                                       return "prefix1";
-                               case 255:
-                                       return "prefixref";
-                               case -512:
-                                       return "arglist";
-                               case -511:
-                                       return "ceq";
-                               case -510:
-                                       return "cgt";
-                               case -509:
-                                       return "cgt.un";
-                               case -508:
-                                       return "clt";
-                               case -507:
-                                       return "clt.un";
-                               case -506:
-                                       return "ldftn";
-                               case -505:
-                                       return "ldvirtftn";
-                               case -503:
-                                       return "ldarg";
-                               case -502:
-                                       return "ldarga";
-                               case -501:
-                                       return "starg";
-                               case -500:
-                                       return "ldloc";
-                               case -499:
-                                       return "ldloca";
-                               case -498:
-                                       return "stloc";
-                               case -497:
-                                       return "localloc";
-                               case -495:
-                                       return "endfilter";
-                               case -494:
-                                       return "unaligned.";
-                               case -493:
-                                       return "volatile.";
-                               case -492:
-                                       return "tail.";
-                               case -491:
-                                       return "initobj";
-                               case -490:
-                                       return "constrained.";
-                               case -489:
-                                       return "cpblk";
-                               case -488:
-                                       return "initblk";
-                               case -486:
-                                       return "rethrow";
-                               case -484:
-                                       return "sizeof";
-                               case -483:
-                                       return "refanytype";
-                               case -482:
-                                       return "readonly.";
-                       }
-                       throw new ArgumentOutOfRangeException();
-               }
-
-               public static bool TakesSingleByteArgument(OpCode inst)
-               {
-                       switch (inst.Value)
-                       {
-                               case 14:
-                               case 15:
-                               case 16:
-                               case 17:
-                               case 18:
-                               case 19:
-                               case 31:
-                               case 43:
-                               case 44:
-                               case 45:
-                               case 46:
-                               case 47:
-                               case 48:
-                               case 49:
-                               case 50:
-                               case 51:
-                               case 52:
-                               case 53:
-                               case 54:
-                               case 55:
-                               case 222:
-                               case -494:
-                                       return true;
-                               default:
-                                       return false;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/ParameterBuilder.cs b/mcs/class/IKVM.Reflection/Emit/ParameterBuilder.cs
deleted file mode 100644 (file)
index 8b01efc..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class ParameterBuilder
-       {
-               private readonly ModuleBuilder moduleBuilder;
-               private short flags;
-               private readonly short sequence;
-               private readonly int nameIndex;
-               private readonly string name;
-               private int lazyPseudoToken;
-
-               internal ParameterBuilder(ModuleBuilder moduleBuilder, int sequence, ParameterAttributes attribs, string name)
-               {
-                       this.moduleBuilder = moduleBuilder;
-                       this.flags = (short)attribs;
-                       this.sequence = (short)sequence;
-                       this.nameIndex = name == null ? 0 : moduleBuilder.Strings.Add(name);
-                       this.name = name;
-               }
-
-               internal int PseudoToken
-               {
-                       get
-                       {
-                               if (lazyPseudoToken == 0)
-                               {
-                                       // we lazily create the token, because if we don't need it we don't want the token fixup cost
-                                       lazyPseudoToken = moduleBuilder.AllocPseudoToken();
-                               }
-                               return lazyPseudoToken;
-                       }
-               }
-
-               public string Name
-               {
-                       get { return name; }
-               }
-
-               public int Position
-               {
-                       // note that this differs from ParameterInfo.Position, which is zero based
-                       get { return sequence; }
-               }
-
-               public int Attributes
-               {
-                       get { return flags; }
-               }
-
-               public bool IsIn
-               {
-                       get { return (flags & (short)ParameterAttributes.In) != 0; }
-               }
-
-               public bool IsOut
-               {
-                       get { return (flags & (short)ParameterAttributes.Out) != 0; }
-               }
-
-               public bool IsOptional
-               {
-                       get { return (flags & (short)ParameterAttributes.Optional) != 0; }
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customAttributeBuilder)
-               {
-                       Universe u = moduleBuilder.universe;
-                       if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_InAttribute)
-                       {
-                               flags |= (short)ParameterAttributes.In;
-                       }
-                       else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OutAttribute)
-                       {
-                               flags |= (short)ParameterAttributes.Out;
-                       }
-                       else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_OptionalAttribute)
-                       {
-                               flags |= (short)ParameterAttributes.Optional;
-                       }
-                       else if (customAttributeBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
-                       {
-                               FieldMarshal.SetMarshalAsAttribute(moduleBuilder, PseudoToken, customAttributeBuilder);
-                               flags |= (short)ParameterAttributes.HasFieldMarshal;
-                       }
-                       else
-                       {
-                               moduleBuilder.SetCustomAttribute(PseudoToken, customAttributeBuilder);
-                       }
-               }
-
-               public void SetConstant(object defaultValue)
-               {
-                       flags |= (short)ParameterAttributes.HasDefault;
-                       moduleBuilder.AddConstant(PseudoToken, defaultValue);
-               }
-
-               internal void WriteParamRecord(MetadataWriter mw)
-               {
-                       mw.Write(flags);
-                       mw.Write(sequence);
-                       mw.WriteStringIndex(nameIndex);
-               }
-
-               internal void FixupToken(int parameterToken)
-               {
-                       if (lazyPseudoToken != 0)
-                       {
-                               moduleBuilder.RegisterTokenFixup(lazyPseudoToken, parameterToken);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/PropertyBuilder.cs b/mcs/class/IKVM.Reflection/Emit/PropertyBuilder.cs
deleted file mode 100644 (file)
index 2900f7a..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class PropertyBuilder : PropertyInfo
-       {
-               private readonly TypeBuilder typeBuilder;
-               private readonly string name;
-               private PropertyAttributes attributes;
-               private PropertySignature sig;
-               private MethodBuilder getter;
-               private MethodBuilder setter;
-               private readonly List<Accessor> accessors = new List<Accessor>();
-               private int lazyPseudoToken;
-               private bool patchCallingConvention;
-
-               private struct Accessor
-               {
-                       internal short Semantics;
-                       internal MethodBuilder Method;
-               }
-
-               internal PropertyBuilder(TypeBuilder typeBuilder, string name, PropertyAttributes attributes, PropertySignature sig, bool patchCallingConvention)
-               {
-                       this.typeBuilder = typeBuilder;
-                       this.name = name;
-                       this.attributes = attributes;
-                       this.sig = sig;
-                       this.patchCallingConvention = patchCallingConvention;
-               }
-
-               internal override PropertySignature PropertySignature
-               {
-                       get { return sig; }
-               }
-
-               public void SetGetMethod(MethodBuilder mdBuilder)
-               {
-                       getter = mdBuilder;
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.Getter;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void SetSetMethod(MethodBuilder mdBuilder)
-               {
-                       setter = mdBuilder;
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.Setter;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void AddOtherMethod(MethodBuilder mdBuilder)
-               {
-                       Accessor acc;
-                       acc.Semantics = MethodSemanticsTable.Other;
-                       acc.Method = mdBuilder;
-                       accessors.Add(acc);
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       Universe u = typeBuilder.ModuleBuilder.universe;
-                       if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
-                       {
-                               attributes |= PropertyAttributes.SpecialName;
-                       }
-                       else
-                       {
-                               if (lazyPseudoToken == 0)
-                               {
-                                       lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
-                               }
-                               typeBuilder.ModuleBuilder.SetCustomAttribute(lazyPseudoToken, customBuilder);
-                       }
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       if (lazyPseudoToken != 0)
-                       {
-                               return typeBuilder.ModuleBuilder.Constant.GetRawConstantValue(typeBuilder.ModuleBuilder, lazyPseudoToken);
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               public override PropertyAttributes Attributes
-               {
-                       get { return attributes; }
-               }
-
-               public override bool CanRead
-               {
-                       get { return getter != null; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return setter != null; }
-               }
-
-               public override MethodInfo GetGetMethod(bool nonPublic)
-               {
-                       return nonPublic || (getter != null && getter.IsPublic) ? getter : null;
-               }
-
-               public override MethodInfo GetSetMethod(bool nonPublic)
-               {
-                       return nonPublic || (setter != null && setter.IsPublic) ? setter : null;
-               }
-
-               public override MethodInfo[] GetAccessors(bool nonPublic)
-               {
-                       List<MethodInfo> list = new List<MethodInfo>();
-                       foreach (Accessor acc in accessors)
-                       {
-                               AddAccessor(list, nonPublic, acc.Method);
-                       }
-                       return list.ToArray();
-               }
-
-               private static void AddAccessor(List<MethodInfo> list, bool nonPublic, MethodInfo method)
-               {
-                       if (method != null && (nonPublic || method.IsPublic))
-                       {
-                               list.Add(method);
-                       }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeBuilder; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeBuilder.Module; }
-               }
-
-               public void SetConstant(object defaultValue)
-               {
-                       if (lazyPseudoToken == 0)
-                       {
-                               lazyPseudoToken = typeBuilder.ModuleBuilder.AllocPseudoToken();
-                       }
-                       attributes |= PropertyAttributes.HasDefault;
-                       typeBuilder.ModuleBuilder.AddConstant(lazyPseudoToken, defaultValue);
-               }
-
-               internal void Bake()
-               {
-                       if (patchCallingConvention)
-                       {
-                               sig.HasThis = !this.IsStatic;
-                       }
-
-                       PropertyTable.Record rec = new PropertyTable.Record();
-                       rec.Flags = (short)attributes;
-                       rec.Name = typeBuilder.ModuleBuilder.Strings.Add(name);
-                       rec.Type = typeBuilder.ModuleBuilder.GetSignatureBlobIndex(sig);
-                       int token = 0x17000000 | typeBuilder.ModuleBuilder.Property.AddRecord(rec);
-
-                       if (lazyPseudoToken == 0)
-                       {
-                               lazyPseudoToken = token;
-                       }
-                       else
-                       {
-                               typeBuilder.ModuleBuilder.RegisterTokenFixup(lazyPseudoToken, token);
-                       }
-
-                       foreach (Accessor acc in accessors)
-                       {
-                               AddMethodSemantics(acc.Semantics, acc.Method.MetadataToken, token);
-                       }
-               }
-
-               private void AddMethodSemantics(short semantics, int methodToken, int propertyToken)
-               {
-                       MethodSemanticsTable.Record rec = new MethodSemanticsTable.Record();
-                       rec.Semantics = semantics;
-                       rec.Method = methodToken;
-                       rec.Association = propertyToken;
-                       typeBuilder.ModuleBuilder.MethodSemantics.AddRecord(rec);
-               }
-
-               internal override bool IsPublic
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if (acc.Method.IsPublic)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if ((acc.Method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsStatic
-               {
-                       get
-                       {
-                               foreach (Accessor acc in accessors)
-                               {
-                                       if (acc.Method.IsStatic)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return typeBuilder.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       if (typeBuilder.ModuleBuilder.IsSaved && typeBuilder.ModuleBuilder.IsPseudoToken(lazyPseudoToken))
-                       {
-                               return typeBuilder.ModuleBuilder.ResolvePseudoToken(lazyPseudoToken);
-                       }
-                       else
-                       {
-                               return lazyPseudoToken;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/SignatureHelper.cs b/mcs/class/IKVM.Reflection/Emit/SignatureHelper.cs
deleted file mode 100644 (file)
index b70ace8..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using IKVM.Reflection;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public abstract class SignatureHelper
-       {
-               protected readonly byte type;
-               protected ushort paramCount;
-
-               sealed class Lazy : SignatureHelper
-               {
-                       private readonly List<Type> args = new List<Type>();
-
-                       internal Lazy(byte type)
-                               : base(type)
-                       {
-                       }
-
-                       internal override Type ReturnType
-                       {
-                               get { return args[0]; }
-                       }
-
-                       public override byte[] GetSignature()
-                       {
-                               throw new NotSupportedException();
-                       }
-
-                       internal override ByteBuffer GetSignature(ModuleBuilder module)
-                       {
-                               ByteBuffer bb = new ByteBuffer(16);
-                               Signature.WriteSignatureHelper(module, bb, type, paramCount, args);
-                               return bb;
-                       }
-
-                       public override void AddSentinel()
-                       {
-                               args.Add(MarkerType.Sentinel);
-                       }
-
-                       public override void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers)
-                       {
-                               if (pinned)
-                               {
-                                       args.Add(MarkerType.Pinned);
-                               }
-                               foreach (CustomModifiers.Entry mod in customModifiers)
-                               {
-                                       args.Add(mod.IsRequired ? MarkerType.ModReq : MarkerType.ModOpt);
-                                       args.Add(mod.Type);
-                               }
-                               args.Add(argument);
-                               paramCount++;
-                       }
-               }
-
-               sealed class Eager : SignatureHelper
-               {
-                       private readonly ModuleBuilder module;
-                       private readonly ByteBuffer bb = new ByteBuffer(16);
-                       private readonly Type returnType;
-
-                       internal Eager(ModuleBuilder module, byte type, Type returnType)
-                               : base(type)
-                       {
-                               this.module = module;
-                               this.returnType = returnType;
-                               bb.Write(type);
-                               if (type != Signature.FIELD)
-                               {
-                                       // space for parameterCount
-                                       bb.Write((byte)0);
-                               }
-                       }
-
-                       internal override Type ReturnType
-                       {
-                               get { return returnType; }
-                       }
-
-                       public override byte[] GetSignature()
-                       {
-                               return GetSignature(null).ToArray();
-                       }
-
-                       internal override ByteBuffer GetSignature(ModuleBuilder module)
-                       {
-                               if (type != Signature.FIELD)
-                               {
-                                       bb.Position = 1;
-                                       bb.Insert(MetadataWriter.GetCompressedIntLength(paramCount) - bb.GetCompressedIntLength());
-                                       bb.WriteCompressedInt(paramCount);
-                               }
-                               return bb;
-                       }
-
-                       public override void AddSentinel()
-                       {
-                               bb.Write(Signature.SENTINEL);
-                       }
-
-                       public override void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers)
-                       {
-                               if (pinned)
-                               {
-                                       bb.Write(Signature.ELEMENT_TYPE_PINNED);
-                               }
-                               foreach (CustomModifiers.Entry mod in customModifiers)
-                               {
-                                       bb.Write(mod.IsRequired ? Signature.ELEMENT_TYPE_CMOD_REQD : Signature.ELEMENT_TYPE_CMOD_OPT);
-                                       Signature.WriteTypeSpec(module, bb, mod.Type);
-                               }
-                               Signature.WriteTypeSpec(module, bb, argument ?? module.universe.System_Void);
-                               paramCount++;
-                       }
-               }
-
-               private SignatureHelper(byte type)
-               {
-                       this.type = type;
-               }
-
-               internal bool HasThis
-               {
-                       get { return (type & Signature.HASTHIS) != 0; }
-               }
-
-               internal abstract Type ReturnType
-               {
-                       get;
-               }
-
-               internal int ParameterCount
-               {
-                       get { return paramCount; }
-               }
-
-               private static SignatureHelper Create(Module mod, byte type, Type returnType)
-               {
-                       ModuleBuilder mb = mod as ModuleBuilder;
-                       return mb == null
-                               ? (SignatureHelper)new Lazy(type)
-                               : new Eager(mb, type, returnType);
-               }
-
-               public static SignatureHelper GetFieldSigHelper(Module mod)
-               {
-                       return Create(mod, Signature.FIELD, null);
-               }
-
-               public static SignatureHelper GetLocalVarSigHelper()
-               {
-                       return new Lazy(Signature.LOCAL_SIG);
-               }
-
-               public static SignatureHelper GetLocalVarSigHelper(Module mod)
-               {
-                       return Create(mod, Signature.LOCAL_SIG, null);
-               }
-
-               public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
-               {
-                       SignatureHelper sig = Create(mod, Signature.PROPERTY, returnType);
-                       sig.AddArgument(returnType);
-                       sig.paramCount = 0;
-                       sig.AddArguments(parameterTypes, null, null);
-                       return sig;
-               }
-
-               public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
-               {
-                       return GetPropertySigHelper(mod, CallingConventions.Standard, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
-               }
-
-               public static SignatureHelper GetPropertySigHelper(Module mod, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
-               {
-                       byte type = Signature.PROPERTY;
-                       if ((callingConvention & CallingConventions.HasThis) != 0)
-                       {
-                               type |= Signature.HASTHIS;
-                       }
-                       SignatureHelper sig = Create(mod, type, returnType);
-                       sig.AddArgument(returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);
-                       sig.paramCount = 0;
-                       sig.AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
-                       return sig;
-               }
-
-               public static SignatureHelper GetMethodSigHelper(CallingConvention unmanagedCallingConvention, Type returnType)
-               {
-                       return GetMethodSigHelper(null, unmanagedCallingConvention, returnType);
-               }
-
-               public static SignatureHelper GetMethodSigHelper(CallingConventions callingConvention, Type returnType)
-               {
-                       return GetMethodSigHelper(null, callingConvention, returnType);
-               }
-
-               public static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType)
-               {
-                       byte type;
-                       switch (unmanagedCallConv)
-                       {
-                               case CallingConvention.Cdecl:
-                                       type = 0x01;    // C
-                                       break;
-                               case CallingConvention.StdCall:
-                               case CallingConvention.Winapi:
-                                       type = 0x02;    // STDCALL
-                                       break;
-                               case CallingConvention.ThisCall:
-                                       type = 0x03;    // THISCALL
-                                       break;
-                               case CallingConvention.FastCall:
-                                       type = 0x04;    // FASTCALL
-                                       break;
-                               default:
-                                       throw new ArgumentOutOfRangeException("unmanagedCallConv");
-                       }
-                       SignatureHelper sig = Create(mod, type, returnType);
-                       sig.AddArgument(returnType);
-                       sig.paramCount = 0;
-                       return sig;
-               }
-
-               public static SignatureHelper GetMethodSigHelper(Module mod, CallingConventions callingConvention, Type returnType)
-               {
-                       byte type = 0;
-                       if ((callingConvention & CallingConventions.HasThis) != 0)
-                       {
-                               type |= Signature.HASTHIS;
-                       }
-                       if ((callingConvention & CallingConventions.ExplicitThis) != 0)
-                       {
-                               type |= Signature.EXPLICITTHIS;
-                       }
-                       if ((callingConvention & CallingConventions.VarArgs) != 0)
-                       {
-                               type |= Signature.VARARG;
-                       }
-                       SignatureHelper sig = Create(mod, type, returnType);
-                       sig.AddArgument(returnType);
-                       sig.paramCount = 0;
-                       return sig;
-               }
-
-               public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
-               {
-                       SignatureHelper sig = Create(mod, 0, returnType);
-                       sig.AddArgument(returnType);
-                       sig.paramCount = 0;
-                       sig.AddArguments(parameterTypes, null, null);
-                       return sig;
-               }
-
-               public abstract byte[] GetSignature();
-
-               internal abstract ByteBuffer GetSignature(ModuleBuilder module);
-
-               public abstract void AddSentinel();
-
-               public void AddArgument(Type clsArgument)
-               {
-                       AddArgument(clsArgument, false);
-               }
-
-               public void AddArgument(Type argument, bool pinned)
-               {
-                       __AddArgument(argument, pinned, new CustomModifiers());
-               }
-
-               public void AddArgument(Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       __AddArgument(argument, false, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public abstract void __AddArgument(Type argument, bool pinned, CustomModifiers customModifiers);
-
-               public void AddArguments(Type[] arguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
-               {
-                       if (arguments != null)
-                       {
-                               for (int i = 0; i < arguments.Length; i++)
-                               {
-                                       __AddArgument(arguments[i], false, CustomModifiers.FromReqOpt(Util.NullSafeElementAt(requiredCustomModifiers, i), Util.NullSafeElementAt(optionalCustomModifiers, i)));
-                               }
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/Tokens.cs b/mcs/class/IKVM.Reflection/Emit/Tokens.cs
deleted file mode 100644 (file)
index 49ac4c6..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-
-namespace IKVM.Reflection.Emit
-{
-       public struct EventToken
-       {
-               public static readonly EventToken Empty;
-               private readonly int token;
-
-               internal EventToken(int token)
-               {
-                       this.token = token;
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as EventToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(EventToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(EventToken et1, EventToken et2)
-               {
-                       return et1.token == et2.token;
-               }
-
-               public static bool operator !=(EventToken et1, EventToken et2)
-               {
-                       return et1.token != et2.token;
-               }
-       }
-
-       public struct FieldToken
-       {
-               public static readonly FieldToken Empty;
-               private readonly int token;
-
-               internal FieldToken(int token)
-               {
-                       this.token = token;
-               }
-
-               internal bool IsPseudoToken
-               {
-                       get { return token < 0; }
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as FieldToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(FieldToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(FieldToken ft1, FieldToken ft2)
-               {
-                       return ft1.token == ft2.token;
-               }
-
-               public static bool operator !=(FieldToken ft1, FieldToken ft2)
-               {
-                       return ft1.token != ft2.token;
-               }
-       }
-
-       public struct MethodToken
-       {
-               public static readonly MethodToken Empty;
-               private readonly int token;
-
-               internal MethodToken(int token)
-               {
-                       this.token = token;
-               }
-
-               internal bool IsPseudoToken
-               {
-                       get { return token < 0; }
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as MethodToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(MethodToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(MethodToken mt1, MethodToken mt2)
-               {
-                       return mt1.token == mt2.token;
-               }
-
-               public static bool operator !=(MethodToken mt1, MethodToken mt2)
-               {
-                       return mt1.token != mt2.token;
-               }
-       }
-
-       public struct SignatureToken
-       {
-               public static readonly SignatureToken Empty;
-               private readonly int token;
-
-               internal SignatureToken(int token)
-               {
-                       this.token = token;
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as SignatureToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(SignatureToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(SignatureToken st1, SignatureToken st2)
-               {
-                       return st1.token == st2.token;
-               }
-
-               public static bool operator !=(SignatureToken st1, SignatureToken st2)
-               {
-                       return st1.token != st2.token;
-               }
-       }
-
-       public struct StringToken
-       {
-               private readonly int token;
-
-               internal StringToken(int token)
-               {
-                       this.token = token;
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as StringToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(StringToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(StringToken st1, StringToken st2)
-               {
-                       return st1.token == st2.token;
-               }
-
-               public static bool operator !=(StringToken st1, StringToken st2)
-               {
-                       return st1.token != st2.token;
-               }
-       }
-
-       public struct TypeToken
-       {
-               public static readonly TypeToken Empty;
-               private readonly int token;
-
-               internal TypeToken(int token)
-               {
-                       this.token = token;
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return obj as TypeToken? == this;
-               }
-
-               public override int GetHashCode()
-               {
-                       return token;
-               }
-
-               public bool Equals(TypeToken other)
-               {
-                       return this == other;
-               }
-
-               public static bool operator ==(TypeToken tt1, TypeToken tt2)
-               {
-                       return tt1.token == tt2.token;
-               }
-
-               public static bool operator !=(TypeToken tt1, TypeToken tt2)
-               {
-                       return tt1.token != tt2.token;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Emit/TypeBuilder.cs b/mcs/class/IKVM.Reflection/Emit/TypeBuilder.cs
deleted file mode 100644 (file)
index b9f2a8f..0000000
+++ /dev/null
@@ -1,1242 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Writer;
-
-namespace IKVM.Reflection.Emit
-{
-       public sealed class GenericTypeParameterBuilder : TypeInfo
-       {
-               private readonly string name;
-               private readonly TypeBuilder type;
-               private readonly MethodBuilder method;
-               private readonly int paramPseudoIndex;
-               private readonly int position;
-               private int typeToken;
-               private Type baseType;
-               private GenericParameterAttributes attr;
-
-               internal GenericTypeParameterBuilder(string name, TypeBuilder type, MethodBuilder method, int position)
-               {
-                       this.name = name;
-                       this.type = type;
-                       this.method = method;
-                       this.position = position;
-                       GenericParamTable.Record rec = new GenericParamTable.Record();
-                       rec.Number = (short)position;
-                       rec.Flags = 0;
-                       rec.Owner = type != null ? type.MetadataToken : method.MetadataToken;
-                       rec.Name = this.ModuleBuilder.Strings.Add(name);
-                       this.paramPseudoIndex = this.ModuleBuilder.GenericParam.AddRecord(rec);
-               }
-
-               public override string AssemblyQualifiedName
-               {
-                       get { return null; }
-               }
-
-               public override bool IsValueType
-               {
-                       get { return (this.GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
-               }
-
-               public override Type BaseType
-               {
-                       get { return baseType; }
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return TypeAttributes.Public; }
-               }
-
-               public override string Namespace
-               {
-                       get { return DeclaringType.Namespace; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override string FullName
-               {
-                       get { return null; }
-               }
-
-               public override string ToString()
-               {
-                       return this.Name;
-               }
-
-               private ModuleBuilder ModuleBuilder
-               {
-                       get { return type != null ? type.ModuleBuilder : method.ModuleBuilder; }
-               }
-
-               public override Module Module
-               {
-                       get { return ModuleBuilder; }
-               }
-
-               public override bool IsGenericParameter
-               {
-                       get { return true; }
-               }
-
-               public override int GenericParameterPosition
-               {
-                       get { return position; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return type; }
-               }
-
-               public override MethodBase DeclaringMethod
-               {
-                       get { return method; }
-               }
-
-               public override Type[] GetGenericParameterConstraints()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public override GenericParameterAttributes GenericParameterAttributes
-               {
-                       get
-                       {
-                               CheckBaked();
-                               return attr;
-                       }
-               }
-
-               internal override void CheckBaked()
-               {
-                       if (type != null)
-                       {
-                               type.CheckBaked();
-                       }
-                       else
-                       {
-                               method.CheckBaked();
-                       }
-               }
-
-               private void AddConstraint(Type type)
-               {
-                       GenericParamConstraintTable.Record rec = new GenericParamConstraintTable.Record();
-                       rec.Owner = paramPseudoIndex;
-                       rec.Constraint = this.ModuleBuilder.GetTypeTokenForMemberRef(type);
-                       this.ModuleBuilder.GenericParamConstraint.AddRecord(rec);
-               }
-
-               public void SetBaseTypeConstraint(Type baseTypeConstraint)
-               {
-                       this.baseType = baseTypeConstraint;
-                       AddConstraint(baseTypeConstraint);
-               }
-
-               public void SetInterfaceConstraints(params Type[] interfaceConstraints)
-               {
-                       foreach (Type type in interfaceConstraints)
-                       {
-                               AddConstraint(type);
-                       }
-               }
-
-               public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes)
-               {
-                       this.attr = genericParameterAttributes;
-                       // for now we'll back patch the table
-                       this.ModuleBuilder.GenericParam.PatchAttribute(paramPseudoIndex, genericParameterAttributes);
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       this.ModuleBuilder.SetCustomAttribute((GenericParamTable.Index << 24) | paramPseudoIndex, customBuilder);
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public override int MetadataToken
-               {
-                       get
-                       {
-                               CheckBaked();
-                               return (GenericParamTable.Index << 24) | paramPseudoIndex;
-                       }
-               }
-
-               internal override int GetModuleBuilderToken()
-               {
-                       if (typeToken == 0)
-                       {
-                               ByteBuffer spec = new ByteBuffer(5);
-                               Signature.WriteTypeSpec(this.ModuleBuilder, spec, this);
-                               typeToken = 0x1B000000 | this.ModuleBuilder.TypeSpec.AddRecord(this.ModuleBuilder.Blobs.Add(spec));
-                       }
-                       return typeToken;
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       if (type != null)
-                       {
-                               return binder.BindTypeParameter(this);
-                       }
-                       else
-                       {
-                               return binder.BindMethodParameter(this);
-                       }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       if (this.ModuleBuilder.IsSaved)
-                       {
-                               return (GenericParamTable.Index << 24) | this.Module.GenericParam.GetIndexFixup()[paramPseudoIndex - 1] + 1;
-                       }
-                       else
-                       {
-                               return (GenericParamTable.Index << 24) | paramPseudoIndex;
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return ((MemberInfo)type ?? method).IsBaked; }
-               }
-       }
-
-       public sealed class TypeBuilder : TypeInfo, ITypeOwner
-       {
-               public const int UnspecifiedTypeSize = 0;
-               private readonly ITypeOwner owner;
-               private readonly int token;
-               private int extends;
-               private Type lazyBaseType;              // (lazyBaseType == null && attribs & TypeAttributes.Interface) == 0) => BaseType == System.Object
-               private readonly int typeName;
-               private readonly int typeNameSpace;
-               private readonly string ns;
-               private readonly string name;
-               private readonly List<MethodBuilder> methods = new List<MethodBuilder>();
-               private readonly List<FieldBuilder> fields = new List<FieldBuilder>();
-               private List<PropertyBuilder> properties;
-               private List<EventBuilder> events;
-               private TypeAttributes attribs;
-               private GenericTypeParameterBuilder[] gtpb;
-               private List<CustomAttributeBuilder> declarativeSecurity;
-               private List<Type> interfaces;
-               private int size;
-               private short pack;
-               private bool hasLayout;
-
-               internal TypeBuilder(ITypeOwner owner, string ns, string name)
-               {
-                       this.owner = owner;
-                       this.token = this.ModuleBuilder.TypeDef.AllocToken();
-                       this.ns = ns;
-                       this.name = name;
-                       this.typeNameSpace = ns == null ? 0 : this.ModuleBuilder.Strings.Add(ns);
-                       this.typeName = this.ModuleBuilder.Strings.Add(name);
-                       MarkEnumOrValueType(ns, name);
-               }
-
-               public ConstructorBuilder DefineDefaultConstructor(MethodAttributes attributes)
-               {
-                       ConstructorBuilder cb = DefineConstructor(attributes, CallingConventions.Standard, Type.EmptyTypes);
-                       ILGenerator ilgen = cb.GetILGenerator();
-                       ilgen.Emit(OpCodes.Ldarg_0);
-                       ilgen.Emit(OpCodes.Call, BaseType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null));
-                       ilgen.Emit(OpCodes.Ret);
-                       return cb;
-               }
-
-               public ConstructorBuilder DefineConstructor(MethodAttributes attribs, CallingConventions callConv, Type[] parameterTypes)
-               {
-                       return DefineConstructor(attribs, callConv, parameterTypes, null, null);
-               }
-
-               public ConstructorBuilder DefineConstructor(MethodAttributes attribs, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
-               {
-                       attribs |= MethodAttributes.RTSpecialName | MethodAttributes.SpecialName;
-                       string name = (attribs & MethodAttributes.Static) == 0 ? ConstructorInfo.ConstructorName : ConstructorInfo.TypeConstructorName;
-                       MethodBuilder mb = DefineMethod(name, attribs, callingConvention, null, null, null, parameterTypes, requiredCustomModifiers, optionalCustomModifiers);
-                       return new ConstructorBuilder(mb);
-               }
-
-               public ConstructorBuilder DefineTypeInitializer()
-               {
-                       MethodBuilder mb = DefineMethod(ConstructorInfo.TypeConstructorName, MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.RTSpecialName | MethodAttributes.SpecialName, null, Type.EmptyTypes);
-                       return new ConstructorBuilder(mb);
-               }
-
-               private MethodBuilder CreateMethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention)
-               {
-                       this.ModuleBuilder.MethodDef.AddVirtualRecord();
-                       MethodBuilder mb = new MethodBuilder(this, name, attributes, callingConvention);
-                       methods.Add(mb);
-                       return mb;
-               }
-
-               public MethodBuilder DefineMethod(string name, MethodAttributes attribs)
-               {
-                       return DefineMethod(name, attribs, CallingConventions.Standard);
-               }
-
-               public MethodBuilder DefineMethod(string name, MethodAttributes attribs, CallingConventions callingConvention)
-               {
-                       return CreateMethodBuilder(name, attribs, callingConvention);
-               }
-
-               public MethodBuilder DefineMethod(string name, MethodAttributes attribs, Type returnType, Type[] parameterTypes)
-               {
-                       return DefineMethod(name, attribs, CallingConventions.Standard, returnType, null, null, parameterTypes, null, null);
-               }
-
-               public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-               {
-                       return DefineMethod(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null);
-               }
-
-               public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       MethodBuilder mb = CreateMethodBuilder(name, attributes, callingConvention);
-                       mb.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
-                       return mb;
-               }
-
-               public MethodBuilder DefinePInvokeMethod(string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
-               {
-                       return DefinePInvokeMethod(name, dllName, null, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, nativeCallConv, nativeCharSet);
-               }
-
-               public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
-               {
-                       return DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, nativeCallConv, nativeCharSet);
-               }
-
-               public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention,
-                       Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
-                       Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers,
-                       CallingConvention nativeCallConv, CharSet nativeCharSet)
-               {
-                       MethodBuilder mb = DefineMethod(name, attributes | MethodAttributes.PinvokeImpl, callingConvention,
-                               returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
-                               parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
-                       mb.SetDllImportPseudoCustomAttribute(dllName, entryName, nativeCallConv, nativeCharSet, null, null, null, null, null);
-                       return mb;
-               }
-
-               public void DefineMethodOverride(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
-               {
-                       MethodImplTable.Record rec = new MethodImplTable.Record();
-                       rec.Class = token;
-                       rec.MethodBody = this.ModuleBuilder.GetMethodToken(methodInfoBody).Token;
-                       rec.MethodDeclaration = this.ModuleBuilder.GetMethodTokenWinRT(methodInfoDeclaration);
-                       this.ModuleBuilder.MethodImpl.AddRecord(rec);
-               }
-
-               public FieldBuilder DefineField(string name, Type fieldType, FieldAttributes attribs)
-               {
-                       return DefineField(name, fieldType, null, null, attribs);
-               }
-
-               public FieldBuilder DefineField(string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
-               {
-                       return __DefineField(fieldName, type, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers), attributes);
-               }
-
-               public FieldBuilder __DefineField(string fieldName, Type type, CustomModifiers customModifiers, FieldAttributes attributes)
-               {
-                       FieldBuilder fb = new FieldBuilder(this, fieldName, type, customModifiers, attributes);
-                       fields.Add(fb);
-                       return fb;
-               }
-
-               public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes)
-               {
-                       return DefineProperty(name, attributes, returnType, null, null, parameterTypes, null, null);
-               }
-
-               public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
-                       Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       return DefinePropertyImpl(name, attributes, CallingConventions.Standard, true, returnType, parameterTypes,
-                               PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, CallingConventions callingConvention,
-                       Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
-                       Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       return DefinePropertyImpl(name, attributes, callingConvention, false, returnType, parameterTypes,
-                               PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               public PropertyBuilder __DefineProperty(string name, PropertyAttributes attributes, CallingConventions callingConvention,
-                       Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       return DefinePropertyImpl(name, attributes, callingConvention, false, returnType, parameterTypes,
-                               PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               private PropertyBuilder DefinePropertyImpl(string name, PropertyAttributes attributes, CallingConventions callingConvention, bool patchCallingConvention,
-                       Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       if (properties == null)
-                       {
-                               properties = new List<PropertyBuilder>();
-                       }
-                       PropertySignature sig = PropertySignature.Create(callingConvention, returnType, parameterTypes, customModifiers);
-                       PropertyBuilder pb = new PropertyBuilder(this, name, attributes, sig, patchCallingConvention);
-                       properties.Add(pb);
-                       return pb;
-               }
-
-               public EventBuilder DefineEvent(string name, EventAttributes attributes, Type eventtype)
-               {
-                       if (events == null)
-                       {
-                               events = new List<EventBuilder>();
-                       }
-                       EventBuilder eb = new EventBuilder(this, name, attributes, eventtype);
-                       events.Add(eb);
-                       return eb;
-               }
-
-               public TypeBuilder DefineNestedType(string name)
-               {
-                       return DefineNestedType(name, TypeAttributes.Class | TypeAttributes.NestedPrivate);
-               }
-
-               public TypeBuilder DefineNestedType(string name, TypeAttributes attribs)
-               {
-                       return DefineNestedType(name, attribs, null);
-               }
-
-               public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
-               {
-                       TypeBuilder tb = DefineNestedType(name, attr, parent);
-                       if (interfaces != null)
-                       {
-                               foreach (Type iface in interfaces)
-                               {
-                                       tb.AddInterfaceImplementation(iface);
-                               }
-                       }
-                       return tb;
-               }
-
-               public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent)
-               {
-                       return DefineNestedType(name, attr, parent, 0);
-               }
-
-               public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, int typeSize)
-               {
-                       return DefineNestedType(name, attr, parent, PackingSize.Unspecified, typeSize);
-               }
-
-               public TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, PackingSize packSize)
-               {
-                       return DefineNestedType(name, attr, parent, packSize, 0);
-               }
-
-               private TypeBuilder DefineNestedType(string name, TypeAttributes attr, Type parent, PackingSize packSize, int typeSize)
-               {
-                       string ns = null;
-                       int lastdot = name.LastIndexOf('.');
-                       if (lastdot > 0)
-                       {
-                               ns = name.Substring(0, lastdot);
-                               name = name.Substring(lastdot + 1);
-                       }
-                       TypeBuilder typeBuilder = __DefineNestedType(ns, name);
-                       typeBuilder.__SetAttributes(attr);
-                       typeBuilder.SetParent(parent);
-                       if (packSize != PackingSize.Unspecified || typeSize != 0)
-                       {
-                               typeBuilder.__SetLayout((int)packSize, typeSize);
-                       }
-                       return typeBuilder;
-               }
-
-               public TypeBuilder __DefineNestedType(string ns, string name)
-               {
-                       this.typeFlags |= TypeFlags.HasNestedTypes;
-                       TypeBuilder typeBuilder = this.ModuleBuilder.DefineType(this, ns, name);
-                       NestedClassTable.Record rec = new NestedClassTable.Record();
-                       rec.NestedClass = typeBuilder.MetadataToken;
-                       rec.EnclosingClass = this.MetadataToken;
-                       this.ModuleBuilder.NestedClass.AddRecord(rec);
-                       return typeBuilder;
-               }
-
-               public void SetParent(Type parent)
-               {
-                       lazyBaseType = parent;
-               }
-
-               public void AddInterfaceImplementation(Type interfaceType)
-               {
-                       if (interfaces == null)
-                       {
-                               interfaces = new List<Type>();
-                       }
-                       interfaces.Add(interfaceType);
-               }
-
-               public void __SetInterfaceImplementationCustomAttribute(Type interfaceType, CustomAttributeBuilder cab)
-               {
-                       this.ModuleBuilder.SetInterfaceImplementationCustomAttribute(this, interfaceType, cab);
-               }
-
-               public int Size
-               {
-                       get { return size; }
-               }
-
-               public PackingSize PackingSize
-               {
-                       get { return (PackingSize)pack; }
-               }
-
-               public override bool __GetLayout(out int packingSize, out int typeSize)
-               {
-                       packingSize = this.pack;
-                       typeSize = this.size;
-                       return hasLayout;
-               }
-
-               public void __SetLayout(int packingSize, int typesize)
-               {
-                       this.pack = (short)packingSize;
-                       this.size = typesize;
-                       this.hasLayout = true;
-               }
-
-               private void SetStructLayoutPseudoCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       object val = customBuilder.GetConstructorArgument(0);
-                       LayoutKind layout;
-                       if (val is short)
-                       {
-                               layout = (LayoutKind)(short)val;
-                       }
-                       else
-                       {
-                               layout = (LayoutKind)val;
-                       }
-                       StructLayoutAttribute attr = new StructLayoutAttribute(layout);
-                       attr.Pack = (int?)customBuilder.GetFieldValue("Pack") ?? 0;
-                       attr.Size = (int?)customBuilder.GetFieldValue("Size") ?? 0;
-                       attr.CharSet = customBuilder.GetFieldValue<CharSet>("CharSet") ?? CharSet.None;
-                       attribs &= ~TypeAttributes.LayoutMask;
-                       switch (attr.Value)
-                       {
-                               case LayoutKind.Auto:
-                                       attribs |= TypeAttributes.AutoLayout;
-                                       break;
-                               case LayoutKind.Explicit:
-                                       attribs |= TypeAttributes.ExplicitLayout;
-                                       break;
-                               case LayoutKind.Sequential:
-                                       attribs |= TypeAttributes.SequentialLayout;
-                                       break;
-                       }
-                       attribs &= ~TypeAttributes.StringFormatMask;
-                       switch (attr.CharSet)
-                       {
-                               case CharSet.None:
-                               case CharSet.Ansi:
-                                       attribs |= TypeAttributes.AnsiClass;
-                                       break;
-                               case CharSet.Auto:
-                                       attribs |= TypeAttributes.AutoClass;
-                                       break;
-                               case CharSet.Unicode:
-                                       attribs |= TypeAttributes.UnicodeClass;
-                                       break;
-                       }
-                       pack = (short)attr.Pack;
-                       size = attr.Size;
-                       hasLayout = pack != 0 || size != 0;
-               }
-
-               public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
-               {
-                       SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
-               }
-
-               public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
-               {
-                       Universe u = this.ModuleBuilder.universe;
-                       Type type = customBuilder.Constructor.DeclaringType;
-                       if (type == u.System_Runtime_InteropServices_StructLayoutAttribute)
-                       {
-                               SetStructLayoutPseudoCustomAttribute(customBuilder.DecodeBlob(this.Assembly));
-                       }
-                       else if (type == u.System_SerializableAttribute)
-                       {
-                               attribs |= TypeAttributes.Serializable;
-                       }
-                       else if (type == u.System_Runtime_InteropServices_ComImportAttribute)
-                       {
-                               attribs |= TypeAttributes.Import;
-                       }
-                       else if (type == u.System_Runtime_CompilerServices_SpecialNameAttribute)
-                       {
-                               attribs |= TypeAttributes.SpecialName;
-                       }
-                       else
-                       {
-                               if (type == u.System_Security_SuppressUnmanagedCodeSecurityAttribute)
-                               {
-                                       attribs |= TypeAttributes.HasSecurity;
-                               }
-                               this.ModuleBuilder.SetCustomAttribute(token, customBuilder);
-                       }
-               }
-
-               public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
-               {
-                       attribs |= TypeAttributes.HasSecurity;
-                       if (declarativeSecurity == null)
-                       {
-                               declarativeSecurity = new List<CustomAttributeBuilder>();
-                       }
-                       declarativeSecurity.Add(customBuilder);
-               }
-
-               public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
-               {
-                       this.ModuleBuilder.AddDeclarativeSecurity(token, securityAction, permissionSet);
-                       this.attribs |= TypeAttributes.HasSecurity;
-               }
-
-               public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
-               {
-                       typeFlags |= TypeFlags.IsGenericTypeDefinition;
-                       gtpb = new GenericTypeParameterBuilder[names.Length];
-                       for (int i = 0; i < names.Length; i++)
-                       {
-                               gtpb[i] = new GenericTypeParameterBuilder(names[i], this, null, i);
-                       }
-                       return (GenericTypeParameterBuilder[])gtpb.Clone();
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       return Util.Copy(gtpb);
-               }
-
-               public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       return gtpb == null ? Empty<CustomModifiers>.Array : new CustomModifiers[gtpb.Length];
-               }
-
-               internal override Type GetGenericTypeArgument(int index)
-               {
-                       return gtpb[index];
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get { return gtpb != null; }
-               }
-
-               public override Type GetGenericTypeDefinition()
-               {
-                       return this;
-               }
-
-               public Type CreateType()
-               {
-                       if ((typeFlags & TypeFlags.Baked) != 0)
-                       {
-                               // .NET allows multiple invocations (subsequent invocations return the same baked type)
-                               throw new NotImplementedException();
-                       }
-                       typeFlags |= TypeFlags.Baked;
-                       if (hasLayout)
-                       {
-                               ClassLayoutTable.Record rec = new ClassLayoutTable.Record();
-                               rec.PackingSize = pack;
-                               rec.ClassSize = size;
-                               rec.Parent = token;
-                               this.ModuleBuilder.ClassLayout.AddRecord(rec);
-                       }
-                       bool hasConstructor = false;
-                       foreach (MethodBuilder mb in methods)
-                       {
-                               hasConstructor |= mb.IsSpecialName && mb.Name == ConstructorInfo.ConstructorName;
-                               mb.Bake();
-                       }
-                       if (!hasConstructor && !IsModulePseudoType && !IsInterface && !IsValueType && !(IsAbstract && IsSealed))
-                       {
-                               ((MethodBuilder)DefineDefaultConstructor(MethodAttributes.Public).GetMethodInfo()).Bake();
-                       }
-                       if (declarativeSecurity != null)
-                       {
-                               this.ModuleBuilder.AddDeclarativeSecurity(token, declarativeSecurity);
-                       }
-                       if (!IsModulePseudoType)
-                       {
-                               Type baseType = this.BaseType;
-                               if (baseType != null)
-                               {
-                                       extends = this.ModuleBuilder.GetTypeToken(baseType).Token;
-                               }
-                       }
-                       if (interfaces != null)
-                       {
-                               foreach (Type interfaceType in interfaces)
-                               {
-                                       InterfaceImplTable.Record rec = new InterfaceImplTable.Record();
-                                       rec.Class = token;
-                                       rec.Interface = this.ModuleBuilder.GetTypeToken(interfaceType).Token;
-                                       this.ModuleBuilder.InterfaceImpl.AddRecord(rec);
-                               }
-                       }
-                       return new BakedType(this);
-               }
-
-               internal void PopulatePropertyAndEventTables()
-               {
-                       if (properties != null)
-                       {
-                               PropertyMapTable.Record rec = new PropertyMapTable.Record();
-                               rec.Parent = token;
-                               rec.PropertyList = this.ModuleBuilder.Property.RowCount + 1;
-                               this.ModuleBuilder.PropertyMap.AddRecord(rec);
-                               foreach (PropertyBuilder pb in properties)
-                               {
-                                       pb.Bake();
-                               }
-                       }
-                       if (events != null)
-                       {
-                               EventMapTable.Record rec = new EventMapTable.Record();
-                               rec.Parent = token;
-                               rec.EventList = this.ModuleBuilder.Event.RowCount + 1;
-                               this.ModuleBuilder.EventMap.AddRecord(rec);
-                               foreach (EventBuilder eb in events)
-                               {
-                                       eb.Bake();
-                               }
-                       }
-               }
-
-               public override Type BaseType
-               {
-                       get
-                       {
-                               if (lazyBaseType == null && !IsInterface)
-                               {
-                                       Type obj = Module.universe.System_Object;
-                                       if (this != obj)
-                                       {
-                                               lazyBaseType = obj;
-                                       }
-                               }
-                               return lazyBaseType;
-                       }
-               }
-
-               public override string FullName
-               {
-                       get
-                       {
-                               if (this.IsNested)
-                               {
-                                       return this.DeclaringType.FullName + "+" + TypeNameParser.Escape(name);
-                               }
-                               if (ns == null)
-                               {
-                                       return TypeNameParser.Escape(name);
-                               }
-                               else
-                               {
-                                       return TypeNameParser.Escape(ns) + "." + TypeNameParser.Escape(name);
-                               }
-                       }
-               }
-
-               public override string __Name
-               {
-                       get { return name; }
-               }
-
-               public override string __Namespace
-               {
-                       get { return ns; }
-               }
-
-               public override string Name
-               {
-                       // FXBUG for a TypeBuilder the name is not escaped
-                       get { return name; }
-               }
-
-               public override string Namespace
-               {
-                       get
-                       {
-                               // for some reason, TypeBuilder doesn't return null (and mcs depends on this)
-                               // note also that we don't return the declaring type namespace for nested types
-                               return ns ?? "";
-                       }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return attribs; }
-               }
-
-               public void __SetAttributes(TypeAttributes attributes)
-               {
-                       this.attribs = attributes;
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       return Util.ToArray(interfaces, Type.EmptyTypes);
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       MethodBase[] methods = new MethodBase[this.methods.Count];
-                       for (int i = 0; i < methods.Length; i++)
-                       {
-                               MethodBuilder mb = this.methods[i];
-                               if (mb.IsConstructor)
-                               {
-                                       methods[i] = new ConstructorInfoImpl(mb);
-                               }
-                               else
-                               {
-                                       methods[i] = mb;
-                               }
-                       }
-                       return methods;
-               }
-
-               public override StructLayoutAttribute StructLayoutAttribute
-               {
-                       get
-                       {
-                               LayoutKind layout;
-                               switch (attribs & TypeAttributes.LayoutMask)
-                               {
-                                       case TypeAttributes.ExplicitLayout:
-                                               layout = LayoutKind.Explicit;
-                                               break;
-                                       case TypeAttributes.SequentialLayout:
-                                               layout = LayoutKind.Sequential;
-                                               break;
-                                       default:
-                                               layout = LayoutKind.Auto;
-                                               break;
-                               }
-                               StructLayoutAttribute attr = new StructLayoutAttribute(layout);
-                               attr.Pack = (ushort)pack;
-                               attr.Size = size;
-                               switch (attribs & TypeAttributes.StringFormatMask)
-                               {
-                                       case TypeAttributes.AutoClass:
-                                               attr.CharSet = CharSet.Auto;
-                                               break;
-                                       case TypeAttributes.UnicodeClass:
-                                               attr.CharSet = CharSet.Unicode;
-                                               break;
-                                       case TypeAttributes.AnsiClass:
-                                               attr.CharSet = CharSet.Ansi;
-                                               break;
-                                       default:
-                                               attr.CharSet = CharSet.None;
-                                               break;
-                               }
-                               return attr;
-                       }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return owner as TypeBuilder; }
-               }
-
-               public override bool IsGenericType
-               {
-                       get { return IsGenericTypeDefinition; }
-               }
-
-               public override bool IsGenericTypeDefinition
-               {
-                       get { return (typeFlags & TypeFlags.IsGenericTypeDefinition) != 0; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return token; }
-               }
-
-               public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes)
-               {
-                       return DefineInitializedData(name, new byte[size], attributes);
-               }
-
-               public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes)
-               {
-                       Type fieldType = this.ModuleBuilder.GetType("$ArrayType$" + data.Length);
-                       if (fieldType == null)
-                       {
-                               TypeBuilder tb = this.ModuleBuilder.DefineType("$ArrayType$" + data.Length, TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.ExplicitLayout, this.Module.universe.System_ValueType, PackingSize.Size1, data.Length);
-                               tb.CreateType();
-                               fieldType = tb;
-                       }
-                       FieldBuilder fb = DefineField(name, fieldType, attributes | FieldAttributes.Static);
-                       fb.__SetDataAndRVA(data);
-                       return fb;
-               }
-
-               public static MethodInfo GetMethod(Type type, MethodInfo method)
-               {
-                       return new GenericMethodInstance(type, method, null);
-               }
-
-               public static ConstructorInfo GetConstructor(Type type, ConstructorInfo constructor)
-               {
-                       return new ConstructorInfoImpl(GetMethod(type, constructor.GetMethodInfo()));
-               }
-
-               public static FieldInfo GetField(Type type, FieldInfo field)
-               {
-                       return new GenericFieldInstance(type, field);
-               }
-
-               public override Module Module
-               {
-                       get { return owner.ModuleBuilder; }
-               }
-
-               public TypeToken TypeToken
-               {
-                       get { return new TypeToken(token); }
-               }
-
-               internal void WriteTypeDefRecord(MetadataWriter mw, ref int fieldList, ref int methodList)
-               {
-                       mw.Write((int)attribs);
-                       mw.WriteStringIndex(typeName);
-                       mw.WriteStringIndex(typeNameSpace);
-                       mw.WriteTypeDefOrRef(extends);
-                       mw.WriteField(fieldList);
-                       mw.WriteMethodDef(methodList);
-                       methodList += methods.Count;
-                       fieldList += fields.Count;
-               }
-
-               internal void WriteMethodDefRecords(int baseRVA, MetadataWriter mw, ref int paramList)
-               {
-                       foreach (MethodBuilder mb in methods)
-                       {
-                               mb.WriteMethodDefRecord(baseRVA, mw, ref paramList);
-                       }
-               }
-
-               internal void ResolveMethodAndFieldTokens(ref int methodToken, ref int fieldToken, ref int parameterToken)
-               {
-                       foreach (MethodBuilder method in methods)
-                       {
-                               method.FixupToken(methodToken++, ref parameterToken);
-                       }
-                       foreach (FieldBuilder field in fields)
-                       {
-                               field.FixupToken(fieldToken++);
-                       }
-               }
-
-               internal void WriteParamRecords(MetadataWriter mw)
-               {
-                       foreach (MethodBuilder mb in methods)
-                       {
-                               mb.WriteParamRecords(mw);
-                       }
-               }
-
-               internal void WriteFieldRecords(MetadataWriter mw)
-               {
-                       foreach (FieldBuilder fb in fields)
-                       {
-                               fb.WriteFieldRecords(mw);
-                       }
-               }
-
-               internal ModuleBuilder ModuleBuilder
-               {
-                       get { return owner.ModuleBuilder; }
-               }
-
-               ModuleBuilder ITypeOwner.ModuleBuilder
-               {
-                       get { return owner.ModuleBuilder; }
-               }
-
-               internal override int GetModuleBuilderToken()
-               {
-                       return token;
-               }
-
-               internal bool HasNestedTypes
-               {
-                       get { return (typeFlags & TypeFlags.HasNestedTypes) != 0; }
-               }
-
-               // helper for ModuleBuilder.ResolveMethod()
-               internal MethodBase LookupMethod(int token)
-               {
-                       foreach (MethodBuilder method in methods)
-                       {
-                               if (method.MetadataToken == token)
-                               {
-                                       return method;
-                               }
-                       }
-                       return null;
-               }
-
-               public bool IsCreated()
-               {
-                       return (typeFlags & TypeFlags.Baked) != 0;
-               }
-
-               internal override void CheckBaked()
-               {
-                       if ((typeFlags & TypeFlags.Baked) == 0)
-                       {
-                               throw new NotSupportedException();
-                       }
-               }
-
-               public override Type[] __GetDeclaredTypes()
-               {
-                       if (this.HasNestedTypes)
-                       {
-                               List<Type> types = new List<Type>();
-                               List<int> classes = this.ModuleBuilder.NestedClass.GetNestedClasses(token);
-                               foreach (int nestedClass in classes)
-                               {
-                                       types.Add(this.ModuleBuilder.ResolveType(nestedClass));
-                               }
-                               return types.ToArray();
-                       }
-                       else
-                       {
-                               return Type.EmptyTypes;
-                       }
-               }
-
-               public override FieldInfo[] __GetDeclaredFields()
-               {
-                       return Util.ToArray(fields, Empty<FieldInfo>.Array);
-               }
-
-               public override EventInfo[] __GetDeclaredEvents()
-               {
-                       return Util.ToArray(events, Empty<EventInfo>.Array);
-               }
-
-               public override PropertyInfo[] __GetDeclaredProperties()
-               {
-                       return Util.ToArray(properties, Empty<PropertyInfo>.Array);
-               }
-
-               internal override bool IsModulePseudoType
-               {
-                       get { return token == 0x02000001; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return IsCreated(); }
-               }
-       }
-
-       sealed class BakedType : TypeInfo
-       {
-               internal BakedType(TypeBuilder typeBuilder)
-                       : base(typeBuilder)
-               {
-               }
-
-               public override string AssemblyQualifiedName
-               {
-                       get { return underlyingType.AssemblyQualifiedName; }
-               }
-
-               public override Type BaseType
-               {
-                       get { return underlyingType.BaseType; }
-               }
-
-               public override string __Name
-               {
-                       get { return underlyingType.__Name; }
-               }
-
-               public override string __Namespace
-               {
-                       get { return underlyingType.__Namespace; }
-               }
-
-               public override string Name
-               {
-                       // we need to escape here, because TypeBuilder.Name does not escape
-                       get { return TypeNameParser.Escape(underlyingType.__Name); }
-               }
-
-               public override string FullName
-               {
-                       get { return GetFullName(); }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return underlyingType.Attributes; }
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       return underlyingType.__GetDeclaredInterfaces();
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       return underlyingType.__GetDeclaredMethods();
-               }
-
-               public override __MethodImplMap __GetMethodImplMap()
-               {
-                       return underlyingType.__GetMethodImplMap();
-               }
-
-               public override FieldInfo[] __GetDeclaredFields()
-               {
-                       return underlyingType.__GetDeclaredFields();
-               }
-
-               public override EventInfo[] __GetDeclaredEvents()
-               {
-                       return underlyingType.__GetDeclaredEvents();
-               }
-
-               public override PropertyInfo[] __GetDeclaredProperties()
-               {
-                       return underlyingType.__GetDeclaredProperties();
-               }
-
-               public override Type[] __GetDeclaredTypes()
-               {
-                       return underlyingType.__GetDeclaredTypes();
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return underlyingType.DeclaringType; }
-               }
-
-               public override StructLayoutAttribute StructLayoutAttribute
-               {
-                       get { return underlyingType.StructLayoutAttribute; }
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       return underlyingType.GetGenericArguments();
-               }
-
-               internal override Type GetGenericTypeArgument(int index)
-               {
-                       return underlyingType.GetGenericTypeArgument(index);
-               }
-
-               public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       return underlyingType.__GetGenericArgumentsCustomModifiers();
-               }
-
-               public override bool IsGenericType
-               {
-                       get { return underlyingType.IsGenericType; }
-               }
-
-               public override bool IsGenericTypeDefinition
-               {
-                       get { return underlyingType.IsGenericTypeDefinition; }
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get { return underlyingType.ContainsGenericParameters; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return underlyingType.MetadataToken; }
-               }
-
-               public override Module Module
-               {
-                       get { return underlyingType.Module; }
-               }
-
-               internal override int GetModuleBuilderToken()
-               {
-                       return underlyingType.GetModuleBuilderToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Enums.cs b/mcs/class/IKVM.Reflection/Enums.cs
deleted file mode 100644 (file)
index 2ff8de9..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection
-{
-       [Flags]
-       public enum AssemblyNameFlags
-       {
-               None = 0,
-               PublicKey = 1,
-               Retargetable = 256,
-               EnableJITcompileOptimizer = 16384,
-               EnableJITcompileTracking = 32768,
-       }
-
-       public enum AssemblyContentType
-       {
-               Default = 0,
-               WindowsRuntime = 1,
-       }
-
-       [Flags]
-       public enum BindingFlags
-       {
-               Default = 0,
-               IgnoreCase = 1,
-               DeclaredOnly = 2,
-               Instance = 4,
-               Static = 8,
-               Public = 16,
-               NonPublic = 32,
-               FlattenHierarchy = 64,
-       }
-
-       [Flags]
-       public enum CallingConventions
-       {
-               Standard = 1,
-               VarArgs = 2,
-               Any = 3,
-               HasThis = 32,
-               ExplicitThis = 64,
-       }
-
-       [Flags]
-       public enum EventAttributes
-       {
-               None = 0,
-               SpecialName = 512,
-               RTSpecialName = 1024,
-               ReservedMask = 1024,
-       }
-
-       [Flags]
-       public enum FieldAttributes
-       {
-               PrivateScope = 0,
-               Private = 1,
-               FamANDAssem = 2,
-               Assembly = 3,
-               Family = 4,
-               FamORAssem = 5,
-               Public = 6,
-               FieldAccessMask = 7,
-               Static = 16,
-               InitOnly = 32,
-               Literal = 64,
-               NotSerialized = 128,
-               HasFieldRVA = 256,
-               SpecialName = 512,
-               RTSpecialName = 1024,
-               HasFieldMarshal = 4096,
-               PinvokeImpl = 8192,
-               HasDefault = 32768,
-               ReservedMask = 38144,
-       }
-
-       [Flags]
-       public enum GenericParameterAttributes
-       {
-               None = 0,
-               Covariant = 1,
-               Contravariant = 2,
-               VarianceMask = 3,
-               ReferenceTypeConstraint = 4,
-               NotNullableValueTypeConstraint = 8,
-               DefaultConstructorConstraint = 16,
-               SpecialConstraintMask = 28,
-       }
-
-       public enum ImageFileMachine
-       {
-               I386 = 332,
-               ARM = 452,
-               IA64 = 512,
-               AMD64 = 34404,
-       }
-
-       [FlagsAttribute]
-       public enum MemberTypes
-       {
-               Constructor = 0x01,
-               Event = 0x02,
-               Field = 0x04,
-               Method = 0x08,
-               Property = 0x10,
-               TypeInfo = 0x20,
-               Custom = 0x40,
-               NestedType = 0x80,
-               All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType
-       }
-
-       [Flags]
-       public enum MethodAttributes
-       {
-               MemberAccessMask                = 0x0007,
-               PrivateScope                    = 0x0000,
-               Private                                 = 0x0001,
-               FamANDAssem                             = 0x0002,
-               Assembly                                = 0x0003,
-               Family                                  = 0x0004,
-               FamORAssem                              = 0x0005,
-               Public                                  = 0x0006,
-               Static                                  = 0x0010,
-               Final                                   = 0x0020,
-               Virtual                                 = 0x0040,
-               HideBySig                               = 0x0080,
-               VtableLayoutMask                = 0x0100,
-               ReuseSlot                               = 0x0000,
-               NewSlot                                 = 0x0100,
-               CheckAccessOnOverride   = 0x0200,
-               Abstract                                = 0x0400,
-               SpecialName                             = 0x0800,
-
-               PinvokeImpl                             = 0x2000,
-               UnmanagedExport                 = 0x0008,
-
-               RTSpecialName                   = 0x1000,
-               HasSecurity                             = 0x4000,
-               RequireSecObject                = 0x8000,
-
-               ReservedMask                    = 0xd000,
-       }
-
-       [Flags]
-       public enum MethodImplAttributes
-       {
-               CodeTypeMask            = 0x0003,
-               IL                                      = 0x0000,
-               Native                          = 0x0001,
-               OPTIL                           = 0x0002,
-               Runtime                         = 0x0003,
-               ManagedMask                     = 0x0004,
-               Unmanaged                       = 0x0004,
-               Managed                         = 0x0000,
-
-               ForwardRef                      = 0x0010,
-               PreserveSig                     = 0x0080,
-               InternalCall            = 0x1000,
-               Synchronized            = 0x0020,
-               NoInlining                      = 0x0008,
-               NoOptimization          = 0x0040,
-               AggressiveInlining  = 0x0100,
-
-               MaxMethodImplVal        = 0xffff,
-       }
-
-       [Flags]
-       public enum ParameterAttributes
-       {
-               None = 0,
-               In = 1,
-               Out = 2,
-               Lcid = 4,
-               Retval = 8,
-               Optional = 16,
-               HasDefault = 4096,
-               HasFieldMarshal = 8192,
-               Reserved3 = 16384,
-               Reserved4 = 32768,
-               ReservedMask = 61440,
-       }
-
-       [Flags]
-       public enum PortableExecutableKinds
-       {
-               NotAPortableExecutableImage = 0,
-               ILOnly = 1,
-               Required32Bit = 2,
-               PE32Plus = 4,
-               Unmanaged32Bit = 8,
-               Preferred32Bit = 16,
-       }
-
-       public enum ProcessorArchitecture
-       {
-               None = 0,
-               MSIL = 1,
-               X86 = 2,
-               IA64 = 3,
-               Amd64 = 4,
-               Arm = 5,
-               // if an item is added here, make sure to update AssemblyName.ProcessorArchitecture and Fusion.ParseAssemblyName as well
-       }
-
-       [Flags]
-       public enum PropertyAttributes
-       {
-               None = 0,
-               SpecialName = 512,
-               RTSpecialName = 1024,
-               HasDefault = 4096,
-       }
-
-       [Flags]
-       public enum ResourceAttributes
-       {
-               Public = 1,
-               Private = 2,
-       }
-
-       [Flags]
-       public enum ResourceLocation
-       {
-               Embedded = 1,
-               ContainedInAnotherAssembly = 2,
-               ContainedInManifestFile = 4,
-       }
-
-       [Flags]
-       public enum TypeAttributes
-       {
-               AnsiClass = 0,
-               Class = 0,
-               AutoLayout = 0,
-               NotPublic = 0,
-               Public = 1,
-               NestedPublic = 2,
-               NestedPrivate = 3,
-               NestedFamily = 4,
-               NestedAssembly = 5,
-               NestedFamANDAssem = 6,
-               VisibilityMask = 7,
-               NestedFamORAssem = 7,
-               SequentialLayout = 8,
-               ExplicitLayout = 16,
-               LayoutMask = 24,
-               ClassSemanticsMask = 32,
-               Interface = 32,
-               Abstract = 128,
-               Sealed = 256,
-               SpecialName = 1024,
-               RTSpecialName = 2048,
-               Import = 4096,
-               Serializable = 8192,
-               WindowsRuntime = 16384,
-               UnicodeClass = 65536,
-               AutoClass = 131072,
-               CustomFormatClass = 196608,
-               StringFormatMask = 196608,
-               HasSecurity = 262144,
-               ReservedMask = 264192,
-               BeforeFieldInit = 1048576,
-               CustomFormatMask = 12582912,
-       }
-
-       // IKVM.Reflection specific type
-       [Flags]
-       public enum DllCharacteristics
-       {
-               HighEntropyVA = 0x0020,                 // IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA
-               DynamicBase = 0x0040,                   // IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
-               NoSEH = 0x0400,                                 // IMAGE_DLLCHARACTERISTICS_NO_SEH
-               NXCompat = 0x0100,                              // IMAGE_DLLCHARACTERISTICS_NX_COMPAT
-               AppContainer = 0x1000,                  // IMAGE_DLLCHARACTERISTICS_APPCONTAINER
-               TerminalServerAware = 0x8000,   // IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
-       }
-
-       // IKVM.Reflection specific type
-       [Flags]
-       public enum ImplMapFlags
-       {
-               NoMangle = 0x0001,
-               CharSetMask = 0x0006,
-               CharSetNotSpec = 0x0000,
-               CharSetAnsi = 0x0002,
-               CharSetUnicode = 0x0004,
-               CharSetAuto = 0x0006,
-               SupportsLastError = 0x0040,
-               CallConvMask = 0x0700,
-               CallConvWinapi = 0x0100,
-               CallConvCdecl = 0x0200,
-               CallConvStdcall = 0x0300,
-               CallConvThiscall = 0x0400,
-               CallConvFastcall = 0x0500,
-               // non-standard flags (i.e. CLR specific)
-               BestFitOn = 0x0010,
-               BestFitOff = 0x0020,
-               CharMapErrorOn = 0x1000,
-               CharMapErrorOff = 0x2000,
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/EventInfo.cs b/mcs/class/IKVM.Reflection/EventInfo.cs
deleted file mode 100644 (file)
index ffd9a0d..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
-       public abstract class EventInfo : MemberInfo
-       {
-               // prevent external subclasses
-               internal EventInfo()
-               {
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return MemberTypes.Event; }
-               }
-
-               public abstract EventAttributes Attributes { get; }
-               public abstract MethodInfo GetAddMethod(bool nonPublic);
-               public abstract MethodInfo GetRaiseMethod(bool nonPublic);
-               public abstract MethodInfo GetRemoveMethod(bool nonPublic);
-               public abstract MethodInfo[] GetOtherMethods(bool nonPublic);
-               public abstract MethodInfo[] __GetMethods();
-               public abstract Type EventHandlerType { get; }
-               internal abstract bool IsPublic { get; }
-               internal abstract bool IsNonPrivate { get; }
-               internal abstract bool IsStatic { get; }
-
-               public bool IsSpecialName
-               {
-                       get { return (Attributes & EventAttributes.SpecialName) != 0; }
-               }
-
-               public MethodInfo GetAddMethod()
-               {
-                       return GetAddMethod(false);
-               }
-
-               public MethodInfo GetRaiseMethod()
-               {
-                       return GetRaiseMethod(false);
-               }
-
-               public MethodInfo GetRemoveMethod()
-               {
-                       return GetRemoveMethod(false);
-               }
-
-               public MethodInfo[] GetOtherMethods()
-               {
-                       return GetOtherMethods(false);
-               }
-
-               internal virtual EventInfo BindTypeParameters(Type type)
-               {
-                       return new GenericEventInfo(this.DeclaringType.BindTypeParameters(type), this);
-               }
-
-               public override string ToString()
-               {
-                       return this.DeclaringType.ToString() + " " + Name;
-               }
-
-               internal sealed override bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
-               }
-
-               internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
-               {
-                       return IsNonPrivate
-                               && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       return new EventInfoWithReflectedType(type, this);
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       // events don't have pseudo custom attributes
-                       return null;
-               }
-       }
-
-       sealed class EventInfoWithReflectedType : EventInfo
-       {
-               private readonly Type reflectedType;
-               private readonly EventInfo eventInfo;
-
-               internal EventInfoWithReflectedType(Type reflectedType, EventInfo eventInfo)
-               {
-                       Debug.Assert(reflectedType != eventInfo.DeclaringType);
-                       this.reflectedType = reflectedType;
-                       this.eventInfo = eventInfo;
-               }
-
-               public override EventAttributes Attributes
-               {
-                       get { return eventInfo.Attributes; }
-               }
-
-               public override MethodInfo GetAddMethod(bool nonPublic)
-               {
-                       return SetReflectedType(eventInfo.GetAddMethod(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo GetRaiseMethod(bool nonPublic)
-               {
-                       return SetReflectedType(eventInfo.GetRaiseMethod(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo GetRemoveMethod(bool nonPublic)
-               {
-                       return SetReflectedType(eventInfo.GetRemoveMethod(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo[] GetOtherMethods(bool nonPublic)
-               {
-                       return SetReflectedType(eventInfo.GetOtherMethods(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo[] __GetMethods()
-               {
-                       return SetReflectedType(eventInfo.__GetMethods(), reflectedType);
-               }
-
-               public override Type EventHandlerType
-               {
-                       get { return eventInfo.EventHandlerType; }
-               }
-
-               internal override bool IsPublic
-               {
-                       get { return eventInfo.IsPublic; }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get { return eventInfo.IsNonPrivate; }
-               }
-
-               internal override bool IsStatic
-               {
-                       get { return eventInfo.IsStatic; }
-               }
-
-               internal override EventInfo BindTypeParameters(Type type)
-               {
-                       return eventInfo.BindTypeParameters(type);
-               }
-
-               public override string ToString()
-               {
-                       return eventInfo.ToString();
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return eventInfo.__IsMissing; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return eventInfo.DeclaringType; }
-               }
-
-               public override Type ReflectedType
-               {
-                       get { return reflectedType; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       EventInfoWithReflectedType other = obj as EventInfoWithReflectedType;
-                       return other != null
-                               && other.reflectedType == reflectedType
-                               && other.eventInfo == eventInfo;
-               }
-
-               public override int GetHashCode()
-               {
-                       return reflectedType.GetHashCode() ^ eventInfo.GetHashCode();
-               }
-
-               public override int MetadataToken
-               {
-                       get { return eventInfo.MetadataToken; }
-               }
-
-               public override Module Module
-               {
-                       get { return eventInfo.Module; }
-               }
-
-               public override string Name
-               {
-                       get { return eventInfo.Name; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return eventInfo.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return eventInfo.GetCurrentToken();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/ExceptionHandlingClause.cs b/mcs/class/IKVM.Reflection/ExceptionHandlingClause.cs
deleted file mode 100644 (file)
index 3553f90..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       [Flags]
-       public enum ExceptionHandlingClauseOptions
-       {
-               Clause  = 0x0000,
-               Filter  = 0x0001,
-               Finally = 0x0002,
-               Fault   = 0x0004,
-       }
-
-       public sealed class ExceptionHandlingClause
-       {
-               private readonly int flags;
-               private readonly int tryOffset;
-               private readonly int tryLength;
-               private readonly int handlerOffset;
-               private readonly int handlerLength;
-               private readonly Type catchType;
-               private readonly int filterOffset;
-
-               internal ExceptionHandlingClause(ModuleReader module, int flags, int tryOffset, int tryLength, int handlerOffset, int handlerLength, int classTokenOrfilterOffset, IGenericContext context)
-               {
-                       this.flags = flags;
-                       this.tryOffset = tryOffset;
-                       this.tryLength = tryLength;
-                       this.handlerOffset = handlerOffset;
-                       this.handlerLength = handlerLength;
-                       this.catchType = flags == (int)ExceptionHandlingClauseOptions.Clause && classTokenOrfilterOffset != 0 ? module.ResolveType(classTokenOrfilterOffset, context) : null;
-                       this.filterOffset = flags == (int)ExceptionHandlingClauseOptions.Filter ? classTokenOrfilterOffset : 0;
-               }
-
-               public Type CatchType
-               {
-                       get { return catchType; }
-               }
-
-               public int FilterOffset
-               {
-                       get { return filterOffset; }
-               }
-
-               public ExceptionHandlingClauseOptions Flags
-               {
-                       get { return (ExceptionHandlingClauseOptions)flags; }
-               }
-
-               public int HandlerLength
-               {
-                       get { return handlerLength; }
-               }
-
-               public int HandlerOffset
-               {
-                       get { return handlerOffset; }
-               }
-
-               public int TryLength
-               {
-                       get { return tryLength; }
-               }
-
-               public int TryOffset
-               {
-                       get { return tryOffset; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/FieldInfo.cs b/mcs/class/IKVM.Reflection/FieldInfo.cs
deleted file mode 100644 (file)
index 92f8909..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace IKVM.Reflection
-{
-       public abstract class FieldInfo : MemberInfo
-       {
-               // prevent external subclasses
-               internal FieldInfo()
-               {
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return MemberTypes.Field; }
-               }
-
-               public abstract FieldAttributes Attributes { get; }
-               public abstract void __GetDataFromRVA(byte[] data, int offset, int length);
-               public abstract int __FieldRVA { get; }
-               public abstract Object GetRawConstantValue();
-               internal abstract FieldSignature FieldSignature { get; }
-
-               public Type FieldType
-               {
-                       get { return this.FieldSignature.FieldType; }
-               }
-
-               public CustomModifiers __GetCustomModifiers()
-               {
-                       return this.FieldSignature.GetCustomModifiers();
-               }
-
-               public Type[] GetOptionalCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetOptional();
-               }
-
-               public Type[] GetRequiredCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetRequired();
-               }
-
-               public bool IsStatic
-               {
-                       get { return (Attributes & FieldAttributes.Static) != 0; }
-               }
-
-               public bool IsLiteral
-               {
-                       get { return (Attributes & FieldAttributes.Literal) != 0; }
-               }
-
-               public bool IsInitOnly
-               {
-                       get { return (Attributes & FieldAttributes.InitOnly) != 0; }
-               }
-
-               public bool IsNotSerialized
-               {
-                       get { return (Attributes & FieldAttributes.NotSerialized) != 0; }
-               }
-
-               public bool IsSpecialName
-               {
-                       get { return (Attributes & FieldAttributes.SpecialName) != 0; }
-               }
-
-               public bool IsPublic
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; }
-               }
-
-               public bool IsPrivate
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; }
-               }
-
-               public bool IsFamily
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
-               }
-
-               public bool IsFamilyOrAssembly
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; }
-               }
-
-               public bool IsAssembly
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; }
-               }
-
-               public bool IsFamilyAndAssembly
-               {
-                       get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; }
-               }
-
-               public bool IsPinvokeImpl
-               {
-                       get { return (Attributes & FieldAttributes.PinvokeImpl) != 0; }
-               }
-
-               public virtual FieldInfo __GetFieldOnTypeDefinition()
-               {
-                       return this;
-               }
-
-               public abstract bool __TryGetFieldOffset(out int offset);
-
-               public bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-               {
-                       return FieldMarshal.ReadFieldMarshal(this.Module, GetCurrentToken(), out fieldMarshal);
-               }
-
-               internal abstract int ImportTo(Emit.ModuleBuilder module);
-
-               internal virtual FieldInfo BindTypeParameters(Type type)
-               {
-                       return new GenericFieldInstance(this.DeclaringType.BindTypeParameters(type), this);
-               }
-
-               internal sealed override bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
-               }
-
-               internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
-               {
-                       return (Attributes & FieldAttributes.FieldAccessMask) > FieldAttributes.Private
-                               && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       return new FieldInfoWithReflectedType(type, this);
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       Module module = this.Module;
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       if (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_MarshalAsAttribute))
-                       {
-                               FieldMarshal spec;
-                               if (__TryGetFieldMarshal(out spec))
-                               {
-                                       list.Add(CustomAttributeData.CreateMarshalAsPseudoCustomAttribute(module, spec));
-                               }
-                       }
-                       if (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_FieldOffsetAttribute))
-                       {
-                               int offset;
-                               if (__TryGetFieldOffset(out offset))
-                               {
-                                       list.Add(CustomAttributeData.CreateFieldOffsetPseudoCustomAttribute(module, offset));
-                               }
-                       }
-                       return list;
-               }
-       }
-
-       sealed class FieldInfoWithReflectedType : FieldInfo
-       {
-               private readonly Type reflectedType;
-               private readonly FieldInfo field;
-
-               internal FieldInfoWithReflectedType(Type reflectedType, FieldInfo field)
-               {
-                       Debug.Assert(reflectedType != field.DeclaringType);
-                       this.reflectedType = reflectedType;
-                       this.field = field;
-               }
-
-               public override FieldAttributes Attributes
-               {
-                       get { return field.Attributes; }
-               }
-
-               public override void __GetDataFromRVA(byte[] data, int offset, int length)
-               {
-                       field.__GetDataFromRVA(data, offset, length);
-               }
-
-               public override int __FieldRVA
-               {
-                       get { return field.__FieldRVA; }
-               }
-
-               public override bool __TryGetFieldOffset(out int offset)
-               {
-                       return field.__TryGetFieldOffset(out offset);
-               }
-
-               public override Object GetRawConstantValue()
-               {
-                       return field.GetRawConstantValue();
-               }
-
-               internal override FieldSignature FieldSignature
-               {
-                       get { return field.FieldSignature; }
-               }
-
-               public override FieldInfo __GetFieldOnTypeDefinition()
-               {
-                       return field.__GetFieldOnTypeDefinition();
-               }
-
-               internal override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       return field.ImportTo(module);
-               }
-
-               internal override FieldInfo BindTypeParameters(Type type)
-               {
-                       return field.BindTypeParameters(type);
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return field.__IsMissing; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return field.DeclaringType; }
-               }
-
-               public override Type ReflectedType
-               {
-                       get { return reflectedType; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       FieldInfoWithReflectedType other = obj as FieldInfoWithReflectedType;
-                       return other != null
-                               && other.reflectedType == reflectedType
-                               && other.field == field;
-               }
-
-               public override int GetHashCode()
-               {
-                       return reflectedType.GetHashCode() ^ field.GetHashCode();
-               }
-
-               public override int MetadataToken
-               {
-                       get { return field.MetadataToken; }
-               }
-
-               public override Module Module
-               {
-                       get { return field.Module; }
-               }
-
-               public override string Name
-               {
-                       get { return field.Name; }
-               }
-
-               public override string ToString()
-               {
-                       return field.ToString();
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return field.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return field.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/FieldSignature.cs b/mcs/class/IKVM.Reflection/FieldSignature.cs
deleted file mode 100644 (file)
index 481fc61..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       sealed class FieldSignature : Signature
-       {
-               private readonly Type fieldType;
-               private readonly CustomModifiers mods;
-
-               internal static FieldSignature Create(Type fieldType, CustomModifiers customModifiers)
-               {
-                       return new FieldSignature(fieldType, customModifiers);
-               }
-
-               private FieldSignature(Type fieldType, CustomModifiers mods)
-               {
-                       this.fieldType = fieldType;
-                       this.mods = mods;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       FieldSignature other = obj as FieldSignature;
-                       return other != null
-                               && other.fieldType.Equals(fieldType)
-                               && other.mods.Equals(mods);
-               }
-
-               public override int GetHashCode()
-               {
-                       return fieldType.GetHashCode() ^ mods.GetHashCode();
-               }
-
-               internal Type FieldType
-               {
-                       get { return fieldType; }
-               }
-
-               internal CustomModifiers GetCustomModifiers()
-               {
-                       return mods;
-               }
-
-               internal FieldSignature ExpandTypeParameters(Type declaringType)
-               {
-                       return new FieldSignature(
-                               fieldType.BindTypeParameters(declaringType),
-                               mods.Bind(declaringType));
-               }
-
-               internal static FieldSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       if (br.ReadByte() != FIELD)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       CustomModifiers mods = CustomModifiers.Read(module, br, context);
-                       Type fieldType = ReadType(module, br, context);
-                       return new FieldSignature(fieldType, mods);
-               }
-
-               internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
-               {
-                       bb.Write(FIELD);
-                       WriteCustomModifiers(module, bb, mods);
-                       WriteType(module, bb, fieldType);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Fusion.cs b/mcs/class/IKVM.Reflection/Fusion.cs
deleted file mode 100644 (file)
index d9c0e08..0000000
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
-  Copyright (C) 2010-2012 Jeroen Frijters
-  Copyright (C) 2011 Marek Safar
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       struct ParsedAssemblyName
-       {
-               internal string Name;
-               internal Version Version;
-               internal string Culture;
-               internal string PublicKeyToken;
-               internal bool? Retargetable;
-               internal ProcessorArchitecture ProcessorArchitecture;
-               internal bool HasPublicKey;
-               internal bool WindowsRuntime;
-       }
-
-       enum ParseAssemblyResult
-       {
-               OK,
-               GenericError,
-               DuplicateKey,
-       }
-
-       static class Fusion
-       {
-               internal static bool CompareAssemblyIdentityNative(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
-               {
-                       bool equivalent;
-                       Marshal.ThrowExceptionForHR(CompareAssemblyIdentity(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out equivalent, out result));
-                       return equivalent;
-               }
-
-               [DllImport("fusion", CharSet = CharSet.Unicode)]
-               private static extern int CompareAssemblyIdentity(string pwzAssemblyIdentity1, bool fUnified1, string pwzAssemblyIdentity2, bool fUnified2, out bool pfEquivalent, out AssemblyComparisonResult pResult);
-
-               // internal for use by mcs
-               internal static bool CompareAssemblyIdentityPure(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
-               {
-                       ParsedAssemblyName name1;
-                       ParsedAssemblyName name2;
-
-                       ParseAssemblyResult r = ParseAssemblyName(assemblyIdentity1, out name1);
-                       if (r != ParseAssemblyResult.OK || (r = ParseAssemblyName(assemblyIdentity2, out name2)) != ParseAssemblyResult.OK)
-                       {
-                               result = AssemblyComparisonResult.NonEquivalent;
-                               switch (r)
-                               {
-                                       case ParseAssemblyResult.DuplicateKey:
-                                               throw new System.IO.FileLoadException();
-                                       case ParseAssemblyResult.GenericError:
-                                       default:
-                                               throw new ArgumentException();
-                               }
-                       }
-
-                       bool partial = IsPartial(name1);
-
-                       if ((partial && unified1) || IsPartial(name2))
-                       {
-                               result = AssemblyComparisonResult.NonEquivalent;
-                               throw new ArgumentException();
-                       }
-                       if (!name1.Name.Equals(name2.Name, StringComparison.InvariantCultureIgnoreCase))
-                       {
-                               result = AssemblyComparisonResult.NonEquivalent;
-                               return false;
-                       }
-                       if (name1.Name.Equals("mscorlib", StringComparison.InvariantCultureIgnoreCase))
-                       {
-                               result = AssemblyComparisonResult.EquivalentFullMatch;
-                               return true;
-                       }
-                       if (partial && name1.Culture == null)
-                       {
-                       }
-                       else if (!name1.Culture.Equals(name2.Culture, StringComparison.InvariantCultureIgnoreCase))
-                       {
-                               result = AssemblyComparisonResult.NonEquivalent;
-                               return false;
-                       }
-                       if (IsStrongNamed(name2))
-                       {
-                               if (partial && name1.PublicKeyToken == null)
-                               {
-                               }
-                               else if (name1.PublicKeyToken != name2.PublicKeyToken)
-                               {
-                                       result = AssemblyComparisonResult.NonEquivalent;
-                                       return false;
-                               }
-                               if (partial && name1.Version == null)
-                               {
-                                       result = AssemblyComparisonResult.EquivalentPartialMatch;
-                                       return true;
-                               }
-                               else if (IsFrameworkAssembly(name2))
-                               {
-                                       result = partial ? AssemblyComparisonResult.EquivalentPartialFXUnified : AssemblyComparisonResult.EquivalentFXUnified;
-                                       return true;
-                               }
-                               else if (name1.Version.Revision == -1 || name2.Version.Revision == -1)
-                               {
-                                       result = AssemblyComparisonResult.NonEquivalent;
-                                       throw new ArgumentException();
-                               }
-                               else if (name1.Version < name2.Version)
-                               {
-                                       if (unified2)
-                                       {
-                                               result = partial ? AssemblyComparisonResult.EquivalentPartialUnified : AssemblyComparisonResult.EquivalentUnified;
-                                               return true;
-                                       }
-                                       else
-                                       {
-                                               result = partial ? AssemblyComparisonResult.NonEquivalentPartialVersion : AssemblyComparisonResult.NonEquivalentVersion;
-                                               return false;
-                                       }
-                               }
-                               else if (name1.Version > name2.Version)
-                               {
-                                       if (unified1)
-                                       {
-                                               result = partial ? AssemblyComparisonResult.EquivalentPartialUnified : AssemblyComparisonResult.EquivalentUnified;
-                                               return true;
-                                       }
-                                       else
-                                       {
-                                               result = partial ? AssemblyComparisonResult.NonEquivalentPartialVersion : AssemblyComparisonResult.NonEquivalentVersion;
-                                               return false;
-                                       }
-                               }
-                               else
-                               {
-                                       result = partial ? AssemblyComparisonResult.EquivalentPartialMatch : AssemblyComparisonResult.EquivalentFullMatch;
-                                       return true;
-                               }
-                       }
-                       else if (IsStrongNamed(name1))
-                       {
-                               result = AssemblyComparisonResult.NonEquivalent;
-                               return false;
-                       }
-                       else
-                       {
-                               result = partial ? AssemblyComparisonResult.EquivalentPartialWeakNamed : AssemblyComparisonResult.EquivalentWeakNamed;
-                               return true;
-                       }
-               }
-
-               static bool IsFrameworkAssembly(ParsedAssemblyName name)
-               {
-                       // A list of FX assemblies which require some form of remapping
-                       // When 4.0 + 1 version  is release, assemblies introduced in v4.0
-                       // will have to be added
-                       switch (name.Name)
-                       {
-                               case "System":
-                               case "System.Core":
-                               case "System.Data":
-                               case "System.Data.DataSetExtensions":
-                               case "System.Data.Linq":
-                               case "System.Data.OracleClient":
-                               case "System.Data.Services":
-                               case "System.Data.Services.Client":
-                               case "System.IdentityModel":
-                               case "System.IdentityModel.Selectors":
-                               case "System.Runtime.Remoting":
-                               case "System.Runtime.Serialization":
-                               case "System.ServiceModel":
-                               case "System.Transactions":
-                               case "System.Windows.Forms":
-                               case "System.Xml":
-                               case "System.Xml.Linq":
-                                       return name.PublicKeyToken == "b77a5c561934e089";
-
-                               case "System.Configuration":
-                               case "System.Configuration.Install":
-                               case "System.Design":
-                               case "System.DirectoryServices":
-                               case "System.Drawing":
-                               case "System.Drawing.Design":
-                               case "System.EnterpriseServices":
-                               case "System.Management":
-                               case "System.Messaging":
-                               case "System.Runtime.Serialization.Formatters.Soap":
-                               case "System.Security":
-                               case "System.ServiceProcess":
-                               case "System.Web":
-                               case "System.Web.Mobile":
-                               case "System.Web.Services":
-                                       return name.PublicKeyToken == "b03f5f7f11d50a3a";
-
-                               case "System.ComponentModel.DataAnnotations":
-                               case "System.ServiceModel.Web":
-                               case "System.Web.Abstractions":
-                               case "System.Web.Extensions":
-                               case "System.Web.Extensions.Design":
-                               case "System.Web.DynamicData":
-                               case "System.Web.Routing":
-                                       return name.PublicKeyToken == "31bf3856ad364e35";
-                       }
-
-                       return false;
-               }
-
-               internal static ParseAssemblyResult ParseAssemblySimpleName(string fullName, out int pos, out string simpleName)
-               {
-                       StringBuilder sb = new StringBuilder();
-                       pos = 0;
-                       simpleName = null;
-                       while (pos < fullName.Length && char.IsWhiteSpace(fullName[pos]))
-                       {
-                               pos++;
-                       }
-                       char quoteOrComma = ',';
-                       if (pos < fullName.Length && (fullName[pos] == '\"' || fullName[pos] == '\''))
-                       {
-                               quoteOrComma = fullName[pos++];
-                       }
-                       while (pos < fullName.Length)
-                       {
-                               char ch = fullName[pos++];
-                               if (ch == '\\')
-                               {
-                                       if (pos == fullName.Length)
-                                       {
-                                               return ParseAssemblyResult.GenericError;
-                                       }
-                                       ch = fullName[pos++];
-                                       if (ch == '\\')
-                                       {
-                                               return ParseAssemblyResult.GenericError;
-                                       }
-                               }
-                               else if (ch == quoteOrComma)
-                               {
-                                       if (ch != ',')
-                                       {
-                                               while (pos != fullName.Length)
-                                               {
-                                                       ch = fullName[pos++];
-                                                       if (ch == ',')
-                                                       {
-                                                               break;
-                                                       }
-                                                       if (!char.IsWhiteSpace(ch))
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                               }
-                                       }
-                                       break;
-                               }
-                               else if (ch == '=' || (quoteOrComma == ',' && (ch == '\'' || ch == '"')))
-                               {
-                                       return ParseAssemblyResult.GenericError;
-                               }
-                               sb.Append(ch);
-                       }
-                       simpleName = sb.ToString().Trim();
-                       if (simpleName.Length == 0)
-                       {
-                               return ParseAssemblyResult.GenericError;
-                       }
-                       if (pos == fullName.Length && fullName[fullName.Length - 1] == ',')
-                       {
-                               return ParseAssemblyResult.GenericError;
-                       }
-                       return ParseAssemblyResult.OK;
-               }
-
-               internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
-               {
-                       parsedName = new ParsedAssemblyName();
-                       int pos;
-                       ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);
-                       if (res != ParseAssemblyResult.OK || pos == fullName.Length)
-                       {
-                               return res;
-                       }
-                       else
-                       {
-                               System.Collections.Generic.Dictionary<string, string> unknownAttributes = null;
-                               bool hasProcessorArchitecture = false;
-                               bool hasContentType = false;
-                               string[] parts = fullName.Substring(pos).Split(',');
-                               for (int i = 0; i < parts.Length; i++)
-                               {
-                                       string[] kv = parts[i].Split('=');
-                                       if (kv.Length != 2)
-                                       {
-                                               return ParseAssemblyResult.GenericError;
-                                       }
-                                       switch (kv[0].Trim().ToLowerInvariant())
-                                       {
-                                               case "version":
-                                                       if (parsedName.Version != null)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       break;
-                                               case "culture":
-                                                       if (parsedName.Culture != null)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       break;
-                                               case "publickeytoken":
-                                                       if (parsedName.PublicKeyToken != null)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       break;
-                                               case "publickey":
-                                                       if (parsedName.PublicKeyToken != null)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       parsedName.HasPublicKey = true;
-                                                       break;
-                                               case "retargetable":
-                                                       if (parsedName.Retargetable.HasValue)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       switch (kv[1].Trim().ToLowerInvariant())
-                                                       {
-                                                               case "yes":
-                                                                       parsedName.Retargetable = true;
-                                                                       break;
-                                                               case "no":
-                                                                       parsedName.Retargetable = false;
-                                                                       break;
-                                                               default:
-                                                                       return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       break;
-                                               case "processorarchitecture":
-                                                       if (hasProcessorArchitecture)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       hasProcessorArchitecture = true;
-                                                       switch (kv[1].Trim().ToLowerInvariant())
-                                                       {
-                                                               case "none":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
-                                                                       break;
-                                                               case "msil":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
-                                                                       break;
-                                                               case "x86":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
-                                                                       break;
-                                                               case "ia64":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
-                                                                       break;
-                                                               case "amd64":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
-                                                                       break;
-                                                               case "arm":
-                                                                       parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
-                                                                       break;
-                                                               default:
-                                                                       return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       break;
-                                               case "contenttype":
-                                                       if (hasContentType)
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       hasContentType = true;
-                                                       if (kv[1].Trim().ToLowerInvariant() != "windowsruntime")
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       parsedName.WindowsRuntime = true;
-                                                       break;
-                                               default:
-                                                       if (kv[1].Trim() == "")
-                                                       {
-                                                               return ParseAssemblyResult.GenericError;
-                                                       }
-                                                       if (unknownAttributes == null)
-                                                       {
-                                                               unknownAttributes = new System.Collections.Generic.Dictionary<string, string>();
-                                                       }
-                                                       if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
-                                                       {
-                                                               return ParseAssemblyResult.DuplicateKey;
-                                                       }
-                                                       unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
-                                                       break;
-                                       }
-                               }
-                       }
-                       return ParseAssemblyResult.OK;
-               }
-
-               private static bool ParseVersion(string str, out Version version)
-               {
-                       string[] parts = str.Split('.');
-                       if (parts.Length < 2 || parts.Length > 4)
-                       {
-                               version = null;
-                               ushort dummy;
-                               // if the version consists of a single integer, it is invalid, but not invalid enough to fail the parse of the whole assembly name
-                               return parts.Length == 1 && ushort.TryParse(parts[0], System.Globalization.NumberStyles.Integer, null, out dummy);
-                       }
-                       if (parts[0] == "" || parts[1] == "")
-                       {
-                               // this is a strange scenario, the version is invalid, but not invalid enough to fail the parse of the whole assembly name
-                               version = null;
-                               return true;
-                       }
-                       ushort major, minor, build = 65535, revision = 65535;
-                       if (ushort.TryParse(parts[0], System.Globalization.NumberStyles.Integer, null, out major)
-                               && ushort.TryParse(parts[1], System.Globalization.NumberStyles.Integer, null, out minor)
-                               && (parts.Length <= 2 || parts[2] == "" || ushort.TryParse(parts[2], System.Globalization.NumberStyles.Integer, null, out build))
-                               && (parts.Length <= 3 || parts[3] == "" || (parts[2] != "" && ushort.TryParse(parts[3], System.Globalization.NumberStyles.Integer, null, out revision))))
-                       {
-                               if (parts.Length == 4 && parts[3] != "" && parts[2] != "")
-                               {
-                                       version = new Version(major, minor, build, revision);
-                               }
-                               else if (parts.Length == 3 && parts[2] != "")
-                               {
-                                       version = new Version(major, minor, build);
-                               }
-                               else
-                               {
-                                       version = new Version(major, minor);
-                               }
-                               return true;
-                       }
-                       version = null;
-                       return false;
-               }
-
-               private static bool ParseCulture(string str, out string culture)
-               {
-                       if (str == null)
-                       {
-                               culture = null;
-                               return false;
-                       }
-                       culture = str;
-                       return true;
-               }
-
-               private static bool ParsePublicKeyToken(string str, out string publicKeyToken)
-               {
-                       if (str == null)
-                       {
-                               publicKeyToken = null;
-                               return false;
-                       }
-                       publicKeyToken = str.ToLowerInvariant();
-                       return true;
-               }
-
-               private static bool ParsePublicKey(string str, out string publicKeyToken)
-               {
-                       if (str == null)
-                       {
-                               publicKeyToken = null;
-                               return false;
-                       }
-                       // HACK use AssemblyName to convert PublicKey to PublicKeyToken
-                       byte[] token = new System.Reflection.AssemblyName("Foo, PublicKey=" + str).GetPublicKeyToken();
-                       StringBuilder sb = new StringBuilder(token.Length * 2);
-                       for (int i = 0; i < token.Length; i++)
-                       {
-                               sb.AppendFormat("{0:x2}", token[i]);
-                       }
-                       publicKeyToken = sb.ToString();
-                       return true;
-               }
-
-               private static bool IsPartial(ParsedAssemblyName name)
-               {
-                       return name.Version == null || name.Culture == null || name.PublicKeyToken == null;
-               }
-
-               private static bool IsStrongNamed(ParsedAssemblyName name)
-               {
-                       return name.PublicKeyToken != null && name.PublicKeyToken != "null";
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/GenericWrappers.cs b/mcs/class/IKVM.Reflection/GenericWrappers.cs
deleted file mode 100644 (file)
index 1122ff2..0000000
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
-  Copyright (C) 2009, 2010 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       // this represents both generic method instantiations and non-generic methods on generic type instantations
-       // (this means that it can be a generic method declaration as well as a generic method instance)
-       sealed class GenericMethodInstance : MethodInfo
-       {
-               private readonly Type declaringType;
-               private readonly MethodInfo method;
-               private readonly Type[] methodArgs;
-               private MethodSignature lazyMethodSignature;
-
-               internal GenericMethodInstance(Type declaringType, MethodInfo method, Type[] methodArgs)
-               {
-                       System.Diagnostics.Debug.Assert(!(method is GenericMethodInstance));
-                       this.declaringType = declaringType;
-                       this.method = method;
-                       this.methodArgs = methodArgs;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       GenericMethodInstance other = obj as GenericMethodInstance;
-                       return other != null
-                               && other.method.Equals(method)
-                               && other.declaringType.Equals(declaringType)
-                               && Util.ArrayEquals(other.methodArgs, methodArgs);
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() * 33 ^ method.GetHashCode() ^ Util.GetHashCode(methodArgs);
-               }
-
-               public override Type ReturnType
-               {
-                       get { return method.ReturnType.BindTypeParameters(this); }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get { return new GenericParameterInfoImpl(this, method.ReturnParameter); }
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameters = method.GetParameters();
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new GenericParameterInfoImpl(this, parameters[i]);
-                       }
-                       return parameters;
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return method.ParameterCount; }
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return method.CallingConvention; }
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return method.Attributes; }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return method.GetMethodImplementationFlags();
-               }
-
-               public override string Name
-               {
-                       get { return method.Name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType.IsModulePseudoType ? null : declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return method.Module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return method.MetadataToken; }
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       IKVM.Reflection.Reader.MethodDefImpl md = method as IKVM.Reflection.Reader.MethodDefImpl;
-                       if (md != null)
-                       {
-                               return md.GetMethodBody(this);
-                       }
-                       throw new NotSupportedException();
-               }
-
-               public override int __MethodRVA
-               {
-                       get { return method.__MethodRVA; }
-               }
-
-               public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       return new GenericMethodInstance(declaringType, method, typeArguments);
-               }
-
-               public override bool IsGenericMethod
-               {
-                       get { return method.IsGenericMethod; }
-               }
-
-               public override bool IsGenericMethodDefinition
-               {
-                       get { return method.IsGenericMethodDefinition && methodArgs == null; }
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get
-                       {
-                               if (declaringType.ContainsGenericParameters)
-                               {
-                                       return true;
-                               }
-                               if (methodArgs != null)
-                               {
-                                       foreach (Type type in methodArgs)
-                                       {
-                                               if (type.ContainsGenericParameters)
-                                               {
-                                                       return true;
-                                               }
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               public override MethodInfo GetGenericMethodDefinition()
-               {
-                       if (this.IsGenericMethod)
-                       {
-                               if (this.IsGenericMethodDefinition)
-                               {
-                                       return this;
-                               }
-                               else if (declaringType.IsConstructedGenericType)
-                               {
-                                       return new GenericMethodInstance(declaringType, method, null);
-                               }
-                               else
-                               {
-                                       return method;
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               public override MethodBase __GetMethodOnTypeDefinition()
-               {
-                       return method;
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       if (methodArgs == null)
-                       {
-                               return method.GetGenericArguments();
-                       }
-                       else
-                       {
-                               return (Type[])methodArgs.Clone();
-                       }
-               }
-
-               internal override Type GetGenericMethodArgument(int index)
-               {
-                       if (methodArgs == null)
-                       {
-                               return method.GetGenericMethodArgument(index);
-                       }
-                       else
-                       {
-                               return methodArgs[index];
-                       }
-               }
-
-               internal override int GetGenericMethodArgumentCount()
-               {
-                       return method.GetGenericMethodArgumentCount();
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return method.GetMethodOnTypeDefinition();
-               }
-
-               internal override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       if (methodArgs == null)
-                       {
-                               return module.ImportMethodOrField(declaringType, method.Name, method.MethodSignature);
-                       }
-                       else
-                       {
-                               return module.ImportMethodSpec(declaringType, method, methodArgs);
-                       }
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get { return lazyMethodSignature ?? (lazyMethodSignature = method.MethodSignature.Bind(declaringType, methodArgs)); }
-               }
-
-               internal override MethodBase BindTypeParameters(Type type)
-               {
-                       System.Diagnostics.Debug.Assert(methodArgs == null);
-                       return new GenericMethodInstance(declaringType.BindTypeParameters(type), method, null);
-               }
-
-               internal override bool HasThis
-               {
-                       get { return method.HasThis; }
-               }
-
-               public override MethodInfo[] __GetMethodImpls()
-               {
-                       MethodInfo[] methods = method.__GetMethodImpls();
-                       for (int i = 0; i < methods.Length; i++)
-                       {
-                               methods[i] = (MethodInfo)methods[i].BindTypeParameters(declaringType);
-                       }
-                       return methods;
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return method.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return method.IsBaked; }
-               }
-       }
-
-       sealed class GenericFieldInstance : FieldInfo
-       {
-               private readonly Type declaringType;
-               private readonly FieldInfo field;
-
-               internal GenericFieldInstance(Type declaringType, FieldInfo field)
-               {
-                       this.declaringType = declaringType;
-                       this.field = field;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       GenericFieldInstance other = obj as GenericFieldInstance;
-                       return other != null && other.declaringType.Equals(declaringType) && other.field.Equals(field);
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() * 3 ^ field.GetHashCode();
-               }
-
-               public override FieldAttributes Attributes
-               {
-                       get { return field.Attributes; }
-               }
-
-               public override string Name
-               {
-                       get { return field.Name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return declaringType.Module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return field.MetadataToken; }
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return field.GetRawConstantValue();
-               }
-
-               public override void __GetDataFromRVA(byte[] data, int offset, int length)
-               {
-                       field.__GetDataFromRVA(data, offset, length);
-               }
-
-               public override int __FieldRVA
-               {
-                       get { return field.__FieldRVA; }
-               }
-
-               public override bool __TryGetFieldOffset(out int offset)
-               {
-                       return field.__TryGetFieldOffset(out offset);
-               }
-
-               public override FieldInfo __GetFieldOnTypeDefinition()
-               {
-                       return field;
-               }
-
-               internal override FieldSignature FieldSignature
-               {
-                       get { return field.FieldSignature.ExpandTypeParameters(declaringType); }
-               }
-
-               internal override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       return module.ImportMethodOrField(declaringType, field.Name, field.FieldSignature);
-               }
-
-               internal override FieldInfo BindTypeParameters(Type type)
-               {
-                       return new GenericFieldInstance(declaringType.BindTypeParameters(type), field);
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return field.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return field.IsBaked; }
-               }
-       }
-
-       sealed class GenericParameterInfoImpl : ParameterInfo
-       {
-               private readonly GenericMethodInstance method;
-               private readonly ParameterInfo parameterInfo;
-
-               internal GenericParameterInfoImpl(GenericMethodInstance method, ParameterInfo parameterInfo)
-               {
-                       this.method = method;
-                       this.parameterInfo = parameterInfo;
-               }
-
-               public override string Name
-               {
-                       get { return parameterInfo.Name; }
-               }
-
-               public override Type ParameterType
-               {
-                       get { return parameterInfo.ParameterType.BindTypeParameters(method); }
-               }
-
-               public override ParameterAttributes Attributes
-               {
-                       get { return parameterInfo.Attributes; }
-               }
-
-               public override int Position
-               {
-                       get { return parameterInfo.Position; }
-               }
-
-               public override object RawDefaultValue
-               {
-                       get { return parameterInfo.RawDefaultValue; }
-               }
-
-               public override CustomModifiers __GetCustomModifiers()
-               {
-                       return parameterInfo.__GetCustomModifiers().Bind(method);
-               }
-
-               public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-               {
-                       return parameterInfo.__TryGetFieldMarshal(out fieldMarshal);
-               }
-
-               public override MemberInfo Member
-               {
-                       get { return method; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return parameterInfo.MetadataToken; }
-               }
-
-               internal override Module Module
-               {
-                       get { return method.Module; }
-               }
-       }
-
-       sealed class GenericPropertyInfo : PropertyInfo
-       {
-               private readonly Type typeInstance;
-               private readonly PropertyInfo property;
-
-               internal GenericPropertyInfo(Type typeInstance, PropertyInfo property)
-               {
-                       this.typeInstance = typeInstance;
-                       this.property = property;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       GenericPropertyInfo other = obj as GenericPropertyInfo;
-                       return other != null && other.typeInstance == typeInstance && other.property == property;
-               }
-
-               public override int GetHashCode()
-               {
-                       return typeInstance.GetHashCode() * 537 + property.GetHashCode();
-               }
-
-               public override PropertyAttributes Attributes
-               {
-                       get { return property.Attributes; }
-               }
-
-               public override bool CanRead
-               {
-                       get { return property.CanRead; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return property.CanWrite; }
-               }
-
-               private MethodInfo Wrap(MethodInfo method)
-               {
-                       if (method == null)
-                       {
-                               return null;
-                       }
-                       return new GenericMethodInstance(typeInstance, method, null);
-               }
-
-               public override MethodInfo GetGetMethod(bool nonPublic)
-               {
-                       return Wrap(property.GetGetMethod(nonPublic));
-               }
-
-               public override MethodInfo GetSetMethod(bool nonPublic)
-               {
-                       return Wrap(property.GetSetMethod(nonPublic));
-               }
-
-               public override MethodInfo[] GetAccessors(bool nonPublic)
-               {
-                       MethodInfo[] accessors = property.GetAccessors(nonPublic);
-                       for (int i = 0; i < accessors.Length; i++)
-                       {
-                               accessors[i] = Wrap(accessors[i]);
-                       }
-                       return accessors;
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return property.GetRawConstantValue();
-               }
-
-               internal override bool IsPublic
-               {
-                       get { return property.IsPublic; }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get { return property.IsNonPrivate; }
-               }
-
-               internal override bool IsStatic
-               {
-                       get { return property.IsStatic; }
-               }
-
-               internal override PropertySignature PropertySignature
-               {
-                       get { return property.PropertySignature.ExpandTypeParameters(typeInstance); }
-               }
-
-               public override string Name
-               {
-                       get { return property.Name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeInstance; }
-               }
-
-               public override Module Module
-               {
-                       get { return typeInstance.Module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return property.MetadataToken; }
-               }
-
-               internal override PropertyInfo BindTypeParameters(Type type)
-               {
-                       return new GenericPropertyInfo(typeInstance.BindTypeParameters(type), property);
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return property.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return property.GetCurrentToken();
-               }
-       }
-
-       sealed class GenericEventInfo : EventInfo
-       {
-               private readonly Type typeInstance;
-               private readonly EventInfo eventInfo;
-
-               internal GenericEventInfo(Type typeInstance, EventInfo eventInfo)
-               {
-                       this.typeInstance = typeInstance;
-                       this.eventInfo = eventInfo;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       GenericEventInfo other = obj as GenericEventInfo;
-                       return other != null && other.typeInstance == typeInstance && other.eventInfo == eventInfo;
-               }
-
-               public override int GetHashCode()
-               {
-                       return typeInstance.GetHashCode() * 777 + eventInfo.GetHashCode();
-               }
-
-               public override EventAttributes Attributes
-               {
-                       get { return eventInfo.Attributes; }
-               }
-
-               private MethodInfo Wrap(MethodInfo method)
-               {
-                       if (method == null)
-                       {
-                               return null;
-                       }
-                       return new GenericMethodInstance(typeInstance, method, null);
-               }
-
-               public override MethodInfo GetAddMethod(bool nonPublic)
-               {
-                       return Wrap(eventInfo.GetAddMethod(nonPublic));
-               }
-
-               public override MethodInfo GetRaiseMethod(bool nonPublic)
-               {
-                       return Wrap(eventInfo.GetRaiseMethod(nonPublic));
-               }
-
-               public override MethodInfo GetRemoveMethod(bool nonPublic)
-               {
-                       return Wrap(eventInfo.GetRemoveMethod(nonPublic));
-               }
-
-               public override MethodInfo[] GetOtherMethods(bool nonPublic)
-               {
-                       MethodInfo[] others = eventInfo.GetOtherMethods(nonPublic);
-                       for (int i = 0; i < others.Length; i++)
-                       {
-                               others[i] = Wrap(others[i]);
-                       }
-                       return others;
-               }
-
-               public override MethodInfo[] __GetMethods()
-               {
-                       MethodInfo[] others = eventInfo.__GetMethods();
-                       for (int i = 0; i < others.Length; i++)
-                       {
-                               others[i] = Wrap(others[i]);
-                       }
-                       return others;
-               }
-
-               public override Type EventHandlerType
-               {
-                       get { return eventInfo.EventHandlerType.BindTypeParameters(typeInstance); }
-               }
-
-               public override string Name
-               {
-                       get { return eventInfo.Name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return typeInstance; }
-               }
-
-               public override Module Module
-               {
-                       get { return eventInfo.Module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return eventInfo.MetadataToken; }
-               }
-
-               internal override EventInfo BindTypeParameters(Type type)
-               {
-                       return new GenericEventInfo(typeInstance.BindTypeParameters(type), eventInfo);
-               }
-
-               internal override bool IsPublic
-               {
-                       get { return eventInfo.IsPublic; }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get { return eventInfo.IsNonPrivate; }
-               }
-
-               internal override bool IsStatic
-               {
-                       get { return eventInfo.IsStatic; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return eventInfo.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return eventInfo.GetCurrentToken();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/IKVM.Reflection.csproj b/mcs/class/IKVM.Reflection/IKVM.Reflection.csproj
deleted file mode 100644 (file)
index e7e7ad3..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{4CB170EF-DFE6-4A56-9E1B-A85449E827A7}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>IKVM.Reflection</RootNamespace>
-    <AssemblyName>IKVM.Reflection</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <TargetFrameworkSubset>
-    </TargetFrameworkSubset>
-    <SccProjectName>
-    </SccProjectName>
-    <SccLocalPath>
-    </SccLocalPath>
-    <SccAuxPath>
-    </SccAuxPath>
-    <SccProvider>
-    </SccProvider>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Compile Include="AmbiguousMatchException.cs" />
-    <Compile Include="Assembly.cs" />
-    <Compile Include="AssemblyName.cs" />
-    <Compile Include="BadImageFormatException.cs" />
-    <Compile Include="Binder.cs" />
-    <Compile Include="ConstructorInfo.cs" />
-    <Compile Include="CustomAttributeData.cs" />
-    <Compile Include="CustomAttributeNamedArgument.cs" />
-    <Compile Include="CustomAttributeTypedArgument.cs" />
-    <Compile Include="CustomModifiers.cs" />
-    <Compile Include="Emit\AssemblyBuilder.cs" />
-    <Compile Include="Emit\ConstructorBuilder.cs" />
-    <Compile Include="Emit\CustomAttributeBuilder.cs" />
-    <Compile Include="Emit\CustomModifiersBuilder.cs" />
-    <Compile Include="Emit\EnumBuilder.cs" />
-    <Compile Include="Emit\Enums.cs" />
-    <Compile Include="Emit\EventBuilder.cs" />
-    <Compile Include="Emit\FieldBuilder.cs" />
-    <Compile Include="Emit\ILGenerator.cs" />
-    <Compile Include="Emit\MethodBuilder.cs" />
-    <Compile Include="Emit\ModuleBuilder.cs" />
-    <Compile Include="Emit\OpCode.cs" />
-    <Compile Include="Emit\OpCodes.cs" />
-    <Compile Include="Emit\ParameterBuilder.cs" />
-    <Compile Include="Emit\PropertyBuilder.cs" />
-    <Compile Include="Emit\SignatureHelper.cs" />
-    <Compile Include="Emit\Tokens.cs" />
-    <Compile Include="Emit\TypeBuilder.cs" />
-    <Compile Include="Enums.cs" />
-    <Compile Include="EventInfo.cs" />
-    <Compile Include="ExceptionHandlingClause.cs" />
-    <Compile Include="FieldInfo.cs" />
-    <Compile Include="FieldSignature.cs" />
-    <Compile Include="Fusion.cs" />
-    <Compile Include="GenericWrappers.cs" />
-    <Compile Include="Impl\ITypeOwner.cs" />
-    <Compile Include="Impl\MdbWriter.cs" />
-    <Compile Include="Impl\PdbWriter.cs" />
-    <Compile Include="Impl\SymbolSupport.cs" />
-    <Compile Include="InterfaceMapping.cs" />
-    <Compile Include="LocalVariableInfo.cs" />
-    <Compile Include="ManifestResourceInfo.cs" />
-    <Compile Include="MarshalSpec.cs" />
-    <Compile Include="MemberInfo.cs" />
-    <Compile Include="Metadata\CliHeader.cs" />
-    <Compile Include="Metadata\MetadataRW.cs" />
-    <Compile Include="Metadata\Tables.cs" />
-    <Compile Include="MethodBase.cs" />
-    <Compile Include="MethodBody.cs" />
-    <Compile Include="MethodImplMap.cs" />
-    <Compile Include="MethodInfo.cs" />
-    <Compile Include="MethodSignature.cs" />
-    <Compile Include="Missing.cs" />
-    <Compile Include="Module.cs" />
-    <Compile Include="ParameterInfo.cs" />
-    <Compile Include="ParameterModifier.cs" />
-    <Compile Include="PropertyInfo.cs" />
-    <Compile Include="PropertySignature.cs" />
-    <Compile Include="Reader\AssemblyReader.cs" />
-    <Compile Include="Reader\ByteReader.cs" />
-    <Compile Include="Reader\EventInfoImpl.cs" />
-    <Compile Include="Reader\Field.cs" />
-    <Compile Include="Reader\GenericTypeParameter.cs" />
-    <Compile Include="Reader\MetadataReader.cs" />
-    <Compile Include="Reader\Method.cs" />
-    <Compile Include="Reader\ModuleReader.cs" />
-    <Compile Include="Reader\PEReader.cs" />
-    <Compile Include="Reader\PropertyInfoImpl.cs" />
-    <Compile Include="Reader\ResourceModule.cs" />
-    <Compile Include="Reader\TypeDefImpl.cs" />
-    <Compile Include="Signature.cs" />
-    <Compile Include="StandAloneMethodSig.cs" />
-    <Compile Include="StrongNameKeyPair.cs" />
-    <Compile Include="Type.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="TypeNameParser.cs" />
-    <Compile Include="Universe.cs" />
-    <Compile Include="Util.cs" />
-    <Compile Include="Writer\ByteBuffer.cs" />
-    <Compile Include="Writer\Heaps.cs" />
-    <Compile Include="Writer\MetadataWriter.cs" />
-    <Compile Include="Writer\ModuleWriter.cs" />
-    <Compile Include="Writer\PEWriter.cs" />
-    <Compile Include="Writer\ResourceSection.cs" />
-    <Compile Include="Writer\TextSection.cs" />
-    <Compile Include="Writer\VersionInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file
diff --git a/mcs/class/IKVM.Reflection/Impl/ITypeOwner.cs b/mcs/class/IKVM.Reflection/Impl/ITypeOwner.cs
deleted file mode 100644 (file)
index 10050f7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
-       interface ITypeOwner
-       {
-               ModuleBuilder ModuleBuilder { get; }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Impl/MdbWriter.cs b/mcs/class/IKVM.Reflection/Impl/MdbWriter.cs
deleted file mode 100644 (file)
index 226137b..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-#if MONO
-using System;
-using System.Collections.Generic;
-using Mono.CompilerServices.SymbolWriter;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
-       sealed class Method : IMethodDef
-       {
-               internal int token;
-               internal string name;
-               internal SymbolDocumentWriter document;
-               internal int[] offsets;
-               internal int[] lines;
-               internal int[] columns;
-               internal List<string> variables = new List<string>();
-
-               public string Name
-               {
-                       get { return name; }
-               }
-
-               public int Token
-               {
-                       get { return token; }
-               }
-       }
-
-       sealed class SymbolDocumentWriter : System.Diagnostics.SymbolStore.ISymbolDocumentWriter
-       {
-               internal readonly string url;
-               internal SourceFileEntry source;
-
-               internal SymbolDocumentWriter(string url)
-               {
-                       this.url = url;
-               }
-
-               public void SetCheckSum(Guid algorithmId, byte[] checkSum)
-               {
-               }
-
-               public void SetSource(byte[] source)
-               {
-               }
-       }
-
-       sealed class MdbWriter : ISymbolWriterImpl
-       {
-               private readonly ModuleBuilder moduleBuilder;
-               private readonly Dictionary<int, Method> methods = new Dictionary<int, Method>();
-               private readonly Dictionary<string, SymbolDocumentWriter> documents = new Dictionary<string, SymbolDocumentWriter>();
-               private Method currentMethod;
-
-               internal MdbWriter(ModuleBuilder moduleBuilder)
-               {
-                       this.moduleBuilder = moduleBuilder;
-               }
-
-               public byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd)
-               {
-                       return Empty<byte>.Array;
-               }
-
-               public void RemapToken(int oldToken, int newToken)
-               {
-                       if (methods.ContainsKey(oldToken))
-                       {
-                               methods[oldToken].token = newToken;
-                       }
-               }
-
-               public void Close()
-               {
-                       MonoSymbolWriter writer = new MonoSymbolWriter(moduleBuilder.FullyQualifiedName);
-
-                       foreach (Method method in methods.Values)
-                       {
-                               if (method.document != null)
-                               {
-                                       if (method.document.source == null)
-                                       {
-                                               method.document.source = new SourceFileEntry(writer.SymbolFile, method.document.url);
-                                       }
-                                       ICompileUnit file = new CompileUnitEntry(writer.SymbolFile, method.document.source);
-                                       SourceMethodBuilder smb = writer.OpenMethod(file, 0, method);
-                                       for (int i = 0; i < method.offsets.Length; i++)
-                                       {
-                                               smb.MarkSequencePoint(method.offsets[i], method.document.source, method.lines[i], method.columns[i], false);
-                                       }
-                                       for (int i = 0; i < method.variables.Count; i++)
-                                       {
-                                               writer.DefineLocalVariable(i, method.variables[i]);
-                                       }
-                                       writer.CloseMethod();
-                               }
-                       }
-
-                       writer.WriteSymbolFile(moduleBuilder.ModuleVersionId);
-               }
-
-               public System.Diagnostics.SymbolStore.ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
-               {
-                       SymbolDocumentWriter writer;
-                       if (!documents.TryGetValue(url, out writer))
-                       {
-                               writer = new SymbolDocumentWriter(url);
-                               documents.Add(url, writer);
-                       }
-                       return writer;
-               }
-
-               public void OpenMethod(System.Diagnostics.SymbolStore.SymbolToken method)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void OpenMethod(System.Diagnostics.SymbolStore.SymbolToken token, MethodBase mb)
-               {
-                       Method method = new Method();
-                       method.token = token.GetToken();
-                       method.name = mb.Name;
-                       methods.Add(token.GetToken(), method);
-                       currentMethod = method;
-               }
-
-               public void CloseMethod()
-               {
-                       currentMethod = null;
-               }
-
-               public void DefineLocalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
-               {
-               }
-
-               public void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
-               {
-                       currentMethod.variables.Add(name);
-               }
-
-               public void DefineSequencePoints(System.Diagnostics.SymbolStore.ISymbolDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
-               {
-                       currentMethod.document = (SymbolDocumentWriter)document;
-                       currentMethod.offsets = offsets;
-                       currentMethod.lines = lines;
-                       currentMethod.columns = columns;
-               }
-
-               public void DefineParameter(string name, System.Reflection.ParameterAttributes attributes, int sequence, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-               }
-
-               public void DefineField(System.Diagnostics.SymbolStore.SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-               }
-
-               public void DefineGlobalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, System.Diagnostics.SymbolStore.SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-               }
-
-               public void OpenNamespace(string name)
-               {
-               }
-
-               public void CloseNamespace()
-               {
-               }
-
-               public void UsingNamespace(string fullName)
-               {
-               }
-
-               public int OpenScope(int startOffset)
-               {
-                       return 0;
-               }
-
-               public void CloseScope(int endOffset)
-               {
-               }
-
-               public void SetMethodSourceRange(System.Diagnostics.SymbolStore.ISymbolDocumentWriter startDoc, int startLine, int startColumn, System.Diagnostics.SymbolStore.ISymbolDocumentWriter endDoc, int endLine, int endColumn)
-               {
-               }
-
-               public void SetScopeRange(int scopeID, int startOffset, int endOffset)
-               {
-               }
-
-               public void SetSymAttribute(System.Diagnostics.SymbolStore.SymbolToken parent, string name, byte[] data)
-               {
-               }
-
-               public void SetUserEntryPoint(System.Diagnostics.SymbolStore.SymbolToken entryMethod)
-               {
-               }
-
-               public void SetUnderlyingWriter(IntPtr underlyingWriter)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public void Initialize(IntPtr emitter, string filename, bool fFullBuild)
-               {
-                       throw new InvalidOperationException();
-               }
-       }
-}
-#endif // MONO
diff --git a/mcs/class/IKVM.Reflection/Impl/PdbWriter.cs b/mcs/class/IKVM.Reflection/Impl/PdbWriter.cs
deleted file mode 100644 (file)
index b8976bb..0000000
+++ /dev/null
@@ -1,1188 +0,0 @@
-/*
-  Copyright (C) 2008-2010 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
-       [Guid("7dac8207-d3ae-4c75-9b67-92801a497d44")]
-       [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-       [ComImport]
-       interface IMetaDataImport
-       {
-               void PlaceHolder_CloseEnum();
-               void PlaceHolder_CountEnum();
-               void PlaceHolder_ResetEnum();
-               void PlaceHolder_EnumTypeDefs();
-               void PlaceHolder_EnumInterfaceImpls();
-               void PlaceHolder_EnumTypeRefs();
-               void PlaceHolder_FindTypeDefByName();
-               void PlaceHolder_GetScopeProps();
-               void PlaceHolder_GetModuleFromScope();
-
-               void GetTypeDefProps(
-                       int                     td,                     // [IN] TypeDef token for inquiry.
-               IntPtr          szTypeDef,              // [OUT] Put name here.
-                   int                 cchTypeDef,             // [IN] size of name buffer in wide chars.
-                       IntPtr          pchTypeDef,                             // [OUT] put size of name (wide chars) here.
-                       IntPtr          pdwTypeDefFlags,                // [OUT] Put flags here.
-                       IntPtr          ptkExtends);                    // [OUT] Put base class TypeDef/TypeRef here.
-
-               void PlaceHolder_GetInterfaceImplProps();
-               void PlaceHolder_GetTypeRefProps();
-               void PlaceHolder_ResolveTypeRef();
-               void PlaceHolder_EnumMembers();
-               void PlaceHolder_EnumMembersWithName();
-               void PlaceHolder_EnumMethods();
-               void PlaceHolder_EnumMethodsWithName();
-               void PlaceHolder_EnumFields();
-               void PlaceHolder_EnumFieldsWithName();
-               void PlaceHolder_EnumParams();
-               void PlaceHolder_EnumMemberRefs();
-               void PlaceHolder_EnumMethodImpls();
-               void PlaceHolder_EnumPermissionSets();
-               void PlaceHolder_FindMember();
-               void PlaceHolder_FindMethod();
-               void PlaceHolder_FindField();
-               void PlaceHolder_FindMemberRef();
-
-               void GetMethodProps(
-                       int                     mb,                     // The method for which to get props.   
-                       IntPtr          pClass,                                 // Put method's class here. 
-                       IntPtr      szMethod,               // Put method's name here.  
-                       int                     cchMethod,              // Size of szMethod buffer in wide chars.   
-                       IntPtr      pchMethod,                          // Put actual size here 
-                       IntPtr          pdwAttr,                                // Put flags here.  
-                       IntPtr          ppvSigBlob,                             // [OUT] point to the blob value of meta data   
-                       IntPtr          pcbSigBlob,                             // [OUT] actual size of signature blob  
-                       IntPtr          pulCodeRVA,                             // [OUT] codeRVA    
-                       IntPtr          pdwImplFlags);              // [OUT] Impl. Flags    
-
-               void PlaceHolder_GetMemberRefProps();
-               void PlaceHolder_EnumProperties();
-               void PlaceHolder_EnumEvents();
-               void PlaceHolder_GetEventProps();
-               void PlaceHolder_EnumMethodSemantics();
-               void PlaceHolder_GetMethodSemantics();
-               void PlaceHolder_GetClassLayout();
-               void PlaceHolder_GetFieldMarshal();
-               void PlaceHolder_GetRVA();
-               void PlaceHolder_GetPermissionSetProps();
-               void PlaceHolder_GetSigFromToken();
-               void PlaceHolder_GetModuleRefProps();
-               void PlaceHolder_EnumModuleRefs();
-               void PlaceHolder_GetTypeSpecFromToken();
-               void PlaceHolder_GetNameFromToken();
-               void PlaceHolder_EnumUnresolvedMethods();
-               void PlaceHolder_GetUserString();
-               void PlaceHolder_GetPinvokeMap();
-               void PlaceHolder_EnumSignatures();
-               void PlaceHolder_EnumTypeSpecs();
-               void PlaceHolder_EnumUserStrings();
-               void PlaceHolder_GetParamForMethodIndex();
-               void PlaceHolder_EnumCustomAttributes();
-               void PlaceHolder_GetCustomAttributeProps();
-               void PlaceHolder_FindTypeRef();
-               void PlaceHolder_GetMemberProps();
-               void PlaceHolder_GetFieldProps();
-               void PlaceHolder_GetPropertyProps();
-               void PlaceHolder_GetParamProps();
-               void PlaceHolder_GetCustomAttributeByName();
-               void PlaceHolder_IsValidToken();
-
-               void GetNestedClassProps(
-                       int             tdNestedClass,                  // [IN] NestedClass token.
-                       IntPtr  ptdEnclosingClass);             // [OUT] EnclosingClass token.
-
-               void PlaceHolder_GetNativeCallConvFromSig();
-               void PlaceHolder_IsGlobal();
-       }
-
-       [Guid("ba3fee4c-ecb9-4e41-83b7-183fa41cd859")]
-       [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-       [ComImport]
-       interface IMetaDataEmit
-       {
-               void PlaceHolder_SetModuleProps();
-               void PlaceHolder_Save();
-               void PlaceHolder_SaveToStream();
-               void PlaceHolder_GetSaveSize();
-               void PlaceHolder_DefineTypeDef();
-               void PlaceHolder_DefineNestedType();
-               void PlaceHolder_SetHandler();
-               void PlaceHolder_DefineMethod();
-               void PlaceHolder_DefineMethodImpl();
-               void PlaceHolder_DefineTypeRefByName();
-               void PlaceHolder_DefineImportType();
-               void PlaceHolder_DefineMemberRef();
-               void PlaceHolder_DefineImportMember();
-               void PlaceHolder_DefineEvent();
-               void PlaceHolder_SetClassLayout();
-               void PlaceHolder_DeleteClassLayout();
-               void PlaceHolder_SetFieldMarshal();
-               void PlaceHolder_DeleteFieldMarshal();
-               void PlaceHolder_DefinePermissionSet();
-               void PlaceHolder_SetRVA();
-               void PlaceHolder_GetTokenFromSig();
-               void PlaceHolder_DefineModuleRef();
-               void PlaceHolder_SetParent();
-               void PlaceHolder_GetTokenFromTypeSpec();
-               void PlaceHolder_SaveToMemory();
-               void PlaceHolder_DefineUserString();
-               void PlaceHolder_DeleteToken();
-               void PlaceHolder_SetMethodProps();
-               void PlaceHolder_SetTypeDefProps();
-               void PlaceHolder_SetEventProps();
-               void PlaceHolder_SetPermissionSetProps();
-               void PlaceHolder_DefinePinvokeMap();
-               void PlaceHolder_SetPinvokeMap();
-               void PlaceHolder_DeletePinvokeMap();
-               void PlaceHolder_DefineCustomAttribute();
-               void PlaceHolder_SetCustomAttributeValue();
-               void PlaceHolder_DefineField();
-               void PlaceHolder_DefineProperty();
-               void PlaceHolder_DefineParam();
-               void PlaceHolder_SetFieldProps();
-               void PlaceHolder_SetPropertyProps();
-               void PlaceHolder_SetParamProps();
-               void PlaceHolder_DefineSecurityAttributeSet();
-               void PlaceHolder_ApplyEditAndContinue();
-               void PlaceHolder_TranslateSigWithScope();
-               void PlaceHolder_SetMethodImplFlags();
-               void PlaceHolder_SetFieldRVA();
-               void PlaceHolder_Merge();
-               void PlaceHolder_MergeEnd();
-       }
-
-       [Guid("B01FAFEB-C450-3A4D-BEEC-B4CEEC01E006")]
-       [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-       [ComImport]
-       internal interface ISymUnmanagedDocumentWriter { }
-
-       [Guid("0b97726e-9e6d-4f05-9a26-424022093caa")]
-       [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-       [ComImport]
-       [CoClass(typeof(CorSymWriterClass))]
-       interface ISymUnmanagedWriter2
-       {
-               ISymUnmanagedDocumentWriter DefineDocument(string url, ref Guid language, ref Guid languageVendor, ref Guid documentType);
-               void PlaceHolder_SetUserEntryPoint();
-               void OpenMethod(int method);
-               void CloseMethod();
-               int OpenScope(int startOffset);
-               void CloseScope(int endOffset);
-               void PlaceHolder_SetScopeRange();
-               void DefineLocalVariable(string name, int attributes, int cSig, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] signature, int addrKind, int addr1, int addr2, int startOffset, int endOffset);
-               void PlaceHolder_DefineParameter();
-               void PlaceHolder_DefineField();
-               void PlaceHolder_DefineGlobalVariable();
-               void Close();
-               void PlaceHolder_SetSymAttribute();
-               void PlaceHolder_OpenNamespace();
-               void PlaceHolder_CloseNamespace();
-               void PlaceHolder_UsingNamespace();
-               void PlaceHolder_SetMethodSourceRange();
-               void Initialize([MarshalAs(UnmanagedType.IUnknown)] object emitter, string filename, [MarshalAs(UnmanagedType.IUnknown)] object pIStream, bool fFullBuild);
-
-               void GetDebugInfo(
-                       [In, Out] ref IMAGE_DEBUG_DIRECTORY pIDD,
-                       [In]  uint cData,
-                       [Out] out uint pcData,
-                       [Out, MarshalAs(UnmanagedType.LPArray)] byte[] data);
-
-               void DefineSequencePoints(ISymUnmanagedDocumentWriter document, int spCount,
-                 [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] offsets,
-                 [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] lines,
-                 [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] columns,
-                 [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] endLines,
-                 [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] endColumns);
-
-               void RemapToken(
-                       [In] int oldToken,
-                       [In] int newToken);
-
-               void PlaceHolder_Initialize2();
-               void PlaceHolder_DefineConstant();
-               void PlaceHolder_Abort();
-
-               void DefineLocalVariable2(string name, int attributes, int token, int addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset);
-
-               void PlaceHolder_DefineGlobalVariable2();
-               void PlaceHolder_DefineConstant2();
-       }
-
-       [Guid("108296c1-281e-11d3-bd22-0000f80849bd")]
-       [ComImport]
-       class CorSymWriterClass { }
-
-       sealed class PdbWriter : ISymbolWriterImpl, IMetaDataEmit, IMetaDataImport
-       {
-               private readonly ModuleBuilder moduleBuilder;
-               private ISymUnmanagedWriter2 symUnmanagedWriter;
-               private readonly Dictionary<string, Document> documents = new Dictionary<string, Document>();
-               private readonly List<Method> methods = new List<Method>();
-               private readonly Dictionary<int, int> remap = new Dictionary<int, int>();
-               private readonly Dictionary<int, int> reversemap = new Dictionary<int, int>();
-               private readonly Dictionary<int, MethodBase> methodMap = new Dictionary<int, MethodBase>();
-               private Method currentMethod;
-
-               internal PdbWriter(ModuleBuilder moduleBuilder)
-               {
-                       this.moduleBuilder = moduleBuilder;
-               }
-
-               private sealed class Document : ISymbolDocumentWriter
-               {
-                       internal readonly string url;
-                       private Guid language;
-                       private Guid languageVendor;
-                       private Guid documentType;
-                       private ISymUnmanagedDocumentWriter unmanagedDocument;
-
-                       internal Document(string url, Guid language, Guid languageVendor, Guid documentType)
-                       {
-                               this.url = url;
-                               this.language = language;
-                               this.languageVendor = languageVendor;
-                               this.documentType = documentType;
-                       }
-
-                       public void SetCheckSum(Guid algorithmId, byte[] checkSum)
-                       {
-                               throw new NotImplementedException();
-                       }
-
-                       public void SetSource(byte[] source)
-                       {
-                               throw new NotImplementedException();
-                       }
-
-                       internal ISymUnmanagedDocumentWriter GetUnmanagedDocument(ISymUnmanagedWriter2 symUnmanagedWriter)
-                       {
-                               if (unmanagedDocument == null)
-                               {
-                                       unmanagedDocument = symUnmanagedWriter.DefineDocument(url, ref language, ref languageVendor, ref documentType);
-                               }
-                               return unmanagedDocument;
-                       }
-
-                       internal void Release()
-                       {
-                               if (unmanagedDocument != null)
-                               {
-                                       Marshal.ReleaseComObject(unmanagedDocument);
-                                       unmanagedDocument = null;
-                               }
-                       }
-               }
-
-               private sealed class LocalVar
-               {
-                       internal readonly FieldAttributes attributes;
-                       internal readonly int signature;
-                       internal readonly SymAddressKind addrKind;
-                       internal readonly int addr1;
-                       internal readonly int addr2;
-                       internal readonly int addr3;
-                       internal readonly int startOffset;
-                       internal readonly int endOffset;
-
-                       internal LocalVar(FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
-                       {
-                               this.attributes = attributes;
-                               this.signature = signature;
-                               this.addrKind = addrKind;
-                               this.addr1 = addr1;
-                               this.addr2 = addr2;
-                               this.addr3 = addr3;
-                               this.startOffset = startOffset;
-                               this.endOffset = endOffset;
-                       }
-               }
-
-               private sealed class Scope
-               {
-                       internal readonly int startOffset;
-                       internal int endOffset;
-                       internal readonly List<Scope> scopes = new List<Scope>();
-                       internal readonly Dictionary<string, LocalVar> locals = new Dictionary<string, LocalVar>();
-
-                       internal Scope(int startOffset)
-                       {
-                               this.startOffset = startOffset;
-                       }
-
-                       internal void Do(ISymUnmanagedWriter2 symUnmanagedWriter)
-                       {
-                               symUnmanagedWriter.OpenScope(startOffset);
-                               foreach (KeyValuePair<string, LocalVar> kv in locals)
-                               {
-                                       symUnmanagedWriter.DefineLocalVariable2(kv.Key, (int)kv.Value.attributes, kv.Value.signature, (int)kv.Value.addrKind, kv.Value.addr1, kv.Value.addr2, kv.Value.addr3, kv.Value.startOffset, kv.Value.endOffset);
-                               }
-                               foreach (Scope scope in scopes)
-                               {
-                                       scope.Do(symUnmanagedWriter);
-                               }
-                               symUnmanagedWriter.CloseScope(endOffset);
-                       }
-               }
-
-               private sealed class Method
-               {
-                       internal readonly int token;
-                       internal Document document;
-                       internal int[] offsets;
-                       internal int[] lines;
-                       internal int[] columns;
-                       internal int[] endLines;
-                       internal int[] endColumns;
-                       internal readonly List<Scope> scopes = new List<Scope>();
-                       internal readonly Stack<Scope> scopeStack = new Stack<Scope>();
-
-                       internal Method(int token)
-                       {
-                               this.token = token;
-                       }
-               }
-
-               public ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
-               {
-                       Document doc;
-                       if (!documents.TryGetValue(url, out doc))
-                       {
-                               doc = new Document(url, language, languageVendor, documentType);
-                               documents.Add(url, doc);
-                       }
-                       return doc;
-               }
-
-               public void OpenMethod(SymbolToken method)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void OpenMethod(SymbolToken method, MethodBase mb)
-               {
-                       int token = method.GetToken();
-                       currentMethod = new Method(token);
-                       methodMap.Add(token, mb);
-               }
-
-               public void CloseMethod()
-               {
-                       methods.Add(currentMethod);
-                       currentMethod = null;
-               }
-
-               public void DefineSequencePoints(ISymbolDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
-               {
-                       currentMethod.document = (Document)document;
-                       currentMethod.offsets = offsets;
-                       currentMethod.lines = lines;
-                       currentMethod.columns = columns;
-                       currentMethod.endLines = endLines;
-                       currentMethod.endColumns = endColumns;
-               }
-
-               public int OpenScope(int startOffset)
-               {
-                       Scope scope = new Scope(startOffset);
-                       if (currentMethod.scopeStack.Count == 0)
-                       {
-                               currentMethod.scopes.Add(scope);
-                       }
-                       else
-                       {
-                               currentMethod.scopeStack.Peek().scopes.Add(scope);
-                       }
-                       currentMethod.scopeStack.Push(scope);
-                       return 0;
-               }
-
-               public void CloseScope(int endOffset)
-               {
-                       currentMethod.scopeStack.Pop().endOffset = endOffset;
-               }
-
-               public void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
-               {
-                       currentMethod.scopeStack.Peek().locals[name] = new LocalVar(attributes, signature, addrKind, addr1, addr2, addr3, startOffset, endOffset);
-               }
-
-               private void InitWriter()
-               {
-                       if (symUnmanagedWriter == null)
-                       {
-                               string fileName = System.IO.Path.ChangeExtension(moduleBuilder.FullyQualifiedName, ".pdb");
-                               // pro-actively delete the .pdb to get a meaningful IOException, instead of COMInteropException if the file can't be overwritten (or is corrupt, or who knows what)
-                               System.IO.File.Delete(fileName);
-                               symUnmanagedWriter = new ISymUnmanagedWriter2();
-                               symUnmanagedWriter.Initialize(this, fileName, null, true);
-                       }
-               }
-
-               public byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd)
-               {
-                       InitWriter();
-                       uint cData;
-                       symUnmanagedWriter.GetDebugInfo(ref idd, 0, out cData, null);
-                       byte[] buf = new byte[cData];
-                       symUnmanagedWriter.GetDebugInfo(ref idd, (uint)buf.Length, out cData, buf);
-                       return buf;
-               }
-
-               public void RemapToken(int oldToken, int newToken)
-               {
-                       remap.Add(oldToken, newToken);
-                       reversemap.Add(newToken, oldToken);
-               }
-
-               public void Close()
-               {
-                       InitWriter();
-
-                       foreach (Method method in methods)
-                       {
-                               int remappedToken = method.token;
-                               remap.TryGetValue(remappedToken, out remappedToken);
-                               symUnmanagedWriter.OpenMethod(remappedToken);
-                               if (method.document != null)
-                               {
-                                       ISymUnmanagedDocumentWriter doc = method.document.GetUnmanagedDocument(symUnmanagedWriter);
-                                       symUnmanagedWriter.DefineSequencePoints(doc, method.offsets.Length, method.offsets, method.lines, method.columns, method.endLines, method.endColumns);
-                               }
-                               foreach (Scope scope in method.scopes)
-                               {
-                                       scope.Do(symUnmanagedWriter);
-                               }
-                               symUnmanagedWriter.CloseMethod(); 
-                       }
-
-                       foreach (Document doc in documents.Values)
-                       {
-                               doc.Release();
-                       }
-
-                       symUnmanagedWriter.Close();
-                       Marshal.ReleaseComObject(symUnmanagedWriter);
-                       symUnmanagedWriter = null;
-                       documents.Clear();
-                       methods.Clear();
-                       remap.Clear();
-                       reversemap.Clear();
-               }
-
-               public void DefineLocalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void CloseNamespace()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void DefineField(SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void DefineGlobalVariable(string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void DefineParameter(string name, System.Reflection.ParameterAttributes attributes, int sequence, SymAddressKind addrKind, int addr1, int addr2, int addr3)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void Initialize(IntPtr emitter, string filename, bool fFullBuild)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void OpenNamespace(string name)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetMethodSourceRange(ISymbolDocumentWriter startDoc, int startLine, int startColumn, ISymbolDocumentWriter endDoc, int endLine, int endColumn)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetScopeRange(int scopeID, int startOffset, int endOffset)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetSymAttribute(SymbolToken parent, string name, byte[] data)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetUnderlyingWriter(IntPtr underlyingWriter)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void SetUserEntryPoint(SymbolToken entryMethod)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void UsingNamespace(string fullName)
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_CloseEnum()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_CountEnum()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_ResetEnum()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumTypeDefs()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumInterfaceImpls()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumTypeRefs()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindTypeDefByName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetScopeProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetModuleFromScope()
-               {
-                       throw new NotImplementedException();
-               }
-
-               private static void WriteString(IntPtr ptrString, IntPtr ptrLength, string str, int length)
-               {
-                       if (ptrString != IntPtr.Zero)
-                       {
-                               for (int i = 0; i < Math.Min(length, str.Length); i++)
-                               {
-                                       Marshal.WriteInt16(ptrString, i, str[i]);
-                               }
-                       }
-                       if (ptrLength != IntPtr.Zero)
-                       {
-                               Marshal.WriteInt32(ptrLength, str.Length);
-                       }
-               }
-
-               private static void WriteToken(IntPtr ptr, MemberInfo member)
-               {
-                       if (ptr != IntPtr.Zero)
-                       {
-                               Marshal.WriteInt32(ptr, member == null ? 0 : member.MetadataToken);
-                       }
-               }
-
-               private static void WriteInt32(IntPtr ptr, int value)
-               {
-                       if (ptr != IntPtr.Zero)
-                       {
-                               Marshal.WriteInt32(ptr, value);
-                       }
-               }
-
-               public void GetTypeDefProps(
-                       int td,                     // [IN] TypeDef token for inquiry.
-                       IntPtr szTypeDef,                       // [OUT] Put name here.
-                       int cchTypeDef,             // [IN] size of name buffer in wide chars.
-                       IntPtr pchTypeDef,                      // [OUT] put size of name (wide chars) here.
-                       IntPtr pdwTypeDefFlags,         // [OUT] Put flags here.
-                       IntPtr ptkExtends)                      // [OUT] Put base class TypeDef/TypeRef here.
-               {
-                       if (td == 0)
-                       {
-                               // why are we being called with an invalid token?
-                               WriteString(szTypeDef, pchTypeDef, "", cchTypeDef);
-                               WriteInt32(pdwTypeDefFlags, 0);
-                               WriteToken(ptkExtends, null);
-                       }
-                       else
-                       {
-                               Type type = moduleBuilder.ResolveType(td);
-                               WriteString(szTypeDef, pchTypeDef, type.FullName, cchTypeDef);
-                               WriteInt32(pdwTypeDefFlags, (int)type.Attributes);
-                               WriteToken(ptkExtends, type.BaseType);
-                       }
-               }
-
-               public void PlaceHolder_GetInterfaceImplProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetTypeRefProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_ResolveTypeRef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMembers()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMembersWithName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMethods()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMethodsWithName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumFields()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumFieldsWithName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumParams()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMemberRefs()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMethodImpls()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumPermissionSets()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindMember()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindMethod()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindField()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindMemberRef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void GetMethodProps(
-                       int mb,                                         // The method for which to get props.   
-                       IntPtr pClass,                          // [OUT] Put method's class here. 
-                       IntPtr szMethod,            // [OUT] Put method's name here.  
-                       int cchMethod,              // Size of szMethod buffer in wide chars.   
-                       IntPtr pchMethod,                       // [OUT] Put actual size here 
-                       IntPtr pdwAttr,                         // [OUT] Put flags here.  
-                       IntPtr ppvSigBlob,                      // [OUT] point to the blob value of meta data   
-                       IntPtr pcbSigBlob,                      // [OUT] actual size of signature blob  
-                       IntPtr pulCodeRVA,                      // [OUT] codeRVA    
-                       IntPtr pdwImplFlags)            // [OUT] Impl. Flags    
-               {
-                       if (pdwAttr != IntPtr.Zero || ppvSigBlob != IntPtr.Zero || pcbSigBlob != IntPtr.Zero || pulCodeRVA != IntPtr.Zero || pdwImplFlags != IntPtr.Zero)
-                       {
-                               throw new NotImplementedException();
-                       }
-                       MethodBase method = methodMap[reversemap[mb]];
-                       WriteToken(pClass, method.DeclaringType);
-                       WriteString(szMethod, pchMethod, method.Name, cchMethod);
-               }
-
-               public void PlaceHolder_GetMemberRefProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumProperties()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumEvents()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetEventProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumMethodSemantics()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetMethodSemantics()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetClassLayout()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetFieldMarshal()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetRVA()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetPermissionSetProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetSigFromToken()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetModuleRefProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumModuleRefs()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetTypeSpecFromToken()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetNameFromToken()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumUnresolvedMethods()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetUserString()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetPinvokeMap()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumSignatures()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumTypeSpecs()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumUserStrings()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetParamForMethodIndex()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_EnumCustomAttributes()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetCustomAttributeProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_FindTypeRef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetMemberProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetFieldProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetPropertyProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetParamProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetCustomAttributeByName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_IsValidToken()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void GetNestedClassProps(
-                       int tdNestedClass,                              // [IN] NestedClass token.
-                       IntPtr ptdEnclosingClass)               // [OUT] EnclosingClass token.
-               {
-                       Type type = moduleBuilder.ResolveType(tdNestedClass);
-                       WriteToken(ptdEnclosingClass, type.DeclaringType);
-               }
-
-               public void PlaceHolder_GetNativeCallConvFromSig()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_IsGlobal()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetModuleProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_Save()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SaveToStream()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetSaveSize()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineTypeDef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineNestedType()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetHandler()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineMethod()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineMethodImpl()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineTypeRefByName()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineImportType()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineMemberRef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineImportMember()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineEvent()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetClassLayout()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DeleteClassLayout()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetFieldMarshal()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DeleteFieldMarshal()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefinePermissionSet()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetRVA()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetTokenFromSig()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineModuleRef()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetParent()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_GetTokenFromTypeSpec()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SaveToMemory()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineUserString()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DeleteToken()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetMethodProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetTypeDefProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetEventProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetPermissionSetProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefinePinvokeMap()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetPinvokeMap()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DeletePinvokeMap()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineCustomAttribute()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetCustomAttributeValue()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineField()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineProperty()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineParam()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetFieldProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetPropertyProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetParamProps()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_DefineSecurityAttributeSet()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_ApplyEditAndContinue()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_TranslateSigWithScope()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetMethodImplFlags()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_SetFieldRVA()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_Merge()
-               {
-                       throw new NotImplementedException();
-               }
-
-               public void PlaceHolder_MergeEnd()
-               {
-                       throw new NotImplementedException();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Impl/SymbolSupport.cs b/mcs/class/IKVM.Reflection/Impl/SymbolSupport.cs
deleted file mode 100644 (file)
index 64547eb..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-  Copyright (C) 2008, 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Diagnostics.SymbolStore;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Impl
-{
-       [StructLayout(LayoutKind.Sequential)]
-       struct IMAGE_DEBUG_DIRECTORY
-       {
-               public uint Characteristics;
-               public uint TimeDateStamp;
-               public ushort MajorVersion;
-               public ushort MinorVersion;
-               public uint Type;
-               public uint SizeOfData;
-               public uint AddressOfRawData;
-               public uint PointerToRawData;
-       }
-
-       interface ISymbolWriterImpl : ISymbolWriter
-       {
-               byte[] GetDebugInfo(ref IMAGE_DEBUG_DIRECTORY idd);
-               void RemapToken(int oldToken, int newToken);
-               void DefineLocalVariable2(string name, FieldAttributes attributes, int signature, SymAddressKind addrKind, int addr1, int addr2, int addr3, int startOffset, int endOffset);
-               void OpenMethod(SymbolToken symbolToken, MethodBase mb);
-       }
-
-       static class SymbolSupport
-       {
-               internal static ISymbolWriterImpl CreateSymbolWriterFor(ModuleBuilder moduleBuilder)
-               {
-#if NO_SYMBOL_WRITER
-                       throw new NotSupportedException("IKVM.Reflection compiled with NO_SYMBOL_WRITER does not support writing debugging symbols.");
-#else
-                       if (Universe.MonoRuntime)
-                       {
-#if MONO
-                               return new MdbWriter(moduleBuilder);
-#else
-                               throw new NotSupportedException("IKVM.Reflection must be compiled with MONO defined to support writing Mono debugging symbols.");
-#endif
-                       }
-                       else
-                       {
-                               return new PdbWriter(moduleBuilder);
-                       }
-#endif
-               }
-
-               internal static byte[] GetDebugInfo(ISymbolWriterImpl writer, ref IMAGE_DEBUG_DIRECTORY idd)
-               {
-                       return writer.GetDebugInfo(ref idd);
-               }
-
-               internal static void RemapToken(ISymbolWriterImpl writer, int oldToken, int newToken)
-               {
-                       writer.RemapToken(oldToken, newToken);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/InterfaceMapping.cs b/mcs/class/IKVM.Reflection/InterfaceMapping.cs
deleted file mode 100644 (file)
index f589cfe..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection
-{
-       public struct InterfaceMapping
-       {
-               public MethodInfo[] InterfaceMethods;
-               public Type InterfaceType;
-               public MethodInfo[] TargetMethods;
-               public Type TargetType;
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/LocalVariableInfo.cs b/mcs/class/IKVM.Reflection/LocalVariableInfo.cs
deleted file mode 100644 (file)
index e7f0567..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection
-{
-       public sealed class LocalVariableInfo
-       {
-               private readonly int index;
-               private readonly Type type;
-               private readonly bool pinned;
-               private readonly CustomModifiers customModifiers;
-
-               internal LocalVariableInfo(int index, Type type, bool pinned, CustomModifiers customModifiers)
-               {
-                       this.index = index;
-                       this.type = type;
-                       this.pinned = pinned;
-                       this.customModifiers = customModifiers;
-               }
-
-               public bool IsPinned
-               {
-                       get { return pinned; }
-               }
-
-               public int LocalIndex
-               {
-                       get { return index; }
-               }
-
-               public Type LocalType
-               {
-                       get { return type; }
-               }
-
-               public CustomModifiers __GetCustomModifiers()
-               {
-                       return customModifiers;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Makefile b/mcs/class/IKVM.Reflection/Makefile
deleted file mode 100644 (file)
index 069df18..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-thisdir = class/IKVM.Reflection
-SUBDIRS = 
-
-include ../../build/rules.make
-
-DISTFILES = \
-       Emit/*.cs \
-       Impl/*.cs \
-       Metadata/*.cs \
-       Properties/*.cs \
-       Reader/*.cs \
-       Writer/*.cs \
-       *.cs  *.csproj \
-       Makefile
-
-all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local:
-
-dist-local: dist-default
diff --git a/mcs/class/IKVM.Reflection/ManifestResourceInfo.cs b/mcs/class/IKVM.Reflection/ManifestResourceInfo.cs
deleted file mode 100644 (file)
index 04a2a30..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
-       public sealed class ManifestResourceInfo
-       {
-               private readonly ModuleReader module;
-               private readonly int index;
-
-               internal ManifestResourceInfo(ModuleReader module, int index)
-               {
-                       this.module = module;
-                       this.index = index;
-               }
-
-               public ResourceAttributes __ResourceAttributes
-               {
-                       get { return (ResourceAttributes)module.ManifestResource.records[index].Flags; }
-               }
-
-               public int __Offset
-               {
-                       get { return module.ManifestResource.records[index].Offset; }
-               }
-
-               public ResourceLocation ResourceLocation
-               {
-                       get
-                       {
-                               int implementation = module.ManifestResource.records[index].Implementation;
-                               if ((implementation >> 24) == AssemblyRefTable.Index)
-                               {
-                                       Assembly asm = ReferencedAssembly;
-                                       if (asm == null || asm.__IsMissing)
-                                       {
-                                               return ResourceLocation.ContainedInAnotherAssembly;
-                                       }
-                                       return asm.GetManifestResourceInfo(module.GetString(module.ManifestResource.records[index].Name)).ResourceLocation | ResourceLocation.ContainedInAnotherAssembly;
-                               }
-                               else if ((implementation >> 24) == FileTable.Index)
-                               {
-                                       if ((implementation & 0xFFFFFF) == 0)
-                                       {
-                                               return ResourceLocation.ContainedInManifestFile | ResourceLocation.Embedded;
-                                       }
-                                       return 0;
-                               }
-                               else
-                               {
-                                       throw new BadImageFormatException();
-                               }
-                       }
-               }
-
-               public Assembly ReferencedAssembly
-               {
-                       get
-                       {
-                               int implementation = module.ManifestResource.records[index].Implementation;
-                               if ((implementation >> 24) == AssemblyRefTable.Index)
-                               {
-                                       return module.ResolveAssemblyRef((implementation & 0xFFFFFF) - 1);
-                               }
-                               return null;
-                       }
-               }
-
-               public string FileName
-               {
-                       get
-                       {
-                               int implementation = module.ManifestResource.records[index].Implementation;
-                               if ((implementation >> 24) == FileTable.Index)
-                               {
-                                       if ((implementation & 0xFFFFFF) == 0)
-                                       {
-                                               return null;
-                                       }
-                                       else
-                                       {
-                                               return module.GetString(module.File.records[(implementation & 0xFFFFFF) - 1].Name);
-                                       }
-                               }
-                               return null;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MarshalSpec.cs b/mcs/class/IKVM.Reflection/MarshalSpec.cs
deleted file mode 100644 (file)
index f568a68..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
-  Copyright (C) 2008-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
-       public struct FieldMarshal
-       {
-               private const UnmanagedType NATIVE_TYPE_MAX = (UnmanagedType)0x50;
-               public UnmanagedType UnmanagedType;
-               public UnmanagedType? ArraySubType;
-               public short? SizeParamIndex;
-               public int? SizeConst;
-               public VarEnum? SafeArraySubType;
-               public Type SafeArrayUserDefinedSubType;
-               public int? IidParameterIndex;
-               public string MarshalType;
-               public string MarshalCookie;
-               public Type MarshalTypeRef;
-
-               internal static bool ReadFieldMarshal(Module module, int token, out FieldMarshal fm)
-               {
-                       fm = new FieldMarshal();
-                       foreach (int i in module.FieldMarshal.Filter(token))
-                       {
-                               ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
-                               fm.UnmanagedType = (UnmanagedType)blob.ReadCompressedInt();
-                               if (fm.UnmanagedType == UnmanagedType.LPArray)
-                               {
-                                       fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
-                                       if (fm.ArraySubType == NATIVE_TYPE_MAX)
-                                       {
-                                               fm.ArraySubType = null;
-                                       }
-                                       if (blob.Length != 0)
-                                       {
-                                               fm.SizeParamIndex = (short)blob.ReadCompressedInt();
-                                               if (blob.Length != 0)
-                                               {
-                                                       fm.SizeConst = blob.ReadCompressedInt();
-                                                       if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
-                                                       {
-                                                               fm.SizeParamIndex = null;
-                                                       }
-                                               }
-                                       }
-                               }
-                               else if (fm.UnmanagedType == UnmanagedType.SafeArray)
-                               {
-                                       if (blob.Length != 0)
-                                       {
-                                               fm.SafeArraySubType = (VarEnum)blob.ReadCompressedInt();
-                                               if (blob.Length != 0)
-                                               {
-                                                       fm.SafeArrayUserDefinedSubType = ReadType(module, blob);
-                                               }
-                                       }
-                               }
-                               else if (fm.UnmanagedType == UnmanagedType.ByValArray)
-                               {
-                                       fm.SizeConst = blob.ReadCompressedInt();
-                                       if (blob.Length != 0)
-                                       {
-                                               fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
-                                       }
-                               }
-                               else if (fm.UnmanagedType == UnmanagedType.ByValTStr)
-                               {
-                                       fm.SizeConst = blob.ReadCompressedInt();
-                               }
-                               else if (fm.UnmanagedType == UnmanagedType.Interface
-                                       || fm.UnmanagedType == UnmanagedType.IDispatch
-                                       || fm.UnmanagedType == UnmanagedType.IUnknown)
-                               {
-                                       if (blob.Length != 0)
-                                       {
-                                               fm.IidParameterIndex = blob.ReadCompressedInt();
-                                       }
-                               }
-                               else if (fm.UnmanagedType == UnmanagedType.CustomMarshaler)
-                               {
-                                       blob.ReadCompressedInt();
-                                       blob.ReadCompressedInt();
-                                       fm.MarshalType = ReadString(blob);
-                                       fm.MarshalCookie = ReadString(blob);
-
-                                       TypeNameParser parser = TypeNameParser.Parse(fm.MarshalType, false);
-                                       if (!parser.Error)
-                                       {
-                                               fm.MarshalTypeRef = parser.GetType(module.universe, module.Assembly, false, fm.MarshalType, false, false);
-                                       }
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-
-               internal static void SetMarshalAsAttribute(ModuleBuilder module, int token, CustomAttributeBuilder attribute)
-               {
-                       attribute = attribute.DecodeBlob(module.Assembly);
-                       FieldMarshalTable.Record rec = new FieldMarshalTable.Record();
-                       rec.Parent = token;
-                       rec.NativeType = WriteMarshallingDescriptor(module, attribute);
-                       module.FieldMarshal.AddRecord(rec);
-               }
-
-               private static int WriteMarshallingDescriptor(ModuleBuilder module, CustomAttributeBuilder attribute)
-               {
-                       UnmanagedType unmanagedType;
-                       object val = attribute.GetConstructorArgument(0);
-                       if (val is short)
-                       {
-                               unmanagedType = (UnmanagedType)(short)val;
-                       }
-                       else if (val is int)
-                       {
-                               unmanagedType = (UnmanagedType)(int)val;
-                       }
-                       else
-                       {
-                               unmanagedType = (UnmanagedType)val;
-                       }
-
-                       ByteBuffer bb = new ByteBuffer(5);
-                       bb.WriteCompressedInt((int)unmanagedType);
-
-                       if (unmanagedType == UnmanagedType.LPArray)
-                       {
-                               UnmanagedType arraySubType = attribute.GetFieldValue<UnmanagedType>("ArraySubType") ?? NATIVE_TYPE_MAX;
-                               bb.WriteCompressedInt((int)arraySubType);
-                               int? sizeParamIndex = attribute.GetFieldValue<short>("SizeParamIndex");
-                               int? sizeConst = attribute.GetFieldValue<int>("SizeConst");
-                               if (sizeParamIndex != null)
-                               {
-                                       bb.WriteCompressedInt(sizeParamIndex.Value);
-                                       if (sizeConst != null)
-                                       {
-                                               bb.WriteCompressedInt(sizeConst.Value);
-                                               bb.WriteCompressedInt(1); // flag that says that SizeParamIndex was specified
-                                       }
-                               }
-                               else if (sizeConst != null)
-                               {
-                                       bb.WriteCompressedInt(0); // SizeParamIndex
-                                       bb.WriteCompressedInt(sizeConst.Value);
-                                       bb.WriteCompressedInt(0); // flag that says that SizeParamIndex was not specified
-                               }
-                       }
-                       else if (unmanagedType == UnmanagedType.SafeArray)
-                       {
-                               VarEnum? safeArraySubType = attribute.GetFieldValue<VarEnum>("SafeArraySubType");
-                               if (safeArraySubType != null)
-                               {
-                                       bb.WriteCompressedInt((int)safeArraySubType);
-                                       Type safeArrayUserDefinedSubType = (Type)attribute.GetFieldValue("SafeArrayUserDefinedSubType");
-                                       if (safeArrayUserDefinedSubType != null)
-                                       {
-                                               WriteType(module, bb, safeArrayUserDefinedSubType);
-                                       }
-                               }
-                       }
-                       else if (unmanagedType == UnmanagedType.ByValArray)
-                       {
-                               bb.WriteCompressedInt(attribute.GetFieldValue<int>("SizeConst") ?? 1);
-                               UnmanagedType? arraySubType = attribute.GetFieldValue<UnmanagedType>("ArraySubType");
-                               if (arraySubType != null)
-                               {
-                                       bb.WriteCompressedInt((int)arraySubType);
-                               }
-                       }
-                       else if (unmanagedType == UnmanagedType.ByValTStr)
-                       {
-                               bb.WriteCompressedInt(attribute.GetFieldValue<int>("SizeConst").Value);
-                       }
-                       else if (unmanagedType == UnmanagedType.Interface
-                               || unmanagedType == UnmanagedType.IDispatch
-                               || unmanagedType == UnmanagedType.IUnknown)
-                       {
-                               int? iidParameterIndex = attribute.GetFieldValue<int>("IidParameterIndex");
-                               if (iidParameterIndex != null)
-                               {
-                                       bb.WriteCompressedInt(iidParameterIndex.Value);
-                               }
-                       }
-                       else if (unmanagedType == UnmanagedType.CustomMarshaler)
-                       {
-                               bb.WriteCompressedInt(0);
-                               bb.WriteCompressedInt(0);
-                               string marshalType = (string)attribute.GetFieldValue("MarshalType");
-                               if (marshalType != null)
-                               {
-                                       WriteString(bb, marshalType);
-                               }
-                               else
-                               {
-                                       WriteType(module, bb, (Type)attribute.GetFieldValue("MarshalTypeRef"));
-                               }
-                               WriteString(bb, (string)attribute.GetFieldValue("MarshalCookie") ?? "");
-                       }
-
-                       return module.Blobs.Add(bb);
-               }
-
-               private static Type ReadType(Module module, ByteReader br)
-               {
-                       string str = ReadString(br);
-                       if (str == "")
-                       {
-                               return null;
-                       }
-                       return module.Assembly.GetType(str) ?? module.universe.GetType(str, true);
-               }
-
-               private static void WriteType(Module module, ByteBuffer bb, Type type)
-               {
-                       WriteString(bb, type.Assembly == module.Assembly ? type.FullName : type.AssemblyQualifiedName);
-               }
-
-               private static string ReadString(ByteReader br)
-               {
-                       return Encoding.UTF8.GetString(br.ReadBytes(br.ReadCompressedInt()));
-               }
-
-               private static void WriteString(ByteBuffer bb, string str)
-               {
-                       byte[] buf = Encoding.UTF8.GetBytes(str);
-                       bb.WriteCompressedInt(buf.Length);
-                       bb.Write(buf);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MemberInfo.cs b/mcs/class/IKVM.Reflection/MemberInfo.cs
deleted file mode 100644 (file)
index 0f9438c..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-// disable warnings that complain about us having == and != operators without also overriding Equals/GetHashCode,
-// this is intentional because most subtypes use reference equality
-#pragma warning disable 660, 661
-       public abstract class MemberInfo : ICustomAttributeProvider
-       {
-               // prevent external subclasses
-               internal MemberInfo()
-               {
-               }
-
-               public abstract string Name { get; }
-               public abstract Type DeclaringType { get; }
-               public abstract MemberTypes MemberType { get; }
-
-               public virtual Type ReflectedType
-               {
-                       get { return DeclaringType; }
-               }
-
-               internal abstract MemberInfo SetReflectedType(Type type);
-
-               public virtual int MetadataToken
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public abstract Module Module
-               {
-                       get;
-               }
-
-               public virtual bool __IsMissing
-               {
-                       get { return false; }
-               }
-
-               public bool IsDefined(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
-               }
-
-               public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
-               }
-
-               public static bool operator ==(MemberInfo m1, MemberInfo m2)
-               {
-                       return ReferenceEquals(m1, m2) || (!ReferenceEquals(m1, null) && m1.Equals(m2));
-               }
-
-               public static bool operator !=(MemberInfo m1, MemberInfo m2)
-               {
-                       return !(m1 == m2);
-               }
-
-               internal abstract int GetCurrentToken();
-
-               internal abstract List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType);
-
-               internal abstract bool IsBaked { get; }
-
-               internal virtual bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               internal virtual bool BindingFlagsMatchInherited(BindingFlags flags)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               protected static bool BindingFlagsMatch(bool state, BindingFlags flags, BindingFlags trueFlag, BindingFlags falseFlag)
-               {
-                       return (state && (flags & trueFlag) == trueFlag)
-                               || (!state && (flags & falseFlag) == falseFlag);
-               }
-
-               protected static T SetReflectedType<T>(T member, Type type)
-                       where T : MemberInfo
-               {
-                       return member == null ? null : (T)member.SetReflectedType(type);
-               }
-
-               protected static T[] SetReflectedType<T>(T[] members, Type type)
-                       where T : MemberInfo
-               {
-                       for (int i = 0; i < members.Length; i++)
-                       {
-                               members[i] = SetReflectedType(members[i], type);
-                       }
-                       return members;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Metadata/CliHeader.cs b/mcs/class/IKVM.Reflection/Metadata/CliHeader.cs
deleted file mode 100644 (file)
index 3281229..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System.IO;
-using IMAGE_DATA_DIRECTORY = IKVM.Reflection.Reader.IMAGE_DATA_DIRECTORY;
-
-namespace IKVM.Reflection.Metadata
-{
-       sealed class CliHeader
-       {
-               internal const uint COMIMAGE_FLAGS_ILONLY = 0x00000001;
-               internal const uint COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002;
-               internal const uint COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008;
-               internal const uint COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010;
-               internal const uint COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000;
-
-               internal uint Cb = 0x48;
-               internal ushort MajorRuntimeVersion;
-               internal ushort MinorRuntimeVersion;
-               internal IMAGE_DATA_DIRECTORY MetaData;
-               internal uint Flags;
-               internal uint EntryPointToken;
-               internal IMAGE_DATA_DIRECTORY Resources;
-               internal IMAGE_DATA_DIRECTORY StrongNameSignature;
-               internal IMAGE_DATA_DIRECTORY CodeManagerTable;
-               internal IMAGE_DATA_DIRECTORY VTableFixups;
-               internal IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
-               internal IMAGE_DATA_DIRECTORY ManagedNativeHeader;
-
-               internal void Read(BinaryReader br)
-               {
-                       Cb = br.ReadUInt32();
-                       MajorRuntimeVersion = br.ReadUInt16();
-                       MinorRuntimeVersion = br.ReadUInt16();
-                       MetaData.Read(br);
-                       Flags = br.ReadUInt32();
-                       EntryPointToken = br.ReadUInt32();
-                       Resources.Read(br);
-                       StrongNameSignature.Read(br);
-                       CodeManagerTable.Read(br);
-                       VTableFixups.Read(br);
-                       ExportAddressTableJumps.Read(br);
-                       ManagedNativeHeader.Read(br);
-               }
-
-               internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
-               {
-                       mw.Write(Cb);
-                       mw.Write(MajorRuntimeVersion);
-                       mw.Write(MinorRuntimeVersion);
-                       MetaData.Write(mw);
-                       mw.Write(Flags);
-                       mw.Write(EntryPointToken);
-                       Resources.Write(mw);
-                       StrongNameSignature.Write(mw);
-                       CodeManagerTable.Write(mw);
-                       VTableFixups.Write(mw);
-                       ExportAddressTableJumps.Write(mw);
-                       ManagedNativeHeader.Write(mw);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Metadata/MetadataRW.cs b/mcs/class/IKVM.Reflection/Metadata/MetadataRW.cs
deleted file mode 100644 (file)
index d03c8d6..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Metadata
-{
-       // base class for MetadataReader and MetadataWriter
-       abstract class MetadataRW
-       {
-               internal readonly bool bigStrings;
-               internal readonly bool bigGuids;
-               internal readonly bool bigBlobs;
-               internal readonly bool bigResolutionScope;
-               internal readonly bool bigTypeDefOrRef;
-               internal readonly bool bigMemberRefParent;
-               internal readonly bool bigHasCustomAttribute;
-               internal readonly bool bigCustomAttributeType;
-               internal readonly bool bigMethodDefOrRef;
-               internal readonly bool bigHasConstant;
-               internal readonly bool bigHasSemantics;
-               internal readonly bool bigHasFieldMarshal;
-               internal readonly bool bigHasDeclSecurity;
-               internal readonly bool bigTypeOrMethodDef;
-               internal readonly bool bigMemberForwarded;
-               internal readonly bool bigImplementation;
-               internal readonly bool bigField;
-               internal readonly bool bigMethodDef;
-               internal readonly bool bigParam;
-               internal readonly bool bigTypeDef;
-               internal readonly bool bigProperty;
-               internal readonly bool bigEvent;
-               internal readonly bool bigGenericParam;
-               internal readonly bool bigModuleRef;
-
-               protected MetadataRW(Module module, bool bigStrings, bool bigGuids, bool bigBlobs)
-               {
-                       this.bigStrings = bigStrings;
-                       this.bigGuids = bigGuids;
-                       this.bigBlobs = bigBlobs;
-                       this.bigField = module.Field.IsBig;
-                       this.bigMethodDef = module.MethodDef.IsBig;
-                       this.bigParam = module.Param.IsBig;
-                       this.bigTypeDef = module.TypeDef.IsBig;
-                       this.bigProperty = module.Property.IsBig;
-                       this.bigEvent = module.Event.IsBig;
-                       this.bigGenericParam = module.GenericParam.IsBig;
-                       this.bigModuleRef = module.ModuleRef.IsBig;
-                       this.bigResolutionScope = IsBig(2, module.ModuleTable, module.ModuleRef, module.AssemblyRef, module.TypeRef);
-                       this.bigTypeDefOrRef = IsBig(2, module.TypeDef, module.TypeRef, module.TypeSpec);
-                       this.bigMemberRefParent = IsBig(3, module.TypeDef, module.TypeRef, module.ModuleRef, module.MethodDef, module.TypeSpec);
-                       this.bigMethodDefOrRef = IsBig(1, module.MethodDef, module.MemberRef);
-                       this.bigHasCustomAttribute = IsBig(5, module.MethodDef, module.Field, module.TypeRef, module.TypeDef, module.Param, module.InterfaceImpl, module.MemberRef,
-                               module.ModuleTable, /*module.Permission,*/ module.Property, module.Event, module.StandAloneSig, module.ModuleRef, module.TypeSpec, module.AssemblyTable,
-                               module.AssemblyRef, module.File, module.ExportedType, module.ManifestResource);
-                       this.bigCustomAttributeType = IsBig(3, module.MethodDef, module.MemberRef);
-                       this.bigHasConstant = IsBig(2, module.Field, module.Param, module.Property);
-                       this.bigHasSemantics = IsBig(1, module.Event, module.Property);
-                       this.bigHasFieldMarshal = IsBig(1, module.Field, module.Param);
-                       this.bigHasDeclSecurity = IsBig(2, module.TypeDef, module.MethodDef, module.AssemblyTable);
-                       this.bigTypeOrMethodDef = IsBig(1, module.TypeDef, module.MethodDef);
-                       this.bigMemberForwarded = IsBig(1, module.Field, module.MethodDef);
-                       this.bigImplementation = IsBig(2, module.File, module.AssemblyRef, module.ExportedType);
-               }
-
-               private static bool IsBig(int bitsUsed, params Table[] tables)
-               {
-                       int limit = 1 << (16 - bitsUsed);
-                       foreach (Table table in tables)
-                       {
-                               if (table.RowCount >= limit)
-                               {
-                                       return true;
-                               }
-                       }
-                       return false;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Metadata/Tables.cs b/mcs/class/IKVM.Reflection/Metadata/Tables.cs
deleted file mode 100644 (file)
index ad61cb0..0000000
+++ /dev/null
@@ -1,2724 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection.Metadata
-{
-       internal abstract class Table
-       {
-               internal bool Sorted;
-
-               internal bool IsBig
-               {
-                       get { return RowCount > 65535; }
-               }
-
-               internal abstract int RowCount { get; set; }
-
-               internal abstract void Write(MetadataWriter mw);
-               internal abstract void Read(MetadataReader mr);
-
-               internal int GetLength(MetadataWriter md)
-               {
-                       return RowCount * GetRowSize(new RowSizeCalc(md));
-               }
-
-               protected abstract int GetRowSize(RowSizeCalc rsc);
-
-               protected sealed class RowSizeCalc
-               {
-                       private readonly MetadataWriter mw;
-                       private int size;
-
-                       internal RowSizeCalc(MetadataWriter mw)
-                       {
-                               this.mw = mw;
-                       }
-
-                       internal RowSizeCalc AddFixed(int size)
-                       {
-                               this.size += size;
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteStringIndex()
-                       {
-                               if (mw.bigStrings)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteGuidIndex()
-                       {
-                               if (mw.bigGuids)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteBlobIndex()
-                       {
-                               if (mw.bigBlobs)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteTypeDefOrRef()
-                       {
-                               if (mw.bigTypeDefOrRef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteField()
-                       {
-                               if (mw.bigField)
-                               {
-                                       size += 4;
-                               }
-                               else
-                               {
-                                       size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteMethodDef()
-                       {
-                               if (mw.bigMethodDef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteParam()
-                       {
-                               if (mw.bigParam)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteResolutionScope()
-                       {
-                               if (mw.bigResolutionScope)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteMemberRefParent()
-                       {
-                               if (mw.bigMemberRefParent)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteHasCustomAttribute()
-                       {
-                               if (mw.bigHasCustomAttribute)
-                               {
-                                       size += 4;
-                               }
-                               else
-                               {
-                                       size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteCustomAttributeType()
-                       {
-                               if (mw.bigCustomAttributeType)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteHasConstant()
-                       {
-                               if (mw.bigHasConstant)
-                               {
-                                       size += 4;
-                               }
-                               else
-                               {
-                                       size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteTypeDef()
-                       {
-                               if (mw.bigTypeDef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteMethodDefOrRef()
-                       {
-                               if (mw.bigMethodDefOrRef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteEvent()
-                       {
-                               if (mw.bigEvent)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteProperty()
-                       {
-                               if (mw.bigProperty)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteHasSemantics()
-                       {
-                               if (mw.bigHasSemantics)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteImplementation()
-                       {
-                               if (mw.bigImplementation)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteTypeOrMethodDef()
-                       {
-                               if (mw.bigTypeOrMethodDef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteGenericParam()
-                       {
-                               if (mw.bigGenericParam)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteHasDeclSecurity()
-                       {
-                               if (mw.bigHasDeclSecurity)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteMemberForwarded()
-                       {
-                               if (mw.bigMemberForwarded)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteModuleRef()
-                       {
-                               if (mw.bigModuleRef)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal RowSizeCalc WriteHasFieldMarshal()
-                       {
-                               if (mw.bigHasFieldMarshal)
-                               {
-                                       this.size += 4;
-                               }
-                               else
-                               {
-                                       this.size += 2;
-                               }
-                               return this;
-                       }
-
-                       internal int Value
-                       {
-                               get { return size; }
-                       }
-               }
-       }
-
-       abstract class Table<T> : Table
-       {
-               internal T[] records = new T[1];
-               protected int rowCount;
-
-               internal sealed override int RowCount
-               {
-                       get { return rowCount; }
-                       set { rowCount = value; records = new T[value]; }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               internal int AddRecord(T newRecord)
-               {
-                       if (rowCount == records.Length)
-                       {
-                               T[] newarr = new T[records.Length * 2];
-                               Array.Copy(records, newarr, records.Length);
-                               records = newarr;
-                       }
-                       records[rowCount++] = newRecord;
-                       return rowCount;
-               }
-
-               internal int AddVirtualRecord()
-               {
-                       return ++rowCount;
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       throw new InvalidOperationException();
-               }
-       }
-
-       abstract class SortedTable<T> : Table<T>
-               where T : SortedTable<T>.IRecord
-       {
-               internal interface IRecord
-               {
-                       int SortKey { get; }
-                       int FilterKey { get; }
-               }
-
-               internal struct Enumerable
-               {
-                       private readonly SortedTable<T> table;
-                       private readonly int token;
-
-                       internal Enumerable(SortedTable<T> table, int token)
-                       {
-                               this.table = table;
-                               this.token = token;
-                       }
-
-                       public Enumerator GetEnumerator()
-                       {
-                               T[] records = table.records;
-                               if (!table.Sorted)
-                               {
-                                       return new Enumerator(records, table.RowCount - 1, -1, token);
-                               }
-                               int index = BinarySearch(records, table.RowCount, token & 0xFFFFFF);
-                               if (index < 0)
-                               {
-                                       return new Enumerator(null, 0, 1, -1);
-                               }
-                               int start = index;
-                               while (start > 0 && (records[start - 1].FilterKey & 0xFFFFFF) == (token & 0xFFFFFF))
-                               {
-                                       start--;
-                               }
-                               int end = index;
-                               int max = table.RowCount - 1;
-                               while (end < max && (records[end + 1].FilterKey & 0xFFFFFF) == (token & 0xFFFFFF))
-                               {
-                                       end++;
-                               }
-                               return new Enumerator(records, end, start - 1, token);
-                       }
-
-                       private static int BinarySearch(T[] records, int length, int maskedToken)
-                       {
-                               int min = 0;
-                               int max = length - 1;
-                               while (min <= max)
-                               {
-                                       int mid = min + ((max - min) / 2);
-                                       int maskedValue = records[mid].FilterKey & 0xFFFFFF;
-                                       if (maskedToken == maskedValue)
-                                       {
-                                               return mid;
-                                       }
-                                       else if (maskedToken < maskedValue)
-                                       {
-                                               max = mid - 1;
-                                       }
-                                       else
-                                       {
-                                               min = mid + 1;
-                                       }
-                               }
-                               return -1;
-                       }
-               }
-
-               internal struct Enumerator
-               {
-                       private readonly T[] records;
-                       private readonly int token;
-                       private readonly int max;
-                       private int index;
-
-                       internal Enumerator(T[] records, int max, int index, int token)
-                       {
-                               this.records = records;
-                               this.token = token;
-                               this.max = max;
-                               this.index = index;
-                       }
-
-                       public int Current
-                       {
-                               get { return index; }
-                       }
-
-                       public bool MoveNext()
-                       {
-                               while (index < max)
-                               {
-                                       index++;
-                                       if (records[index].FilterKey == token)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal Enumerable Filter(int token)
-               {
-                       return new Enumerable(this, token);
-               }
-
-               protected void Sort()
-               {
-                       ulong[] map = new ulong[rowCount];
-                       for (uint i = 0; i < map.Length; i++)
-                       {
-                               map[i] = ((ulong)records[i].SortKey << 32) | i;
-                       }
-                       Array.Sort(map);
-                       T[] newRecords = new T[rowCount];
-                       for (int i = 0; i < map.Length; i++)
-                       {
-                               newRecords[i] = records[(int)map[i]];
-                       }
-                       records = newRecords;
-               }
-       }
-
-       sealed class ModuleTable : Table<ModuleTable.Record>
-       {
-               internal const int Index = 0x00;
-
-               internal struct Record
-               {
-                       internal short Generation;
-                       internal int Name; // -> StringHeap
-                       internal int Mvid; // -> GuidHeap
-                       internal int EncId; // -> GuidHeap
-                       internal int EncBaseId; // -> GuidHeap
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Generation = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Mvid = mr.ReadGuidIndex();
-                               records[i].EncId = mr.ReadGuidIndex();
-                               records[i].EncBaseId = mr.ReadGuidIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Generation);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteGuidIndex(records[i].Mvid);
-                               mw.WriteGuidIndex(records[i].EncId);
-                               mw.WriteGuidIndex(records[i].EncBaseId);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteStringIndex()
-                               .WriteGuidIndex()
-                               .WriteGuidIndex()
-                               .WriteGuidIndex()
-                               .Value;
-               }
-
-               internal void Add(short generation, int name, int mvid, int encid, int encbaseid)
-               {
-                       Record record = new Record();
-                       record.Generation = generation;
-                       record.Name = name;
-                       record.Mvid = mvid;
-                       record.EncId = encid;
-                       record.EncBaseId = encbaseid;
-                       AddRecord(record);
-               }
-       }
-
-       sealed class TypeRefTable : Table<TypeRefTable.Record>
-       {
-               internal const int Index = 0x01;
-
-               internal struct Record
-               {
-                       internal int ResolutionScope;
-                       internal int TypeName;
-                       internal int TypeNameSpace;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].ResolutionScope = mr.ReadResolutionScope();
-                               records[i].TypeName = mr.ReadStringIndex();
-                               records[i].TypeNameSpace = mr.ReadStringIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteResolutionScope(records[i].ResolutionScope);
-                               mw.WriteStringIndex(records[i].TypeName);
-                               mw.WriteStringIndex(records[i].TypeNameSpace);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteResolutionScope()
-                               .WriteStringIndex()
-                               .WriteStringIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].ResolutionScope);
-                       }
-               }
-       }
-
-       sealed class TypeDefTable : Table<TypeDefTable.Record>
-       {
-               internal const int Index = 0x02;
-
-               internal struct Record
-               {
-                       internal int Flags;
-                       internal int TypeName;
-                       internal int TypeNamespace;
-                       internal int Extends;
-                       internal int FieldList;
-                       internal int MethodList;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].TypeName = mr.ReadStringIndex();
-                               records[i].TypeNamespace = mr.ReadStringIndex();
-                               records[i].Extends = mr.ReadTypeDefOrRef();
-                               records[i].FieldList = mr.ReadField();
-                               records[i].MethodList = mr.ReadMethodDef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       mw.ModuleBuilder.WriteTypeDefTable(mw);
-               }
-
-               internal int AllocToken()
-               {
-                       return 0x02000000 + AddVirtualRecord();
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteStringIndex()
-                               .WriteStringIndex()
-                               .WriteTypeDefOrRef()
-                               .WriteField()
-                               .WriteMethodDef()
-                               .Value;
-               }
-       }
-
-       sealed class FieldPtrTable : Table<int>
-       {
-               internal const int Index = 0x03;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadField();
-                       }
-               }
-       }
-
-       sealed class FieldTable : Table<FieldTable.Record>
-       {
-               internal const int Index = 0x04;
-
-               internal struct Record
-               {
-                       internal short Flags;
-                       internal int Name;
-                       internal int Signature;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Signature = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       mw.ModuleBuilder.WriteFieldTable(mw);
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-       }
-
-       sealed class MethodPtrTable : Table<int>
-       {
-               internal const int Index = 0x05;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadMethodDef();
-                       }
-               }
-       }
-
-       sealed class MethodDefTable : Table<MethodDefTable.Record>
-       {
-               internal const int Index = 0x06;
-               private int baseRVA;
-
-               internal struct Record
-               {
-                       internal int RVA;
-                       internal short ImplFlags;
-                       internal short Flags;
-                       internal int Name;
-                       internal int Signature;
-                       internal int ParamList;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].RVA = mr.ReadInt32();
-                               records[i].ImplFlags = mr.ReadInt16();
-                               records[i].Flags = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Signature = mr.ReadBlobIndex();
-                               records[i].ParamList = mr.ReadParam();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       mw.ModuleBuilder.WriteMethodDefTable(baseRVA, mw);
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(8)
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .WriteParam()
-                               .Value;
-               }
-
-               internal void Fixup(TextSection code)
-               {
-                       baseRVA = (int)code.MethodBodiesRVA;
-               }
-       }
-
-       sealed class ParamPtrTable : Table<int>
-       {
-               internal const int Index = 0x07;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadParam();
-                       }
-               }
-       }
-
-       sealed class ParamTable : Table<ParamTable.Record>
-       {
-               internal const int Index = 0x08;
-
-               internal struct Record
-               {
-                       internal short Flags;
-                       internal short Sequence;
-                       internal int Name;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt16();
-                               records[i].Sequence = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       mw.ModuleBuilder.WriteParamTable(mw);
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteStringIndex()
-                               .Value;
-               }
-       }
-
-       sealed class InterfaceImplTable : SortedTable<InterfaceImplTable.Record>
-       {
-               internal const int Index = 0x09;
-
-               internal struct Record : IRecord
-               {
-                       internal int Class;
-                       internal int Interface;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Class; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Class; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Class = mr.ReadTypeDef();
-                               records[i].Interface = mr.ReadTypeDefOrRef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteTypeDef(records[i].Class);
-                               mw.WriteEncodedTypeDefOrRef(records[i].Interface);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteTypeDef()
-                               .WriteTypeDefOrRef()
-                               .Value;
-               }
-
-               internal void Fixup()
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               int token = records[i].Interface;
-                               switch (token >> 24)
-                               {
-                                       case 0:
-                                               break;
-                                       case TypeDefTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 0;
-                                               break;
-                                       case TypeRefTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 1;
-                                               break;
-                                       case TypeSpecTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 2;
-                                               break;
-                                       default:
-                                               throw new InvalidOperationException();
-                               }
-                               records[i].Interface = token;
-                       }
-                       // LAMESPEC the CLI spec says that InterfaceImpl should be sorted by { Class, Interface },
-                       // but it appears to only be necessary to sort by Class (and csc emits InterfaceImpl records in
-                       // source file order, so to be able to support round tripping, we need to retain ordering as well).
-                       Sort();
-               }
-       }
-
-       sealed class MemberRefTable : Table<MemberRefTable.Record>
-       {
-               internal const int Index = 0x0A;
-
-               internal struct Record
-               {
-                       internal int Class;
-                       internal int Name;
-                       internal int Signature;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Class = mr.ReadMemberRefParent();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Signature = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteMemberRefParent(records[i].Class);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteBlobIndex(records[i].Signature);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteMemberRefParent()
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal int FindOrAddRecord(Record record)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i].Class == record.Class
-                                       && records[i].Name == record.Name
-                                       && records[i].Signature == record.Signature)
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(record);
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Class);
-                       }
-               }
-       }
-
-       sealed class ConstantTable : SortedTable<ConstantTable.Record>
-       {
-               internal const int Index = 0x0B;
-
-               internal struct Record : IRecord
-               {
-                       internal short Type;
-                       internal int Parent;
-                       internal int Value;
-
-                       int IRecord.SortKey
-                       {
-                               get { return EncodeHasConstant(Parent); }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Type = mr.ReadInt16();
-                               records[i].Parent = mr.ReadHasConstant();
-                               records[i].Value = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Type);
-                               mw.WriteHasConstant(records[i].Parent);
-                               mw.WriteBlobIndex(records[i].Value);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteHasConstant()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Parent);
-                       }
-                       Sort();
-               }
-
-               internal static int EncodeHasConstant(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case FieldTable.Index:
-                                       return (token & 0xFFFFFF) << 2 | 0;
-                               case ParamTable.Index:
-                                       return (token & 0xFFFFFF) << 2 | 1;
-                               case PropertyTable.Index:
-                                       return (token & 0xFFFFFF) << 2 | 2;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-               }
-
-               internal object GetRawConstantValue(Module module, int parent)
-               {
-                       foreach (int i in Filter(parent))
-                       {
-                               ByteReader br = module.GetBlob(module.Constant.records[i].Value);
-                               switch (module.Constant.records[i].Type)
-                               {
-                                       // see ModuleBuilder.AddConstant for the encodings
-                                       case Signature.ELEMENT_TYPE_BOOLEAN:
-                                               return br.ReadByte() != 0;
-                                       case Signature.ELEMENT_TYPE_I1:
-                                               return br.ReadSByte();
-                                       case Signature.ELEMENT_TYPE_I2:
-                                               return br.ReadInt16();
-                                       case Signature.ELEMENT_TYPE_I4:
-                                               return br.ReadInt32();
-                                       case Signature.ELEMENT_TYPE_I8:
-                                               return br.ReadInt64();
-                                       case Signature.ELEMENT_TYPE_U1:
-                                               return br.ReadByte();
-                                       case Signature.ELEMENT_TYPE_U2:
-                                               return br.ReadUInt16();
-                                       case Signature.ELEMENT_TYPE_U4:
-                                               return br.ReadUInt32();
-                                       case Signature.ELEMENT_TYPE_U8:
-                                               return br.ReadUInt64();
-                                       case Signature.ELEMENT_TYPE_R4:
-                                               return br.ReadSingle();
-                                       case Signature.ELEMENT_TYPE_R8:
-                                               return br.ReadDouble();
-                                       case Signature.ELEMENT_TYPE_CHAR:
-                                               return br.ReadChar();
-                                       case Signature.ELEMENT_TYPE_STRING:
-                                               {
-                                                       char[] chars = new char[br.Length / 2];
-                                                       for (int j = 0; j < chars.Length; j++)
-                                                       {
-                                                               chars[j] = br.ReadChar();
-                                                       }
-                                                       return new String(chars);
-                                               }
-                                       case Signature.ELEMENT_TYPE_CLASS:
-                                               if (br.ReadInt32() != 0)
-                                               {
-                                                       throw new BadImageFormatException();
-                                               }
-                                               return null;
-                                       default:
-                                               throw new BadImageFormatException();
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-       }
-
-       sealed class CustomAttributeTable : SortedTable<CustomAttributeTable.Record>
-       {
-               internal const int Index = 0x0C;
-
-               internal struct Record : IRecord
-               {
-                       internal int Parent;
-                       internal int Type;
-                       internal int Value;
-
-                       int IRecord.SortKey
-                       {
-                               get { return EncodeHasCustomAttribute(Parent); }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Parent = mr.ReadHasCustomAttribute();
-                               records[i].Type = mr.ReadCustomAttributeType();
-                               records[i].Value = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteHasCustomAttribute(records[i].Parent);
-                               mw.WriteCustomAttributeType(records[i].Type);
-                               mw.WriteBlobIndex(records[i].Value);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteHasCustomAttribute()
-                               .WriteCustomAttributeType()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       int[] genericParamFixup = moduleBuilder.GenericParam.GetIndexFixup();
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Type);
-                               moduleBuilder.FixupPseudoToken(ref records[i].Parent);
-                               if (records[i].Parent >> 24 == GenericParamTable.Index)
-                               {
-                                       records[i].Parent = (GenericParamTable.Index << 24) + genericParamFixup[(records[i].Parent & 0xFFFFFF) - 1] + 1;
-                               }
-                       }
-                       Sort();
-               }
-
-               internal static int EncodeHasCustomAttribute(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case MethodDefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 0;
-                               case FieldTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 1;
-                               case TypeRefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 2;
-                               case TypeDefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 3;
-                               case ParamTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 4;
-                               case InterfaceImplTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 5;
-                               case MemberRefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 6;
-                               case ModuleTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 7;
-                               // Permission (8) table doesn't exist in the spec
-                               case PropertyTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 9;
-                               case EventTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 10;
-                               case StandAloneSigTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 11;
-                               case ModuleRefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 12;
-                               case TypeSpecTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 13;
-                               case AssemblyTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 14;
-                               case AssemblyRefTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 15;
-                               case FileTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 16;
-                               case ExportedTypeTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 17;
-                               case ManifestResourceTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 18;
-                               case GenericParamTable.Index:
-                                       return (token & 0xFFFFFF) << 5 | 19;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-               }
-       }
-
-       sealed class FieldMarshalTable : SortedTable<FieldMarshalTable.Record>
-       {
-               internal const int Index = 0x0D;
-
-               internal struct Record : IRecord
-               {
-                       internal int Parent;
-                       internal int NativeType;
-
-                       int IRecord.SortKey
-                       {
-                               get { return EncodeHasFieldMarshal(Parent); }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Parent = mr.ReadHasFieldMarshal();
-                               records[i].NativeType = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteHasFieldMarshal(records[i].Parent);
-                               mw.WriteBlobIndex(records[i].NativeType);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteHasFieldMarshal()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               records[i].Parent = moduleBuilder.ResolvePseudoToken(records[i].Parent);
-                       }
-                       Sort();
-               }
-
-               internal static int EncodeHasFieldMarshal(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case FieldTable.Index:
-                                       return (token & 0xFFFFFF) << 1 | 0;
-                               case ParamTable.Index:
-                                       return (token & 0xFFFFFF) << 1 | 1;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-               }
-       }
-
-       sealed class DeclSecurityTable : SortedTable<DeclSecurityTable.Record>
-       {
-               internal const int Index = 0x0E;
-
-               internal struct Record : IRecord
-               {
-                       internal short Action;
-                       internal int Parent;
-                       internal int PermissionSet;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Parent; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Action = mr.ReadInt16();
-                               records[i].Parent = mr.ReadHasDeclSecurity();
-                               records[i].PermissionSet = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Action);
-                               mw.WriteHasDeclSecurity(records[i].Parent);
-                               mw.WriteBlobIndex(records[i].PermissionSet);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteHasDeclSecurity()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               int token = records[i].Parent;
-                               moduleBuilder.FixupPseudoToken(ref token);
-                               // do the HasDeclSecurity encoding, so that we can sort the table
-                               switch (token >> 24)
-                               {
-                                       case TypeDefTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 0;
-                                               break;
-                                       case MethodDefTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 1;
-                                               break;
-                                       case AssemblyTable.Index:
-                                               token = (token & 0xFFFFFF) << 2 | 2;
-                                               break;
-                                       default:
-                                               throw new InvalidOperationException();
-                               }
-                               records[i].Parent = token;
-                       }
-                       Sort();
-               }
-       }
-
-       sealed class ClassLayoutTable : SortedTable<ClassLayoutTable.Record>
-       {
-               internal const int Index = 0x0f;
-
-               internal struct Record : IRecord
-               {
-                       internal short PackingSize;
-                       internal int ClassSize;
-                       internal int Parent;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Parent; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].PackingSize = mr.ReadInt16();
-                               records[i].ClassSize = mr.ReadInt32();
-                               records[i].Parent = mr.ReadTypeDef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       Sort();
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].PackingSize);
-                               mw.Write(records[i].ClassSize);
-                               mw.WriteTypeDef(records[i].Parent);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(6)
-                               .WriteTypeDef()
-                               .Value;
-               }
-       }
-
-       sealed class FieldLayoutTable : SortedTable<FieldLayoutTable.Record>
-       {
-               internal const int Index = 0x10;
-
-               internal struct Record : IRecord
-               {
-                       internal int Offset;
-                       internal int Field;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Field; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Field; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Offset = mr.ReadInt32();
-                               records[i].Field = mr.ReadField();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Offset);
-                               mw.WriteField(records[i].Field);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteField()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               records[i].Field = moduleBuilder.ResolvePseudoToken(records[i].Field) & 0xFFFFFF;
-                       }
-                       Sort();
-               }
-       }
-
-       sealed class StandAloneSigTable : Table<int>
-       {
-               internal const int Index = 0x11;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteBlobIndex(records[i]);
-                       }
-               }
-
-               protected override int GetRowSize(Table.RowSizeCalc rsc)
-               {
-                       return rsc.WriteBlobIndex().Value;
-               }
-
-               internal int FindOrAddRecord(int blob)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i] == blob)
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(blob);
-               }
-       }
-
-       sealed class EventMapTable : SortedTable<EventMapTable.Record>
-       {
-               internal const int Index = 0x12;
-
-               internal struct Record : IRecord
-               {
-                       internal int Parent;
-                       internal int EventList;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Parent; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Parent = mr.ReadTypeDef();
-                               records[i].EventList = mr.ReadEvent();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteTypeDef(records[i].Parent);
-                               mw.WriteEvent(records[i].EventList);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteTypeDef()
-                               .WriteEvent()
-                               .Value;
-               }
-       }
-
-       sealed class EventPtrTable : Table<int>
-       {
-               internal const int Index = 0x13;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadEvent();
-                       }
-               }
-       }
-
-       sealed class EventTable : Table<EventTable.Record>
-       {
-               internal const int Index = 0x14;
-
-               internal struct Record
-               {
-                       internal short EventFlags;
-                       internal int Name;
-                       internal int EventType;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].EventFlags = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].EventType = mr.ReadTypeDefOrRef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].EventFlags);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteTypeDefOrRef(records[i].EventType);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteStringIndex()
-                               .WriteTypeDefOrRef()
-                               .Value;
-               }
-       }
-
-       sealed class PropertyMapTable : SortedTable<PropertyMapTable.Record>
-       {
-               internal const int Index = 0x15;
-
-               internal struct Record : IRecord
-               {
-                       internal int Parent;
-                       internal int PropertyList;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Parent; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Parent; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Parent = mr.ReadTypeDef();
-                               records[i].PropertyList = mr.ReadProperty();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteTypeDef(records[i].Parent);
-                               mw.WriteProperty(records[i].PropertyList);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteTypeDef()
-                               .WriteProperty()
-                               .Value;
-               }
-       }
-
-       sealed class PropertyPtrTable : Table<int>
-       {
-               internal const int Index = 0x16;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadProperty();
-                       }
-               }
-       }
-
-       sealed class PropertyTable : Table<PropertyTable.Record>
-       {
-               internal const int Index = 0x17;
-
-               internal struct Record
-               {
-                       internal short Flags;
-                       internal int Name;
-                       internal int Type;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt16();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Type = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Flags);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteBlobIndex(records[i].Type);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-       }
-
-       sealed class MethodSemanticsTable : SortedTable<MethodSemanticsTable.Record>
-       {
-               internal const int Index = 0x18;
-
-               // semantics
-               internal const short Setter = 0x0001;
-               internal const short Getter = 0x0002;
-               internal const short Other = 0x0004;
-               internal const short AddOn = 0x0008;
-               internal const short RemoveOn = 0x0010;
-               internal const short Fire = 0x0020;
-
-               internal struct Record : IRecord
-               {
-                       internal short Semantics;
-                       internal int Method;
-                       internal int Association;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Association; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Association; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Semantics = mr.ReadInt16();
-                               records[i].Method = mr.ReadMethodDef();
-                               records[i].Association = mr.ReadHasSemantics();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Semantics);
-                               mw.WriteMethodDef(records[i].Method);
-                               mw.WriteHasSemantics(records[i].Association);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteMethodDef()
-                               .WriteHasSemantics()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Method);
-                               int token = records[i].Association;
-                               // do the HasSemantics encoding, so that we can sort the table
-                               switch (token >> 24)
-                               {
-                                       case EventTable.Index:
-                                               token = (token & 0xFFFFFF) << 1 | 0;
-                                               break;
-                                       case PropertyTable.Index:
-                                               token = (token & 0xFFFFFF) << 1 | 1;
-                                               break;
-                                       default:
-                                               throw new InvalidOperationException();
-                               }
-                               records[i].Association = token;
-                       }
-                       Sort();
-               }
-
-               internal MethodInfo GetMethod(Module module, int token, bool nonPublic, short semantics)
-               {
-                       foreach (int i in Filter(token))
-                       {
-                               if ((records[i].Semantics & semantics) != 0)
-                               {
-                                       MethodBase method = module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
-                                       if (nonPublic || method.IsPublic)
-                                       {
-                                               return (MethodInfo)method;
-                                       }
-                               }
-                       }
-                       return null;
-               }
-
-               internal MethodInfo[] GetMethods(Module module, int token, bool nonPublic, short semantics)
-               {
-                       List<MethodInfo> methods = new List<MethodInfo>();
-                       foreach (int i in Filter(token))
-                       {
-                               if ((records[i].Semantics & semantics) != 0)
-                               {
-                                       MethodInfo method = (MethodInfo)module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
-                                       if (nonPublic || method.IsPublic)
-                                       {
-                                               methods.Add(method);
-                                       }
-                               }
-                       }
-                       return methods.ToArray();
-               }
-
-               internal void ComputeFlags(Module module, int token, out bool isPublic, out bool isNonPrivate, out bool isStatic)
-               {
-                       isPublic = false;
-                       isNonPrivate = false;
-                       isStatic = false;
-                       foreach (int i in Filter(token))
-                       {
-                               MethodBase method = module.ResolveMethod((MethodDefTable.Index << 24) + records[i].Method);
-                               isPublic |= method.IsPublic;
-                               isNonPrivate |= (method.Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private;
-                               isStatic |= method.IsStatic;
-                       }
-               }
-       }
-
-       sealed class MethodImplTable : SortedTable<MethodImplTable.Record>
-       {
-               internal const int Index = 0x19;
-
-               internal struct Record : IRecord
-               {
-                       internal int Class;
-                       internal int MethodBody;
-                       internal int MethodDeclaration;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Class; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Class; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Class = mr.ReadTypeDef();
-                               records[i].MethodBody = mr.ReadMethodDefOrRef();
-                               records[i].MethodDeclaration = mr.ReadMethodDefOrRef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteTypeDef(records[i].Class);
-                               mw.WriteMethodDefOrRef(records[i].MethodBody);
-                               mw.WriteMethodDefOrRef(records[i].MethodDeclaration);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteTypeDef()
-                               .WriteMethodDefOrRef()
-                               .WriteMethodDefOrRef()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].MethodBody);
-                               moduleBuilder.FixupPseudoToken(ref records[i].MethodDeclaration);
-                       }
-                       Sort();
-               }
-       }
-
-       sealed class ModuleRefTable : Table<int>
-       {
-               internal const int Index = 0x1A;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadStringIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteStringIndex(records[i]);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteStringIndex()
-                               .Value;
-               }
-
-               internal int FindOrAddRecord(int str)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i] == str)
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(str);
-               }
-       }
-
-       sealed class TypeSpecTable : Table<int>
-       {
-               internal const int Index = 0x1B;
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i] = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteBlobIndex(records[i]);
-                       }
-               }
-
-               protected override int GetRowSize(Table.RowSizeCalc rsc)
-               {
-                       return rsc.WriteBlobIndex().Value;
-               }
-       }
-
-       sealed class ImplMapTable : SortedTable<ImplMapTable.Record>
-       {
-               internal const int Index = 0x1C;
-
-               internal struct Record : IRecord
-               {
-                       internal short MappingFlags;
-                       internal int MemberForwarded;
-                       internal int ImportName;
-                       internal int ImportScope;
-
-                       int IRecord.SortKey
-                       {
-                               get { return MemberForwarded; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return MemberForwarded; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].MappingFlags = mr.ReadInt16();
-                               records[i].MemberForwarded = mr.ReadMemberForwarded();
-                               records[i].ImportName = mr.ReadStringIndex();
-                               records[i].ImportScope = mr.ReadModuleRef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].MappingFlags);
-                               mw.WriteMemberForwarded(records[i].MemberForwarded);
-                               mw.WriteStringIndex(records[i].ImportName);
-                               mw.WriteModuleRef(records[i].ImportScope);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(2)
-                               .WriteMemberForwarded()
-                               .WriteStringIndex()
-                               .WriteModuleRef()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].MemberForwarded);
-                       }
-                       Sort();
-               }
-       }
-
-       sealed class FieldRVATable : SortedTable<FieldRVATable.Record>
-       {
-               internal const int Index = 0x1D;
-
-               internal struct Record : IRecord
-               {
-                       internal int RVA;               // we set the high bit to signify that the RVA is in the CIL stream (instead of .sdata)
-                       internal int Field;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Field; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Field; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].RVA = mr.ReadInt32();
-                               records[i].Field = mr.ReadField();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].RVA);
-                               mw.WriteField(records[i].Field);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteField()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder, int sdataRVA, int cilRVA)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i].RVA < 0)
-                               {
-                                       records[i].RVA = (records[i].RVA & 0x7fffffff) + cilRVA;
-                               }
-                               else
-                               {
-                                       records[i].RVA += sdataRVA;
-                               }
-                               moduleBuilder.FixupPseudoToken(ref records[i].Field);
-                       }
-                       Sort();
-               }
-       }
-
-       sealed class AssemblyTable : Table<AssemblyTable.Record>
-       {
-               internal const int Index = 0x20;
-
-               internal struct Record
-               {
-                       internal int HashAlgId;
-                       internal ushort MajorVersion;
-                       internal ushort MinorVersion;
-                       internal ushort BuildNumber;
-                       internal ushort RevisionNumber;
-                       internal int Flags;
-                       internal int PublicKey;
-                       internal int Name;
-                       internal int Culture;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].HashAlgId = mr.ReadInt32();
-                               records[i].MajorVersion = mr.ReadUInt16();
-                               records[i].MinorVersion = mr.ReadUInt16();
-                               records[i].BuildNumber = mr.ReadUInt16();
-                               records[i].RevisionNumber = mr.ReadUInt16();
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].PublicKey = mr.ReadBlobIndex();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Culture = mr.ReadStringIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].HashAlgId);
-                               mw.Write(records[i].MajorVersion);
-                               mw.Write(records[i].MinorVersion);
-                               mw.Write(records[i].BuildNumber);
-                               mw.Write(records[i].RevisionNumber);
-                               mw.Write(records[i].Flags);
-                               mw.WriteBlobIndex(records[i].PublicKey);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteStringIndex(records[i].Culture);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(16)
-                               .WriteBlobIndex()
-                               .WriteStringIndex()
-                               .WriteStringIndex()
-                               .Value;
-               }
-       }
-
-       sealed class AssemblyRefTable : Table<AssemblyRefTable.Record>
-       {
-               internal const int Index = 0x23;
-
-               internal struct Record
-               {
-                       internal ushort MajorVersion;
-                       internal ushort MinorVersion;
-                       internal ushort BuildNumber;
-                       internal ushort RevisionNumber;
-                       internal int Flags;
-                       internal int PublicKeyOrToken;
-                       internal int Name;
-                       internal int Culture;
-                       internal int HashValue;
-               }
-
-               internal int FindOrAddRecord(Record rec)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               // note that we ignore HashValue here!
-                               if (records[i].Name == rec.Name
-                                       && records[i].MajorVersion == rec.MajorVersion
-                                       && records[i].MinorVersion == rec.MinorVersion
-                                       && records[i].BuildNumber == rec.BuildNumber
-                                       && records[i].RevisionNumber == rec.RevisionNumber
-                                       && records[i].Flags == rec.Flags
-                                       && records[i].PublicKeyOrToken == rec.PublicKeyOrToken
-                                       && records[i].Culture == rec.Culture
-                                       )
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(rec);
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].MajorVersion = mr.ReadUInt16();
-                               records[i].MinorVersion = mr.ReadUInt16();
-                               records[i].BuildNumber = mr.ReadUInt16();
-                               records[i].RevisionNumber = mr.ReadUInt16();
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].PublicKeyOrToken = mr.ReadBlobIndex();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Culture = mr.ReadStringIndex();
-                               records[i].HashValue = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].MajorVersion);
-                               mw.Write(records[i].MinorVersion);
-                               mw.Write(records[i].BuildNumber);
-                               mw.Write(records[i].RevisionNumber);
-                               mw.Write(records[i].Flags);
-                               mw.WriteBlobIndex(records[i].PublicKeyOrToken);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteStringIndex(records[i].Culture);
-                               mw.WriteBlobIndex(records[i].HashValue);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(12)
-                               .WriteBlobIndex()
-                               .WriteStringIndex()
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-       }
-
-       sealed class FileTable : Table<FileTable.Record>
-       {
-               internal const int Index = 0x26;
-
-               internal struct Record
-               {
-                       internal int Flags;
-                       internal int Name;
-                       internal int HashValue;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].HashValue = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Flags);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteBlobIndex(records[i].HashValue);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteStringIndex()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-       }
-
-       sealed class ExportedTypeTable : Table<ExportedTypeTable.Record>
-       {
-               internal const int Index = 0x27;
-
-               internal struct Record
-               {
-                       internal int Flags;
-                       internal int TypeDefId;
-                       internal int TypeName;
-                       internal int TypeNamespace;
-                       internal int Implementation;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].TypeDefId = mr.ReadInt32();
-                               records[i].TypeName = mr.ReadStringIndex();
-                               records[i].TypeNamespace = mr.ReadStringIndex();
-                               records[i].Implementation = mr.ReadImplementation();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Flags);
-                               mw.Write(records[i].TypeDefId);
-                               mw.WriteStringIndex(records[i].TypeName);
-                               mw.WriteStringIndex(records[i].TypeNamespace);
-                               mw.WriteImplementation(records[i].Implementation);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(8)
-                               .WriteStringIndex()
-                               .WriteStringIndex()
-                               .WriteImplementation()
-                               .Value;
-               }
-
-               internal int FindOrAddRecord(Record rec)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i].Implementation == rec.Implementation
-                                       && records[i].TypeName == rec.TypeName
-                                       && records[i].TypeNamespace == rec.TypeNamespace)
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(rec);
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Implementation);
-                       }
-               }
-       }
-
-       sealed class ManifestResourceTable : Table<ManifestResourceTable.Record>
-       {
-               internal const int Index = 0x28;
-
-               internal struct Record
-               {
-                       internal int Offset;
-                       internal int Flags;
-                       internal int Name;
-                       internal int Implementation;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Offset = mr.ReadInt32();
-                               records[i].Flags = mr.ReadInt32();
-                               records[i].Name = mr.ReadStringIndex();
-                               records[i].Implementation = mr.ReadImplementation();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Offset);
-                               mw.Write(records[i].Flags);
-                               mw.WriteStringIndex(records[i].Name);
-                               mw.WriteImplementation(records[i].Implementation);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(8)
-                               .WriteStringIndex()
-                               .WriteImplementation()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Implementation);
-                       }
-               }
-       }
-
-       sealed class NestedClassTable : SortedTable<NestedClassTable.Record>
-       {
-               internal const int Index = 0x29;
-
-               internal struct Record : IRecord
-               {
-                       internal int NestedClass;
-                       internal int EnclosingClass;
-
-                       int IRecord.SortKey
-                       {
-                               get { return NestedClass; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return NestedClass; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].NestedClass = mr.ReadTypeDef();
-                               records[i].EnclosingClass = mr.ReadTypeDef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteTypeDef(records[i].NestedClass);
-                               mw.WriteTypeDef(records[i].EnclosingClass);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteTypeDef()
-                               .WriteTypeDef()
-                               .Value;
-               }
-
-               internal List<int> GetNestedClasses(int enclosingClass)
-               {
-                       List<int> nestedClasses = new List<int>();
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i].EnclosingClass == enclosingClass)
-                               {
-                                       nestedClasses.Add(records[i].NestedClass);
-                               }
-                       }
-                       return nestedClasses;
-               }
-       }
-
-       sealed class GenericParamTable : SortedTable<GenericParamTable.Record>, IComparer<GenericParamTable.Record>
-       {
-               internal const int Index = 0x2A;
-
-               internal struct Record : IRecord
-               {
-                       internal short Number;
-                       internal short Flags;
-                       internal int Owner;
-                       internal int Name;
-                       // not part of the table, we use it to be able to fixup the GenericParamConstraint table
-                       internal int unsortedIndex;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Owner; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Owner; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Number = mr.ReadInt16();
-                               records[i].Flags = mr.ReadInt16();
-                               records[i].Owner = mr.ReadTypeOrMethodDef();
-                               records[i].Name = mr.ReadStringIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.Write(records[i].Number);
-                               mw.Write(records[i].Flags);
-                               mw.WriteTypeOrMethodDef(records[i].Owner);
-                               mw.WriteStringIndex(records[i].Name);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .AddFixed(4)
-                               .WriteTypeOrMethodDef()
-                               .WriteStringIndex()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               int token = records[i].Owner;
-                               moduleBuilder.FixupPseudoToken(ref token);
-                               // do the TypeOrMethodDef encoding, so that we can sort the table
-                               switch (token >> 24)
-                               {
-                                       case TypeDefTable.Index:
-                                               records[i].Owner = (token & 0xFFFFFF) << 1 | 0;
-                                               break;
-                                       case MethodDefTable.Index:
-                                               records[i].Owner = (token & 0xFFFFFF) << 1 | 1;
-                                               break;
-                                       default:
-                                               throw new InvalidOperationException();
-                               }
-                               records[i].unsortedIndex = i;
-                       }
-                       // FXBUG the unnecessary (IComparer<Record>) cast is a workaround for a .NET 2.0 C# compiler bug
-                       Array.Sort(records, 0, rowCount, (IComparer<Record>)this);
-               }
-
-               int IComparer<Record>.Compare(Record x, Record y)
-               {
-                       if (x.Owner == y.Owner)
-                       {
-                               return x.Number == y.Number ? 0 : (x.Number > y.Number ? 1 : -1);
-                       }
-                       return x.Owner > y.Owner ? 1 : -1;
-               }
-
-               internal void PatchAttribute(int token, GenericParameterAttributes genericParameterAttributes)
-               {
-                       records[(token & 0xFFFFFF) - 1].Flags = (short)genericParameterAttributes;
-               }
-
-               internal int[] GetIndexFixup()
-               {
-                       int[] array = new int[rowCount];
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               array[records[i].unsortedIndex] = i;
-                       }
-                       return array;
-               }
-
-               internal int FindFirstByOwner(int token)
-               {
-                       foreach (int i in Filter(token))
-                       {
-                               return i;
-                       }
-                       return -1;
-               }
-       }
-
-       sealed class MethodSpecTable : Table<MethodSpecTable.Record>
-       {
-               internal const int Index = 0x2B;
-
-               internal struct Record
-               {
-                       internal int Method;
-                       internal int Instantiation;
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Method = mr.ReadMethodDefOrRef();
-                               records[i].Instantiation = mr.ReadBlobIndex();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteMethodDefOrRef(records[i].Method);
-                               mw.WriteBlobIndex(records[i].Instantiation);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteMethodDefOrRef()
-                               .WriteBlobIndex()
-                               .Value;
-               }
-
-               internal int FindOrAddRecord(Record record)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               if (records[i].Method == record.Method
-                                       && records[i].Instantiation == record.Instantiation)
-                               {
-                                       return i + 1;
-                               }
-                       }
-                       return AddRecord(record);
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               moduleBuilder.FixupPseudoToken(ref records[i].Method);
-                       }
-               }
-       }
-
-       sealed class GenericParamConstraintTable : SortedTable<GenericParamConstraintTable.Record>
-       {
-               internal const int Index = 0x2C;
-
-               internal struct Record : IRecord
-               {
-                       internal int Owner;
-                       internal int Constraint;
-
-                       int IRecord.SortKey
-                       {
-                               get { return Owner; }
-                       }
-
-                       int IRecord.FilterKey
-                       {
-                               get { return Owner; }
-                       }
-               }
-
-               internal override void Read(MetadataReader mr)
-               {
-                       for (int i = 0; i < records.Length; i++)
-                       {
-                               records[i].Owner = mr.ReadGenericParam();
-                               records[i].Constraint = mr.ReadTypeDefOrRef();
-                       }
-               }
-
-               internal override void Write(MetadataWriter mw)
-               {
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               mw.WriteGenericParam(records[i].Owner);
-                               mw.WriteTypeDefOrRef(records[i].Constraint);
-                       }
-               }
-
-               protected override int GetRowSize(RowSizeCalc rsc)
-               {
-                       return rsc
-                               .WriteGenericParam()
-                               .WriteTypeDefOrRef()
-                               .Value;
-               }
-
-               internal void Fixup(ModuleBuilder moduleBuilder)
-               {
-                       int[] fixups = moduleBuilder.GenericParam.GetIndexFixup();
-                       for (int i = 0; i < rowCount; i++)
-                       {
-                               records[i].Owner = fixups[records[i].Owner - 1] + 1;
-                       }
-                       Sort();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MethodBase.cs b/mcs/class/IKVM.Reflection/MethodBase.cs
deleted file mode 100644 (file)
index 1bf10e2..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-
-namespace IKVM.Reflection
-{
-       public abstract class MethodBase : MemberInfo
-       {
-               // prevent external subclasses
-               internal MethodBase()
-               {
-               }
-
-               internal abstract MethodSignature MethodSignature { get; }
-               internal abstract int ParameterCount { get; }
-               public abstract ParameterInfo[] GetParameters();
-               public abstract MethodAttributes Attributes { get; }
-               public abstract MethodImplAttributes GetMethodImplementationFlags();
-               public abstract MethodBody GetMethodBody();
-               public abstract CallingConventions CallingConvention { get; }
-               public abstract int __MethodRVA { get; }
-
-               public bool IsConstructor
-               {
-                       get
-                       {
-                               if ((this.Attributes & MethodAttributes.RTSpecialName) != 0)
-                               {
-                                       string name = this.Name;
-                                       return name == ConstructorInfo.ConstructorName || name == ConstructorInfo.TypeConstructorName;
-                               }
-                               return false;
-                       }
-               }
-
-               public bool IsStatic
-               {
-                       get { return (Attributes & MethodAttributes.Static) != 0; }
-               }
-
-               public bool IsVirtual
-               {
-                       get { return (Attributes & MethodAttributes.Virtual) != 0; }
-               }
-
-               public bool IsAbstract
-               {
-                       get { return (Attributes & MethodAttributes.Abstract) != 0; }
-               }
-
-               public bool IsFinal
-               {
-                       get { return (Attributes & MethodAttributes.Final) != 0; }
-               }
-
-               public bool IsPublic
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
-               }
-
-               public bool IsFamily
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; }
-               }
-
-               public bool IsFamilyOrAssembly
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; }
-               }
-
-               public bool IsAssembly
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly; }
-               }
-
-               public bool IsFamilyAndAssembly
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; }
-               }
-
-               public bool IsPrivate
-               {
-                       get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
-               }
-
-               public bool IsSpecialName
-               {
-                       get { return (Attributes & MethodAttributes.SpecialName) != 0; }
-               }
-
-               public bool IsHideBySig
-               {
-                       get { return (Attributes & MethodAttributes.HideBySig) != 0; }
-               }
-
-               public virtual Type[] GetGenericArguments()
-               {
-                       return Type.EmptyTypes;
-               }
-
-               public virtual bool IsGenericMethod
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsGenericMethodDefinition
-               {
-                       get { return false; }
-               }
-
-               public virtual bool ContainsGenericParameters
-               {
-                       get { return IsGenericMethodDefinition; }
-               }
-
-               public virtual MethodBase __GetMethodOnTypeDefinition()
-               {
-                       return this;
-               }
-
-               // This goes to the (uninstantiated) MethodInfo on the (uninstantiated) Type. For constructors
-               // it also has the effect of removing the ConstructorInfo wrapper and returning the underlying MethodInfo.
-               internal abstract MethodInfo GetMethodOnTypeDefinition();
-
-               internal abstract int ImportTo(Emit.ModuleBuilder module);
-
-               internal abstract MethodBase BindTypeParameters(Type type);
-
-               internal sealed override bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
-               }
-
-               internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
-               {
-                       return (Attributes & MethodAttributes.MemberAccessMask) > MethodAttributes.Private
-                               && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MethodBody.cs b/mcs/class/IKVM.Reflection/MethodBody.cs
deleted file mode 100644 (file)
index fc26f6f..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Reader;
-using System.IO;
-
-namespace IKVM.Reflection
-{
-       public sealed class MethodBody
-       {
-               private readonly IList<ExceptionHandlingClause> exceptionClauses;
-               private readonly IList<LocalVariableInfo> locals;
-               private readonly bool initLocals;
-               private readonly int maxStack;
-               private readonly int localVarSigTok;
-               private byte[] body;
-
-               internal MethodBody(ModuleReader module, int rva, IGenericContext context)
-               {
-                       const byte CorILMethod_TinyFormat = 0x02;
-                       const byte CorILMethod_FatFormat = 0x03;
-                       const byte CorILMethod_MoreSects = 0x08;
-                       const byte CorILMethod_InitLocals = 0x10;
-                       const byte CorILMethod_Sect_EHTable = 0x01;
-                       const byte CorILMethod_Sect_FatFormat = 0x40;
-                       const byte CorILMethod_Sect_MoreSects = 0x80;
-
-                       List<ExceptionHandlingClause> exceptionClauses = new List<ExceptionHandlingClause>();
-                       List<LocalVariableInfo> locals = new List<LocalVariableInfo>();
-                       module.SeekRVA(rva);
-                       BinaryReader br = new BinaryReader(module.stream);
-                       byte b = br.ReadByte();
-                       if ((b & 3) == CorILMethod_TinyFormat)
-                       {
-                               initLocals = true;
-                               body = br.ReadBytes(b >> 2);
-                               maxStack = 8;
-                       }
-                       else if ((b & 3) == CorILMethod_FatFormat)
-                       {
-                               initLocals = (b & CorILMethod_InitLocals) != 0;
-                               short flagsAndSize = (short)(b | (br.ReadByte() << 8));
-                               if ((flagsAndSize >> 12) != 3)
-                               {
-                                       throw new BadImageFormatException("Fat format method header size should be 3");
-                               }
-                               maxStack = br.ReadUInt16();
-                               int codeLength = br.ReadInt32();
-                               localVarSigTok = br.ReadInt32();
-                               body = br.ReadBytes(codeLength);
-                               if ((b & CorILMethod_MoreSects) != 0)
-                               {
-                                       module.stream.Position = (module.stream.Position + 3) & ~3;
-                                       int hdr = br.ReadInt32();
-                                       if ((hdr & CorILMethod_Sect_MoreSects) != 0 || (hdr & CorILMethod_Sect_EHTable) == 0)
-                                       {
-                                               throw new NotImplementedException();
-                                       }
-                                       else if ((hdr & CorILMethod_Sect_FatFormat) != 0)
-                                       {
-                                               int count = ComputeExceptionCount((hdr >> 8) & 0xFFFFFF, 24);
-                                               for (int i = 0; i < count; i++)
-                                               {
-                                                       int flags = br.ReadInt32();
-                                                       int tryOffset = br.ReadInt32();
-                                                       int tryLength = br.ReadInt32();
-                                                       int handlerOffset = br.ReadInt32();
-                                                       int handlerLength = br.ReadInt32();
-                                                       int classTokenOrFilterOffset = br.ReadInt32();
-                                                       exceptionClauses.Add(new ExceptionHandlingClause(module, flags, tryOffset, tryLength, handlerOffset, handlerLength, classTokenOrFilterOffset, context));
-                                               }
-                                       }
-                                       else
-                                       {
-                                               int count = ComputeExceptionCount((hdr >> 8) & 0xFF, 12);
-                                               for (int i = 0; i < count; i++)
-                                               {
-                                                       int flags = br.ReadUInt16();
-                                                       int tryOffset = br.ReadUInt16();
-                                                       int tryLength = br.ReadByte();
-                                                       int handlerOffset = br.ReadUInt16();
-                                                       int handlerLength = br.ReadByte();
-                                                       int classTokenOrFilterOffset = br.ReadInt32();
-                                                       exceptionClauses.Add(new ExceptionHandlingClause(module, flags, tryOffset, tryLength, handlerOffset, handlerLength, classTokenOrFilterOffset, context));
-                                               }
-                                       }
-                               }
-                               if (localVarSigTok != 0)
-                               {
-                                       ByteReader sig = module.GetStandAloneSig((localVarSigTok & 0xFFFFFF) - 1);
-                                       Signature.ReadLocalVarSig(module, sig, context, locals);
-                               }
-                       }
-                       else
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       this.exceptionClauses = exceptionClauses.AsReadOnly();
-                       this.locals = locals.AsReadOnly();
-               }
-
-               private static int ComputeExceptionCount(int size, int itemLength)
-               {
-                       // LAMESPEC according to the spec, the count should be calculated as "(size - 4) / itemLength",
-                       // FXBUG but to workaround a VB compiler bug that specifies the size incorrectly,
-                       // we do a truncating division instead.
-                       return size / itemLength;
-               }
-
-               public IList<ExceptionHandlingClause> ExceptionHandlingClauses
-               {
-                       get { return exceptionClauses; }
-               }
-
-               public bool InitLocals
-               {
-                       get { return initLocals; }
-               }
-
-               public IList<LocalVariableInfo> LocalVariables
-               {
-                       get { return locals; }
-               }
-
-               public byte[] GetILAsByteArray()
-               {
-                       return body;
-               }
-
-               public int LocalSignatureMetadataToken
-               {
-                       get { return localVarSigTok; }
-               }
-
-               public int MaxStackSize
-               {
-                       get { return maxStack; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MethodImplMap.cs b/mcs/class/IKVM.Reflection/MethodImplMap.cs
deleted file mode 100644 (file)
index bab829f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       public struct __MethodImplMap
-       {
-               public Type TargetType;
-               public MethodInfo[] MethodBodies;
-               public MethodInfo[][] MethodDeclarations;
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MethodInfo.cs b/mcs/class/IKVM.Reflection/MethodInfo.cs
deleted file mode 100644 (file)
index 40ca321..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       public abstract class MethodInfo : MethodBase, IGenericContext, IGenericBinder
-       {
-               // prevent external subclasses
-               internal MethodInfo()
-               {
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return MemberTypes.Method; }
-               }
-
-               public abstract Type ReturnType { get; }
-               public abstract ParameterInfo ReturnParameter { get; }
-
-               public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       throw new NotSupportedException(this.GetType().FullName);
-               }
-
-               public virtual MethodInfo GetGenericMethodDefinition()
-               {
-                       throw new NotSupportedException(this.GetType().FullName);
-               }
-
-               public override string ToString()
-               {
-                       StringBuilder sb = new StringBuilder();
-                       sb.Append(this.ReturnType.Name).Append(' ').Append(this.Name);
-                       string sep;
-                       if (this.IsGenericMethod)
-                       {
-                               sb.Append('[');
-                               sep = "";
-                               foreach (Type arg in GetGenericArguments())
-                               {
-                                       sb.Append(sep).Append(arg);
-                                       sep = ", ";
-                               }
-                               sb.Append(']');
-                       }
-                       sb.Append('(');
-                       sep = "";
-                       foreach (ParameterInfo arg in GetParameters())
-                       {
-                               sb.Append(sep).Append(arg.ParameterType);
-                               sep = ", ";
-                       }
-                       sb.Append(')');
-                       return sb.ToString();
-               }
-
-               internal bool IsNewSlot
-               {
-                       get { return (this.Attributes & MethodAttributes.NewSlot) != 0; }
-               }
-
-               public MethodInfo GetBaseDefinition()
-               {
-                       MethodInfo match = this;
-                       if (match.IsVirtual)
-                       {
-                               for (Type type = this.DeclaringType.BaseType; type != null && !match.IsNewSlot; type = type.BaseType)
-                               {
-                                       MethodInfo method = type.FindMethod(this.Name, this.MethodSignature) as MethodInfo;
-                                       if (method != null && method.IsVirtual)
-                                       {
-                                               match = method;
-                                       }
-                               }
-                       }
-                       return match;
-               }
-
-               public virtual MethodInfo[] __GetMethodImpls()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope)
-               {
-                       Module module = this.Module;
-                       foreach (int i in module.ImplMap.Filter(GetCurrentToken()))
-                       {
-                               mappingFlags = (ImplMapFlags)(ushort)module.ImplMap.records[i].MappingFlags;
-                               importName = module.GetString(module.ImplMap.records[i].ImportName);
-                               importScope = module.GetString(module.ModuleRef.records[(module.ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]);
-                               return true;
-                       }
-                       mappingFlags = 0;
-                       importName = null;
-                       importScope = null;
-                       return false;
-               }
-
-               public ConstructorInfo __AsConstructorInfo()
-               {
-                       return new ConstructorInfoImpl(this);
-               }
-
-               Type IGenericContext.GetGenericTypeArgument(int index)
-               {
-                       return this.DeclaringType.GetGenericTypeArgument(index);
-               }
-
-               Type IGenericContext.GetGenericMethodArgument(int index)
-               {
-                       return GetGenericMethodArgument(index);
-               }
-
-               internal virtual Type GetGenericMethodArgument(int index)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               internal virtual int GetGenericMethodArgumentCount()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return this;
-               }
-
-               Type IGenericBinder.BindTypeParameter(Type type)
-               {
-                       return this.DeclaringType.GetGenericTypeArgument(type.GenericParameterPosition);
-               }
-
-               Type IGenericBinder.BindMethodParameter(Type type)
-               {
-                       return GetGenericMethodArgument(type.GenericParameterPosition);
-               }
-
-               internal override MethodBase BindTypeParameters(Type type)
-               {
-                       return new GenericMethodInstance(this.DeclaringType.BindTypeParameters(type), this, null);
-               }
-
-               // This method is used by ILGenerator and exists to allow ArrayMethod to override it,
-               // because ArrayMethod doesn't have a working MethodAttributes property, so it needs
-               // to base the result of this on the CallingConvention.
-               internal virtual bool HasThis
-               {
-                       get { return !IsStatic; }
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       return new MethodInfoWithReflectedType(type, this);
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       Module module = this.Module;
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       if ((this.Attributes & MethodAttributes.PinvokeImpl) != 0
-                               && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_DllImportAttribute)))
-                       {
-                               ImplMapFlags flags;
-                               string importName;
-                               string importScope;
-                               if (__TryGetImplMap(out flags, out importName, out importScope))
-                               {
-                                       list.Add(CustomAttributeData.CreateDllImportPseudoCustomAttribute(module, flags, importName, importScope, GetMethodImplementationFlags()));
-                               }
-                       }
-                       if ((GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0
-                               && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_PreserveSigAttribute)))
-                       {
-                               list.Add(CustomAttributeData.CreatePreserveSigPseudoCustomAttribute(module));
-                       }
-                       return list;
-               }
-       }
-
-       sealed class MethodInfoWithReflectedType : MethodInfo
-       {
-               private readonly Type reflectedType;
-               private readonly MethodInfo method;
-
-               internal MethodInfoWithReflectedType(Type reflectedType, MethodInfo method)
-               {
-                       Debug.Assert(reflectedType != method.DeclaringType);
-                       this.reflectedType = reflectedType;
-                       this.method = method;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       MethodInfoWithReflectedType other = obj as MethodInfoWithReflectedType;
-                       return other != null
-                               && other.reflectedType == reflectedType
-                               && other.method == method;
-               }
-
-               public override int GetHashCode()
-               {
-                       return reflectedType.GetHashCode() ^ method.GetHashCode();
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get { return method.MethodSignature; }
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return method.ParameterCount; }
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameters = method.GetParameters();
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
-                       }
-                       return parameters;
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return method.Attributes; }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return method.GetMethodImplementationFlags();
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       return method.GetMethodBody();
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return method.CallingConvention; }
-               }
-
-               public override int __MethodRVA
-               {
-                       get { return method.__MethodRVA; }
-               }
-
-               public override Type ReturnType
-               {
-                       get { return method.ReturnType; }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get { return new ParameterInfoWrapper(this, method.ReturnParameter); }
-               }
-
-               public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       return SetReflectedType(method.MakeGenericMethod(typeArguments), reflectedType);
-               }
-
-               public override MethodInfo GetGenericMethodDefinition()
-               {
-                       return method.GetGenericMethodDefinition();
-               }
-
-               public override string ToString()
-               {
-                       return method.ToString();
-               }
-
-               public override MethodInfo[] __GetMethodImpls()
-               {
-                       return method.__GetMethodImpls();
-               }
-
-               internal override Type GetGenericMethodArgument(int index)
-               {
-                       return method.GetGenericMethodArgument(index);
-               }
-
-               internal override int GetGenericMethodArgumentCount()
-               {
-                       return method.GetGenericMethodArgumentCount();
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return method.GetMethodOnTypeDefinition();
-               }
-
-               internal override bool HasThis
-               {
-                       get { return method.HasThis; }
-               }
-
-               public override Module Module
-               {
-                       get { return method.Module; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return method.DeclaringType; }
-               }
-
-               public override Type ReflectedType
-               {
-                       get { return reflectedType; }
-               }
-
-               public override string Name
-               {
-                       get { return method.Name; }
-               }
-
-               internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
-               {
-                       return method.ImportTo(module);
-               }
-
-               public override MethodBase __GetMethodOnTypeDefinition()
-               {
-                       return method.__GetMethodOnTypeDefinition();
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return method.__IsMissing; }
-               }
-
-               internal override MethodBase BindTypeParameters(Type type)
-               {
-                       return method.BindTypeParameters(type);
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get { return method.ContainsGenericParameters; }
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       return method.GetGenericArguments();
-               }
-
-               public override bool IsGenericMethod
-               {
-                       get { return method.IsGenericMethod; }
-               }
-
-               public override bool IsGenericMethodDefinition
-               {
-                       get { return method.IsGenericMethodDefinition; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return method.MetadataToken; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return method.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return method.IsBaked; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/MethodSignature.cs b/mcs/class/IKVM.Reflection/MethodSignature.cs
deleted file mode 100644 (file)
index 76c9cb5..0000000
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
-       sealed class MethodSignature : Signature
-       {
-               private readonly Type returnType;
-               private readonly Type[] parameterTypes;
-               private readonly PackedCustomModifiers modifiers;
-               private readonly CallingConventions callingConvention;
-               private readonly int genericParamCount;
-
-               internal MethodSignature(Type returnType, Type[] parameterTypes, PackedCustomModifiers modifiers, CallingConventions callingConvention, int genericParamCount)
-               {
-                       this.returnType = returnType;
-                       this.parameterTypes = parameterTypes;
-                       this.modifiers = modifiers;
-                       this.callingConvention = callingConvention;
-                       this.genericParamCount = genericParamCount;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       MethodSignature other = obj as MethodSignature;
-                       return other != null
-                               && other.callingConvention == callingConvention
-                               && other.genericParamCount == genericParamCount
-                               && other.returnType.Equals(returnType)
-                               && Util.ArrayEquals(other.parameterTypes, parameterTypes)
-                               && other.modifiers.Equals(modifiers);
-               }
-
-               public override int GetHashCode()
-               {
-                       return genericParamCount ^ 77 * (int)callingConvention
-                               ^ 3 * returnType.GetHashCode()
-                               ^ Util.GetHashCode(parameterTypes) * 5
-                               ^ modifiers.GetHashCode() * 55;
-               }
-
-               private sealed class UnboundGenericMethodContext : IGenericContext
-               {
-                       private readonly IGenericContext original;
-
-                       internal UnboundGenericMethodContext(IGenericContext original)
-                       {
-                               this.original = original;
-                       }
-
-                       public Type GetGenericTypeArgument(int index)
-                       {
-                               return original.GetGenericTypeArgument(index);
-                       }
-
-                       public Type GetGenericMethodArgument(int index)
-                       {
-                               return UnboundGenericMethodParameter.Make(index);
-                       }
-               }
-
-               internal static MethodSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       CallingConventions callingConvention;
-                       int genericParamCount;
-                       Type returnType;
-                       Type[] parameterTypes;
-                       byte flags = br.ReadByte();
-                       switch (flags & 7)
-                       {
-                               case DEFAULT:
-                                       callingConvention = CallingConventions.Standard;
-                                       break;
-                               case VARARG:
-                                       callingConvention = CallingConventions.VarArgs;
-                                       break;
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-                       if ((flags & HASTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.HasThis;
-                       }
-                       if ((flags & EXPLICITTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.ExplicitThis;
-                       }
-                       genericParamCount = 0;
-                       if ((flags & GENERIC) != 0)
-                       {
-                               genericParamCount = br.ReadCompressedInt();
-                               context = new UnboundGenericMethodContext(context);
-                       }
-                       int paramCount = br.ReadCompressedInt();
-                       CustomModifiers[] modifiers = null;
-                       PackedCustomModifiers.Pack(ref modifiers, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
-                       returnType = ReadRetType(module, br, context);
-                       parameterTypes = new Type[paramCount];
-                       for (int i = 0; i < parameterTypes.Length; i++)
-                       {
-                               if ((callingConvention & CallingConventions.VarArgs) != 0 && br.PeekByte() == SENTINEL)
-                               {
-                                       Array.Resize(ref parameterTypes, i);
-                                       if (modifiers != null)
-                                       {
-                                               Array.Resize(ref modifiers, i + 1);
-                                       }
-                                       break;
-                               }
-                               PackedCustomModifiers.Pack(ref modifiers, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
-                               parameterTypes[i] = ReadParam(module, br, context);
-                       }
-                       return new MethodSignature(returnType, parameterTypes, PackedCustomModifiers.Wrap(modifiers), callingConvention, genericParamCount);
-               }
-
-               internal static __StandAloneMethodSig ReadStandAloneMethodSig(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       CallingConventions callingConvention = 0;
-                       System.Runtime.InteropServices.CallingConvention unmanagedCallingConvention = 0;
-                       bool unmanaged;
-                       byte flags = br.ReadByte();
-                       switch (flags & 7)
-                       {
-                               case DEFAULT:
-                                       callingConvention = CallingConventions.Standard;
-                                       unmanaged = false;
-                                       break;
-                               case 0x01:      // C
-                                       unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
-                                       unmanaged = true;
-                                       break;
-                               case 0x02:      // STDCALL
-                                       unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
-                                       unmanaged = true;
-                                       break;
-                               case 0x03:      // THISCALL
-                                       unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
-                                       unmanaged = true;
-                                       break;
-                               case 0x04:      // FASTCALL
-                                       unmanagedCallingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
-                                       unmanaged = true;
-                                       break;
-                               case VARARG:
-                                       callingConvention = CallingConventions.VarArgs;
-                                       unmanaged = false;
-                                       break;
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-                       if ((flags & HASTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.HasThis;
-                       }
-                       if ((flags & EXPLICITTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.ExplicitThis;
-                       }
-                       if ((flags & GENERIC) != 0)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       int paramCount = br.ReadCompressedInt();
-                       CustomModifiers[] customModifiers = null;
-                       PackedCustomModifiers.Pack(ref customModifiers, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
-                       Type returnType = ReadRetType(module, br, context);
-                       List<Type> parameterTypes = new List<Type>();
-                       List<Type> optionalParameterTypes = new List<Type>();
-                       List<Type> curr = parameterTypes;
-                       for (int i = 0; i < paramCount; i++)
-                       {
-                               if (br.PeekByte() == SENTINEL)
-                               {
-                                       br.ReadByte();
-                                       curr = optionalParameterTypes;
-                               }
-                               PackedCustomModifiers.Pack(ref customModifiers, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
-                               curr.Add(ReadParam(module, br, context));
-                       }
-                       return new __StandAloneMethodSig(unmanaged, unmanagedCallingConvention, callingConvention, returnType, parameterTypes.ToArray(), optionalParameterTypes.ToArray(), PackedCustomModifiers.Wrap(customModifiers));
-               }
-
-               internal int GetParameterCount()
-               {
-                       return parameterTypes.Length;
-               }
-
-               internal Type GetParameterType(int index)
-               {
-                       return parameterTypes[index];
-               }
-
-               internal Type GetReturnType(IGenericBinder binder)
-               {
-                       return returnType.BindTypeParameters(binder);
-               }
-
-               internal CustomModifiers GetReturnTypeCustomModifiers(IGenericBinder binder)
-               {
-                       return modifiers.GetReturnTypeCustomModifiers().Bind(binder);
-               }
-
-               internal Type GetParameterType(IGenericBinder binder, int index)
-               {
-                       return parameterTypes[index].BindTypeParameters(binder);
-               }
-
-               internal CustomModifiers GetParameterCustomModifiers(IGenericBinder binder, int index)
-               {
-                       return modifiers.GetParameterCustomModifiers(index).Bind(binder);
-               }
-
-               internal CallingConventions CallingConvention
-               {
-                       get { return callingConvention; }
-               }
-
-               internal int GenericParameterCount
-               {
-                       get { return genericParamCount; }
-               }
-
-               private sealed class Binder : IGenericBinder
-               {
-                       private readonly Type declaringType;
-                       private readonly Type[] methodArgs;
-
-                       internal Binder(Type declaringType, Type[] methodArgs)
-                       {
-                               this.declaringType = declaringType;
-                               this.methodArgs = methodArgs;
-                       }
-
-                       public Type BindTypeParameter(Type type)
-                       {
-                               return declaringType.GetGenericTypeArgument(type.GenericParameterPosition);
-                       }
-
-                       public Type BindMethodParameter(Type type)
-                       {
-                               if (methodArgs == null)
-                               {
-                                       return type;
-                               }
-                               return methodArgs[type.GenericParameterPosition];
-                       }
-               }
-
-               internal MethodSignature Bind(Type type, Type[] methodArgs)
-               {
-                       Binder binder = new Binder(type, methodArgs);
-                       return new MethodSignature(returnType.BindTypeParameters(binder),
-                               BindTypeParameters(binder, parameterTypes),
-                               modifiers.Bind(binder),
-                               callingConvention, genericParamCount);
-               }
-
-               private sealed class Unbinder : IGenericBinder
-               {
-                       internal static readonly Unbinder Instance = new Unbinder();
-
-                       private Unbinder()
-                       {
-                       }
-
-                       public Type BindTypeParameter(Type type)
-                       {
-                               return type;
-                       }
-
-                       public Type BindMethodParameter(Type type)
-                       {
-                               return UnboundGenericMethodParameter.Make(type.GenericParameterPosition);
-                       }
-               }
-
-               internal static MethodSignature MakeFromBuilder(Type returnType, Type[] parameterTypes, PackedCustomModifiers modifiers, CallingConventions callingConvention, int genericParamCount)
-               {
-                       if (genericParamCount > 0)
-                       {
-                               returnType = returnType.BindTypeParameters(Unbinder.Instance);
-                               parameterTypes = BindTypeParameters(Unbinder.Instance, parameterTypes);
-                               modifiers = modifiers.Bind(Unbinder.Instance);
-                       }
-                       return new MethodSignature(returnType, parameterTypes, modifiers, callingConvention, genericParamCount);
-               }
-
-               internal bool MatchParameterTypes(MethodSignature other)
-               {
-                       return Util.ArrayEquals(other.parameterTypes, parameterTypes);
-               }
-
-               internal bool MatchParameterTypes(Type[] types)
-               {
-                       return Util.ArrayEquals(types, parameterTypes);
-               }
-
-               internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
-               {
-                       WriteSigImpl(module, bb, parameterTypes.Length);
-               }
-
-               internal void WriteMethodRefSig(ModuleBuilder module, ByteBuffer bb, Type[] optionalParameterTypes, CustomModifiers[] customModifiers)
-               {
-                       WriteSigImpl(module, bb, parameterTypes.Length + optionalParameterTypes.Length);
-                       if (optionalParameterTypes.Length > 0)
-                       {
-                               bb.Write(SENTINEL);
-                               for (int i = 0; i < optionalParameterTypes.Length; i++)
-                               {
-                                       WriteCustomModifiers(module, bb, Util.NullSafeElementAt(customModifiers, i));
-                                       WriteType(module, bb, optionalParameterTypes[i]);
-                               }
-                       }
-               }
-
-               private void WriteSigImpl(ModuleBuilder module, ByteBuffer bb, int parameterCount)
-               {
-                       byte first;
-                       if ((callingConvention & CallingConventions.Any) == CallingConventions.VarArgs)
-                       {
-                               Debug.Assert(genericParamCount == 0);
-                               first = VARARG;
-                       }
-                       else if (genericParamCount > 0)
-                       {
-                               first = GENERIC;
-                       }
-                       else
-                       {
-                               first = DEFAULT;
-                       }
-                       if ((callingConvention & CallingConventions.HasThis) != 0)
-                       {
-                               first |= HASTHIS;
-                       }
-                       if ((callingConvention & CallingConventions.ExplicitThis) != 0)
-                       {
-                               first |= EXPLICITTHIS;
-                       }
-                       bb.Write(first);
-                       if (genericParamCount > 0)
-                       {
-                               bb.WriteCompressedInt(genericParamCount);
-                       }
-                       bb.WriteCompressedInt(parameterCount);
-                       // RetType
-                       WriteCustomModifiers(module, bb, modifiers.GetReturnTypeCustomModifiers());
-                       WriteType(module, bb, returnType);
-                       // Param
-                       for (int i = 0; i < parameterTypes.Length; i++)
-                       {
-                               WriteCustomModifiers(module, bb, modifiers.GetParameterCustomModifiers(i));
-                               WriteType(module, bb, parameterTypes[i]);
-                       }
-               }
-       }
-
-       struct PackedCustomModifiers
-       {
-               // element 0 is the return type, the rest are the parameters
-               private readonly CustomModifiers[] customModifiers;
-
-               private PackedCustomModifiers(CustomModifiers[] customModifiers)
-               {
-                       this.customModifiers = customModifiers;
-               }
-
-               public override int GetHashCode()
-               {
-                       return Util.GetHashCode(customModifiers);
-               }
-
-               public override bool Equals(object obj)
-               {
-                       PackedCustomModifiers? other = obj as PackedCustomModifiers?;
-                       return other != null && Equals(other.Value);
-               }
-
-               internal bool Equals(PackedCustomModifiers other)
-               {
-                       return Util.ArrayEquals(customModifiers, other.customModifiers);
-               }
-
-               internal CustomModifiers GetReturnTypeCustomModifiers()
-               {
-                       if (customModifiers == null)
-                       {
-                               return new CustomModifiers();
-                       }
-                       return customModifiers[0];
-               }
-
-               internal CustomModifiers GetParameterCustomModifiers(int index)
-               {
-                       if (customModifiers == null)
-                       {
-                               return new CustomModifiers();
-                       }
-                       return customModifiers[index + 1];
-               }
-
-               internal PackedCustomModifiers Bind(IGenericBinder binder)
-               {
-                       if (customModifiers == null)
-                       {
-                               return new PackedCustomModifiers();
-                       }
-                       CustomModifiers[] expanded = new CustomModifiers[customModifiers.Length];
-                       for (int i = 0; i < customModifiers.Length; i++)
-                       {
-                               expanded[i] = customModifiers[i].Bind(binder);
-                       }
-                       return new PackedCustomModifiers(expanded);
-               }
-
-               // this method make a copy of the incoming arrays (where necessary) and returns a normalized modifiers array
-               internal static PackedCustomModifiers CreateFromExternal(Type[] returnOptional, Type[] returnRequired, Type[][] parameterOptional, Type[][] parameterRequired, int parameterCount)
-               {
-                       CustomModifiers[] modifiers = null;
-                       Pack(ref modifiers, 0, CustomModifiers.FromReqOpt(returnRequired, returnOptional), parameterCount + 1);
-                       for (int i = 0; i < parameterCount; i++)
-                       {
-                               Pack(ref modifiers, i + 1, CustomModifiers.FromReqOpt(Util.NullSafeElementAt(parameterRequired, i), Util.NullSafeElementAt(parameterOptional, i)), parameterCount + 1);
-                       }
-                       return new PackedCustomModifiers(modifiers);
-               }
-
-               internal static PackedCustomModifiers CreateFromExternal(CustomModifiers returnTypeCustomModifiers, CustomModifiers[] parameterTypeCustomModifiers, int parameterCount)
-               {
-                       CustomModifiers[] customModifiers = null;
-                       Pack(ref customModifiers, 0, returnTypeCustomModifiers, parameterCount + 1);
-                       if (parameterTypeCustomModifiers != null)
-                       {
-                               for (int i = 0; i < parameterCount; i++)
-                               {
-                                       Pack(ref customModifiers, i + 1, parameterTypeCustomModifiers[i], parameterCount + 1);
-                               }
-                       }
-                       return new PackedCustomModifiers(customModifiers);
-               }
-
-               internal static PackedCustomModifiers Wrap(CustomModifiers[] modifiers)
-               {
-                       return new PackedCustomModifiers(modifiers);
-               }
-
-               internal static void Pack(ref CustomModifiers[] array, int index, CustomModifiers mods, int count)
-               {
-                       if (!mods.IsEmpty)
-                       {
-                               if (array == null)
-                               {
-                                       array = new CustomModifiers[count];
-                               }
-                               array[index] = mods;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Missing.cs b/mcs/class/IKVM.Reflection/Missing.cs
deleted file mode 100644 (file)
index 6d2364b..0000000
+++ /dev/null
@@ -1,1162 +0,0 @@
-/*
-  Copyright (C) 2011-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-namespace IKVM.Reflection
-{
-       [Serializable]
-       public sealed class MissingAssemblyException : InvalidOperationException
-       {
-               [NonSerialized]
-               private readonly MissingAssembly assembly;
-
-               internal MissingAssemblyException(MissingAssembly assembly)
-                       : base("Assembly '" + assembly.FullName + "' is a missing assembly and does not support the requested operation.")
-               {
-                       this.assembly = assembly;
-               }
-
-               private MissingAssemblyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
-                       : base(info, context)
-               {
-               }
-
-               public Assembly Assembly
-               {
-                       get { return assembly; }
-               }
-       }
-
-       [Serializable]
-       public sealed class MissingModuleException : InvalidOperationException
-       {
-               [NonSerialized]
-               private readonly MissingModule module;
-
-               internal MissingModuleException(MissingModule module)
-                       : base("Module from missing assembly '" + module.Assembly.FullName + "' does not support the requested operation.")
-               {
-                       this.module = module;
-               }
-
-               private MissingModuleException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
-                       : base(info, context)
-               {
-               }
-
-               public Module Module
-               {
-                       get { return module; }
-               }
-       }
-
-       [Serializable]
-       public sealed class MissingMemberException : InvalidOperationException
-       {
-               [NonSerialized]
-               private readonly MemberInfo member;
-
-               internal MissingMemberException(MemberInfo member)
-                       : base("Member '" + member + "' is a missing member and does not support the requested operation.")
-               {
-                       this.member = member;
-               }
-
-               private MissingMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
-                       : base(info, context)
-               {
-               }
-
-               public MemberInfo MemberInfo
-               {
-                       get { return member; }
-               }
-       }
-
-       public struct MissingGenericMethodBuilder
-       {
-               private readonly MissingMethod method;
-
-               public MissingGenericMethodBuilder(Type declaringType, CallingConventions callingConvention, string name, int genericParameterCount)
-               {
-                       method = new MissingMethod(declaringType, name, new MethodSignature(null, null, new PackedCustomModifiers(), callingConvention, genericParameterCount));
-               }
-
-               public Type[] GetGenericArguments()
-               {
-                       return method.GetGenericArguments();
-               }
-
-               public void SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       method.signature = new MethodSignature(
-                               returnType ?? method.Module.universe.System_Void,
-                               Util.Copy(parameterTypes),
-                               PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, parameterTypes.Length),
-                               method.signature.CallingConvention,
-                               method.signature.GenericParameterCount);
-               }
-
-               [Obsolete("Please use SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
-               public void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       method.signature = new MethodSignature(
-                               returnType ?? method.Module.universe.System_Void,
-                               Util.Copy(parameterTypes),
-                               PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length),
-                               method.signature.CallingConvention,
-                               method.signature.GenericParameterCount);
-               }
-
-               public MethodInfo Finish()
-               {
-                       return method;
-               }
-       }
-
-       sealed class MissingAssembly : Assembly
-       {
-               private readonly MissingModule module;
-
-               internal MissingAssembly(Universe universe, string name)
-                       : base(universe)
-               {
-                       module = new MissingModule(this);
-                       this.fullName = name;
-               }
-
-               public override Type[] GetTypes()
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override AssemblyName GetName()
-               {
-                       return new AssemblyName(fullName);
-               }
-
-               public override string ImageRuntimeVersion
-               {
-                       get { throw new MissingAssemblyException(this); }
-               }
-
-               public override Module ManifestModule
-               {
-                       get { return module; }
-               }
-
-               public override MethodInfo EntryPoint
-               {
-                       get { throw new MissingAssemblyException(this); }
-               }
-
-               public override string Location
-               {
-                       get { throw new MissingAssemblyException(this); }
-               }
-
-               public override AssemblyName[] GetReferencedAssemblies()
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override Module[] GetModules(bool getResourceModules)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override Module[] GetLoadedModules(bool getResourceModules)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override Module GetModule(string name)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override string[] GetManifestResourceNames()
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override System.IO.Stream GetManifestResourceStream(string resourceName)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return true; }
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       return null;
-               }
-
-               internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
-               {
-                       throw new MissingAssemblyException(this);
-               }
-       }
-
-       sealed class MissingModule : NonPEModule
-       {
-               private readonly MissingAssembly assembly;
-
-               internal MissingModule(MissingAssembly assembly)
-                       : base(assembly.universe)
-               {
-                       this.assembly = assembly;
-               }
-
-               public override int MDStreamVersion
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               public override Assembly Assembly
-               {
-                       get { return assembly; }
-               }
-
-               public override string FullyQualifiedName
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               public override string Name
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               public override Guid ModuleVersionId
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               public override string ScopeName
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       return null;
-               }
-
-               internal override void GetTypesImpl(System.Collections.Generic.List<Type> list)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override void __GetDataDirectoryEntry(int index, out int rva, out int length)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override long __RelativeVirtualAddressToFileOffset(int rva)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override int __Subsystem
-               {
-                       get { throw new MissingModuleException(this); }
-               }
-
-               internal override void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
-               {
-                       throw new MissingModuleException(this);
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return true; }
-               }
-
-               protected override Exception InvalidOperationException()
-               {
-                       return new MissingModuleException(this);
-               }
-
-               protected override Exception NotSupportedException()
-               {
-                       return new MissingModuleException(this);
-               }
-
-               protected override Exception ArgumentOutOfRangeException()
-               {
-                       return new MissingModuleException(this);
-               }
-       }
-
-       sealed class MissingType : Type
-       {
-               private readonly Module module;
-               private readonly Type declaringType;
-               private readonly string ns;
-               private readonly string name;
-               private Type[] typeArgs;
-               private int token;
-
-               internal MissingType(Module module, Type declaringType, string ns, string name)
-               {
-                       this.module = module;
-                       this.declaringType = declaringType;
-                       this.ns = ns;
-                       this.name = name;
-                       MarkEnumOrValueType(ns, name);
-               }
-
-               internal override MethodBase FindMethod(string name, MethodSignature signature)
-               {
-                       MethodInfo method = new MissingMethod(this, name, signature);
-                       if (name == ".ctor")
-                       {
-                               return new ConstructorInfoImpl(method);
-                       }
-                       return method;
-               }
-
-               internal override FieldInfo FindField(string name, FieldSignature signature)
-               {
-                       return new MissingField(this, name, signature);
-               }
-
-               internal override Type FindNestedType(TypeName name)
-               {
-                       return null;
-               }
-
-               internal override Type FindNestedTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       return null;
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return true; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType; }
-               }
-
-               public override string __Name
-               {
-                       get { return name; }
-               }
-
-               public override string __Namespace
-               {
-                       get { return ns; }
-               }
-
-               public override string Name
-               {
-                       get { return TypeNameParser.Escape(name); }
-               }
-
-               public override string FullName
-               {
-                       get { return GetFullName(); }
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return token; }
-               }
-
-               public override bool IsValueType
-               {
-                       get
-                       {
-                               switch (typeFlags & (TypeFlags.ValueType | TypeFlags.NotValueType))
-                               {
-                                       case TypeFlags.ValueType:
-                                               return true;
-                                       case TypeFlags.NotValueType:
-                                               return false;
-                                       default:
-                                               if (module.universe.ResolveMissingTypeIsValueType(this))
-                                               {
-                                                       typeFlags |= TypeFlags.ValueType;
-                                               }
-                                               else
-                                               {
-                                                       typeFlags |= TypeFlags.NotValueType;
-                                               }
-                                               return (typeFlags & TypeFlags.ValueType) != 0;
-                               }
-                       }
-               }
-
-               public override Type BaseType
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override Type[] __GetDeclaredTypes()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override __MethodImplMap __GetMethodImplMap()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override FieldInfo[] __GetDeclaredFields()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override EventInfo[] __GetDeclaredEvents()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override PropertyInfo[] __GetDeclaredProperties()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override CustomModifiers __GetCustomModifiers()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override StructLayoutAttribute StructLayoutAttribute
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override bool IsGenericType
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override bool IsGenericTypeDefinition
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               internal override Type GetGenericTypeArgument(int index)
-               {
-                       if (typeArgs == null)
-                       {
-                               typeArgs = new Type[index + 1];
-                       }
-                       else if (typeArgs.Length <= index)
-                       {
-                               Array.Resize(ref typeArgs, index + 1);
-                       }
-                       return typeArgs[index] ?? (typeArgs[index] = new MissingTypeParameter(this, index));
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       return this;
-               }
-
-               internal override Type SetMetadataTokenForMissing(int token)
-               {
-                       this.token = token;
-                       return this;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-       }
-
-       sealed class MissingTypeParameter : IKVM.Reflection.Reader.TypeParameterType
-       {
-               private readonly MemberInfo owner;
-               private readonly int index;
-
-               internal MissingTypeParameter(MemberInfo owner, int index)
-               {
-                       this.owner = owner;
-                       this.index = index;
-               }
-
-               public override Module Module
-               {
-                       get { return owner.Module; }
-               }
-
-               public override string Name
-               {
-                       get { return null; }
-               }
-
-               public override int GenericParameterPosition
-               {
-                       get { return index; }
-               }
-
-               public override MethodBase DeclaringMethod
-               {
-                       get { return owner as MethodBase; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return owner as Type; }
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       if (owner is MethodBase)
-                       {
-                               return binder.BindMethodParameter(this);
-                       }
-                       else
-                       {
-                               return binder.BindTypeParameter(this);
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return owner.IsBaked; }
-               }
-       }
-
-       sealed class MissingMethod : MethodInfo
-       {
-               private readonly Type declaringType;
-               private readonly string name;
-               internal MethodSignature signature;
-               private MethodInfo forwarder;
-               private Type[] typeArgs;
-
-               internal MissingMethod(Type declaringType, string name, MethodSignature signature)
-               {
-                       this.declaringType = declaringType;
-                       this.name = name;
-                       this.signature = signature;
-               }
-
-               private MethodInfo Forwarder
-               {
-                       get
-                       {
-                               MethodInfo method = TryGetForwarder();
-                               if (method == null)
-                               {
-                                       throw new MissingMemberException(this);
-                               }
-                               return method;
-                       }
-               }
-
-               private MethodInfo TryGetForwarder()
-               {
-                       if (forwarder == null && !declaringType.__IsMissing)
-                       {
-                               MethodBase mb = declaringType.FindMethod(name, signature);
-                               ConstructorInfo ci = mb as ConstructorInfo;
-                               if (ci != null)
-                               {
-                                       forwarder = ci.GetMethodInfo();
-                               }
-                               else
-                               {
-                                       forwarder = (MethodInfo)mb;
-                               }
-                       }
-                       return forwarder;
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return TryGetForwarder() == null; }
-               }
-
-               public override Type ReturnType
-               {
-                       get { return signature.GetReturnType(this); }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get { return new ParameterInfoImpl(this, -1); }
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get { return signature; }
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return signature.GetParameterCount(); }
-               }
-
-               private sealed class ParameterInfoImpl : ParameterInfo
-               {
-                       private readonly MissingMethod method;
-                       private readonly int index;
-
-                       internal ParameterInfoImpl(MissingMethod method, int index)
-                       {
-                               this.method = method;
-                               this.index = index;
-                       }
-
-                       private ParameterInfo Forwarder
-                       {
-                               get { return index == -1 ? method.Forwarder.ReturnParameter : method.Forwarder.GetParameters()[index]; }
-                       }
-
-                       public override string Name
-                       {
-                               get { return Forwarder.Name; }
-                       }
-
-                       public override Type ParameterType
-                       {
-                               get { return index == -1 ? method.signature.GetReturnType(method) : method.signature.GetParameterType(method, index); }
-                       }
-
-                       public override ParameterAttributes Attributes
-                       {
-                               get { return Forwarder.Attributes; }
-                       }
-
-                       public override int Position
-                       {
-                               get { return index; }
-                       }
-
-                       public override object RawDefaultValue
-                       {
-                               get { return Forwarder.RawDefaultValue; }
-                       }
-
-                       public override CustomModifiers __GetCustomModifiers()
-                       {
-                               return index == -1
-                                       ? method.signature.GetReturnTypeCustomModifiers(method)
-                                       : method.signature.GetParameterCustomModifiers(method, index);
-                       }
-
-                       public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-                       {
-                               return Forwarder.__TryGetFieldMarshal(out fieldMarshal);
-                       }
-
-                       public override MemberInfo Member
-                       {
-                               get { return method; }
-                       }
-
-                       public override int MetadataToken
-                       {
-                               get { return Forwarder.MetadataToken; }
-                       }
-
-                       internal override Module Module
-                       {
-                               get { return method.Module; }
-                       }
-
-                       public override string ToString()
-                       {
-                               return Forwarder.ToString();
-                       }
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameters = new ParameterInfo[signature.GetParameterCount()];
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoImpl(this, i);
-                       }
-                       return parameters;
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return Forwarder.Attributes; }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return Forwarder.GetMethodImplementationFlags();
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       return Forwarder.GetMethodBody();
-               }
-
-               public override int __MethodRVA
-               {
-                       get { return Forwarder.__MethodRVA; }
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return signature.CallingConvention; }
-               }
-
-               internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
-               {
-                       MethodInfo method = TryGetForwarder();
-                       if (method != null)
-                       {
-                               return method.ImportTo(module);
-                       }
-                       return module.ImportMethodOrField(declaringType, this.Name, this.MethodSignature);
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType.IsModulePseudoType ? null : declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return declaringType.Module; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       MissingMethod other = obj as MissingMethod;
-                       return other != null
-                               && other.declaringType == declaringType
-                               && other.name == name
-                               && other.signature.Equals(signature);
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() ^ name.GetHashCode() ^ signature.GetHashCode();
-               }
-
-               internal override MethodBase BindTypeParameters(Type type)
-               {
-                       MethodInfo forwarder = TryGetForwarder();
-                       if (forwarder != null)
-                       {
-                               return forwarder.BindTypeParameters(type);
-                       }
-                       return new GenericMethodInstance(type, this, null);
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get { return Forwarder.ContainsGenericParameters; }
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       MethodInfo method = TryGetForwarder();
-                       if (method != null)
-                       {
-                               return Forwarder.GetGenericArguments();
-                       }
-                       if (typeArgs == null)
-                       {
-                               typeArgs = new Type[signature.GenericParameterCount];
-                               for (int i = 0; i < typeArgs.Length; i++)
-                               {
-                                       typeArgs[i] = new MissingTypeParameter(this, i);
-                               }
-                       }
-                       return Util.Copy(typeArgs);
-               }
-
-               internal override Type GetGenericMethodArgument(int index)
-               {
-                       return GetGenericArguments()[index];
-               }
-
-               internal override int GetGenericMethodArgumentCount()
-               {
-                       return Forwarder.GetGenericMethodArgumentCount();
-               }
-
-               public override MethodInfo GetGenericMethodDefinition()
-               {
-                       return Forwarder.GetGenericMethodDefinition();
-               }
-
-               internal override MethodInfo GetMethodOnTypeDefinition()
-               {
-                       return Forwarder.GetMethodOnTypeDefinition();
-               }
-
-               internal override bool HasThis
-               {
-                       get { return (signature.CallingConvention & (CallingConventions.HasThis | CallingConventions.ExplicitThis)) == CallingConventions.HasThis; }
-               }
-
-               public override bool IsGenericMethod
-               {
-                       get { return IsGenericMethodDefinition; }
-               }
-
-               public override bool IsGenericMethodDefinition
-               {
-                       get { return signature.GenericParameterCount != 0; }
-               }
-
-               public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       MethodInfo method = TryGetForwarder();
-                       if (method != null)
-                       {
-                               return method.MakeGenericMethod(typeArguments);
-                       }
-                       return new GenericMethodInstance(declaringType, this, typeArguments);
-               }
-
-               public override int MetadataToken
-               {
-                       get { return Forwarder.MetadataToken; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return Forwarder.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return Forwarder.IsBaked; }
-               }
-       }
-
-       sealed class MissingField : FieldInfo
-       {
-               private readonly Type declaringType;
-               private readonly string name;
-               private readonly FieldSignature signature;
-               private FieldInfo forwarder;
-
-               internal MissingField(Type declaringType, string name, FieldSignature signature)
-               {
-                       this.declaringType = declaringType;
-                       this.name = name;
-                       this.signature = signature;
-               }
-
-               private FieldInfo Forwarder
-               {
-                       get
-                       {
-                               FieldInfo field = TryGetForwarder();
-                               if (field == null)
-                               {
-                                       throw new MissingMemberException(this);
-                               }
-                               return field;
-                       }
-               }
-
-               private FieldInfo TryGetForwarder()
-               {
-                       if (forwarder == null && !declaringType.__IsMissing)
-                       {
-                               forwarder = declaringType.FindField(name, signature);
-                       }
-                       return forwarder;
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return TryGetForwarder() == null; }
-               }
-
-               public override FieldAttributes Attributes
-               {
-                       get { return Forwarder.Attributes; }
-               }
-
-               public override void __GetDataFromRVA(byte[] data, int offset, int length)
-               {
-                       Forwarder.__GetDataFromRVA(data, offset, length);
-               }
-
-               public override int __FieldRVA
-               {
-                       get { return Forwarder.__FieldRVA; }
-               }
-
-               public override bool __TryGetFieldOffset(out int offset)
-               {
-                       return Forwarder.__TryGetFieldOffset(out offset);
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return Forwarder.GetRawConstantValue();
-               }
-
-               internal override FieldSignature FieldSignature
-               {
-                       get { return signature; }
-               }
-
-               internal override int ImportTo(IKVM.Reflection.Emit.ModuleBuilder module)
-               {
-                       FieldInfo field = TryGetForwarder();
-                       if (field != null)
-                       {
-                               return field.ImportTo(module);
-                       }
-                       return module.ImportMethodOrField(declaringType, this.Name, this.FieldSignature);
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType.IsModulePseudoType ? null : declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return declaringType.Module; }
-               }
-
-               internal override FieldInfo BindTypeParameters(Type type)
-               {
-                       FieldInfo forwarder = TryGetForwarder();
-                       if (forwarder != null)
-                       {
-                               return forwarder.BindTypeParameters(type);
-                       }
-                       return new GenericFieldInstance(type, this);
-               }
-
-               public override int MetadataToken
-               {
-                       get { return Forwarder.MetadataToken; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       MissingField other = obj as MissingField;
-                       return other != null
-                               && other.declaringType == declaringType
-                               && other.name == name
-                               && other.signature.Equals(signature);
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() ^ name.GetHashCode() ^ signature.GetHashCode();
-               }
-
-               public override string ToString()
-               {
-                       return this.FieldType.Name + " " + this.Name;
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return Forwarder.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return Forwarder.IsBaked; }
-               }
-       }
-
-       // NOTE this is currently only used by CustomAttributeData (because there is no other way to refer to a property)
-       sealed class MissingProperty : PropertyInfo
-       {
-               private readonly Type declaringType;
-               private readonly string name;
-               private readonly PropertySignature signature;
-
-               internal MissingProperty(Type declaringType, string name, PropertySignature signature)
-               {
-                       this.declaringType = declaringType;
-                       this.name = name;
-                       this.signature = signature;
-               }
-
-               public override PropertyAttributes Attributes
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override bool CanRead
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override bool CanWrite
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               public override MethodInfo GetGetMethod(bool nonPublic)
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override MethodInfo GetSetMethod(bool nonPublic)
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override MethodInfo[] GetAccessors(bool nonPublic)
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       throw new MissingMemberException(this);
-               }
-
-               internal override bool IsPublic
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               internal override bool IsStatic
-               {
-                       get { throw new MissingMemberException(this); }
-               }
-
-               internal override PropertySignature PropertySignature
-               {
-                       get { return signature; }
-               }
-
-               public override string Name
-               {
-                       get { return name; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return declaringType.Module; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return declaringType.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       throw new MissingMemberException(this);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Module.cs b/mcs/class/IKVM.Reflection/Module.cs
deleted file mode 100644 (file)
index d734aae..0000000
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       public sealed class RawModule : IDisposable
-       {
-               private readonly ModuleReader module;
-               private readonly bool isManifestModule;
-               private bool imported;
-
-               internal RawModule(ModuleReader module)
-               {
-                       this.module = module;
-                       this.isManifestModule = module.Assembly != null;
-               }
-
-               public string Location
-               {
-                       get { return module.FullyQualifiedName; }
-               }
-
-               public bool IsManifestModule
-               {
-                       get { return isManifestModule; }
-               }
-
-               public Guid ModuleVersionId
-               {
-                       get { return module.ModuleVersionId; }
-               }
-
-               private void CheckManifestModule()
-               {
-                       if (!IsManifestModule)
-                       {
-                               throw new BadImageFormatException("Module does not contain a manifest");
-                       }
-               }
-
-               public AssemblyName GetAssemblyName()
-               {
-                       CheckManifestModule();
-                       return module.Assembly.GetName();
-               }
-
-               public AssemblyName[] GetReferencedAssemblies()
-               {
-                       return module.__GetReferencedAssemblies();
-               }
-
-               public void Dispose()
-               {
-                       if (!imported)
-                       {
-                               module.stream.Dispose();
-                       }
-               }
-
-               internal AssemblyReader ToAssembly()
-               {
-                       if (imported)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       imported = true;
-                       return (AssemblyReader)module.Assembly;
-               }
-
-               internal Module ToModule(Assembly assembly)
-               {
-                       if (module.Assembly != null)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       imported = true;
-                       module.SetAssembly(assembly);
-                       return module;
-               }
-       }
-
-       public abstract class Module : ICustomAttributeProvider
-       {
-               internal readonly Universe universe;
-               internal readonly ModuleTable ModuleTable = new ModuleTable();
-               internal readonly TypeRefTable TypeRef = new TypeRefTable();
-               internal readonly TypeDefTable TypeDef = new TypeDefTable();
-               internal readonly FieldPtrTable FieldPtr = new FieldPtrTable();
-               internal readonly FieldTable Field = new FieldTable();
-               internal readonly MemberRefTable MemberRef = new MemberRefTable();
-               internal readonly ConstantTable Constant = new ConstantTable();
-               internal readonly CustomAttributeTable CustomAttribute = new CustomAttributeTable();
-               internal readonly FieldMarshalTable FieldMarshal = new FieldMarshalTable();
-               internal readonly DeclSecurityTable DeclSecurity = new DeclSecurityTable();
-               internal readonly ClassLayoutTable ClassLayout = new ClassLayoutTable();
-               internal readonly FieldLayoutTable FieldLayout = new FieldLayoutTable();
-               internal readonly ParamPtrTable ParamPtr = new ParamPtrTable();
-               internal readonly ParamTable Param = new ParamTable();
-               internal readonly InterfaceImplTable InterfaceImpl = new InterfaceImplTable();
-               internal readonly StandAloneSigTable StandAloneSig = new StandAloneSigTable();
-               internal readonly EventMapTable EventMap = new EventMapTable();
-               internal readonly EventPtrTable EventPtr = new EventPtrTable();
-               internal readonly EventTable Event = new EventTable();
-               internal readonly PropertyMapTable PropertyMap = new PropertyMapTable();
-               internal readonly PropertyPtrTable PropertyPtr = new PropertyPtrTable();
-               internal readonly PropertyTable Property = new PropertyTable();
-               internal readonly MethodSemanticsTable MethodSemantics = new MethodSemanticsTable();
-               internal readonly MethodImplTable MethodImpl = new MethodImplTable();
-               internal readonly ModuleRefTable ModuleRef = new ModuleRefTable();
-               internal readonly TypeSpecTable TypeSpec = new TypeSpecTable();
-               internal readonly ImplMapTable ImplMap = new ImplMapTable();
-               internal readonly FieldRVATable FieldRVA = new FieldRVATable();
-               internal readonly AssemblyTable AssemblyTable = new AssemblyTable();
-               internal readonly AssemblyRefTable AssemblyRef = new AssemblyRefTable();
-               internal readonly MethodPtrTable MethodPtr = new MethodPtrTable();
-               internal readonly MethodDefTable MethodDef = new MethodDefTable();
-               internal readonly NestedClassTable NestedClass = new NestedClassTable();
-               internal readonly FileTable File = new FileTable();
-               internal readonly ExportedTypeTable ExportedType = new ExportedTypeTable();
-               internal readonly ManifestResourceTable ManifestResource = new ManifestResourceTable();
-               internal readonly GenericParamTable GenericParam = new GenericParamTable();
-               internal readonly MethodSpecTable MethodSpec = new MethodSpecTable();
-               internal readonly GenericParamConstraintTable GenericParamConstraint = new GenericParamConstraintTable();
-
-               protected Module(Universe universe)
-               {
-                       this.universe = universe;
-               }
-
-               internal Table[] GetTables()
-               {
-                       Table[] tables = new Table[64];
-                       tables[ModuleTable.Index] = ModuleTable;
-                       tables[TypeRefTable.Index] = TypeRef;
-                       tables[TypeDefTable.Index] = TypeDef;
-                       tables[FieldPtrTable.Index] = FieldPtr;
-                       tables[FieldTable.Index] = Field;
-                       tables[MemberRefTable.Index] = MemberRef;
-                       tables[ConstantTable.Index] = Constant;
-                       tables[CustomAttributeTable.Index] = CustomAttribute;
-                       tables[FieldMarshalTable.Index] = FieldMarshal;
-                       tables[DeclSecurityTable.Index] = DeclSecurity;
-                       tables[ClassLayoutTable.Index] = ClassLayout;
-                       tables[FieldLayoutTable.Index] = FieldLayout;
-                       tables[ParamPtrTable.Index] = ParamPtr;
-                       tables[ParamTable.Index] = Param;
-                       tables[InterfaceImplTable.Index] = InterfaceImpl;
-                       tables[StandAloneSigTable.Index] = StandAloneSig;
-                       tables[EventMapTable.Index] = EventMap;
-                       tables[EventPtrTable.Index] = EventPtr;
-                       tables[EventTable.Index] = Event;
-                       tables[PropertyMapTable.Index] = PropertyMap;
-                       tables[PropertyPtrTable.Index] = PropertyPtr;
-                       tables[PropertyTable.Index] = Property;
-                       tables[MethodSemanticsTable.Index] = MethodSemantics;
-                       tables[MethodImplTable.Index] = MethodImpl;
-                       tables[ModuleRefTable.Index] = ModuleRef;
-                       tables[TypeSpecTable.Index] = TypeSpec;
-                       tables[ImplMapTable.Index] = ImplMap;
-                       tables[FieldRVATable.Index] = FieldRVA;
-                       tables[AssemblyTable.Index] = AssemblyTable;
-                       tables[AssemblyRefTable.Index] = AssemblyRef;
-                       tables[MethodPtrTable.Index] = MethodPtr;
-                       tables[MethodDefTable.Index] = MethodDef;
-                       tables[NestedClassTable.Index] = NestedClass;
-                       tables[FileTable.Index] = File;
-                       tables[ExportedTypeTable.Index] = ExportedType;
-                       tables[ManifestResourceTable.Index] = ManifestResource;
-                       tables[GenericParamTable.Index] = GenericParam;
-                       tables[MethodSpecTable.Index] = MethodSpec;
-                       tables[GenericParamConstraintTable.Index] = GenericParamConstraint;
-                       return tables;
-               }
-
-               public virtual void __GetDataDirectoryEntry(int index, out int rva, out int length)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual long __RelativeVirtualAddressToFileOffset(int rva)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual bool __GetSectionInfo(int rva, out string name, out int characteristics)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual int __ReadDataFromRVA(int rva, byte[] data, int offset, int length)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual int __Subsystem
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public FieldInfo GetField(string name)
-               {
-                       return GetField(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
-               }
-
-               public FieldInfo GetField(string name, BindingFlags bindingFlags)
-               {
-                       return IsResource() ? null : GetModuleType().GetField(name, bindingFlags | BindingFlags.DeclaredOnly);
-               }
-
-               public FieldInfo[] GetFields()
-               {
-                       return GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
-               }
-
-               public FieldInfo[] GetFields(BindingFlags bindingFlags)
-               {
-                       return IsResource() ? Empty<FieldInfo>.Array : GetModuleType().GetFields(bindingFlags | BindingFlags.DeclaredOnly);
-               }
-
-               public MethodInfo GetMethod(string name)
-               {
-                       return IsResource() ? null : GetModuleType().GetMethod(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
-               }
-
-               public MethodInfo GetMethod(string name, Type[] types)
-               {
-                       return IsResource() ? null : GetModuleType().GetMethod(name, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, types, null);
-               }
-
-               public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
-               {
-                       return IsResource() ? null : GetModuleType().GetMethod(name, bindingAttr | BindingFlags.DeclaredOnly, binder, callConv, types, modifiers);
-               }
-
-               public MethodInfo[] GetMethods()
-               {
-                       return GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
-               }
-
-               public MethodInfo[] GetMethods(BindingFlags bindingFlags)
-               {
-                       return IsResource() ? Empty<MethodInfo>.Array : GetModuleType().GetMethods(bindingFlags | BindingFlags.DeclaredOnly);
-               }
-
-               public ConstructorInfo __ModuleInitializer
-               {
-                       get { return IsResource() ? null : GetModuleType().TypeInitializer; }
-               }
-
-               public virtual byte[] ResolveSignature(int metadataToken)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public int MetadataToken
-               {
-                       get { return IsResource() ? 0 : 1; }
-               }
-
-               public abstract int MDStreamVersion { get ;}
-               public abstract Assembly Assembly { get; }
-               public abstract string FullyQualifiedName { get; }
-               public abstract string Name { get; }
-               public abstract Guid ModuleVersionId { get; }
-               public abstract MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
-               public abstract FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
-               public abstract MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
-
-               public abstract string ResolveString(int metadataToken);
-               public abstract Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers);
-               public abstract string ScopeName { get; }
-
-               internal abstract void GetTypesImpl(List<Type> list);
-
-               internal abstract Type FindType(TypeName name);
-               internal abstract Type FindTypeIgnoreCase(TypeName lowerCaseName);
-
-               [Obsolete("Please use __ResolveOptionalParameterTypes(int, Type[], Type[], out CustomModifiers[]) instead.")]
-               public Type[] __ResolveOptionalParameterTypes(int metadataToken)
-               {
-                       CustomModifiers[] dummy;
-                       return __ResolveOptionalParameterTypes(metadataToken, null, null, out dummy);
-               }
-
-               public Type GetType(string className)
-               {
-                       return GetType(className, false, false);
-               }
-
-               public Type GetType(string className, bool ignoreCase)
-               {
-                       return GetType(className, false, ignoreCase);
-               }
-
-               public Type GetType(string className, bool throwOnError, bool ignoreCase)
-               {
-                       TypeNameParser parser = TypeNameParser.Parse(className, throwOnError);
-                       if (parser.Error)
-                       {
-                               return null;
-                       }
-                       if (parser.AssemblyName != null)
-                       {
-                               if (throwOnError)
-                               {
-                                       throw new ArgumentException("Type names passed to Module.GetType() must not specify an assembly.");
-                               }
-                               else
-                               {
-                                       return null;
-                               }
-                       }
-                       TypeName typeName = TypeName.Split(TypeNameParser.Unescape(parser.FirstNamePart));
-                       Type type = ignoreCase
-                               ? FindTypeIgnoreCase(typeName.ToLowerInvariant())
-                               : FindType(typeName);
-                       if (type == null && __IsMissing)
-                       {
-                               throw new MissingModuleException((MissingModule)this);
-                       }
-                       return parser.Expand(type, this.Assembly, throwOnError, className, false, ignoreCase);
-               }
-
-               public Type[] GetTypes()
-               {
-                       List<Type> list = new List<Type>();
-                       GetTypesImpl(list);
-                       return list.ToArray();
-               }
-
-               public Type[] FindTypes(TypeFilter filter, object filterCriteria)
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (Type type in GetTypes())
-                       {
-                               if (filter(type, filterCriteria))
-                               {
-                                       list.Add(type);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public virtual bool IsResource()
-               {
-                       return false;
-               }
-
-               public Type ResolveType(int metadataToken)
-               {
-                       return ResolveType(metadataToken, null, null);
-               }
-
-               internal sealed class GenericContext : IGenericContext
-               {
-                       private readonly Type[] genericTypeArguments;
-                       private readonly Type[] genericMethodArguments;
-
-                       internal GenericContext(Type[] genericTypeArguments, Type[] genericMethodArguments)
-                       {
-                               this.genericTypeArguments = genericTypeArguments;
-                               this.genericMethodArguments = genericMethodArguments;
-                       }
-
-                       public Type GetGenericTypeArgument(int index)
-                       {
-                               return genericTypeArguments[index];
-                       }
-
-                       public Type GetGenericMethodArgument(int index)
-                       {
-                               return genericMethodArguments[index];
-                       }
-               }
-
-               public Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       if ((metadataToken >> 24) == TypeSpecTable.Index)
-                       {
-                               return ResolveType(metadataToken, new GenericContext(genericTypeArguments, genericMethodArguments));
-                       }
-                       else
-                       {
-                               return ResolveType(metadataToken, null);
-                       }
-               }
-
-               internal abstract Type ResolveType(int metadataToken, IGenericContext context);
-
-               public MethodBase ResolveMethod(int metadataToken)
-               {
-                       return ResolveMethod(metadataToken, null, null);
-               }
-
-               public FieldInfo ResolveField(int metadataToken)
-               {
-                       return ResolveField(metadataToken, null, null);
-               }
-
-               public MemberInfo ResolveMember(int metadataToken)
-               {
-                       return ResolveMember(metadataToken, null, null);
-               }
-
-               public bool IsDefined(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
-               }
-
-               public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
-               }
-
-               public virtual IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
-               {
-                       return Empty<CustomAttributeData>.Array;
-               }
-
-               public abstract AssemblyName[] __GetReferencedAssemblies();
-
-               public virtual void __ResolveReferencedAssemblies(Assembly[] assemblies)
-               {
-                       throw new NotSupportedException();
-               }
-
-               public abstract string[] __GetReferencedModules();
-
-               public abstract Type[] __GetReferencedTypes();
-
-               public abstract Type[] __GetExportedTypes();
-
-               public virtual bool __IsMissing
-               {
-                       get { return false; }
-               }
-
-               public long __ImageBase
-               {
-                       get { return GetImageBaseImpl(); }
-               }
-
-               protected abstract long GetImageBaseImpl();
-
-               public long __StackReserve
-               {
-                       get { return GetStackReserveImpl(); }
-               }
-
-               protected abstract long GetStackReserveImpl();
-
-               public int __FileAlignment
-               {
-                       get { return GetFileAlignmentImpl(); }
-               }
-
-               protected abstract int GetFileAlignmentImpl();
-
-               public DllCharacteristics __DllCharacteristics
-               {
-                       get { return GetDllCharacteristicsImpl(); }
-               }
-
-               protected abstract DllCharacteristics GetDllCharacteristicsImpl();
-
-               public virtual byte[] __ModuleHash
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public virtual int __EntryPointRVA
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public virtual int __EntryPointToken
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public virtual string __ImageRuntimeVersion
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public IEnumerable<CustomAttributeData> __EnumerateCustomAttributeTable()
-               {
-                       List<CustomAttributeData> list = new List<CustomAttributeData>(CustomAttribute.RowCount);
-                       for (int i = 0; i < CustomAttribute.RowCount; i++)
-                       {
-                               list.Add(new CustomAttributeData(this, i));
-                       }
-                       return list;
-               }
-
-               [Obsolete]
-               public List<CustomAttributeData> __GetCustomAttributesFor(int token)
-               {
-                       return CustomAttributeData.GetCustomAttributesImpl(new List<CustomAttributeData>(), this, token, null);
-               }
-
-               internal abstract Type GetModuleType();
-
-               internal abstract ByteReader GetBlob(int blobIndex);
-
-               internal IList<CustomAttributeData> GetDeclarativeSecurity(int metadataToken)
-               {
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       foreach (int i in DeclSecurity.Filter(metadataToken))
-                       {
-                               CustomAttributeData.ReadDeclarativeSecurity(this, i, list);
-                       }
-                       return list;
-               }
-
-               internal virtual void Dispose()
-               {
-               }
-
-               internal virtual void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
-               {
-               }
-
-               internal virtual string GetString(int index)
-               {
-                       throw new NotSupportedException();
-               }
-       }
-
-       abstract class NonPEModule : Module
-       {
-               protected NonPEModule(Universe universe)
-                       : base(universe)
-               {
-               }
-
-               protected virtual Exception InvalidOperationException()
-               {
-                       return new InvalidOperationException();
-               }
-
-               protected virtual Exception NotSupportedException()
-               {
-                       return new NotSupportedException();
-               }
-
-               protected virtual Exception ArgumentOutOfRangeException()
-               {
-                       return new ArgumentOutOfRangeException();
-               }
-
-               internal sealed override Type GetModuleType()
-               {
-                       throw InvalidOperationException();
-               }
-
-               internal sealed override ByteReader GetBlob(int blobIndex)
-               {
-                       throw InvalidOperationException();
-               }
-
-               public sealed override AssemblyName[] __GetReferencedAssemblies()
-               {
-                       throw NotSupportedException();
-               }
-
-               public sealed override string[] __GetReferencedModules()
-               {
-                       throw NotSupportedException();
-               }
-
-               public override Type[] __GetReferencedTypes()
-               {
-                       throw NotSupportedException();
-               }
-
-               public override Type[] __GetExportedTypes()
-               {
-                       throw NotSupportedException();
-               }
-
-               protected sealed override long GetImageBaseImpl()
-               {
-                       throw NotSupportedException();
-               }
-
-               protected sealed override long GetStackReserveImpl()
-               {
-                       throw NotSupportedException();
-               }
-
-               protected sealed override int GetFileAlignmentImpl()
-               {
-                       throw NotSupportedException();
-               }
-
-               protected override DllCharacteristics GetDllCharacteristicsImpl()
-               {
-                       throw NotSupportedException();
-               }
-
-               internal sealed override Type ResolveType(int metadataToken, IGenericContext context)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-
-               public sealed override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-
-               public sealed override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-
-               public sealed override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-
-               public sealed override string ResolveString(int metadataToken)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-
-               public sealed override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
-               {
-                       throw ArgumentOutOfRangeException();
-               }
-       }
-
-       public delegate bool TypeFilter(Type m, object filterCriteria);
-       public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
-}
diff --git a/mcs/class/IKVM.Reflection/ParameterInfo.cs b/mcs/class/IKVM.Reflection/ParameterInfo.cs
deleted file mode 100644 (file)
index fa704ad..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
-       public abstract class ParameterInfo : ICustomAttributeProvider
-       {
-               // prevent external subclasses
-               internal ParameterInfo()
-               {
-               }
-
-               public sealed override bool Equals(object obj)
-               {
-                       ParameterInfo other = obj as ParameterInfo;
-                       return other != null && other.Member == this.Member && other.Position == this.Position;
-               }
-
-               public sealed override int GetHashCode()
-               {
-                       return this.Member.GetHashCode() * 1777 + this.Position;
-               }
-
-               public static bool operator ==(ParameterInfo p1, ParameterInfo p2)
-               {
-                       return ReferenceEquals(p1, p2) || (!ReferenceEquals(p1, null) && p1.Equals(p2));
-               }
-
-               public static bool operator !=(ParameterInfo p1, ParameterInfo p2)
-               {
-                       return !(p1 == p2);
-               }
-
-               public abstract string Name { get; }
-               public abstract Type ParameterType { get; }
-               public abstract ParameterAttributes Attributes { get; }
-               public abstract int Position { get; }
-               public abstract object RawDefaultValue { get; }
-               public abstract CustomModifiers __GetCustomModifiers();
-               public abstract bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal);
-               public abstract MemberInfo Member { get; }
-               public abstract int MetadataToken { get; }
-               internal abstract Module Module { get; }
-
-               public Type[] GetOptionalCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetOptional();
-               }
-
-               public Type[] GetRequiredCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetRequired();
-               }
-
-               public bool IsIn
-               {
-                       get { return (Attributes & ParameterAttributes.In) != 0; }
-               }
-
-               public bool IsOut
-               {
-                       get { return (Attributes & ParameterAttributes.Out) != 0; }
-               }
-
-               public bool IsLcid
-               {
-                       get { return (Attributes & ParameterAttributes.Lcid) != 0; }
-               }
-
-               public bool IsRetval
-               {
-                       get { return (Attributes & ParameterAttributes.Retval) != 0; }
-               }
-
-               public bool IsOptional
-               {
-                       get { return (Attributes & ParameterAttributes.Optional) != 0; }
-               }
-
-               public bool IsDefined(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit).Count != 0;
-               }
-
-               public IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit)
-               {
-                       return CustomAttributeData.__GetCustomAttributes(this, attributeType, inherit);
-               }
-       }
-
-       sealed class ParameterInfoWrapper : ParameterInfo
-       {
-               private readonly MemberInfo member;
-               private readonly ParameterInfo forward;
-
-               internal ParameterInfoWrapper(MemberInfo member, ParameterInfo forward)
-               {
-                       this.member = member;
-                       this.forward = forward;
-               }
-
-               public override string Name
-               {
-                       get { return forward.Name; }
-               }
-
-               public override Type ParameterType
-               {
-                       get { return forward.ParameterType; }
-               }
-
-               public override ParameterAttributes Attributes
-               {
-                       get { return forward.Attributes; }
-               }
-
-               public override int Position
-               {
-                       get { return forward.Position; }
-               }
-
-               public override object RawDefaultValue
-               {
-                       get { return forward.RawDefaultValue; }
-               }
-
-               public override CustomModifiers __GetCustomModifiers()
-               {
-                       return forward.__GetCustomModifiers();
-               }
-
-               public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-               {
-                       return forward.__TryGetFieldMarshal(out fieldMarshal);
-               }
-
-               public override MemberInfo Member
-               {
-                       get { return member; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return forward.MetadataToken; }
-               }
-
-               internal override Module Module
-               {
-                       get { return member.Module; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/ParameterModifier.cs b/mcs/class/IKVM.Reflection/ParameterModifier.cs
deleted file mode 100644 (file)
index 605cca4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       public struct ParameterModifier
-       {
-               private readonly bool[] values;
-
-               public ParameterModifier(int parameterCount)
-               {
-                       values = new bool[parameterCount];
-               }
-
-               public bool this[int index]
-               {
-                       get { return values[index]; }
-                       set { values[index] = value; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Properties/AssemblyInfo.cs b/mcs/class/IKVM.Reflection/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index f453241..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System.Reflection;
-
-[assembly: AssemblyTitle("IKVM.Reflection")]
-[assembly: AssemblyDescription("Alternative implementation of System.Reflection[.Emit]")]
diff --git a/mcs/class/IKVM.Reflection/PropertyInfo.cs b/mcs/class/IKVM.Reflection/PropertyInfo.cs
deleted file mode 100644 (file)
index b05d07f..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
-       public abstract class PropertyInfo : MemberInfo
-       {
-               // prevent external subclasses
-               internal PropertyInfo()
-               {
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return MemberTypes.Property; }
-               }
-
-               public abstract PropertyAttributes Attributes { get; }
-               public abstract bool CanRead { get; }
-               public abstract bool CanWrite { get; }
-               public abstract MethodInfo GetGetMethod(bool nonPublic);
-               public abstract MethodInfo GetSetMethod(bool nonPublic);
-               public abstract MethodInfo[] GetAccessors(bool nonPublic);
-               public abstract object GetRawConstantValue();
-               internal abstract bool IsPublic { get; }
-               internal abstract bool IsNonPrivate { get; }
-               internal abstract bool IsStatic { get; }
-               internal abstract PropertySignature PropertySignature { get; }
-
-               private sealed class ParameterInfoImpl : ParameterInfo
-               {
-                       private readonly PropertyInfo property;
-                       private readonly int parameter;
-
-                       internal ParameterInfoImpl(PropertyInfo property, int parameter)
-                       {
-                               this.property = property;
-                               this.parameter = parameter;
-                       }
-
-                       public override string Name
-                       {
-                               get { return null; }
-                       }
-
-                       public override Type ParameterType
-                       {
-                               get { return property.PropertySignature.GetParameter(parameter); }
-                       }
-
-                       public override ParameterAttributes Attributes
-                       {
-                               get { return ParameterAttributes.None; }
-                       }
-
-                       public override int Position
-                       {
-                               get { return parameter; }
-                       }
-
-                       public override object RawDefaultValue
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       public override CustomModifiers __GetCustomModifiers()
-                       {
-                               return property.PropertySignature.GetParameterCustomModifiers(parameter);
-                       }
-
-                       public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-                       {
-                               fieldMarshal = new FieldMarshal();
-                               return false;
-                       }
-
-                       public override MemberInfo Member
-                       {
-                               get { return property; }
-                       }
-
-                       public override int MetadataToken
-                       {
-                               get { return 0x08000000; }
-                       }
-
-                       internal override Module Module
-                       {
-                               get { return property.Module; }
-                       }
-               }
-
-               public virtual ParameterInfo[] GetIndexParameters()
-               {
-                       ParameterInfo[] parameters = new ParameterInfo[this.PropertySignature.ParameterCount];
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoImpl(this, i);
-                       }
-                       return parameters;
-               }
-
-               public Type PropertyType
-               {
-                       get { return this.PropertySignature.PropertyType; }
-               }
-
-               public CustomModifiers __GetCustomModifiers()
-               {
-                       return this.PropertySignature.GetCustomModifiers();
-               }
-
-               public Type[] GetRequiredCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetRequired();
-               }
-
-               public Type[] GetOptionalCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetOptional();
-               }
-
-               public bool IsSpecialName
-               {
-                       get { return (Attributes & PropertyAttributes.SpecialName) != 0; }
-               }
-
-               public MethodInfo GetGetMethod()
-               {
-                       return GetGetMethod(false);
-               }
-
-               public MethodInfo GetSetMethod()
-               {
-                       return GetSetMethod(false);
-               }
-
-               public MethodInfo[] GetAccessors()
-               {
-                       return GetAccessors(false);
-               }
-
-               public CallingConventions __CallingConvention
-               {
-                       get { return this.PropertySignature.CallingConvention; }
-               }
-
-               internal virtual PropertyInfo BindTypeParameters(Type type)
-               {
-                       return new GenericPropertyInfo(this.DeclaringType.BindTypeParameters(type), this);
-               }
-
-               public override string ToString()
-               {
-                       return this.DeclaringType.ToString() + " " + Name;
-               }
-
-               internal sealed override bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       return BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static, BindingFlags.Instance);
-               }
-
-               internal sealed override bool BindingFlagsMatchInherited(BindingFlags flags)
-               {
-                       return IsNonPrivate
-                               && BindingFlagsMatch(IsPublic, flags, BindingFlags.Public, BindingFlags.NonPublic)
-                               && BindingFlagsMatch(IsStatic, flags, BindingFlags.Static | BindingFlags.FlattenHierarchy, BindingFlags.Instance);
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       return new PropertyInfoWithReflectedType(type, this);
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       // properties don't have pseudo custom attributes
-                       return null;
-               }
-       }
-
-       sealed class PropertyInfoWithReflectedType : PropertyInfo
-       {
-               private readonly Type reflectedType;
-               private readonly PropertyInfo property;
-
-               internal PropertyInfoWithReflectedType(Type reflectedType, PropertyInfo property)
-               {
-                       this.reflectedType = reflectedType;
-                       this.property = property;
-               }
-
-               public override PropertyAttributes Attributes
-               {
-                       get { return property.Attributes; }
-               }
-
-               public override bool CanRead
-               {
-                       get { return property.CanRead; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return property.CanWrite; }
-               }
-
-               public override MethodInfo GetGetMethod(bool nonPublic)
-               {
-                       return SetReflectedType(property.GetGetMethod(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo GetSetMethod(bool nonPublic)
-               {
-                       return SetReflectedType(property.GetSetMethod(nonPublic), reflectedType);
-               }
-
-               public override MethodInfo[] GetAccessors(bool nonPublic)
-               {
-                       return SetReflectedType(property.GetAccessors(nonPublic), reflectedType);
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return property.GetRawConstantValue();
-               }
-
-               internal override bool IsPublic
-               {
-                       get { return property.IsPublic; }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get { return property.IsNonPrivate; }
-               }
-
-               internal override bool IsStatic
-               {
-                       get { return property.IsStatic; }
-               }
-
-               internal override PropertySignature PropertySignature
-               {
-                       get { return property.PropertySignature; }
-               }
-
-               public override ParameterInfo[] GetIndexParameters()
-               {
-                       ParameterInfo[] parameters = property.GetIndexParameters();
-                       for (int i = 0; i < parameters.Length; i++)
-                       {
-                               parameters[i] = new ParameterInfoWrapper(this, parameters[i]);
-                       }
-                       return parameters;
-               }
-
-               internal override PropertyInfo BindTypeParameters(Type type)
-               {
-                       return property.BindTypeParameters(type);
-               }
-
-               public override string ToString()
-               {
-                       return property.ToString();
-               }
-
-               public override bool __IsMissing
-               {
-                       get { return property.__IsMissing; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return property.DeclaringType; }
-               }
-
-               public override Type ReflectedType
-               {
-                       get { return reflectedType; }
-               }
-
-               public override bool Equals(object obj)
-               {
-                       PropertyInfoWithReflectedType other = obj as PropertyInfoWithReflectedType;
-                       return other != null
-                               && other.reflectedType == reflectedType
-                               && other.property == property;
-               }
-
-               public override int GetHashCode()
-               {
-                       return reflectedType.GetHashCode() ^ property.GetHashCode();
-               }
-
-               public override int MetadataToken
-               {
-                       get { return property.MetadataToken; }
-               }
-
-               public override Module Module
-               {
-                       get { return property.Module; }
-               }
-
-               public override string Name
-               {
-                       get { return property.Name; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return property.IsBaked; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return property.GetCurrentToken();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/PropertySignature.cs b/mcs/class/IKVM.Reflection/PropertySignature.cs
deleted file mode 100644 (file)
index 9a4a553..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       sealed class PropertySignature : Signature
-       {
-               private CallingConventions callingConvention;
-               private readonly Type propertyType;
-               private readonly Type[] parameterTypes;
-               private readonly PackedCustomModifiers customModifiers;
-
-               internal static PropertySignature Create(CallingConventions callingConvention, Type propertyType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       return new PropertySignature(callingConvention, propertyType, Util.Copy(parameterTypes), customModifiers);
-               }
-
-               private PropertySignature(CallingConventions callingConvention, Type propertyType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       this.callingConvention = callingConvention;
-                       this.propertyType = propertyType;
-                       this.parameterTypes = parameterTypes;
-                       this.customModifiers = customModifiers;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       PropertySignature other = obj as PropertySignature;
-                       return other != null
-                               && other.propertyType.Equals(propertyType)
-                               && other.customModifiers.Equals(customModifiers);
-               }
-
-               public override int GetHashCode()
-               {
-                       return propertyType.GetHashCode() ^ customModifiers.GetHashCode();
-               }
-
-               internal int ParameterCount
-               {
-                       get { return parameterTypes.Length; }
-               }
-
-               internal bool HasThis
-               {
-                       set
-                       {
-                               if (value)
-                               {
-                                       callingConvention |= CallingConventions.HasThis;
-                               }
-                               else
-                               {
-                                       callingConvention &= ~CallingConventions.HasThis;
-                               }
-                       }
-               }
-
-               internal Type PropertyType
-               {
-                       get { return propertyType; }
-               }
-
-               internal CustomModifiers GetCustomModifiers()
-               {
-                       return customModifiers.GetReturnTypeCustomModifiers();
-               }
-
-               internal PropertySignature ExpandTypeParameters(Type declaringType)
-               {
-                       return new PropertySignature(
-                               callingConvention,
-                               propertyType.BindTypeParameters(declaringType),
-                               BindTypeParameters(declaringType, parameterTypes),
-                               customModifiers.Bind(declaringType));
-               }
-
-               internal override void WriteSig(ModuleBuilder module, ByteBuffer bb)
-               {
-                       byte flags = PROPERTY;
-                       if ((callingConvention & CallingConventions.HasThis) != 0)
-                       {
-                               flags |= HASTHIS;
-                       }
-                       if ((callingConvention & CallingConventions.ExplicitThis) != 0)
-                       {
-                               flags |= EXPLICITTHIS;
-                       }
-                       if ((callingConvention & CallingConventions.VarArgs) != 0)
-                       {
-                               flags |= VARARG;
-                       }
-                       bb.Write(flags);
-                       bb.WriteCompressedInt(parameterTypes == null ? 0 : parameterTypes.Length);
-                       WriteCustomModifiers(module, bb, customModifiers.GetReturnTypeCustomModifiers());
-                       WriteType(module, bb, propertyType);
-                       if (parameterTypes != null)
-                       {
-                               for (int i = 0; i < parameterTypes.Length; i++)
-                               {
-                                       WriteCustomModifiers(module, bb, customModifiers.GetParameterCustomModifiers(i));
-                                       WriteType(module, bb, parameterTypes[i]);
-                               }
-                       }
-               }
-
-               internal Type GetParameter(int parameter)
-               {
-                       return parameterTypes[parameter];
-               }
-
-               internal CustomModifiers GetParameterCustomModifiers(int parameter)
-               {
-                       return customModifiers.GetParameterCustomModifiers(parameter);
-               }
-
-               internal CallingConventions CallingConvention
-               {
-                       get { return callingConvention; }
-               }
-
-               internal bool MatchParameterTypes(Type[] types)
-               {
-                       return Util.ArrayEquals(types, parameterTypes);
-               }
-
-               internal static PropertySignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       byte flags = br.ReadByte();
-                       if ((flags & PROPERTY) == 0)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       CallingConventions callingConvention = CallingConventions.Standard;
-                       if ((flags & HASTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.HasThis;
-                       }
-                       if ((flags & EXPLICITTHIS) != 0)
-                       {
-                               callingConvention |= CallingConventions.ExplicitThis;
-                       }
-                       Type returnType;
-                       Type[] parameterTypes;
-                       int paramCount = br.ReadCompressedInt();
-                       CustomModifiers[] mods = null;
-                       PackedCustomModifiers.Pack(ref mods, 0, CustomModifiers.Read(module, br, context), paramCount + 1);
-                       returnType = ReadRetType(module, br, context);
-                       parameterTypes = new Type[paramCount];
-                       for (int i = 0; i < parameterTypes.Length; i++)
-                       {
-                               PackedCustomModifiers.Pack(ref mods, i + 1, CustomModifiers.Read(module, br, context), paramCount + 1);
-                               parameterTypes[i] = ReadParam(module, br, context);
-                       }
-                       return new PropertySignature(callingConvention, returnType, parameterTypes, PackedCustomModifiers.Wrap(mods));
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/AssemblyReader.cs b/mcs/class/IKVM.Reflection/Reader/AssemblyReader.cs
deleted file mode 100644 (file)
index 0004862..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Configuration.Assemblies;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class AssemblyReader : Assembly
-       {
-               private const int ContainsNoMetaData = 0x0001;
-               private readonly string location;
-               private readonly ModuleReader manifestModule;
-               private readonly Module[] externalModules;
-
-               internal AssemblyReader(string location, ModuleReader manifestModule)
-                       : base(manifestModule.universe)
-               {
-                       this.location = location;
-                       this.manifestModule = manifestModule;
-                       externalModules = new Module[manifestModule.File.records.Length];
-               }
-
-               public override string Location
-               {
-                       get { return location; }
-               }
-
-               public override AssemblyName GetName()
-               {
-                       return GetNameImpl(ref manifestModule.AssemblyTable.records[0]);
-               }
-
-               private AssemblyName GetNameImpl(ref AssemblyTable.Record rec)
-               {
-                       AssemblyName name = new AssemblyName();
-                       name.Name = manifestModule.GetString(rec.Name);
-                       name.Version = new Version(rec.MajorVersion, rec.MinorVersion, rec.BuildNumber, rec.RevisionNumber);
-                       if (rec.PublicKey != 0)
-                       {
-                               name.SetPublicKey(manifestModule.GetBlobCopy(rec.PublicKey));
-                       }
-                       else
-                       {
-                               name.SetPublicKey(Empty<byte>.Array);
-                       }
-                       if (rec.Culture != 0)
-                       {
-                               name.Culture = manifestModule.GetString(rec.Culture);
-                       }
-                       else
-                       {
-                               name.Culture = "";
-                       }
-                       name.HashAlgorithm = (AssemblyHashAlgorithm)rec.HashAlgId;
-                       name.CodeBase = this.CodeBase;
-                       name.RawFlags = (AssemblyNameFlags)rec.Flags;
-                       return name;
-               }
-
-               public override Type[] GetTypes()
-               {
-                       if (externalModules.Length == 0)
-                       {
-                               return manifestModule.GetTypes();
-                       }
-
-                       List<Type> list = new List<Type>();
-                       foreach (Module module in GetModules(false))
-                       {
-                               list.AddRange(module.GetTypes());
-                       }
-                       return list.ToArray();
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       Type type = manifestModule.FindType(typeName);
-                       for (int i = 0; type == null && i < externalModules.Length; i++)
-                       {
-                               if ((manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
-                               {
-                                       type = GetModule(i).FindType(typeName);
-                               }
-                       }
-                       return type;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       Type type = manifestModule.FindTypeIgnoreCase(lowerCaseName);
-                       for (int i = 0; type == null && i < externalModules.Length; i++)
-                       {
-                               if ((manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
-                               {
-                                       type = GetModule(i).FindTypeIgnoreCase(lowerCaseName);
-                               }
-                       }
-                       return type;
-               }
-
-               public override string ImageRuntimeVersion
-               {
-                       get { return manifestModule.__ImageRuntimeVersion; }
-               }
-
-               public override Module ManifestModule
-               {
-                       get { return manifestModule; }
-               }
-
-               public override Module[] GetLoadedModules(bool getResourceModules)
-               {
-                       List<Module> list = new List<Module>();
-                       list.Add(manifestModule);
-                       foreach (Module m in externalModules)
-                       {
-                               if (m != null)
-                               {
-                                       list.Add(m);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public override Module[] GetModules(bool getResourceModules)
-               {
-                       if (externalModules.Length == 0)
-                       {
-                               return new Module[] { manifestModule };
-                       }
-                       else
-                       {
-                               List<Module> list = new List<Module>();
-                               list.Add(manifestModule);
-                               for (int i = 0; i < manifestModule.File.records.Length; i++)
-                               {
-                                       if (getResourceModules || (manifestModule.File.records[i].Flags & ContainsNoMetaData) == 0)
-                                       {
-                                               list.Add(GetModule(i));
-                                       }
-                               }
-                               return list.ToArray();
-                       }
-               }
-
-               public override Module GetModule(string name)
-               {
-                       if (name.Equals(manifestModule.ScopeName, StringComparison.InvariantCultureIgnoreCase))
-                       {
-                               return manifestModule;
-                       }
-                       int index = GetModuleIndex(name);
-                       if (index != -1)
-                       {
-                               return GetModule(index);
-                       }
-                       return null;
-               }
-
-               private int GetModuleIndex(string name)
-               {
-                       for (int i = 0; i < manifestModule.File.records.Length; i++)
-                       {
-                               if (name.Equals(manifestModule.GetString(manifestModule.File.records[i].Name), StringComparison.InvariantCultureIgnoreCase))
-                               {
-                                       return i;
-                               }
-                       }
-                       return -1;
-               }
-
-               private Module GetModule(int index)
-               {
-                       if (externalModules[index] != null)
-                       {
-                               return externalModules[index];
-                       }
-                       // TODO add ModuleResolve event
-                       string location = Path.Combine(Path.GetDirectoryName(this.location), manifestModule.GetString(manifestModule.File.records[index].Name));
-                       return LoadModule(index, null, location);
-               }
-
-               private Module LoadModule(int index, byte[] rawModule, string location)
-               {
-                       if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0)
-                       {
-                               return externalModules[index] = new ResourceModule(manifestModule, index, location);
-                       }
-                       else
-                       {
-                               if (rawModule == null)
-                               {
-                                       rawModule = File.ReadAllBytes(location);
-                               }
-                               return externalModules[index] = new ModuleReader(this, manifestModule.universe, new MemoryStream(rawModule), location);
-                       }
-               }
-
-               public override Module LoadModule(string moduleName, byte[] rawModule)
-               {
-                       int index = GetModuleIndex(moduleName);
-                       if (index == -1)
-                       {
-                               throw new ArgumentException();
-                       }
-                       if (externalModules[index] != null)
-                       {
-                               return externalModules[index];
-                       }
-                       return LoadModule(index, rawModule, null);
-               }
-
-               public override MethodInfo EntryPoint
-               {
-                       get { return manifestModule.GetEntryPoint(); }
-               }
-
-               public override string[] GetManifestResourceNames()
-               {
-                       return manifestModule.GetManifestResourceNames();
-               }
-
-               public override ManifestResourceInfo GetManifestResourceInfo(string resourceName)
-               {
-                       return manifestModule.GetManifestResourceInfo(resourceName);
-               }
-
-               public override Stream GetManifestResourceStream(string resourceName)
-               {
-                       return manifestModule.GetManifestResourceStream(resourceName);
-               }
-
-               public override AssemblyName[] GetReferencedAssemblies()
-               {
-                       return manifestModule.__GetReferencedAssemblies();
-               }
-
-               public override AssemblyNameFlags __AssemblyFlags
-               {
-                       get { return (AssemblyNameFlags)manifestModule.AssemblyTable.records[0].Flags; }
-               }
-
-               internal string Name
-               {
-                       get { return manifestModule.GetString(manifestModule.AssemblyTable.records[0].Name); }
-               }
-
-               internal override IList<CustomAttributeData> GetCustomAttributesData(Type attributeType)
-               {
-                       return CustomAttributeData.GetCustomAttributesImpl(null, manifestModule, 0x20000001, attributeType) ?? CustomAttributeData.EmptyList;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/ByteReader.cs b/mcs/class/IKVM.Reflection/Reader/ByteReader.cs
deleted file mode 100644 (file)
index a82744f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class ByteReader
-       {
-               private byte[] buffer;
-               private int pos;
-               private int end;
-
-               internal ByteReader(byte[] buffer, int offset, int length)
-               {
-                       this.buffer = buffer;
-                       this.pos = offset;
-                       this.end = pos + length;
-               }
-
-               internal static ByteReader FromBlob(byte[] blobHeap, int blob)
-               {
-                       ByteReader br = new ByteReader(blobHeap, blob, 4);
-                       int length = br.ReadCompressedInt();
-                       br.end = br.pos + length;
-                       return br;
-               }
-
-               internal int Length
-               {
-                       get { return end - pos; }
-               }
-
-               internal byte PeekByte()
-               {
-                       if (pos == end)
-                               throw new BadImageFormatException();
-                       return buffer[pos];
-               }
-
-               internal byte ReadByte()
-               {
-                       if (pos == end)
-                               throw new BadImageFormatException();
-                       return buffer[pos++];
-               }
-
-               internal byte[] ReadBytes(int count)
-               {
-                       if (count < 0)
-                               throw new BadImageFormatException();
-                       if (end - pos < count)
-                               throw new BadImageFormatException();
-                       byte[] buf = new byte[count];
-                       Buffer.BlockCopy(buffer, pos, buf, 0, count);
-                       pos += count;
-                       return buf;
-               }
-
-               internal int ReadCompressedInt()
-               {
-                       byte b1 = ReadByte();
-                       if (b1 <= 0x7F)
-                       {
-                               return b1;
-                       }
-                       else if ((b1 & 0xC0) == 0x80)
-                       {
-                               byte b2 = ReadByte();
-                               return ((b1 & 0x3F) << 8) | b2;
-                       }
-                       else
-                       {
-                               byte b2 = ReadByte();
-                               byte b3 = ReadByte();
-                               byte b4 = ReadByte();
-                               return ((b1 & 0x3F) << 24) + (b2 << 16) + (b3 << 8) + b4;
-                       }
-               }
-
-               internal string ReadString()
-               {
-                       if (PeekByte() == 0xFF)
-                       {
-                               pos++;
-                               return null;
-                       }
-                       int length = ReadCompressedInt();
-                       string str = Encoding.UTF8.GetString(buffer, pos, length);
-                       pos += length;
-                       return str;
-               }
-
-               internal char ReadChar()
-               {
-                       return (char)ReadInt16();
-               }
-
-               internal sbyte ReadSByte()
-               {
-                       return (sbyte)ReadByte();
-               }
-
-               internal short ReadInt16()
-               {
-                       if (end - pos < 2)
-                               throw new BadImageFormatException();
-                       byte b1 = buffer[pos++];
-                       byte b2 = buffer[pos++];
-                       return (short)(b1 | (b2 << 8));
-               }
-
-               internal ushort ReadUInt16()
-               {
-                       return (ushort)ReadInt16();
-               }
-
-               internal int ReadInt32()
-               {
-                       if (end - pos < 4)
-                               throw new BadImageFormatException();
-                       byte b1 = buffer[pos++];
-                       byte b2 = buffer[pos++];
-                       byte b3 = buffer[pos++];
-                       byte b4 = buffer[pos++];
-                       return (int)(b1 | (b2 << 8) | (b3 << 16) | (b4 << 24));
-               }
-
-               internal uint ReadUInt32()
-               {
-                       return (uint)ReadInt32();
-               }
-
-               internal long ReadInt64()
-               {
-                       ulong lo = ReadUInt32();
-                       ulong hi = ReadUInt32();
-                       return (long)(lo | (hi << 32));
-               }
-
-               internal ulong ReadUInt64()
-               {
-                       return (ulong)ReadInt64();
-               }
-
-               internal float ReadSingle()
-               {
-                       return SingleConverter.Int32BitsToSingle(ReadInt32());
-               }
-
-               internal double ReadDouble()
-               {
-                       return BitConverter.Int64BitsToDouble(ReadInt64());
-               }
-
-               internal ByteReader Slice(int length)
-               {
-                       if (end - pos < length)
-                               throw new BadImageFormatException();
-                       ByteReader br = new ByteReader(buffer, pos, length);
-                       pos += length;
-                       return br;
-               }
-
-               // NOTE this method only works if the original offset was aligned and for alignments that are a power of 2
-               internal void Align(int alignment)
-               {
-                       alignment--;
-                       pos = (pos + alignment) & ~alignment;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/EventInfoImpl.cs b/mcs/class/IKVM.Reflection/Reader/EventInfoImpl.cs
deleted file mode 100644 (file)
index 68d0bc0..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class EventInfoImpl : EventInfo
-       {
-               private readonly ModuleReader module;
-               private readonly Type declaringType;
-               private readonly int index;
-               private bool isPublic;
-               private bool isNonPrivate;
-               private bool isStatic;
-               private bool flagsCached;
-
-               internal EventInfoImpl(ModuleReader module, Type declaringType, int index)
-               {
-                       this.module = module;
-                       this.declaringType = declaringType;
-                       this.index = index;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       EventInfoImpl other = obj as EventInfoImpl;
-                       return other != null && other.declaringType == declaringType && other.index == index;
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() * 123 + index;
-               }
-
-               public override EventAttributes Attributes
-               {
-                       get { return (EventAttributes)module.Event.records[index].EventFlags; }
-               }
-
-               public override MethodInfo GetAddMethod(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.AddOn);
-               }
-
-               public override MethodInfo GetRaiseMethod(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Fire);
-               }
-
-               public override MethodInfo GetRemoveMethod(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.RemoveOn);
-               }
-
-               public override MethodInfo[] GetOtherMethods(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethods(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Other);
-               }
-
-               public override MethodInfo[] __GetMethods()
-               {
-                       return module.MethodSemantics.GetMethods(module, this.MetadataToken, true, -1);
-               }
-
-               public override Type EventHandlerType
-               {
-                       get { return module.ResolveType(module.Event.records[index].EventType, declaringType); }
-               }
-
-               public override string Name
-               {
-                       get { return module.GetString(module.Event.records[index].Name); }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (EventTable.Index << 24) + index + 1; }
-               }
-
-               internal override bool IsPublic
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isPublic;
-                       }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isNonPrivate;
-                       }
-               }
-
-               internal override bool IsStatic
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isStatic;
-                       }
-               }
-
-               private void ComputeFlags()
-               {
-                       module.MethodSemantics.ComputeFlags(module, this.MetadataToken, out isPublic, out isNonPrivate, out isStatic);
-                       flagsCached = true;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/Field.cs b/mcs/class/IKVM.Reflection/Reader/Field.cs
deleted file mode 100644 (file)
index 2aba292..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class FieldDefImpl : FieldInfo
-       {
-               private readonly ModuleReader module;
-               private readonly TypeDefImpl declaringType;
-               private readonly int index;
-               private FieldSignature lazyFieldSig;
-
-               internal FieldDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
-               {
-                       this.module = module;
-                       this.declaringType = declaringType;
-                       this.index = index;
-               }
-
-               public override FieldAttributes Attributes
-               {
-                       get { return (FieldAttributes)module.Field.records[index].Flags; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType.IsModulePseudoType ? null : declaringType; }
-               }
-
-               public override string Name
-               {
-                       get { return module.GetString(module.Field.records[index].Name); }
-               }
-
-               public override string ToString()
-               {
-                       return this.FieldType.Name + " " + this.Name;
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (FieldTable.Index << 24) + index + 1; }
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return module.Constant.GetRawConstantValue(module, this.MetadataToken);
-               }
-
-               public override void __GetDataFromRVA(byte[] data, int offset, int length)
-               {
-                       int rva = this.__FieldRVA;
-                       if (rva == 0)
-                       {
-                               // C++ assemblies can have fields that have an RVA that is zero
-                               Array.Clear(data, offset, length);
-                               return;
-                       }
-                       module.__ReadDataFromRVA(rva, data, offset, length);
-               }
-
-               public override int __FieldRVA
-               {
-                       get
-                       {
-                               foreach (int i in module.FieldRVA.Filter(index + 1))
-                               {
-                                       return module.FieldRVA.records[i].RVA;
-                               }
-                               throw new InvalidOperationException();
-                       }
-               }
-
-               public override bool __TryGetFieldOffset(out int offset)
-               {
-                       foreach (int i in this.Module.FieldLayout.Filter(index + 1))
-                       {
-                               offset = this.Module.FieldLayout.records[i].Offset;
-                               return true;
-                       }
-                       offset = 0;
-                       return false;
-               }
-
-               internal override FieldSignature FieldSignature
-               {
-                       get { return lazyFieldSig ?? (lazyFieldSig = FieldSignature.ReadSig(module, module.GetBlob(module.Field.records[index].Signature), declaringType)); }
-               }
-
-               internal override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       return module.ImportMethodOrField(declaringType, this.Name, this.FieldSignature);
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/GenericTypeParameter.cs b/mcs/class/IKVM.Reflection/Reader/GenericTypeParameter.cs
deleted file mode 100644 (file)
index d0c7405..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       abstract class TypeParameterType : TypeInfo
-       {
-               public sealed override string AssemblyQualifiedName
-               {
-                       get { return null; }
-               }
-
-               public sealed override bool IsValueType
-               {
-                       get { return (this.GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
-               }
-
-               public sealed override Type BaseType
-               {
-                       get
-                       {
-                               foreach (Type type in GetGenericParameterConstraints())
-                               {
-                                       if (!type.IsInterface && !type.IsGenericParameter)
-                                       {
-                                               return type;
-                                       }
-                               }
-                               return this.IsValueType ? this.Module.universe.System_ValueType : this.Module.universe.System_Object;
-                       }
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (Type type in GetGenericParameterConstraints())
-                       {
-                               if (type.IsInterface)
-                               {
-                                       list.Add(type);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public sealed override TypeAttributes Attributes
-               {
-                       get { return TypeAttributes.Public; }
-               }
-
-               public sealed override string FullName
-               {
-                       get { return null; }
-               }
-
-               public sealed override string ToString()
-               {
-                       return this.Name;
-               }
-
-               public sealed override bool IsGenericParameter
-               {
-                       get { return true; }
-               }
-
-               public sealed override bool __ContainsMissingType
-               {
-                       get
-                       {
-                               bool freeList = false;
-                               try
-                               {
-                                       foreach (Type type in GetGenericParameterConstraints())
-                                       {
-                                               if (type.__IsMissing)
-                                               {
-                                                       return true;
-                                               }
-                                               else if (type.IsConstructedGenericType || type.HasElementType || type.__IsFunctionPointer)
-                                               {
-                                                       // if a constructed type contains generic parameters,
-                                                       // it might contain this type parameter again and
-                                                       // to prevent infinite recurssion, we keep a thread local
-                                                       // list of type parameters we've already processed
-                                                       if (type.ContainsGenericParameters)
-                                                       {
-                                                               if (containsMissingTypeHack == null)
-                                                               {
-                                                                       freeList = true;
-                                                                       containsMissingTypeHack = new List<Type>();
-                                                               }
-                                                               else if (containsMissingTypeHack.Contains(this))
-                                                               {
-                                                                       return false;
-                                                               }
-                                                               containsMissingTypeHack.Add(this);
-                                                       }
-                                                       if (type.__ContainsMissingType)
-                                                       {
-                                                               return true;
-                                                       }
-                                               }
-                                       }
-                                       return false;
-                               }
-                               finally
-                               {
-                                       if (freeList)
-                                       {
-                                               containsMissingTypeHack = null;
-                                       }
-                               }
-                       }
-               }
-
-               [ThreadStatic]
-               private static List<Type> containsMissingTypeHack;
-       }
-
-       sealed class UnboundGenericMethodParameter : TypeParameterType
-       {
-               private static readonly DummyModule module = new DummyModule();
-               private readonly int position;
-
-               private sealed class DummyModule : NonPEModule
-               {
-                       internal DummyModule()
-                               : base(new Universe())
-                       {
-                       }
-
-                       protected override Exception NotSupportedException()
-                       {
-                               return new InvalidOperationException();
-                       }
-
-                       protected override Exception ArgumentOutOfRangeException()
-                       {
-                               return new InvalidOperationException();
-                       }
-
-                       public override bool Equals(object obj)
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       public override int GetHashCode()
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       public override string ToString()
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       public override int MDStreamVersion
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       public override Assembly Assembly
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       internal override Type FindType(TypeName typeName)
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       internal override void GetTypesImpl(List<Type> list)
-                       {
-                               throw new InvalidOperationException();
-                       }
-
-                       public override string FullyQualifiedName
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       public override string Name
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       public override Guid ModuleVersionId
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-
-                       public override string ScopeName
-                       {
-                               get { throw new InvalidOperationException(); }
-                       }
-               }
-
-               internal static Type Make(int position)
-               {
-                       return module.universe.CanonicalizeType(new UnboundGenericMethodParameter(position));
-               }
-
-               private UnboundGenericMethodParameter(int position)
-               {
-                       this.position = position;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       UnboundGenericMethodParameter other = obj as UnboundGenericMethodParameter;
-                       return other != null && other.position == position;
-               }
-
-               public override int GetHashCode()
-               {
-                       return position;
-               }
-
-               public override string Namespace
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override string Name
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override int MetadataToken
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int GenericParameterPosition
-               {
-                       get { return position; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return null; }
-               }
-
-               public override MethodBase DeclaringMethod
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override Type[] GetGenericParameterConstraints()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public override GenericParameterAttributes GenericParameterAttributes
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       return binder.BindMethodParameter(this);
-               }
-
-               internal override bool IsBaked
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-       }
-
-       sealed class GenericTypeParameter : TypeParameterType
-       {
-               private readonly ModuleReader module;
-               private readonly int index;
-
-               internal GenericTypeParameter(ModuleReader module, int index)
-               {
-                       this.module = module;
-                       this.index = index;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return base.Equals(obj);
-               }
-
-               public override int GetHashCode()
-               {
-                       return base.GetHashCode();
-               }
-
-               public override string Namespace
-               {
-                       get { return DeclaringType.Namespace; }
-               }
-
-               public override string Name
-               {
-                       get { return module.GetString(module.GenericParam.records[index].Name); }
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (GenericParamTable.Index << 24) + index + 1; }
-               }
-
-               public override int GenericParameterPosition
-               {
-                       get { return module.GenericParam.records[index].Number; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get
-                       {
-                               int owner = module.GenericParam.records[index].Owner;
-                               return (owner >> 24) == TypeDefTable.Index ? module.ResolveType(owner) : null;
-                       }
-               }
-
-               public override MethodBase DeclaringMethod
-               {
-                       get
-                       {
-                               int owner = module.GenericParam.records[index].Owner;
-                               return (owner >> 24) == MethodDefTable.Index ? module.ResolveMethod(owner) : null;
-                       }
-               }
-
-               public override Type[] GetGenericParameterConstraints()
-               {
-                       IGenericContext context = (this.DeclaringMethod as IGenericContext) ?? this.DeclaringType;
-                       List<Type> list = new List<Type>();
-                       foreach (int i in module.GenericParamConstraint.Filter(this.MetadataToken))
-                       {
-                               list.Add(module.ResolveType(module.GenericParamConstraint.records[i].Constraint, context));
-                       }
-                       return list.ToArray();
-               }
-
-               public override GenericParameterAttributes GenericParameterAttributes
-               {
-                       get { return (GenericParameterAttributes)module.GenericParam.records[index].Flags; }
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       int owner = module.GenericParam.records[index].Owner;
-                       if ((owner >> 24) == MethodDefTable.Index)
-                       {
-                               return binder.BindMethodParameter(this);
-                       }
-                       else
-                       {
-                               return binder.BindTypeParameter(this);
-                       }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/MetadataReader.cs b/mcs/class/IKVM.Reflection/Reader/MetadataReader.cs
deleted file mode 100644 (file)
index 28a4720..0000000
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.IO;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class MetadataReader : MetadataRW
-       {
-               private readonly Stream stream;
-               private const int bufferLength = 2048;
-               private readonly byte[] buffer = new byte[bufferLength];
-               private int pos = bufferLength;
-
-               internal MetadataReader(ModuleReader module, Stream stream, byte heapSizes)
-                       : base(module, (heapSizes & 0x01) != 0, (heapSizes & 0x02) != 0, (heapSizes & 0x04) != 0)
-               {
-                       this.stream = stream;
-               }
-
-               private void FillBuffer(int needed)
-               {
-                       int count = bufferLength - pos;
-                       if (count != 0)
-                       {
-                               // move remaining bytes to the front of the buffer
-                               Buffer.BlockCopy(buffer, pos, buffer, 0, count);
-                       }
-                       pos = 0;
-
-                       while (count < needed)
-                       {
-                               int len = stream.Read(buffer, count, bufferLength - count);
-                               if (len == 0)
-                               {
-                                       throw new BadImageFormatException();
-                               }
-                               count += len;
-                       }
-
-                       if (count != bufferLength)
-                       {
-                               // we didn't fill the buffer completely, so have to restore the invariant
-                               // that all data from pos up until the end of the buffer is valid
-                               Buffer.BlockCopy(buffer, 0, buffer, bufferLength - count, count);
-                               pos = bufferLength - count;
-                       }
-               }
-
-               internal ushort ReadUInt16()
-               {
-                       return (ushort)ReadInt16();
-               }
-
-               internal short ReadInt16()
-               {
-                       if (pos > bufferLength - 2)
-                       {
-                               FillBuffer(2);
-                       }
-                       byte b1 = buffer[pos++];
-                       byte b2 = buffer[pos++];
-                       return (short)(b1 | (b2 << 8));
-               }
-
-               internal int ReadInt32()
-               {
-                       if (pos > bufferLength - 4)
-                       {
-                               FillBuffer(4);
-                       }
-                       byte b1 = buffer[pos++];
-                       byte b2 = buffer[pos++];
-                       byte b3 = buffer[pos++];
-                       byte b4 = buffer[pos++];
-                       return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24);
-               }
-
-               private int ReadIndex(bool big)
-               {
-                       if (big)
-                       {
-                               return ReadInt32();
-                       }
-                       else
-                       {
-                               return ReadUInt16();
-                       }
-               }
-
-               internal int ReadStringIndex()
-               {
-                       return ReadIndex(bigStrings);
-               }
-
-               internal int ReadGuidIndex()
-               {
-                       return ReadIndex(bigGuids);
-               }
-
-               internal int ReadBlobIndex()
-               {
-                       return ReadIndex(bigBlobs);
-               }
-
-               internal int ReadResolutionScope()
-               {
-                       int codedIndex = ReadIndex(bigResolutionScope);
-                       switch (codedIndex & 3)
-                       {
-                               case 0:
-                                       return (ModuleTable.Index << 24) + (codedIndex >> 2);
-                               case 1:
-                                       return (ModuleRefTable.Index << 24) + (codedIndex >> 2);
-                               case 2:
-                                       return (AssemblyRefTable.Index << 24) + (codedIndex >> 2);
-                               case 3:
-                                       return (TypeRefTable.Index << 24) + (codedIndex >> 2);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadTypeDefOrRef()
-               {
-                       int codedIndex = ReadIndex(bigTypeDefOrRef);
-                       switch (codedIndex & 3)
-                       {
-                               case 0:
-                                       return (TypeDefTable.Index << 24) + (codedIndex >> 2);
-                               case 1:
-                                       return (TypeRefTable.Index << 24) + (codedIndex >> 2);
-                               case 2:
-                                       return (TypeSpecTable.Index << 24) + (codedIndex >> 2);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadMemberRefParent()
-               {
-                       int codedIndex = ReadIndex(bigMemberRefParent);
-                       switch (codedIndex & 7)
-                       {
-                               case 0:
-                                       return (TypeDefTable.Index << 24) + (codedIndex >> 3);
-                               case 1:
-                                       return (TypeRefTable.Index << 24) + (codedIndex >> 3);
-                               case 2:
-                                       return (ModuleRefTable.Index << 24) + (codedIndex >> 3);
-                               case 3:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 3);
-                               case 4:
-                                       return (TypeSpecTable.Index << 24) + (codedIndex >> 3);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadHasCustomAttribute()
-               {
-                       int codedIndex = ReadIndex(bigHasCustomAttribute);
-                       switch (codedIndex & 31)
-                       {
-                               case 0:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 5);
-                               case 1:
-                                       return (FieldTable.Index << 24) + (codedIndex >> 5);
-                               case 2:
-                                       return (TypeRefTable.Index << 24) + (codedIndex >> 5);
-                               case 3:
-                                       return (TypeDefTable.Index << 24) + (codedIndex >> 5);
-                               case 4:
-                                       return (ParamTable.Index << 24) + (codedIndex >> 5);
-                               case 5:
-                                       return (InterfaceImplTable.Index << 24) + (codedIndex >> 5);
-                               case 6:
-                                       return (MemberRefTable.Index << 24) + (codedIndex >> 5);
-                               case 7:
-                                       return (ModuleTable.Index << 24) + (codedIndex >> 5);
-                               case 8:
-                                       throw new BadImageFormatException();
-                               case 9:
-                                       return (PropertyTable.Index << 24) + (codedIndex >> 5);
-                               case 10:
-                                       return (EventTable.Index << 24) + (codedIndex >> 5);
-                               case 11:
-                                       return (StandAloneSigTable.Index << 24) + (codedIndex >> 5);
-                               case 12:
-                                       return (ModuleRefTable.Index << 24) + (codedIndex >> 5);
-                               case 13:
-                                       return (TypeSpecTable.Index << 24) + (codedIndex >> 5);
-                               case 14:
-                                       return (AssemblyTable.Index << 24) + (codedIndex >> 5);
-                               case 15:
-                                       return (AssemblyRefTable.Index << 24) + (codedIndex >> 5);
-                               case 16:
-                                       return (FileTable.Index << 24) + (codedIndex >> 5);
-                               case 17:
-                                       return (ExportedTypeTable.Index << 24) + (codedIndex >> 5);
-                               case 18:
-                                       return (ManifestResourceTable.Index << 24) + (codedIndex >> 5);
-                               case 19:
-                                       return (GenericParamTable.Index << 24) + (codedIndex >> 5);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadCustomAttributeType()
-               {
-                       int codedIndex = ReadIndex(bigCustomAttributeType);
-                       switch (codedIndex & 7)
-                       {
-                               case 2:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 3);
-                               case 3:
-                                       return (MemberRefTable.Index << 24) + (codedIndex >> 3);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadMethodDefOrRef()
-               {
-                       int codedIndex = ReadIndex(bigMethodDefOrRef);
-                       switch (codedIndex & 1)
-                       {
-                               case 0:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 1);
-                               case 1:
-                                       return (MemberRefTable.Index << 24) + (codedIndex >> 1);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadHasConstant()
-               {
-                       int codedIndex = ReadIndex(bigHasConstant);
-                       switch (codedIndex & 3)
-                       {
-                               case 0:
-                                       return (FieldTable.Index << 24) + (codedIndex >> 2);
-                               case 1:
-                                       return (ParamTable.Index << 24) + (codedIndex >> 2);
-                               case 2:
-                                       return (PropertyTable.Index << 24) + (codedIndex >> 2);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadHasSemantics()
-               {
-                       int codedIndex = ReadIndex(bigHasSemantics);
-                       switch (codedIndex & 1)
-                       {
-                               case 0:
-                                       return (EventTable.Index << 24) + (codedIndex >> 1);
-                               case 1:
-                                       return (PropertyTable.Index << 24) + (codedIndex >> 1);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadHasFieldMarshal()
-               {
-                       int codedIndex = ReadIndex(bigHasFieldMarshal);
-                       switch (codedIndex & 1)
-                       {
-                               case 0:
-                                       return (FieldTable.Index << 24) + (codedIndex >> 1);
-                               case 1:
-                                       return (ParamTable.Index << 24) + (codedIndex >> 1);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadHasDeclSecurity()
-               {
-                       int codedIndex = ReadIndex(bigHasDeclSecurity);
-                       switch (codedIndex & 3)
-                       {
-                               case 0:
-                                       return (TypeDefTable.Index << 24) + (codedIndex >> 2);
-                               case 1:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 2);
-                               case 2:
-                                       return (AssemblyTable.Index << 24) + (codedIndex >> 2);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadTypeOrMethodDef()
-               {
-                       int codedIndex = ReadIndex(bigTypeOrMethodDef);
-                       switch (codedIndex & 1)
-                       {
-                               case 0:
-                                       return (TypeDefTable.Index << 24) + (codedIndex >> 1);
-                               case 1:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 1);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadMemberForwarded()
-               {
-                       int codedIndex = ReadIndex(bigMemberForwarded);
-                       switch (codedIndex & 1)
-                       {
-                               case 0:
-                                       return (FieldTable.Index << 24) + (codedIndex >> 1);
-                               case 1:
-                                       return (MethodDefTable.Index << 24) + (codedIndex >> 1);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadImplementation()
-               {
-                       int codedIndex = ReadIndex(bigImplementation);
-                       switch (codedIndex & 3)
-                       {
-                               case 0:
-                                       return (FileTable.Index << 24) + (codedIndex >> 2);
-                               case 1:
-                                       return (AssemblyRefTable.Index << 24) + (codedIndex >> 2);
-                               case 2:
-                                       return (ExportedTypeTable.Index << 24) + (codedIndex >> 2);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal int ReadField()
-               {
-                       return ReadIndex(bigField);
-               }
-
-               internal int ReadMethodDef()
-               {
-                       return ReadIndex(bigMethodDef);
-               }
-
-               internal int ReadParam()
-               {
-                       return ReadIndex(bigParam);
-               }
-
-               internal int ReadProperty()
-               {
-                       return ReadIndex(bigProperty);
-               }
-
-               internal int ReadEvent()
-               {
-                       return ReadIndex(bigEvent);
-               }
-
-               internal int ReadTypeDef()
-               {
-                       return ReadIndex(bigTypeDef) | (TypeDefTable.Index << 24);
-               }
-
-               internal int ReadGenericParam()
-               {
-                       return ReadIndex(bigGenericParam) | (GenericParamTable.Index << 24);
-               }
-
-               internal int ReadModuleRef()
-               {
-                       return ReadIndex(bigModuleRef) | (ModuleRefTable.Index << 24);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/Method.cs b/mcs/class/IKVM.Reflection/Reader/Method.cs
deleted file mode 100644 (file)
index dd2712e..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class MethodDefImpl : MethodInfo
-       {
-               private readonly ModuleReader module;
-               private readonly int index;
-               private readonly TypeDefImpl declaringType;
-               private MethodSignature lazyMethodSignature;
-               private ParameterInfo returnParameter;
-               private ParameterInfo[] parameters;
-               private Type[] typeArgs;
-
-               internal MethodDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
-               {
-                       this.module = module;
-                       this.index = index;
-                       this.declaringType = declaringType;
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       return GetMethodBody(this);
-               }
-
-               internal MethodBody GetMethodBody(IGenericContext context)
-               {
-                       if ((GetMethodImplementationFlags() & MethodImplAttributes.CodeTypeMask) != MethodImplAttributes.IL)
-                       {
-                               // method is not IL
-                               return null;
-                       }
-                       int rva = module.MethodDef.records[index].RVA;
-                       return rva == 0 ? null : new MethodBody(module, rva, context);
-               }
-
-               public override int __MethodRVA
-               {
-                       get { return module.MethodDef.records[index].RVA; }
-               }
-
-               public override CallingConventions CallingConvention
-               {
-                       get { return this.MethodSignature.CallingConvention; }
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return (MethodAttributes)module.MethodDef.records[index].Flags; }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return (MethodImplAttributes)module.MethodDef.records[index].ImplFlags;
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       PopulateParameters();
-                       return (ParameterInfo[])parameters.Clone();
-               }
-
-               private void PopulateParameters()
-               {
-                       if (parameters == null)
-                       {
-                               MethodSignature methodSignature = this.MethodSignature;
-                               parameters = new ParameterInfo[methodSignature.GetParameterCount()];
-                               int parameter = module.MethodDef.records[index].ParamList - 1;
-                               int end = module.MethodDef.records.Length > index + 1 ? module.MethodDef.records[index + 1].ParamList - 1 : module.Param.records.Length;
-                               for (; parameter < end; parameter++)
-                               {
-                                       int seq = module.Param.records[parameter].Sequence - 1;
-                                       if (seq == -1)
-                                       {
-                                               returnParameter = new ParameterInfoImpl(this, seq, parameter);
-                                       }
-                                       else
-                                       {
-                                               parameters[seq] = new ParameterInfoImpl(this, seq, parameter);
-                                       }
-                               }
-                               for (int i = 0; i < parameters.Length; i++)
-                               {
-                                       if (parameters[i] == null)
-                                       {
-                                               parameters[i] = new ParameterInfoImpl(this, i, -1);
-                                       }
-                               }
-                               if (returnParameter == null)
-                               {
-                                       returnParameter = new ParameterInfoImpl(this, -1, -1);
-                               }
-                       }
-               }
-
-               internal override int ParameterCount
-               {
-                       get { return this.MethodSignature.GetParameterCount(); }
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get
-                       {
-                               PopulateParameters();
-                               return returnParameter;
-                       }
-               }
-
-               public override Type ReturnType
-               {
-                       get
-                       {
-                               return this.ReturnParameter.ParameterType;
-                       }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType.IsModulePseudoType ? null : declaringType; }
-               }
-
-               public override string Name
-               {
-                       get { return module.GetString(module.MethodDef.records[index].Name); }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (MethodDefTable.Index << 24) + index + 1; }
-               }
-
-               public override bool IsGenericMethodDefinition
-               {
-                       get
-                       {
-                               PopulateGenericArguments();
-                               return typeArgs.Length > 0;
-                       }
-               }
-
-               public override bool IsGenericMethod
-               {
-                       get { return IsGenericMethodDefinition; }
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       PopulateGenericArguments();
-                       return Util.Copy(typeArgs);
-               }
-
-               private void PopulateGenericArguments()
-               {
-                       if (typeArgs == null)
-                       {
-                               int token = this.MetadataToken;
-                               int first = module.GenericParam.FindFirstByOwner(token);
-                               if (first == -1)
-                               {
-                                       typeArgs = Type.EmptyTypes;
-                               }
-                               else
-                               {
-                                       List<Type> list = new List<Type>();
-                                       int len = module.GenericParam.records.Length;
-                                       for (int i = first; i < len && module.GenericParam.records[i].Owner == token; i++)
-                                       {
-                                               list.Add(new GenericTypeParameter(module, i));
-                                       }
-                                       typeArgs = list.ToArray();
-                               }
-                       }
-               }
-
-               internal override Type GetGenericMethodArgument(int index)
-               {
-                       PopulateGenericArguments();
-                       return typeArgs[index];
-               }
-
-               internal override int GetGenericMethodArgumentCount()
-               {
-                       PopulateGenericArguments();
-                       return typeArgs.Length;
-               }
-
-               public override MethodInfo GetGenericMethodDefinition()
-               {
-                       if (this.IsGenericMethodDefinition)
-                       {
-                               return this;
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
-               {
-                       return new GenericMethodInstance(declaringType, this, typeArguments);
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               internal override MethodSignature MethodSignature
-               {
-                       get { return lazyMethodSignature ?? (lazyMethodSignature = MethodSignature.ReadSig(module, module.GetBlob(module.MethodDef.records[index].Signature), this)); }
-               }
-
-               internal override int ImportTo(Emit.ModuleBuilder module)
-               {
-                       return module.ImportMethodOrField(declaringType, this.Name, this.MethodSignature);
-               }
-
-               public override MethodInfo[] __GetMethodImpls()
-               {
-                       Type[] typeArgs = null;
-                       List<MethodInfo> list = null;
-                       foreach (int i in module.MethodImpl.Filter(declaringType.MetadataToken))
-                       {
-                               if (module.MethodImpl.records[i].MethodBody == this.MetadataToken)
-                               {
-                                       if (typeArgs == null)
-                                       {
-                                               typeArgs = declaringType.GetGenericArguments();
-                                       }
-                                       if (list == null)
-                                       {
-                                               list = new List<MethodInfo>();
-                                       }
-                                       list.Add((MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null));
-                               }
-                       }
-                       return Util.ToArray(list, Empty<MethodInfo>.Array);
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-
-       sealed class ParameterInfoImpl : ParameterInfo
-       {
-               private readonly MethodDefImpl method;
-               private readonly int position;
-               private readonly int index;
-
-               internal ParameterInfoImpl(MethodDefImpl method, int position, int index)
-               {
-                       this.method = method;
-                       this.position = position;
-                       this.index = index;
-               }
-
-               public override string Name
-               {
-                       get { return index == -1 ? null : ((ModuleReader)this.Module).GetString(this.Module.Param.records[index].Name); }
-               }
-
-               public override Type ParameterType
-               {
-                       get { return position == -1 ? method.MethodSignature.GetReturnType(method) : method.MethodSignature.GetParameterType(method, position); }
-               }
-
-               public override ParameterAttributes Attributes
-               {
-                       get { return index == -1 ? ParameterAttributes.None : (ParameterAttributes)this.Module.Param.records[index].Flags; }
-               }
-
-               public override int Position
-               {
-                       get { return position; }
-               }
-
-               public override object RawDefaultValue
-               {
-                       get
-                       {
-                               if ((this.Attributes & ParameterAttributes.HasDefault) != 0)
-                               {
-                                       return this.Module.Constant.GetRawConstantValue(this.Module, this.MetadataToken);
-                               }
-                               Universe universe = this.Module.universe;
-                               if (this.ParameterType == universe.System_Decimal)
-                               {
-                                       Type attr = universe.System_Runtime_CompilerServices_DecimalConstantAttribute;
-                                       if (attr != null)
-                                       {
-                                               foreach (CustomAttributeData cad in CustomAttributeData.__GetCustomAttributes(this, attr, false))
-                                               {
-                                                       IList<CustomAttributeTypedArgument> args = cad.ConstructorArguments;
-                                                       if (args.Count == 5)
-                                                       {
-                                                               if (args[0].ArgumentType == universe.System_Byte
-                                                                       && args[1].ArgumentType == universe.System_Byte
-                                                                       && args[2].ArgumentType == universe.System_Int32
-                                                                       && args[3].ArgumentType == universe.System_Int32
-                                                                       && args[4].ArgumentType == universe.System_Int32)
-                                                               {
-                                                                       return new Decimal((int)args[4].Value, (int)args[3].Value, (int)args[2].Value, (byte)args[1].Value != 0, (byte)args[0].Value);
-                                                               }
-                                                               else if (args[0].ArgumentType == universe.System_Byte
-                                                                       && args[1].ArgumentType == universe.System_Byte
-                                                                       && args[2].ArgumentType == universe.System_UInt32
-                                                                       && args[3].ArgumentType == universe.System_UInt32
-                                                                       && args[4].ArgumentType == universe.System_UInt32)
-                                                               {
-                                                                       return new Decimal(unchecked((int)(uint)args[4].Value), unchecked((int)(uint)args[3].Value), unchecked((int)(uint)args[2].Value), (byte)args[1].Value != 0, (byte)args[0].Value);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                               if ((this.Attributes & ParameterAttributes.Optional) != 0)
-                               {
-                                       return Missing.Value;
-                               }
-                               return null;
-                       }
-               }
-
-               public override CustomModifiers __GetCustomModifiers()
-               {
-                       return position == -1
-                               ? method.MethodSignature.GetReturnTypeCustomModifiers(method)
-                               : method.MethodSignature.GetParameterCustomModifiers(method, position);
-               }
-
-               public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-               {
-                       return FieldMarshal.ReadFieldMarshal(this.Module, this.MetadataToken, out fieldMarshal);
-               }
-
-               public override MemberInfo Member
-               {
-                       get
-                       {
-                               // return the right ConstructorInfo wrapper
-                               return method.Module.ResolveMethod(method.MetadataToken);
-                       }
-               }
-
-               public override int MetadataToken
-               {
-                       get
-                       {
-                               // for parameters that don't have a row in the Param table, we return 0x08000000 (because index is -1 in that case),
-                               // just like .NET
-                               return (ParamTable.Index << 24) + index + 1;
-                       }
-               }
-
-               internal override Module Module
-               {
-                       get { return method.Module; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/ModuleReader.cs b/mcs/class/IKVM.Reflection/Reader/ModuleReader.cs
deleted file mode 100644 (file)
index 180e968..0000000
+++ /dev/null
@@ -1,1269 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class StreamHeader
-       {
-               internal uint Offset;
-               internal uint Size;
-               internal string Name;
-
-               internal void Read(BinaryReader br)
-               {
-                       Offset = br.ReadUInt32();
-                       Size = br.ReadUInt32();
-                       byte[] buf = new byte[32];
-                       byte b;
-                       int len = 0;
-                       while ((b = br.ReadByte()) != 0)
-                       {
-                               buf[len++] = b;
-                       }
-                       Name = Encoding.UTF8.GetString(buf, 0, len); ;
-                       int padding = -1 + ((len + 4) & ~3) - len;
-                       br.BaseStream.Seek(padding, SeekOrigin.Current);
-               }
-       }
-
-       sealed class ModuleReader : Module
-       {
-               internal readonly Stream stream;
-               private readonly string location;
-               private Assembly assembly;
-               private readonly PEReader peFile = new PEReader();
-               private readonly CliHeader cliHeader = new CliHeader();
-               private string imageRuntimeVersion;
-               private int metadataStreamVersion;
-               private byte[] stringHeap;
-               private byte[] blobHeap;
-               private byte[] userStringHeap;
-               private byte[] guidHeap;
-               private TypeDefImpl[] typeDefs;
-               private TypeDefImpl moduleType;
-               private Assembly[] assemblyRefs;
-               private Type[] typeRefs;
-               private Type[] typeSpecs;
-               private FieldInfo[] fields;
-               private MethodBase[] methods;
-               private MemberInfo[] memberRefs;
-               private Dictionary<int, string> strings = new Dictionary<int, string>();
-               private Dictionary<TypeName, Type> types = new Dictionary<TypeName, Type>();
-               private Dictionary<TypeName, LazyForwardedType> forwardedTypes = new Dictionary<TypeName, LazyForwardedType>();
-
-               private sealed class LazyForwardedType
-               {
-                       private readonly int assemblyRef;
-                       private Type type;
-
-                       internal LazyForwardedType(int assemblyRef)
-                       {
-                               this.assemblyRef = assemblyRef;
-                       }
-
-                       internal Type GetType(ModuleReader module, TypeName typeName)
-                       {
-                               if (type == null)
-                               {
-                                       Assembly asm = module.ResolveAssemblyRef(assemblyRef);
-                                       type = asm.ResolveType(typeName);
-                                       if (type == null)
-                                       {
-                                               throw new TypeLoadException(typeName.ToString());
-                                       }
-                               }
-                               return type;
-                       }
-               }
-
-               internal ModuleReader(AssemblyReader assembly, Universe universe, Stream stream, string location)
-                       : base(universe)
-               {
-                       this.stream = stream;
-                       this.location = location;
-                       Read();
-                       if (assembly == null && AssemblyTable.records.Length != 0)
-                       {
-                               assembly = new AssemblyReader(location, this);
-                       }
-                       this.assembly = assembly;
-               }
-
-               private void Read()
-               {
-                       BinaryReader br = new BinaryReader(stream);
-                       peFile.Read(br);
-                       stream.Seek(peFile.RvaToFileOffset(peFile.GetComDescriptorVirtualAddress()), SeekOrigin.Begin);
-                       cliHeader.Read(br);
-                       stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress), SeekOrigin.Begin);
-                       foreach (StreamHeader sh in ReadStreamHeaders(br, out imageRuntimeVersion))
-                       {
-                               switch (sh.Name)
-                               {
-                                       case "#Strings":
-                                               stringHeap = ReadHeap(stream, sh);
-                                               break;
-                                       case "#Blob":
-                                               blobHeap = ReadHeap(stream, sh);
-                                               break;
-                                       case "#US":
-                                               userStringHeap = ReadHeap(stream, sh);
-                                               break;
-                                       case "#GUID":
-                                               guidHeap = ReadHeap(stream, sh);
-                                               break;
-                                       case "#~":
-                                       case "#-":
-                                               stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress + sh.Offset), SeekOrigin.Begin);
-                                               ReadTables(br);
-                                               break;
-                                       default:
-                                               // we ignore unknown streams, because the CLR does so too
-                                               // (and some obfuscators add bogus streams)
-                                               break;
-                               }
-                       }
-               }
-
-               internal void SetAssembly(Assembly assembly)
-               {
-                       this.assembly = assembly;
-               }
-
-               private static StreamHeader[] ReadStreamHeaders(BinaryReader br, out string Version)
-               {
-                       uint Signature = br.ReadUInt32();
-                       if (Signature != 0x424A5342)
-                       {
-                               throw new BadImageFormatException("Invalid metadata signature");
-                       }
-                       /*ushort MajorVersion =*/ br.ReadUInt16();
-                       /*ushort MinorVersion =*/ br.ReadUInt16();
-                       /*uint Reserved =*/ br.ReadUInt32();
-                       uint Length = br.ReadUInt32();
-                       byte[] buf = br.ReadBytes((int)Length);
-                       Version = Encoding.UTF8.GetString(buf).TrimEnd('\u0000');
-                       /*ushort Flags =*/ br.ReadUInt16();
-                       ushort Streams = br.ReadUInt16();
-                       StreamHeader[] streamHeaders = new StreamHeader[Streams];
-                       for (int i = 0; i < streamHeaders.Length; i++)
-                       {
-                               streamHeaders[i] = new StreamHeader();
-                               streamHeaders[i].Read(br);
-                       }
-                       return streamHeaders;
-               }
-
-               private void ReadTables(BinaryReader br)
-               {
-                       Table[] tables = GetTables();
-                       /*uint Reserved0 =*/ br.ReadUInt32();
-                       byte MajorVersion = br.ReadByte();
-                       byte MinorVersion = br.ReadByte();
-                       metadataStreamVersion = MajorVersion << 16 | MinorVersion;
-                       byte HeapSizes = br.ReadByte();
-                       /*byte Reserved7 =*/ br.ReadByte();
-                       ulong Valid = br.ReadUInt64();
-                       ulong Sorted = br.ReadUInt64();
-                       for (int i = 0; i < 64; i++)
-                       {
-                               if ((Valid & (1UL << i)) != 0)
-                               {
-                                       tables[i].Sorted = (Sorted & (1UL << i)) != 0;
-                                       tables[i].RowCount = br.ReadInt32();
-                               }
-                               else if (tables[i] != null)
-                               {
-                                       tables[i].RowCount = 0;
-                               }
-                       }
-                       MetadataReader mr = new MetadataReader(this, br.BaseStream, HeapSizes);
-                       for (int i = 0; i < 64; i++)
-                       {
-                               if ((Valid & (1UL << i)) != 0)
-                               {
-                                       tables[i].Read(mr);
-                               }
-                       }
-                       if (ParamPtr.RowCount != 0)
-                       {
-                               throw new NotImplementedException("ParamPtr table support has not yet been implemented.");
-                       }
-               }
-
-               private byte[] ReadHeap(Stream stream, StreamHeader sh)
-               {
-                       byte[] buf = new byte[sh.Size];
-                       stream.Seek(peFile.RvaToFileOffset(cliHeader.MetaData.VirtualAddress + sh.Offset), SeekOrigin.Begin);
-                       for (int pos = 0; pos < buf.Length; )
-                       {
-                               int read = stream.Read(buf, pos, buf.Length - pos);
-                               if (read == 0)
-                               {
-                                       throw new BadImageFormatException();
-                               }
-                               pos += read;
-                       }
-                       return buf;
-               }
-
-               internal void SeekRVA(int rva)
-               {
-                       stream.Seek(peFile.RvaToFileOffset((uint)rva), SeekOrigin.Begin);
-               }
-
-               internal override void GetTypesImpl(List<Type> list)
-               {
-                       PopulateTypeDef();
-                       foreach (TypeDefImpl type in typeDefs)
-                       {
-                               if (type != moduleType)
-                               {
-                                       list.Add(type);
-                               }
-                       }
-               }
-
-               private void PopulateTypeDef()
-               {
-                       if (typeDefs == null)
-                       {
-                               typeDefs = new TypeDefImpl[TypeDef.records.Length];
-                               for (int i = 0; i < typeDefs.Length; i++)
-                               {
-                                       TypeDefImpl type = new TypeDefImpl(this, i);
-                                       typeDefs[i] = type;
-                                       if (type.IsModulePseudoType)
-                                       {
-                                               moduleType = type;
-                                       }
-                                       else if (!type.IsNestedByFlags)
-                                       {
-                                               types.Add(new TypeName(type.__Namespace, type.__Name), type);
-                                       }
-                               }
-                               // add forwarded types to forwardedTypes dictionary (because Module.GetType(string) should return them)
-                               for (int i = 0; i < ExportedType.records.Length; i++)
-                               {
-                                       int implementation = ExportedType.records[i].Implementation;
-                                       if (implementation >> 24 == AssemblyRefTable.Index)
-                                       {
-                                               TypeName typeName = GetTypeName(ExportedType.records[i].TypeNamespace, ExportedType.records[i].TypeName);
-                                               forwardedTypes.Add(typeName, new LazyForwardedType((implementation & 0xFFFFFF) - 1));
-                                       }
-                               }
-                       }
-               }
-
-               internal override string GetString(int index)
-               {
-                       if (index == 0)
-                       {
-                               return null;
-                       }
-                       string str;
-                       if (!strings.TryGetValue(index, out str))
-                       {
-                               int len = 0;
-                               while (stringHeap[index + len] != 0)
-                               {
-                                       len++;
-                               }
-                               str = Encoding.UTF8.GetString(stringHeap, index, len);
-                               strings.Add(index, str);
-                       }
-                       return str;
-               }
-
-               private static int ReadCompressedInt(byte[] buffer, ref int offset)
-               {
-                       byte b1 = buffer[offset++];
-                       if (b1 <= 0x7F)
-                       {
-                               return b1;
-                       }
-                       else if ((b1 & 0xC0) == 0x80)
-                       {
-                               byte b2 = buffer[offset++];
-                               return ((b1 & 0x3F) << 8) | b2;
-                       }
-                       else
-                       {
-                               byte b2 = buffer[offset++];
-                               byte b3 = buffer[offset++];
-                               byte b4 = buffer[offset++];
-                               return ((b1 & 0x3F) << 24) + (b2 << 16) + (b3 << 8) + b4;
-                       }
-               }
-
-               internal byte[] GetBlobCopy(int blobIndex)
-               {
-                       int len = ReadCompressedInt(blobHeap, ref blobIndex);
-                       byte[] buf = new byte[len];
-                       Buffer.BlockCopy(blobHeap, blobIndex, buf, 0, len);
-                       return buf;
-               }
-
-               internal override ByteReader GetBlob(int blobIndex)
-               {
-                       return ByteReader.FromBlob(blobHeap, blobIndex);
-               }
-
-               public override string ResolveString(int metadataToken)
-               {
-                       string str;
-                       if (!strings.TryGetValue(metadataToken, out str))
-                       {
-                               if ((metadataToken >> 24) != 0x70)
-                               {
-                                       throw TokenOutOfRangeException(metadataToken);
-                               }
-                               int index = metadataToken & 0xFFFFFF;
-                               int len = ReadCompressedInt(userStringHeap, ref index) & ~1;
-                               StringBuilder sb = new StringBuilder(len / 2);
-                               for (int i = 0; i < len; i += 2)
-                               {
-                                       char ch = (char)(userStringHeap[index + i] | userStringHeap[index + i + 1] << 8);
-                                       sb.Append(ch);
-                               }
-                               str = sb.ToString();
-                               strings.Add(metadataToken, str);
-                       }
-                       return str;
-               }
-
-               internal override Type ResolveType(int metadataToken, IGenericContext context)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if (index < 0)
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-                       else if ((metadataToken >> 24) == TypeDefTable.Index && index < TypeDef.RowCount)
-                       {
-                               PopulateTypeDef();
-                               return typeDefs[index];
-                       }
-                       else if ((metadataToken >> 24) == TypeRefTable.Index && index < TypeRef.RowCount)
-                       {
-                               if (typeRefs == null)
-                               {
-                                       typeRefs = new Type[TypeRef.records.Length];
-                               }
-                               if (typeRefs[index] == null)
-                               {
-                                       int scope = TypeRef.records[index].ResolutionScope;
-                                       switch (scope >> 24)
-                                       {
-                                               case AssemblyRefTable.Index:
-                                                       {
-                                                               Assembly assembly = ResolveAssemblyRef((scope & 0xFFFFFF) - 1);
-                                                               TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
-                                                               typeRefs[index] = assembly.ResolveType(typeName);
-                                                               break;
-                                                       }
-                                               case TypeRefTable.Index:
-                                                       {
-                                                               Type outer = ResolveType(scope, null);
-                                                               TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
-                                                               typeRefs[index] = outer.ResolveNestedType(typeName);
-                                                               break;
-                                                       }
-                                               case ModuleTable.Index:
-                                               case ModuleRefTable.Index:
-                                                       {
-                                                               Module module;
-                                                               if (scope >> 24 == ModuleTable.Index)
-                                                               {
-                                                                       if (scope == 0 || scope == 1)
-                                                                       {
-                                                                               module = this;
-                                                                       }
-                                                                       else
-                                                                       {
-                                                                               throw new NotImplementedException("self reference scope?");
-                                                                       }
-                                                               }
-                                                               else
-                                                               {
-                                                                       module = ResolveModuleRef(ModuleRef.records[(scope & 0xFFFFFF) - 1]);
-                                                               }
-                                                               TypeName typeName = GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName);
-                                                               typeRefs[index] = module.FindType(typeName) ?? module.universe.GetMissingTypeOrThrow(module, null, typeName);
-                                                               break;
-                                                       }
-                                               default:
-                                                       throw new NotImplementedException("ResolutionScope = " + scope.ToString("X"));
-                                       }
-                               }
-                               return typeRefs[index];
-                       }
-                       else if ((metadataToken >> 24) == TypeSpecTable.Index && index < TypeSpec.RowCount)
-                       {
-                               if (typeSpecs == null)
-                               {
-                                       typeSpecs = new Type[TypeSpec.records.Length];
-                               }
-                               Type type = typeSpecs[index];
-                               if (type == null)
-                               {
-                                       TrackingGenericContext tc = context == null ? null : new TrackingGenericContext(context);
-                                       type = Signature.ReadTypeSpec(this, ByteReader.FromBlob(blobHeap, TypeSpec.records[index]), tc);
-                                       if (tc == null || !tc.IsUsed)
-                                       {
-                                               typeSpecs[index] = type;
-                                       }
-                               }
-                               return type;
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               private Module ResolveModuleRef(int moduleNameIndex)
-               {
-                       string moduleName = GetString(moduleNameIndex);
-                       Module module = assembly.GetModule(moduleName);
-                       if (module == null)
-                       {
-                               throw new FileNotFoundException(moduleName);
-                       }
-                       return module;
-               }
-
-               private sealed class TrackingGenericContext : IGenericContext
-               {
-                       private readonly IGenericContext context;
-                       private bool used;
-
-                       internal TrackingGenericContext(IGenericContext context)
-                       {
-                               this.context = context;
-                       }
-
-                       internal bool IsUsed
-                       {
-                               get { return used; }
-                       }
-
-                       public Type GetGenericTypeArgument(int index)
-                       {
-                               used = true;
-                               return context.GetGenericTypeArgument(index);
-                       }
-
-                       public Type GetGenericMethodArgument(int index)
-                       {
-                               used = true;
-                               return context.GetGenericMethodArgument(index);
-                       }
-               }
-
-               private TypeName GetTypeName(int typeNamespace, int typeName)
-               {
-                       return new TypeName(GetString(typeNamespace), GetString(typeName));
-               }
-
-               internal Assembly ResolveAssemblyRef(int index)
-               {
-                       if (assemblyRefs == null)
-                       {
-                               assemblyRefs = new Assembly[AssemblyRef.RowCount];
-                       }
-                       if (assemblyRefs[index] == null)
-                       {
-                               assemblyRefs[index] = ResolveAssemblyRefImpl(ref AssemblyRef.records[index]);
-                       }
-                       return assemblyRefs[index];
-               }
-
-               private Assembly ResolveAssemblyRefImpl(ref AssemblyRefTable.Record rec)
-               {
-                       const int PublicKey = 0x0001;
-                       string name = String.Format("{0}, Version={1}.{2}.{3}.{4}, Culture={5}, {6}={7}",
-                               GetString(rec.Name),
-                               rec.MajorVersion,
-                               rec.MinorVersion,
-                               rec.BuildNumber,
-                               rec.RevisionNumber,
-                               rec.Culture == 0 ? "neutral" : GetString(rec.Culture),
-                               (rec.Flags & PublicKey) == 0 ? "PublicKeyToken" : "PublicKey",
-                               PublicKeyOrTokenToString(rec.PublicKeyOrToken));
-                       return universe.Load(name, this.Assembly, true);
-               }
-
-               private string PublicKeyOrTokenToString(int publicKeyOrToken)
-               {
-                       if (publicKeyOrToken == 0)
-                       {
-                               return "null";
-                       }
-                       ByteReader br = GetBlob(publicKeyOrToken);
-                       if (br.Length == 0)
-                       {
-                               return "null";
-                       }
-                       StringBuilder sb = new StringBuilder(br.Length * 2);
-                       while (br.Length > 0)
-                       {
-                               sb.AppendFormat("{0:x2}", br.ReadByte());
-                       }
-                       return sb.ToString();
-               }
-
-               public override Guid ModuleVersionId
-               {
-                       get
-                       {
-                               byte[] buf = new byte[16];
-                               Buffer.BlockCopy(guidHeap, 16 * (ModuleTable.records[0].Mvid - 1), buf, 0, 16);
-                               return new Guid(buf);
-                       }
-               }
-
-               public override string FullyQualifiedName
-               {
-                       get { return location ?? "<Unknown>"; }
-               }
-
-               public override string Name
-               {
-                       get { return location == null ? "<Unknown>" : System.IO.Path.GetFileName(location); }
-               }
-
-               public override Assembly Assembly
-               {
-                       get { return assembly; }
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       PopulateTypeDef();
-                       Type type;
-                       if (!types.TryGetValue(typeName, out type))
-                       {
-                               LazyForwardedType fw;
-                               if (forwardedTypes.TryGetValue(typeName, out fw))
-                               {
-                                       return fw.GetType(this, typeName);
-                               }
-                       }
-                       return type;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       PopulateTypeDef();
-                       foreach (Type type in types.Values)
-                       {
-                               if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
-                               {
-                                       return type;
-                               }
-                       }
-                       foreach (TypeName name in forwardedTypes.Keys)
-                       {
-                               if (name.ToLowerInvariant() == lowerCaseName)
-                               {
-                                       return forwardedTypes[name].GetType(this, name);
-                               }
-                       }
-                       return null;
-               }
-
-               private Exception TokenOutOfRangeException(int metadataToken)
-               {
-                       return new ArgumentOutOfRangeException("metadataToken", String.Format("Token 0x{0:x8} is not valid in the scope of module {1}.", metadataToken, this.Name));
-               }
-
-               public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       switch (metadataToken >> 24)
-                       {
-                               case FieldTable.Index:
-                                       return ResolveField(metadataToken, genericTypeArguments, genericMethodArguments);
-                               case MemberRefTable.Index:
-                                       int index = (metadataToken & 0xFFFFFF) - 1;
-                                       if (index < 0 || index >= MemberRef.RowCount)
-                                       {
-                                               goto default;
-                                       }
-                                       return GetMemberRef(index, genericTypeArguments, genericMethodArguments);
-                               case MethodDefTable.Index:
-                               case MethodSpecTable.Index:
-                                       return ResolveMethod(metadataToken, genericTypeArguments, genericMethodArguments);
-                               default:
-                                       throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               internal FieldInfo GetFieldAt(TypeDefImpl owner, int index)
-               {
-                       if (fields == null)
-                       {
-                               fields = new FieldInfo[Field.records.Length];
-                       }
-                       if (fields[index] == null)
-                       {
-                               fields[index] = new FieldDefImpl(this, owner ?? FindFieldOwner(index), index);
-                       }
-                       return fields[index];
-               }
-
-               public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if (index < 0)
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-                       else if ((metadataToken >> 24) == FieldTable.Index && index < Field.RowCount)
-                       {
-                               return GetFieldAt(null, index);
-                       }
-                       else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
-                       {
-                               FieldInfo field = GetMemberRef(index, genericTypeArguments, genericMethodArguments) as FieldInfo;
-                               if (field != null)
-                               {
-                                       return field;
-                               }
-                               throw new ArgumentException(String.Format("Token 0x{0:x8} is not a valid FieldInfo token in the scope of module {1}.", metadataToken, this.Name), "metadataToken");
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               private TypeDefImpl FindFieldOwner(int fieldIndex)
-               {
-                       // TODO use binary search?
-                       for (int i = 0; i < TypeDef.records.Length; i++)
-                       {
-                               int field = TypeDef.records[i].FieldList - 1;
-                               int end = TypeDef.records.Length > i + 1 ? TypeDef.records[i + 1].FieldList - 1 : Field.records.Length;
-                               if (field <= fieldIndex && fieldIndex < end)
-                               {
-                                       PopulateTypeDef();
-                                       return typeDefs[i];
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               internal MethodBase GetMethodAt(TypeDefImpl owner, int index)
-               {
-                       if (methods == null)
-                       {
-                               methods = new MethodBase[MethodDef.records.Length];
-                       }
-                       if (methods[index] == null)
-                       {
-                               MethodDefImpl method = new MethodDefImpl(this, owner ?? FindMethodOwner(index), index);
-                               methods[index] = method.IsConstructor ? new ConstructorInfoImpl(method) : (MethodBase)method;
-                       }
-                       return methods[index];
-               }
-
-               public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if (index < 0)
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-                       else if ((metadataToken >> 24) == MethodDefTable.Index && index < MethodDef.RowCount)
-                       {
-                               return GetMethodAt(null, index);
-                       }
-                       else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
-                       {
-                               MethodBase method = GetMemberRef(index, genericTypeArguments, genericMethodArguments) as MethodBase;
-                               if (method != null)
-                               {
-                                       return method;
-                               }
-                               throw new ArgumentException(String.Format("Token 0x{0:x8} is not a valid MethodBase token in the scope of module {1}.", metadataToken, this.Name), "metadataToken");
-                       }
-                       else if ((metadataToken >> 24) == MethodSpecTable.Index && index < MethodSpec.RowCount)
-                       {
-                               MethodInfo method = (MethodInfo)ResolveMethod(MethodSpec.records[index].Method, genericTypeArguments, genericMethodArguments);
-                               ByteReader instantiation = ByteReader.FromBlob(blobHeap, MethodSpec.records[index].Instantiation);
-                               return method.MakeGenericMethod(Signature.ReadMethodSpec(this, instantiation, new GenericContext(genericTypeArguments, genericMethodArguments)));
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               public override Type[] __ResolveOptionalParameterTypes(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments, out CustomModifiers[] customModifiers)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if (index < 0)
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-                       else if ((metadataToken >> 24) == MemberRefTable.Index && index < MemberRef.RowCount)
-                       {
-                               int sig = MemberRef.records[index].Signature;
-                               return Signature.ReadOptionalParameterTypes(this, GetBlob(sig), new GenericContext(genericTypeArguments, genericMethodArguments), out customModifiers);
-                       }
-                       else if ((metadataToken >> 24) == MethodDefTable.Index && index < MethodDef.RowCount)
-                       {
-                               // for convenience, we support passing a MethodDef token as well, because in some places
-                               // it makes sense to have a vararg method that is referred to by its methoddef (e.g. ldftn).
-                               // Note that MethodSpec doesn't make sense, because generic methods cannot be vararg.
-                               customModifiers = Empty<CustomModifiers>.Array;
-                               return Type.EmptyTypes;
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               public override string ScopeName
-               {
-                       get { return GetString(ModuleTable.records[0].Name); }
-               }
-
-               private TypeDefImpl FindMethodOwner(int methodIndex)
-               {
-                       // TODO use binary search?
-                       for (int i = 0; i < TypeDef.records.Length; i++)
-                       {
-                               int method = TypeDef.records[i].MethodList - 1;
-                               int end = TypeDef.records.Length > i + 1 ? TypeDef.records[i + 1].MethodList - 1 : MethodDef.records.Length;
-                               if (method <= methodIndex && methodIndex < end)
-                               {
-                                       PopulateTypeDef();
-                                       return typeDefs[i];
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               private MemberInfo GetMemberRef(int index, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       if (memberRefs == null)
-                       {
-                               memberRefs = new MemberInfo[MemberRef.records.Length];
-                       }
-                       if (memberRefs[index] == null)
-                       {
-                               int owner = MemberRef.records[index].Class;
-                               int sig = MemberRef.records[index].Signature;
-                               string name = GetString(MemberRef.records[index].Name);
-                               switch (owner >> 24)
-                               {
-                                       case MethodDefTable.Index:
-                                               return GetMethodAt(null, (owner & 0xFFFFFF) - 1);
-                                       case ModuleRefTable.Index:
-                                               memberRefs[index] = ResolveTypeMemberRef(ResolveModuleType(owner), name, ByteReader.FromBlob(blobHeap, sig));
-                                               break;
-                                       case TypeDefTable.Index:
-                                       case TypeRefTable.Index:
-                                               memberRefs[index] = ResolveTypeMemberRef(ResolveType(owner), name, ByteReader.FromBlob(blobHeap, sig));
-                                               break;
-                                       case TypeSpecTable.Index:
-                                       {
-                                               Type type = ResolveType(owner, genericTypeArguments, genericMethodArguments);
-                                               if (type.IsArray)
-                                               {
-                                                       MethodSignature methodSig = MethodSignature.ReadSig(this, ByteReader.FromBlob(blobHeap, sig), new GenericContext(genericTypeArguments, genericMethodArguments));
-                                                       return type.FindMethod(name, methodSig)
-                                                               ?? universe.GetMissingMethodOrThrow(type, name, methodSig);
-                                               }
-                                               else if (type.IsConstructedGenericType)
-                                               {
-                                                       MemberInfo member = ResolveTypeMemberRef(type.GetGenericTypeDefinition(), name, ByteReader.FromBlob(blobHeap, sig));
-                                                       MethodBase mb = member as MethodBase;
-                                                       if (mb != null)
-                                                       {
-                                                               member = mb.BindTypeParameters(type);
-                                                       }
-                                                       FieldInfo fi = member as FieldInfo;
-                                                       if (fi != null)
-                                                       {
-                                                               member = fi.BindTypeParameters(type);
-                                                       }
-                                                       return member;
-                                               }
-                                               else
-                                               {
-                                                       return ResolveTypeMemberRef(type, name, ByteReader.FromBlob(blobHeap, sig));
-                                               }
-                                       }
-                                       default:
-                                               throw new BadImageFormatException();
-                               }
-                       }
-                       return memberRefs[index];
-               }
-
-               private Type ResolveModuleType(int token)
-               {
-                       int index = (token & 0xFFFFFF) - 1;
-                       string name = GetString(ModuleRef.records[index]);
-                       Module module = assembly.GetModule(name);
-                       if (module == null || module.IsResource())
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       return module.GetModuleType();
-               }
-
-               private MemberInfo ResolveTypeMemberRef(Type type, string name, ByteReader sig)
-               {
-                       if (sig.PeekByte() == Signature.FIELD)
-                       {
-                               Type org = type;
-                               FieldSignature fieldSig = FieldSignature.ReadSig(this, sig, type);
-                               FieldInfo field = type.FindField(name, fieldSig);
-                               if (field == null && universe.MissingMemberResolution)
-                               {
-                                       return universe.GetMissingFieldOrThrow(type, name, fieldSig);
-                               }
-                               while (field == null && (type = type.BaseType) != null)
-                               {
-                                       field = type.FindField(name, fieldSig);
-                               }
-                               if (field != null)
-                               {
-                                       return field;
-                               }
-                               throw new MissingFieldException(org.ToString(), name);
-                       }
-                       else
-                       {
-                               Type org = type;
-                               MethodSignature methodSig = MethodSignature.ReadSig(this, sig, type);
-                               MethodBase method = type.FindMethod(name, methodSig);
-                               if (method == null && universe.MissingMemberResolution)
-                               {
-                                       return universe.GetMissingMethodOrThrow(type, name, methodSig);
-                               }
-                               while (method == null && (type = type.BaseType) != null)
-                               {
-                                       method = type.FindMethod(name, methodSig);
-                               }
-                               if (method != null)
-                               {
-                                       return method;
-                               }
-                               throw new MissingMethodException(org.ToString(), name);
-                       }
-               }
-
-               internal ByteReader GetStandAloneSig(int index)
-               {
-                       return ByteReader.FromBlob(blobHeap, StandAloneSig.records[index]);
-               }
-
-               public override byte[] ResolveSignature(int metadataToken)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if ((metadataToken >> 24) == StandAloneSigTable.Index && index >= 0 && index < StandAloneSig.RowCount)
-                       {
-                               ByteReader br = GetStandAloneSig(index);
-                               return br.ReadBytes(br.Length);
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
-               {
-                       int index = (metadataToken & 0xFFFFFF) - 1;
-                       if ((metadataToken >> 24) == StandAloneSigTable.Index && index >= 0 && index < StandAloneSig.RowCount)
-                       {
-                               return MethodSignature.ReadStandAloneMethodSig(this, GetStandAloneSig(index), new GenericContext(genericTypeArguments, genericMethodArguments));
-                       }
-                       else
-                       {
-                               throw TokenOutOfRangeException(metadataToken);
-                       }
-               }
-
-               internal MethodInfo GetEntryPoint()
-               {
-                       if (cliHeader.EntryPointToken != 0 && (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) == 0)
-                       {
-                               return (MethodInfo)ResolveMethod((int)cliHeader.EntryPointToken);
-                       }
-                       return null;
-               }
-
-               internal string[] GetManifestResourceNames()
-               {
-                       string[] names = new string[ManifestResource.records.Length];
-                       for (int i = 0; i < ManifestResource.records.Length; i++)
-                       {
-                               names[i] = GetString(ManifestResource.records[i].Name);
-                       }
-                       return names;
-               }
-
-               internal ManifestResourceInfo GetManifestResourceInfo(string resourceName)
-               {
-                       for (int i = 0; i < ManifestResource.records.Length; i++)
-                       {
-                               if (resourceName == GetString(ManifestResource.records[i].Name))
-                               {
-                                       ManifestResourceInfo info = new ManifestResourceInfo(this, i);
-                                       Assembly asm = info.ReferencedAssembly;
-                                       if (asm != null && !asm.__IsMissing && asm.GetManifestResourceInfo(resourceName) == null)
-                                       {
-                                               return null;
-                                       }
-                                       return info;
-                               }
-                       }
-                       return null;
-               }
-
-               internal Stream GetManifestResourceStream(string resourceName)
-               {
-                       for (int i = 0; i < ManifestResource.records.Length; i++)
-                       {
-                               if (resourceName == GetString(ManifestResource.records[i].Name))
-                               {
-                                       if (ManifestResource.records[i].Implementation != 0x26000000)
-                                       {
-                                               ManifestResourceInfo info = new ManifestResourceInfo(this, i);
-                                               switch (ManifestResource.records[i].Implementation >> 24)
-                                               {
-                                                       case FileTable.Index:
-                                                               string fileName = Path.Combine(Path.GetDirectoryName(location), info.FileName);
-                                                               if (System.IO.File.Exists(fileName))
-                                                               {
-                                                                       // note that, like System.Reflection, we return null for zero length files and
-                                                                       // ManifestResource.Offset is ignored
-                                                                       FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
-                                                                       if (fs.Length == 0)
-                                                                       {
-                                                                               fs.Close();
-                                                                               return null;
-                                                                       }
-                                                                       return fs;
-                                                               }
-                                                               return null;
-                                                       case AssemblyRefTable.Index:
-                                                               Assembly asm = info.ReferencedAssembly;
-                                                               if (asm.__IsMissing)
-                                                               {
-                                                                       return null;
-                                                               }
-                                                               return asm.GetManifestResourceStream(resourceName);
-                                                       default:
-                                                               throw new BadImageFormatException();
-                                               }
-                                       }
-                                       SeekRVA((int)cliHeader.Resources.VirtualAddress + ManifestResource.records[i].Offset);
-                                       BinaryReader br = new BinaryReader(stream);
-                                       int length = br.ReadInt32();
-                                       return new MemoryStream(br.ReadBytes(length));
-                               }
-                       }
-                       return null;
-               }
-
-               public override AssemblyName[] __GetReferencedAssemblies()
-               {
-                       List<AssemblyName> list = new List<AssemblyName>();
-                       for (int i = 0; i < AssemblyRef.records.Length; i++)
-                       {
-                               AssemblyName name = new AssemblyName();
-                               name.Name = GetString(AssemblyRef.records[i].Name);
-                               name.Version = new Version(
-                                       AssemblyRef.records[i].MajorVersion,
-                                       AssemblyRef.records[i].MinorVersion,
-                                       AssemblyRef.records[i].BuildNumber,
-                                       AssemblyRef.records[i].RevisionNumber);
-                               if (AssemblyRef.records[i].PublicKeyOrToken != 0)
-                               {
-                                       byte[] keyOrToken = GetBlobCopy(AssemblyRef.records[i].PublicKeyOrToken);
-                                       const int PublicKey = 0x0001;
-                                       if ((AssemblyRef.records[i].Flags & PublicKey) != 0)
-                                       {
-                                               name.SetPublicKey(keyOrToken);
-                                       }
-                                       else
-                                       {
-                                               name.SetPublicKeyToken(keyOrToken);
-                                       }
-                               }
-                               else
-                               {
-                                       name.SetPublicKeyToken(Empty<byte>.Array);
-                               }
-                               if (AssemblyRef.records[i].Culture != 0)
-                               {
-                                       name.Culture = GetString(AssemblyRef.records[i].Culture);
-                               }
-                               else
-                               {
-                                       name.Culture = "";
-                               }
-                               if (AssemblyRef.records[i].HashValue != 0)
-                               {
-                                       name.hash = GetBlobCopy(AssemblyRef.records[i].HashValue);
-                               }
-                               name.Flags = (AssemblyNameFlags)AssemblyRef.records[i].Flags;
-                               list.Add(name);
-                       }
-                       return list.ToArray();
-               }
-
-               public override void __ResolveReferencedAssemblies(Assembly[] assemblies)
-               {
-                       if (assemblyRefs == null)
-                       {
-                               assemblyRefs = new Assembly[AssemblyRef.RowCount];
-                       }
-                       for (int i = 0; i < assemblies.Length; i++)
-                       {
-                               if (assemblyRefs[i] == null)
-                               {
-                                       assemblyRefs[i] = assemblies[i];
-                               }
-                       }
-               }
-
-               public override string[] __GetReferencedModules()
-               {
-                       string[] arr = new string[this.ModuleRef.RowCount];
-                       for (int i = 0; i < arr.Length; i++)
-                       {
-                               arr[i] = GetString(this.ModuleRef.records[i]);
-                       }
-                       return arr;
-               }
-
-               public override Type[] __GetReferencedTypes()
-               {
-                       Type[] arr = new Type[this.TypeRef.RowCount];
-                       for (int i = 0; i < arr.Length; i++)
-                       {
-                               arr[i] = ResolveType((TypeRefTable.Index << 24) + i + 1);
-                       }
-                       return arr;
-               }
-
-               public override Type[] __GetExportedTypes()
-               {
-                       Type[] arr = new Type[this.ExportedType.RowCount];
-                       for (int i = 0; i < arr.Length; i++)
-                       {
-                               arr[i] = ResolveExportedType(i);
-                       }
-                       return arr;
-               }
-
-               private Type ResolveExportedType(int index)
-               {
-                       TypeName typeName = GetTypeName(ExportedType.records[index].TypeNamespace, ExportedType.records[index].TypeName);
-                       int implementation = ExportedType.records[index].Implementation;
-                       int token = ExportedType.records[index].TypeDefId;
-                       switch (implementation >> 24)
-                       {
-                               case AssemblyRefTable.Index:
-                                       return ResolveAssemblyRef((implementation & 0xFFFFFF) - 1).ResolveType(typeName).SetMetadataTokenForMissing(token);
-                               case ExportedTypeTable.Index:
-                                       return ResolveExportedType((implementation & 0xFFFFFF) - 1).ResolveNestedType(typeName).SetMetadataTokenForMissing(token);
-                               default:
-                                       throw new NotImplementedException();
-                       }
-               }
-
-               internal override Type GetModuleType()
-               {
-                       PopulateTypeDef();
-                       return moduleType;
-               }
-
-               public override string __ImageRuntimeVersion
-               {
-                       get { return imageRuntimeVersion; }
-               }
-
-               public override int MDStreamVersion
-               {
-                       get { return metadataStreamVersion; }
-               }
-
-               public override void __GetDataDirectoryEntry(int index, out int rva, out int length)
-               {
-                       peFile.GetDataDirectoryEntry(index, out rva, out length);
-               }
-
-               public override long __RelativeVirtualAddressToFileOffset(int rva)
-               {
-                       return peFile.RvaToFileOffset((uint)rva);
-               }
-
-               public override bool __GetSectionInfo(int rva, out string name, out int characteristics)
-               {
-                       return peFile.GetSectionInfo(rva, out name, out characteristics);
-               }
-
-               public override int __ReadDataFromRVA(int rva, byte[] data, int offset, int length)
-               {
-                       SeekRVA(rva);
-                       int totalBytesRead = 0;
-                       while (length > 0)
-                       {
-                               int read = stream.Read(data, offset, length);
-                               if (read == 0)
-                               {
-                                       // C++ assemblies can have fields that have an RVA that lies outside of the file
-                                       break;
-                               }
-                               offset += read;
-                               length -= read;
-                               totalBytesRead += read;
-                       }
-                       return totalBytesRead;
-               }
-
-               public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
-               {
-                       peKind = 0;
-                       if ((cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_ILONLY) != 0)
-                       {
-                               peKind |= PortableExecutableKinds.ILOnly;
-                       }
-                       switch (cliHeader.Flags & (CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED))
-                       {
-                               case CliHeader.COMIMAGE_FLAGS_32BITREQUIRED:
-                                       peKind |= PortableExecutableKinds.Required32Bit;
-                                       break;
-                               case CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED:
-                                       peKind |= PortableExecutableKinds.Preferred32Bit;
-                                       break;
-                               default:
-                                       // COMIMAGE_FLAGS_32BITPREFERRED by itself is illegal, so we ignore it
-                                       // (not setting any flag is ok)
-                                       break;
-                       }
-                       if (peFile.OptionalHeader.Magic == IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC)
-                       {
-                               peKind |= PortableExecutableKinds.PE32Plus;
-                       }
-
-                       machine = (ImageFileMachine)peFile.FileHeader.Machine;
-               }
-
-               public override int __Subsystem
-               {
-                       get { return peFile.OptionalHeader.Subsystem; }
-               }
-
-               public override IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
-               {
-                       TypeName typeName;
-                       switch ((multiple ? 1 : 0) + (security ? 2 : 0))
-                       {
-                               case 0:
-                                       typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHere");
-                                       break;
-                               case 1:
-                                       typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereM");
-                                       break;
-                               case 2:
-                                       typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereS");
-                                       break;
-                               case 3:
-                               default:
-                                       typeName = new TypeName("System.Runtime.CompilerServices", "AssemblyAttributesGoHereSM");
-                                       break;
-                       }
-                       List<CustomAttributeData> list = new List<CustomAttributeData>();
-                       for (int i = 0; i < CustomAttribute.records.Length; i++)
-                       {
-                               if ((CustomAttribute.records[i].Parent >> 24) == TypeRefTable.Index)
-                               {
-                                       int index = (CustomAttribute.records[i].Parent & 0xFFFFFF) - 1;
-                                       if (typeName == GetTypeName(TypeRef.records[index].TypeNameSpace, TypeRef.records[index].TypeName))
-                                       {
-                                               list.Add(new CustomAttributeData(this, i));
-                                       }
-                               }
-                       }
-                       return list;
-               }
-
-               internal override void Dispose()
-               {
-                       stream.Close();
-               }
-
-               internal override void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
-               {
-                       PopulateTypeDef();
-                       manifestModule.ExportTypes(typeDefs, fileToken);
-               }
-
-               protected override long GetImageBaseImpl()
-               {
-                       return (long)peFile.OptionalHeader.ImageBase;
-               }
-
-               protected override long GetStackReserveImpl()
-               {
-                       return (long)peFile.OptionalHeader.SizeOfStackReserve;
-               }
-
-               protected override int GetFileAlignmentImpl()
-               {
-                       return (int)peFile.OptionalHeader.FileAlignment;
-               }
-
-               protected override DllCharacteristics GetDllCharacteristicsImpl()
-               {
-                       return (DllCharacteristics)peFile.OptionalHeader.DllCharacteristics;
-               }
-
-               public override int __EntryPointRVA
-               {
-                       get { return (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) != 0 ? (int)cliHeader.EntryPointToken : 0; }
-               }
-
-               public override int __EntryPointToken
-               {
-                       get { return (cliHeader.Flags & CliHeader.COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) == 0 ? (int)cliHeader.EntryPointToken : 0; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/PEReader.cs b/mcs/class/IKVM.Reflection/Reader/PEReader.cs
deleted file mode 100644 (file)
index 50928c8..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
-  Copyright (C) 2009 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using BYTE = System.Byte;
-using WORD = System.UInt16;
-using DWORD = System.UInt32;
-using ULONGLONG = System.UInt64;
-using System.IO;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class MSDOS_HEADER
-       {
-               internal const WORD MAGIC_MZ = 0x5A4D;
-
-               internal WORD signature;        // 'MZ'
-               // skip 58 bytes
-               internal DWORD peSignatureOffset;
-       }
-
-       sealed class IMAGE_NT_HEADERS
-       {
-               public const DWORD MAGIC_SIGNATURE = 0x00004550;        // "PE\0\0"
-
-               public DWORD Signature;
-               public IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
-               public IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
-
-               internal void Read(BinaryReader br)
-               {
-                       Signature = br.ReadUInt32();
-                       if (Signature != IMAGE_NT_HEADERS.MAGIC_SIGNATURE)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       FileHeader.Read(br);
-                       OptionalHeader.Read(br);
-               }
-       }
-
-       sealed class IMAGE_FILE_HEADER
-       {
-               public const WORD IMAGE_FILE_MACHINE_I386 = 0x014c;
-               public const WORD IMAGE_FILE_MACHINE_IA64 = 0x0200;
-               public const WORD IMAGE_FILE_MACHINE_AMD64 = 0x8664;
-
-               public const WORD IMAGE_FILE_32BIT_MACHINE = 0x0100;
-               public const WORD IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
-               public const WORD IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
-               public const WORD IMAGE_FILE_DLL = 0x2000;
-
-               public WORD Machine;
-               public WORD NumberOfSections;
-               public DWORD TimeDateStamp;
-               public DWORD PointerToSymbolTable;
-               public DWORD NumberOfSymbols;
-               public WORD SizeOfOptionalHeader;
-               public WORD Characteristics;
-
-               internal void Read(BinaryReader br)
-               {
-                       Machine = br.ReadUInt16();
-                       NumberOfSections = br.ReadUInt16();
-                       TimeDateStamp = br.ReadUInt32();
-                       PointerToSymbolTable = br.ReadUInt32();
-                       NumberOfSymbols = br.ReadUInt32();
-                       SizeOfOptionalHeader = br.ReadUInt16();
-                       Characteristics = br.ReadUInt16();
-               }
-       }
-
-       sealed class IMAGE_OPTIONAL_HEADER
-       {
-               public const WORD IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
-               public const WORD IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
-
-               public const WORD IMAGE_SUBSYSTEM_WINDOWS_GUI = 2;
-               public const WORD IMAGE_SUBSYSTEM_WINDOWS_CUI = 3;
-
-               public WORD Magic;
-               public BYTE MajorLinkerVersion;
-               public BYTE MinorLinkerVersion;
-               public DWORD SizeOfCode;
-               public DWORD SizeOfInitializedData;
-               public DWORD SizeOfUninitializedData;
-               public DWORD AddressOfEntryPoint;
-               public DWORD BaseOfCode;
-               public DWORD BaseOfData;
-               public ULONGLONG ImageBase;
-               public DWORD SectionAlignment;
-               public DWORD FileAlignment;
-               public WORD MajorOperatingSystemVersion;
-               public WORD MinorOperatingSystemVersion;
-               public WORD MajorImageVersion;
-               public WORD MinorImageVersion;
-               public WORD MajorSubsystemVersion;
-               public WORD MinorSubsystemVersion;
-               public DWORD Win32VersionValue;
-               public DWORD SizeOfImage;
-               public DWORD SizeOfHeaders;
-               public DWORD CheckSum;
-               public WORD Subsystem;
-               public WORD DllCharacteristics;
-               public ULONGLONG SizeOfStackReserve;
-               public ULONGLONG SizeOfStackCommit;
-               public ULONGLONG SizeOfHeapReserve;
-               public ULONGLONG SizeOfHeapCommit;
-               public DWORD LoaderFlags;
-               public DWORD NumberOfRvaAndSizes;
-               public IMAGE_DATA_DIRECTORY[] DataDirectory;
-
-               internal void Read(BinaryReader br)
-               {
-                       Magic = br.ReadUInt16();
-                       if (Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC && Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       MajorLinkerVersion = br.ReadByte();
-                       MinorLinkerVersion = br.ReadByte();
-                       SizeOfCode = br.ReadUInt32();
-                       SizeOfInitializedData = br.ReadUInt32();
-                       SizeOfUninitializedData = br.ReadUInt32();
-                       AddressOfEntryPoint = br.ReadUInt32();
-                       BaseOfCode = br.ReadUInt32();
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               BaseOfData = br.ReadUInt32();
-                               ImageBase = br.ReadUInt32();
-                       }
-                       else
-                       {
-                               ImageBase = br.ReadUInt64();
-                       }
-                       SectionAlignment = br.ReadUInt32();
-                       FileAlignment = br.ReadUInt32();
-                       MajorOperatingSystemVersion = br.ReadUInt16();
-                       MinorOperatingSystemVersion = br.ReadUInt16();
-                       MajorImageVersion = br.ReadUInt16();
-                       MinorImageVersion = br.ReadUInt16();
-                       MajorSubsystemVersion = br.ReadUInt16();
-                       MinorSubsystemVersion = br.ReadUInt16();
-                       Win32VersionValue = br.ReadUInt32();
-                       SizeOfImage = br.ReadUInt32();
-                       SizeOfHeaders = br.ReadUInt32();
-                       CheckSum = br.ReadUInt32();
-                       Subsystem = br.ReadUInt16();
-                       DllCharacteristics = br.ReadUInt16();
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               SizeOfStackReserve = br.ReadUInt32();
-                               SizeOfStackCommit = br.ReadUInt32();
-                               SizeOfHeapReserve = br.ReadUInt32();
-                               SizeOfHeapCommit = br.ReadUInt32();
-                       }
-                       else
-                       {
-                               SizeOfStackReserve = br.ReadUInt64();
-                               SizeOfStackCommit = br.ReadUInt64();
-                               SizeOfHeapReserve = br.ReadUInt64();
-                               SizeOfHeapCommit = br.ReadUInt64();
-                       }
-                       LoaderFlags = br.ReadUInt32();
-                       NumberOfRvaAndSizes = br.ReadUInt32();
-                       DataDirectory = new IMAGE_DATA_DIRECTORY[NumberOfRvaAndSizes];
-                       for (uint i = 0; i < NumberOfRvaAndSizes; i++)
-                       {
-                               DataDirectory[i] = new IMAGE_DATA_DIRECTORY();
-                               DataDirectory[i].Read(br);
-                       }
-               }
-       }
-
-       struct IMAGE_DATA_DIRECTORY
-       {
-               public DWORD VirtualAddress;
-               public DWORD Size;
-
-               internal void Read(BinaryReader br)
-               {
-                       VirtualAddress = br.ReadUInt32();
-                       Size = br.ReadUInt32();
-               }
-
-               internal void Write(IKVM.Reflection.Writer.MetadataWriter mw)
-               {
-                       mw.Write(VirtualAddress);
-                       mw.Write(Size);
-               }
-       }
-
-       class SectionHeader
-       {
-               public const DWORD IMAGE_SCN_CNT_CODE = 0x00000020;
-               public const DWORD IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040;
-               public const DWORD IMAGE_SCN_MEM_DISCARDABLE = 0x02000000;
-               public const DWORD IMAGE_SCN_MEM_EXECUTE = 0x20000000;
-               public const DWORD IMAGE_SCN_MEM_READ = 0x40000000;
-               public const DWORD IMAGE_SCN_MEM_WRITE = 0x80000000;
-
-               public string Name;             // 8 byte UTF8 encoded 0-padded
-               public DWORD VirtualSize;
-               public DWORD VirtualAddress;
-               public DWORD SizeOfRawData;
-               public DWORD PointerToRawData;
-               public DWORD PointerToRelocations;
-               public DWORD PointerToLinenumbers;
-               public WORD NumberOfRelocations;
-               public WORD NumberOfLinenumbers;
-               public DWORD Characteristics;
-
-               internal void Read(BinaryReader br)
-               {
-                       char[] name = new char[8];
-                       int len = 8;
-                       for (int i = 0; i < 8; i++)
-                       {
-                               byte b = br.ReadByte();
-                               name[i] = (char)b;
-                               if (b == 0 && len == 8)
-                               {
-                                       len = i;
-                               }
-                       }
-                       Name = new String(name, 0, len);
-                       VirtualSize = br.ReadUInt32();
-                       VirtualAddress = br.ReadUInt32();
-                       SizeOfRawData = br.ReadUInt32();
-                       PointerToRawData = br.ReadUInt32();
-                       PointerToRelocations = br.ReadUInt32();
-                       PointerToLinenumbers = br.ReadUInt32();
-                       NumberOfRelocations = br.ReadUInt16();
-                       NumberOfLinenumbers = br.ReadUInt16();
-                       Characteristics = br.ReadUInt32();
-               }
-       }
-
-       sealed class PEReader
-       {
-               private MSDOS_HEADER msdos = new MSDOS_HEADER();
-               private IMAGE_NT_HEADERS headers = new IMAGE_NT_HEADERS();
-               private SectionHeader[] sections;
-
-               internal void Read(BinaryReader br)
-               {
-                       msdos.signature = br.ReadUInt16();
-                       br.BaseStream.Seek(58, SeekOrigin.Current);
-                       msdos.peSignatureOffset = br.ReadUInt32();
-
-                       if (msdos.signature != MSDOS_HEADER.MAGIC_MZ)
-                       {
-                               throw new BadImageFormatException();
-                       }
-
-                       br.BaseStream.Seek(msdos.peSignatureOffset, SeekOrigin.Begin);
-                       headers.Read(br);
-                       sections = new SectionHeader[headers.FileHeader.NumberOfSections];
-                       for (int i = 0; i < sections.Length; i++)
-                       {
-                               sections[i] = new SectionHeader();
-                               sections[i].Read(br);
-                       }
-               }
-
-               internal IMAGE_FILE_HEADER FileHeader
-               {
-                       get { return headers.FileHeader; }
-               }
-
-               internal IMAGE_OPTIONAL_HEADER OptionalHeader
-               {
-                       get { return headers.OptionalHeader; }
-               }
-
-               internal DWORD GetComDescriptorVirtualAddress()
-               {
-                       return headers.OptionalHeader.DataDirectory[14].VirtualAddress;
-               }
-
-               internal void GetDataDirectoryEntry(int index, out int rva, out int length)
-               {
-                       rva = (int)headers.OptionalHeader.DataDirectory[index].VirtualAddress;
-                       length = (int)headers.OptionalHeader.DataDirectory[index].Size;
-               }
-
-               internal long RvaToFileOffset(DWORD rva)
-               {
-                       for (int i = 0; i < sections.Length; i++)
-                       {
-                               if (rva >= sections[i].VirtualAddress && rva < sections[i].VirtualAddress + sections[i].VirtualSize)
-                               {
-                                       return sections[i].PointerToRawData + rva - sections[i].VirtualAddress;
-                               }
-                       }
-                       throw new BadImageFormatException();
-               }
-
-               internal bool GetSectionInfo(int rva, out string name, out int characteristics)
-               {
-                       for (int i = 0; i < sections.Length; i++)
-                       {
-                               if (rva >= sections[i].VirtualAddress && rva < sections[i].VirtualAddress + sections[i].VirtualSize)
-                               {
-                                       name = sections[i].Name;
-                                       characteristics = (int)sections[i].Characteristics;
-                                       return true;
-                               }
-                       }
-                       name = null;
-                       characteristics = 0;
-                       return false;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/PropertyInfoImpl.cs b/mcs/class/IKVM.Reflection/Reader/PropertyInfoImpl.cs
deleted file mode 100644 (file)
index 120b839..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class PropertyInfoImpl : PropertyInfo
-       {
-               private readonly ModuleReader module;
-               private readonly Type declaringType;
-               private readonly int index;
-               private PropertySignature sig;
-               private bool isPublic;
-               private bool isNonPrivate;
-               private bool isStatic;
-               private bool flagsCached;
-
-               internal PropertyInfoImpl(ModuleReader module, Type declaringType, int index)
-               {
-                       this.module = module;
-                       this.declaringType = declaringType;
-                       this.index = index;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       PropertyInfoImpl other = obj as PropertyInfoImpl;
-                       return other != null && other.DeclaringType == declaringType && other.index == index;
-               }
-
-               public override int GetHashCode()
-               {
-                       return declaringType.GetHashCode() * 77 + index;
-               }
-
-               internal override PropertySignature PropertySignature
-               {
-                       get
-                       {
-                               if (sig == null)
-                               {
-                                       sig = PropertySignature.ReadSig(module, module.GetBlob(module.Property.records[index].Type), declaringType);
-                               }
-                               return sig;
-                       }
-               }
-
-               public override PropertyAttributes Attributes
-               {
-                       get { return (PropertyAttributes)module.Property.records[index].Flags; }
-               }
-
-               public override object GetRawConstantValue()
-               {
-                       return module.Constant.GetRawConstantValue(module, this.MetadataToken);
-               }
-
-               public override bool CanRead
-               {
-                       get { return GetGetMethod(true) != null; }
-               }
-
-               public override bool CanWrite
-               {
-                       get { return GetSetMethod(true) != null; }
-               }
-
-               public override MethodInfo GetGetMethod(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Getter);
-               }
-
-               public override MethodInfo GetSetMethod(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethod(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Setter);
-               }
-
-               public override MethodInfo[] GetAccessors(bool nonPublic)
-               {
-                       return module.MethodSemantics.GetMethods(module, this.MetadataToken, nonPublic, MethodSemanticsTable.Getter | MethodSemanticsTable.Setter | MethodSemanticsTable.Other);
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return declaringType; }
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (PropertyTable.Index << 24) + index + 1; }
-               }
-
-               public override string Name
-               {
-                       get { return module.GetString(module.Property.records[index].Name); }
-               }
-
-               internal override bool IsPublic
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isPublic;
-                       }
-               }
-
-               internal override bool IsNonPrivate
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isNonPrivate;
-                       }
-               }
-
-               internal override bool IsStatic
-               {
-                       get
-                       {
-                               if (!flagsCached)
-                               {
-                                       ComputeFlags();
-                               }
-                               return isStatic;
-                       }
-               }
-
-               private void ComputeFlags()
-               {
-                       module.MethodSemantics.ComputeFlags(module, this.MetadataToken, out isPublic, out isNonPrivate, out isStatic);
-                       flagsCached = true;
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/ResourceModule.cs b/mcs/class/IKVM.Reflection/Reader/ResourceModule.cs
deleted file mode 100644 (file)
index 0113e47..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class ResourceModule : NonPEModule
-       {
-               private readonly ModuleReader manifest;
-               private readonly int index;
-               private readonly string location;
-
-               internal ResourceModule(ModuleReader manifest, int index, string location)
-                       : base(manifest.universe)
-               {
-                       this.manifest = manifest;
-                       this.index = index;
-                       this.location = location;
-               }
-
-               public override int MDStreamVersion
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public override bool IsResource()
-               {
-                       return true;
-               }
-
-               public override Assembly Assembly
-               {
-                       get { return manifest.Assembly; }
-               }
-
-               public override string FullyQualifiedName
-               {
-                       get { return location ?? "<Unknown>"; }
-               }
-
-               public override string Name
-               {
-                       get { return location == null ? "<Unknown>" : System.IO.Path.GetFileName(location); }
-               }
-
-               public override string ScopeName
-               {
-                       get { return manifest.GetString(manifest.File.records[index].Name); }
-               }
-
-               public override Guid ModuleVersionId
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public override byte[] __ModuleHash
-               {
-                       get
-                       {
-                               int blob = manifest.File.records[index].HashValue;
-                               return blob == 0 ? Empty<byte>.Array : manifest.GetBlobCopy(blob);
-                       }
-               }
-
-               internal override Type FindType(TypeName typeName)
-               {
-                       return null;
-               }
-
-               internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       return null;
-               }
-
-               internal override void GetTypesImpl(List<Type> list)
-               {
-               }
-
-               protected override Exception ArgumentOutOfRangeException()
-               {
-                       return new NotSupportedException();
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Reader/TypeDefImpl.cs b/mcs/class/IKVM.Reflection/Reader/TypeDefImpl.cs
deleted file mode 100644 (file)
index e4a036d..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
-  Copyright (C) 2009-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Reader
-{
-       sealed class TypeDefImpl : TypeInfo
-       {
-               private readonly ModuleReader module;
-               private readonly int index;
-               private readonly string typeName;
-               private readonly string typeNamespace;
-               private Type[] typeArgs;
-
-               internal TypeDefImpl(ModuleReader module, int index)
-               {
-                       this.module = module;
-                       this.index = index;
-                       this.typeName = module.GetString(module.TypeDef.records[index].TypeName);
-                       this.typeNamespace = module.GetString(module.TypeDef.records[index].TypeNamespace);
-                       MarkEnumOrValueType(typeNamespace, typeName);
-               }
-
-               public override Type BaseType
-               {
-                       get
-                       {
-                               int extends = module.TypeDef.records[index].Extends;
-                               if ((extends & 0xFFFFFF) == 0)
-                               {
-                                       return null;
-                               }
-                               return module.ResolveType(extends, this);
-                       }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return (TypeAttributes)module.TypeDef.records[index].Flags; }
-               }
-
-               public override EventInfo[] __GetDeclaredEvents()
-               {
-                       foreach (int i in module.EventMap.Filter(this.MetadataToken))
-                       {
-                               int evt = module.EventMap.records[i].EventList - 1;
-                               int end = module.EventMap.records.Length > i + 1 ? module.EventMap.records[i + 1].EventList - 1 : module.Event.records.Length;
-                               EventInfo[] events = new EventInfo[end - evt];
-                               if (module.EventPtr.RowCount == 0)
-                               {
-                                       for (int j = 0; evt < end; evt++, j++)
-                                       {
-                                               events[j] = new EventInfoImpl(module, this, evt);
-                                       }
-                               }
-                               else
-                               {
-                                       for (int j = 0; evt < end; evt++, j++)
-                                       {
-                                               events[j] = new EventInfoImpl(module, this, module.EventPtr.records[evt] - 1);
-                                       }
-                               }
-                               return events;
-                       }
-                       return Empty<EventInfo>.Array;
-               }
-
-               public override FieldInfo[] __GetDeclaredFields()
-               {
-                       int field = module.TypeDef.records[index].FieldList - 1;
-                       int end = module.TypeDef.records.Length > index + 1 ? module.TypeDef.records[index + 1].FieldList - 1 : module.Field.records.Length;
-                       FieldInfo[] fields = new FieldInfo[end - field];
-                       if (module.FieldPtr.RowCount == 0)
-                       {
-                               for (int i = 0; field < end; i++, field++)
-                               {
-                                       fields[i] = module.GetFieldAt(this, field);
-                               }
-                       }
-                       else
-                       {
-                               for (int i = 0; field < end; i++, field++)
-                               {
-                                       fields[i] = module.GetFieldAt(this, module.FieldPtr.records[field] - 1);
-                               }
-                       }
-                       return fields;
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       List<Type> list = null;
-                       foreach (int i in module.InterfaceImpl.Filter(this.MetadataToken))
-                       {
-                               if (list == null)
-                               {
-                                       list = new List<Type>();
-                               }
-                               list.Add(module.ResolveType(module.InterfaceImpl.records[i].Interface, this));
-                       }
-                       return Util.ToArray(list, Type.EmptyTypes);
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       int method = module.TypeDef.records[index].MethodList - 1;
-                       int end = module.TypeDef.records.Length > index + 1 ? module.TypeDef.records[index + 1].MethodList - 1 : module.MethodDef.records.Length;
-                       MethodBase[] methods = new MethodBase[end - method];
-                       if (module.MethodPtr.RowCount == 0)
-                       {
-                               for (int i = 0; method < end; method++, i++)
-                               {
-                                       methods[i] = module.GetMethodAt(this, method);
-                               }
-                       }
-                       else
-                       {
-                               for (int i = 0; method < end; method++, i++)
-                               {
-                                       methods[i] = module.GetMethodAt(this, module.MethodPtr.records[method] - 1);
-                               }
-                       }
-                       return methods;
-               }
-
-               public override __MethodImplMap __GetMethodImplMap()
-               {
-                       PopulateGenericArguments();
-                       List<MethodInfo> bodies = new List<MethodInfo>();
-                       List<List<MethodInfo>> declarations = new List<List<MethodInfo>>();
-                       foreach (int i in module.MethodImpl.Filter(this.MetadataToken))
-                       {
-                               MethodInfo body = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodBody, typeArgs, null);
-                               int index = bodies.IndexOf(body);
-                               if (index == -1)
-                               {
-                                       index = bodies.Count;
-                                       bodies.Add(body);
-                                       declarations.Add(new List<MethodInfo>());
-                               }
-                               MethodInfo declaration = (MethodInfo)module.ResolveMethod(module.MethodImpl.records[i].MethodDeclaration, typeArgs, null);
-                               declarations[index].Add(declaration);
-                       }
-                       __MethodImplMap map = new __MethodImplMap();
-                       map.TargetType = this;
-                       map.MethodBodies = bodies.ToArray();
-                       map.MethodDeclarations = new MethodInfo[declarations.Count][];
-                       for (int i = 0; i < map.MethodDeclarations.Length; i++)
-                       {
-                               map.MethodDeclarations[i] = declarations[i].ToArray();
-                       }
-                       return map;
-               }
-
-               public override Type[] __GetDeclaredTypes()
-               {
-                       int token = this.MetadataToken;
-                       List<Type> list = new List<Type>();
-                       // note that the NestedClass table is sorted on NestedClass, so we can't use binary search
-                       for (int i = 0; i < module.NestedClass.records.Length; i++)
-                       {
-                               if (module.NestedClass.records[i].EnclosingClass == token)
-                               {
-                                       list.Add(module.ResolveType(module.NestedClass.records[i].NestedClass));
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public override PropertyInfo[] __GetDeclaredProperties()
-               {
-                       foreach (int i in module.PropertyMap.Filter(this.MetadataToken))
-                       {
-                               int property = module.PropertyMap.records[i].PropertyList - 1;
-                               int end = module.PropertyMap.records.Length > i + 1 ? module.PropertyMap.records[i + 1].PropertyList - 1 : module.Property.records.Length;
-                               PropertyInfo[] properties = new PropertyInfo[end - property];
-                               if (module.PropertyPtr.RowCount == 0)
-                               {
-                                       for (int j = 0; property < end; property++, j++)
-                                       {
-                                               properties[j] = new PropertyInfoImpl(module, this, property);
-                                       }
-                               }
-                               else
-                               {
-                                       for (int j = 0; property < end; property++, j++)
-                                       {
-                                               properties[j] = new PropertyInfoImpl(module, this, module.PropertyPtr.records[property] - 1);
-                                       }
-                               }
-                               return properties;
-                       }
-                       return Empty<PropertyInfo>.Array;
-               }
-
-               public override string __Name
-               {
-                       get { return typeName; }
-               }
-
-               public override string __Namespace
-               {
-                       get { return typeNamespace; }
-               }
-
-               public override string Name
-               {
-                       get { return TypeNameParser.Escape(typeName); }
-               }
-
-               public override string FullName
-               {
-                       get { return GetFullName(); }
-               }
-
-               public override int MetadataToken
-               {
-                       get { return (TypeDefTable.Index << 24) + index + 1; }
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       PopulateGenericArguments();
-                       return Util.Copy(typeArgs);
-               }
-
-               private void PopulateGenericArguments()
-               {
-                       if (typeArgs == null)
-                       {
-                               int token = this.MetadataToken;
-                               int first = module.GenericParam.FindFirstByOwner(token);
-                               if (first == -1)
-                               {
-                                       typeArgs = Type.EmptyTypes;
-                               }
-                               else
-                               {
-                                       List<Type> list = new List<Type>();
-                                       int len = module.GenericParam.records.Length;
-                                       for (int i = first; i < len && module.GenericParam.records[i].Owner == token; i++)
-                                       {
-                                               list.Add(new GenericTypeParameter(module, i));
-                                       }
-                                       typeArgs = list.ToArray();
-                               }
-                       }
-               }
-
-               internal override Type GetGenericTypeArgument(int index)
-               {
-                       PopulateGenericArguments();
-                       return typeArgs[index];
-               }
-
-               public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       PopulateGenericArguments();
-                       return new CustomModifiers[typeArgs.Length];
-               }
-
-               public override bool IsGenericType
-               {
-                       get { return IsGenericTypeDefinition; }
-               }
-
-               public override bool IsGenericTypeDefinition
-               {
-                       get
-                       {
-                               if ((typeFlags & (TypeFlags.IsGenericTypeDefinition | TypeFlags.NotGenericTypeDefinition)) == 0)
-                               {
-                                       typeFlags |= module.GenericParam.FindFirstByOwner(this.MetadataToken) == -1
-                                               ? TypeFlags.NotGenericTypeDefinition
-                                               : TypeFlags.IsGenericTypeDefinition;
-                               }
-                               return (typeFlags & TypeFlags.IsGenericTypeDefinition) != 0;
-                       }
-               }
-
-               public override Type GetGenericTypeDefinition()
-               {
-                       if (IsGenericTypeDefinition)
-                       {
-                               return this;
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               public override string ToString()
-               {
-                       StringBuilder sb = new StringBuilder(this.FullName);
-                       string sep = "[";
-                       foreach (Type arg in GetGenericArguments())
-                       {
-                               sb.Append(sep);
-                               sb.Append(arg);
-                               sep = ",";
-                       }
-                       if (sep != "[")
-                       {
-                               sb.Append(']');
-                       }
-                       return sb.ToString();
-               }
-
-               internal bool IsNestedByFlags
-               {
-                       get { return (this.Attributes & TypeAttributes.VisibilityMask & ~TypeAttributes.Public) != 0; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get
-                       {
-                               // note that we cannot use Type.IsNested for this, because that calls DeclaringType
-                               if (!IsNestedByFlags)
-                               {
-                                       return null;
-                               }
-                               foreach (int i in module.NestedClass.Filter(this.MetadataToken))
-                               {
-                                       return module.ResolveType(module.NestedClass.records[i].EnclosingClass, null, null);
-                               }
-                               throw new InvalidOperationException();
-                       }
-               }
-
-               public override StructLayoutAttribute StructLayoutAttribute
-               {
-                       get
-                       {
-                               StructLayoutAttribute layout;
-                               switch (this.Attributes & TypeAttributes.LayoutMask)
-                               {
-                                       case TypeAttributes.AutoLayout:
-                                               layout = new StructLayoutAttribute(LayoutKind.Auto);
-                                               break;
-                                       case TypeAttributes.SequentialLayout:
-                                               layout = new StructLayoutAttribute(LayoutKind.Sequential);
-                                               break;
-                                       case TypeAttributes.ExplicitLayout:
-                                               layout = new StructLayoutAttribute(LayoutKind.Explicit);
-                                               break;
-                                       default:
-                                               throw new BadImageFormatException();
-                               }
-                               switch (this.Attributes & TypeAttributes.StringFormatMask)
-                               {
-                                       case TypeAttributes.AnsiClass:
-                                               layout.CharSet = CharSet.Ansi;
-                                               break;
-                                       case TypeAttributes.UnicodeClass:
-                                               layout.CharSet = CharSet.Unicode;
-                                               break;
-                                       case TypeAttributes.AutoClass:
-                                               layout.CharSet = CharSet.Auto;
-                                               break;
-                                       default:
-                                               layout.CharSet = CharSet.None;
-                                               break;
-                               }
-                               if (!__GetLayout(out layout.Pack, out layout.Size))
-                               {
-                                       // compatibility with System.Reflection
-                                       layout.Pack = 8;
-                               }
-                               return layout;
-                       }
-               }
-
-               public override bool __GetLayout(out int packingSize, out int typeSize)
-               {
-                       foreach (int i in module.ClassLayout.Filter(this.MetadataToken))
-                       {
-                               packingSize = module.ClassLayout.records[i].PackingSize;
-                               typeSize = module.ClassLayout.records[i].ClassSize;
-                               return true;
-                       }
-                       packingSize = 0;
-                       typeSize = 0;
-                       return false;
-               }
-
-               public override Module Module
-               {
-                       get { return module; }
-               }
-
-               internal override bool IsModulePseudoType
-               {
-                       get { return index == 0; }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Signature.cs b/mcs/class/IKVM.Reflection/Signature.cs
deleted file mode 100644 (file)
index 68c3f10..0000000
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using CallingConvention = System.Runtime.InteropServices.CallingConvention;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Writer;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection
-{
-       abstract class Signature
-       {
-               internal const byte DEFAULT = 0x00;
-               internal const byte VARARG = 0x05;
-               internal const byte GENERIC = 0x10;
-               internal const byte HASTHIS = 0x20;
-               internal const byte EXPLICITTHIS = 0x40;
-               internal const byte FIELD = 0x06;
-               internal const byte LOCAL_SIG = 0x07;
-               internal const byte PROPERTY = 0x08;
-               internal const byte GENERICINST = 0x0A;
-               internal const byte SENTINEL = 0x41;
-               internal const byte ELEMENT_TYPE_VOID = 0x01;
-               internal const byte ELEMENT_TYPE_BOOLEAN = 0x02;
-               internal const byte ELEMENT_TYPE_CHAR = 0x03;
-               internal const byte ELEMENT_TYPE_I1 = 0x04;
-               internal const byte ELEMENT_TYPE_U1 = 0x05;
-               internal const byte ELEMENT_TYPE_I2 = 0x06;
-               internal const byte ELEMENT_TYPE_U2 = 0x07;
-               internal const byte ELEMENT_TYPE_I4 = 0x08;
-               internal const byte ELEMENT_TYPE_U4 = 0x09;
-               internal const byte ELEMENT_TYPE_I8 = 0x0a;
-               internal const byte ELEMENT_TYPE_U8 = 0x0b;
-               internal const byte ELEMENT_TYPE_R4 = 0x0c;
-               internal const byte ELEMENT_TYPE_R8 = 0x0d;
-               internal const byte ELEMENT_TYPE_STRING = 0x0e;
-               internal const byte ELEMENT_TYPE_PTR = 0x0f;
-               internal const byte ELEMENT_TYPE_BYREF = 0x10;
-               internal const byte ELEMENT_TYPE_VALUETYPE = 0x11;
-               internal const byte ELEMENT_TYPE_CLASS = 0x12;
-               internal const byte ELEMENT_TYPE_VAR = 0x13;
-               internal const byte ELEMENT_TYPE_ARRAY = 0x14;
-               internal const byte ELEMENT_TYPE_GENERICINST = 0x15;
-               internal const byte ELEMENT_TYPE_TYPEDBYREF = 0x16;
-               internal const byte ELEMENT_TYPE_I = 0x18;
-               internal const byte ELEMENT_TYPE_U = 0x19;
-               internal const byte ELEMENT_TYPE_FNPTR = 0x1b;
-               internal const byte ELEMENT_TYPE_OBJECT = 0x1c;
-               internal const byte ELEMENT_TYPE_SZARRAY = 0x1d;
-               internal const byte ELEMENT_TYPE_MVAR = 0x1e;
-               internal const byte ELEMENT_TYPE_CMOD_REQD = 0x1f;
-               internal const byte ELEMENT_TYPE_CMOD_OPT = 0x20;
-               internal const byte ELEMENT_TYPE_PINNED = 0x45;
-
-               internal abstract void WriteSig(ModuleBuilder module, ByteBuffer bb);
-
-               private static Type ReadGenericInst(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       Type type;
-                       switch (br.ReadByte())
-                       {
-                               case ELEMENT_TYPE_CLASS:
-                                       type = ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
-                                       break;
-                               case ELEMENT_TYPE_VALUETYPE:
-                                       type = ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
-                                       break;
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-                       if (!type.__IsMissing && !type.IsGenericTypeDefinition)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       int genArgCount = br.ReadCompressedInt();
-                       Type[] args = new Type[genArgCount];
-                       CustomModifiers[] mods = null;
-                       for (int i = 0; i < genArgCount; i++)
-                       {
-                               // LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for genericinst, but C++ uses it, the verifier allows it and ildasm also supports it
-                               CustomModifiers cm = CustomModifiers.Read(module, br, context);
-                               if (!cm.IsEmpty)
-                               {
-                                       if (mods == null)
-                                       {
-                                               mods = new CustomModifiers[genArgCount];
-                                       }
-                                       mods[i] = cm;
-                               }
-                               args[i] = ReadType(module, br, context);
-                       }
-                       return GenericTypeInstance.Make(type, args, mods);
-               }
-
-               internal static Type ReadTypeSpec(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       // LAMESPEC a TypeSpec can contain custom modifiers (C++/CLI generates "newarr (TypeSpec with custom modifiers)")
-                       CustomModifiers.Skip(br);
-                       // LAMESPEC anything can be adorned by (useless) custom modifiers
-                       // also, VAR and MVAR are also used in TypeSpec (contrary to what the spec says)
-                       return ReadType(module, br, context);
-               }
-
-               private static Type ReadFunctionPointer(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       __StandAloneMethodSig sig = MethodSignature.ReadStandAloneMethodSig(module, br, context);
-                       if (module.universe.EnableFunctionPointers)
-                       {
-                               return FunctionPointerType.Make(module.universe, sig);
-                       }
-                       else
-                       {
-                               // by default, like .NET we return System.IntPtr here
-                               return module.universe.System_IntPtr;
-                       }
-               }
-
-               internal static Type[] ReadMethodSpec(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       if (br.ReadByte() != GENERICINST)
-                       {
-                               throw new BadImageFormatException();
-                       }
-                       Type[] args = new Type[br.ReadCompressedInt()];
-                       for (int i = 0; i < args.Length; i++)
-                       {
-                               args[i] = ReadType(module, br, context);
-                       }
-                       return args;
-               }
-
-               private static int[] ReadArrayBounds(ByteReader br)
-               {
-                       int num = br.ReadCompressedInt();
-                       if (num == 0)
-                       {
-                               return null;
-                       }
-                       int[] arr = new int[num];
-                       for (int i = 0; i < num; i++)
-                       {
-                               arr[i] = br.ReadCompressedInt();
-                       }
-                       return arr;
-               }
-
-               private static Type ReadTypeOrVoid(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       if (br.PeekByte() == ELEMENT_TYPE_VOID)
-                       {
-                               br.ReadByte();
-                               return module.universe.System_Void;
-                       }
-                       else
-                       {
-                               return ReadType(module, br, context);
-                       }
-               }
-
-               // see ECMA 335 CLI spec June 2006 section 23.2.12 for this production
-               protected static Type ReadType(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       CustomModifiers mods;
-                       switch (br.ReadByte())
-                       {
-                               case ELEMENT_TYPE_CLASS:
-                                       return ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
-                               case ELEMENT_TYPE_VALUETYPE:
-                                       return ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
-                               case ELEMENT_TYPE_BOOLEAN:
-                                       return module.universe.System_Boolean;
-                               case ELEMENT_TYPE_CHAR:
-                                       return module.universe.System_Char;
-                               case ELEMENT_TYPE_I1:
-                                       return module.universe.System_SByte;
-                               case ELEMENT_TYPE_U1:
-                                       return module.universe.System_Byte;
-                               case ELEMENT_TYPE_I2:
-                                       return module.universe.System_Int16;
-                               case ELEMENT_TYPE_U2:
-                                       return module.universe.System_UInt16;
-                               case ELEMENT_TYPE_I4:
-                                       return module.universe.System_Int32;
-                               case ELEMENT_TYPE_U4:
-                                       return module.universe.System_UInt32;
-                               case ELEMENT_TYPE_I8:
-                                       return module.universe.System_Int64;
-                               case ELEMENT_TYPE_U8:
-                                       return module.universe.System_UInt64;
-                               case ELEMENT_TYPE_R4:
-                                       return module.universe.System_Single;
-                               case ELEMENT_TYPE_R8:
-                                       return module.universe.System_Double;
-                               case ELEMENT_TYPE_I:
-                                       return module.universe.System_IntPtr;
-                               case ELEMENT_TYPE_U:
-                                       return module.universe.System_UIntPtr;
-                               case ELEMENT_TYPE_STRING:
-                                       return module.universe.System_String;
-                               case ELEMENT_TYPE_OBJECT:
-                                       return module.universe.System_Object;
-                               case ELEMENT_TYPE_VAR:
-                                       return context.GetGenericTypeArgument(br.ReadCompressedInt());
-                               case ELEMENT_TYPE_MVAR:
-                                       return context.GetGenericMethodArgument(br.ReadCompressedInt());
-                               case ELEMENT_TYPE_GENERICINST:
-                                       return ReadGenericInst(module, br, context);
-                               case ELEMENT_TYPE_SZARRAY:
-                                       mods = CustomModifiers.Read(module, br, context);
-                                       return ReadType(module, br, context).__MakeArrayType(mods);
-                               case ELEMENT_TYPE_ARRAY:
-                                       mods = CustomModifiers.Read(module, br, context);
-                                       return ReadType(module, br, context).__MakeArrayType(br.ReadCompressedInt(), ReadArrayBounds(br), ReadArrayBounds(br), mods);
-                               case ELEMENT_TYPE_PTR:
-                                       mods = CustomModifiers.Read(module, br, context);
-                                       return ReadTypeOrVoid(module, br, context).__MakePointerType(mods);
-                               case ELEMENT_TYPE_FNPTR:
-                                       return ReadFunctionPointer(module, br, context);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal static void ReadLocalVarSig(ModuleReader module, ByteReader br, IGenericContext context, List<LocalVariableInfo> list)
-               {
-                       if (br.Length < 2 || br.ReadByte() != LOCAL_SIG)
-                       {
-                               throw new BadImageFormatException("Invalid local variable signature");
-                       }
-                       int count = br.ReadCompressedInt();
-                       for (int i = 0; i < count; i++)
-                       {
-                               if (br.PeekByte() == ELEMENT_TYPE_TYPEDBYREF)
-                               {
-                                       br.ReadByte();
-                                       list.Add(new LocalVariableInfo(i, module.universe.System_TypedReference, false, new CustomModifiers()));
-                               }
-                               else
-                               {
-                                       CustomModifiers mods1 = CustomModifiers.Read(module, br, context);
-                                       bool pinned = false;
-                                       if (br.PeekByte() == ELEMENT_TYPE_PINNED)
-                                       {
-                                               br.ReadByte();
-                                               pinned = true;
-                                       }
-                                       CustomModifiers mods2 = CustomModifiers.Read(module, br, context);
-                                       Type type = ReadTypeOrByRef(module, br, context);
-                                       list.Add(new LocalVariableInfo(i, type, pinned, CustomModifiers.Combine(mods1, mods2)));
-                               }
-                       }
-               }
-
-               private static Type ReadTypeOrByRef(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       if (br.PeekByte() == ELEMENT_TYPE_BYREF)
-                       {
-                               br.ReadByte();
-                               // LAMESPEC it is allowed (by C++/CLI, ilasm and peverify) to have custom modifiers after the BYREF
-                               // (which makes sense, as it is analogous to pointers)
-                               CustomModifiers mods = CustomModifiers.Read(module, br, context);
-                               // C++/CLI generates void& local variables, so we need to use ReadTypeOrVoid here
-                               return ReadTypeOrVoid(module, br, context).__MakeByRefType(mods);
-                       }
-                       else
-                       {
-                               return ReadType(module, br, context);
-                       }
-               }
-
-               protected static Type ReadRetType(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       switch (br.PeekByte())
-                       {
-                               case ELEMENT_TYPE_VOID:
-                                       br.ReadByte();
-                                       return module.universe.System_Void;
-                               case ELEMENT_TYPE_TYPEDBYREF:
-                                       br.ReadByte();
-                                       return module.universe.System_TypedReference;
-                               default:
-                                       return ReadTypeOrByRef(module, br, context);
-                       }
-               }
-
-               protected static Type ReadParam(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       switch (br.PeekByte())
-                       {
-                               case ELEMENT_TYPE_TYPEDBYREF:
-                                       br.ReadByte();
-                                       return module.universe.System_TypedReference;
-                               default:
-                                       return ReadTypeOrByRef(module, br, context);
-                       }
-               }
-
-               protected static void WriteType(ModuleBuilder module, ByteBuffer bb, Type type)
-               {
-                       while (type.HasElementType)
-                       {
-                               if (type.__IsVector)
-                               {
-                                       bb.Write(ELEMENT_TYPE_SZARRAY);
-                               }
-                               else if (type.IsArray)
-                               {
-                                       int rank = type.GetArrayRank();
-                                       bb.Write(ELEMENT_TYPE_ARRAY);
-                                       // LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for arrays, but the verifier allows it and ildasm also supports it
-                                       WriteCustomModifiers(module, bb, type.__GetCustomModifiers());
-                                       WriteType(module, bb, type.GetElementType());
-                                       bb.WriteCompressedInt(rank);
-                                       int[] sizes = type.__GetArraySizes();
-                                       bb.WriteCompressedInt(sizes.Length);
-                                       for (int i = 0; i < sizes.Length; i++)
-                                       {
-                                               bb.WriteCompressedInt(sizes[i]);
-                                       }
-                                       int[] lobounds = type.__GetArrayLowerBounds();
-                                       bb.WriteCompressedInt(lobounds.Length);
-                                       for (int i = 0; i < lobounds.Length; i++)
-                                       {
-                                               bb.WriteCompressedInt(lobounds[i]);
-                                       }
-                                       return;
-                               }
-                               else if (type.IsByRef)
-                               {
-                                       bb.Write(ELEMENT_TYPE_BYREF);
-                               }
-                               else if (type.IsPointer)
-                               {
-                                       bb.Write(ELEMENT_TYPE_PTR);
-                               }
-                               WriteCustomModifiers(module, bb, type.__GetCustomModifiers());
-                               type = type.GetElementType();
-                       }
-                       Universe u = module.universe;
-                       if (type == u.System_Void)
-                       {
-                               bb.Write(ELEMENT_TYPE_VOID);
-                       }
-                       else if (type == u.System_Int32)
-                       {
-                               bb.Write(ELEMENT_TYPE_I4);
-                       }
-                       else if (type == u.System_Boolean)
-                       {
-                               bb.Write(ELEMENT_TYPE_BOOLEAN);
-                       }
-                       else if (type == u.System_String)
-                       {
-                               bb.Write(ELEMENT_TYPE_STRING);
-                       }
-                       else if (type == u.System_Char)
-                       {
-                               bb.Write(ELEMENT_TYPE_CHAR);
-                       }
-                       else if (type == u.System_SByte)
-                       {
-                               bb.Write(ELEMENT_TYPE_I1);
-                       }
-                       else if (type == u.System_Byte)
-                       {
-                               bb.Write(ELEMENT_TYPE_U1);
-                       }
-                       else if (type == u.System_Int16)
-                       {
-                               bb.Write(ELEMENT_TYPE_I2);
-                       }
-                       else if (type == u.System_UInt16)
-                       {
-                               bb.Write(ELEMENT_TYPE_U2);
-                       }
-                       else if (type == u.System_UInt32)
-                       {
-                               bb.Write(ELEMENT_TYPE_U4);
-                       }
-                       else if (type == u.System_Int64)
-                       {
-                               bb.Write(ELEMENT_TYPE_I8);
-                       }
-                       else if (type == u.System_UInt64)
-                       {
-                               bb.Write(ELEMENT_TYPE_U8);
-                       }
-                       else if (type == u.System_Single)
-                       {
-                               bb.Write(ELEMENT_TYPE_R4);
-                       }
-                       else if (type == u.System_Double)
-                       {
-                               bb.Write(ELEMENT_TYPE_R8);
-                       }
-                       else if (type == u.System_IntPtr)
-                       {
-                               bb.Write(ELEMENT_TYPE_I);
-                       }
-                       else if (type == u.System_UIntPtr)
-                       {
-                               bb.Write(ELEMENT_TYPE_U);
-                       }
-                       else if (type == u.System_TypedReference)
-                       {
-                               bb.Write(ELEMENT_TYPE_TYPEDBYREF);
-                       }
-                       else if (type == u.System_Object)
-                       {
-                               bb.Write(ELEMENT_TYPE_OBJECT);
-                       }
-                       else if (type.IsGenericParameter)
-                       {
-                               if (type is UnboundGenericMethodParameter || type.DeclaringMethod != null)
-                               {
-                                       bb.Write(ELEMENT_TYPE_MVAR);
-                               }
-                               else
-                               {
-                                       bb.Write(ELEMENT_TYPE_VAR);
-                               }
-                               bb.WriteCompressedInt(type.GenericParameterPosition);
-                       }
-                       else if (!type.__IsMissing && type.IsGenericType)
-                       {
-                               WriteGenericSignature(module, bb, type);
-                       }
-                       else if (type.__IsFunctionPointer)
-                       {
-                               bb.Write(ELEMENT_TYPE_FNPTR);
-                               WriteStandAloneMethodSig(module, bb, type.__MethodSignature);
-                       }
-                       else
-                       {
-                               if (type.IsValueType)
-                               {
-                                       bb.Write(ELEMENT_TYPE_VALUETYPE);
-                               }
-                               else
-                               {
-                                       bb.Write(ELEMENT_TYPE_CLASS);
-                               }
-                               bb.WriteTypeDefOrRefEncoded(module.GetTypeToken(type).Token);
-                       }
-               }
-
-               private static void WriteGenericSignature(ModuleBuilder module, ByteBuffer bb, Type type)
-               {
-                       Type[] typeArguments = type.GetGenericArguments();
-                       CustomModifiers[] customModifiers = type.__GetGenericArgumentsCustomModifiers();
-                       if (!type.IsGenericTypeDefinition)
-                       {
-                               type = type.GetGenericTypeDefinition();
-                       }
-                       bb.Write(ELEMENT_TYPE_GENERICINST);
-                       if (type.IsValueType)
-                       {
-                               bb.Write(ELEMENT_TYPE_VALUETYPE);
-                       }
-                       else
-                       {
-                               bb.Write(ELEMENT_TYPE_CLASS);
-                       }
-                       bb.WriteTypeDefOrRefEncoded(module.GetTypeToken(type).Token);
-                       bb.WriteCompressedInt(typeArguments.Length);
-                       for (int i = 0; i < typeArguments.Length; i++)
-                       {
-                               WriteCustomModifiers(module, bb, customModifiers[i]);
-                               WriteType(module, bb, typeArguments[i]);
-                       }
-               }
-
-               protected static void WriteCustomModifiers(ModuleBuilder module, ByteBuffer bb, CustomModifiers modifiers)
-               {
-                       foreach (CustomModifiers.Entry entry in modifiers)
-                       {
-                               bb.Write(entry.IsRequired ? ELEMENT_TYPE_CMOD_REQD : ELEMENT_TYPE_CMOD_OPT);
-                               bb.WriteTypeDefOrRefEncoded(module.GetTypeTokenForMemberRef(entry.Type));
-                       }
-               }
-
-               internal static Type ReadTypeDefOrRefEncoded(ModuleReader module, ByteReader br, IGenericContext context)
-               {
-                       int encoded = br.ReadCompressedInt();
-                       switch (encoded & 3)
-                       {
-                               case 0:
-                                       return module.ResolveType((TypeDefTable.Index << 24) + (encoded >> 2), null, null);
-                               case 1:
-                                       return module.ResolveType((TypeRefTable.Index << 24) + (encoded >> 2), null, null);
-                               case 2:
-                                       return module.ResolveType((TypeSpecTable.Index << 24) + (encoded >> 2), context);
-                               default:
-                                       throw new BadImageFormatException();
-                       }
-               }
-
-               internal static void WriteStandAloneMethodSig(ModuleBuilder module, ByteBuffer bb, __StandAloneMethodSig sig)
-               {
-                       if (sig.IsUnmanaged)
-                       {
-                               switch (sig.UnmanagedCallingConvention)
-                               {
-                                       case CallingConvention.Cdecl:
-                                               bb.Write((byte)0x01);   // C
-                                               break;
-                                       case CallingConvention.StdCall:
-                                       case CallingConvention.Winapi:
-                                               bb.Write((byte)0x02);   // STDCALL
-                                               break;
-                                       case CallingConvention.ThisCall:
-                                               bb.Write((byte)0x03);   // THISCALL
-                                               break;
-                                       case CallingConvention.FastCall:
-                                               bb.Write((byte)0x04);   // FASTCALL
-                                               break;
-                                       default:
-                                               throw new ArgumentOutOfRangeException("callingConvention");
-                               }
-                       }
-                       else
-                       {
-                               CallingConventions callingConvention = sig.CallingConvention;
-                               byte flags = 0;
-                               if ((callingConvention & CallingConventions.HasThis) != 0)
-                               {
-                                       flags |= HASTHIS;
-                               }
-                               if ((callingConvention & CallingConventions.ExplicitThis) != 0)
-                               {
-                                       flags |= EXPLICITTHIS;
-                               }
-                               if ((callingConvention & CallingConventions.VarArgs) != 0)
-                               {
-                                       flags |= VARARG;
-                               }
-                               bb.Write(flags);
-                       }
-                       Type[] parameterTypes = sig.ParameterTypes;
-                       Type[] optionalParameterTypes = sig.OptionalParameterTypes;
-                       bb.WriteCompressedInt(parameterTypes.Length + optionalParameterTypes.Length);
-                       WriteCustomModifiers(module, bb, sig.GetReturnTypeCustomModifiers());
-                       WriteType(module, bb, sig.ReturnType);
-                       int index = 0;
-                       foreach (Type t in parameterTypes)
-                       {
-                               WriteCustomModifiers(module, bb, sig.GetParameterCustomModifiers(index++));
-                               WriteType(module, bb, t);
-                       }
-                       // note that optional parameters are only allowed for managed signatures (but we don't enforce that)
-                       if (optionalParameterTypes.Length > 0)
-                       {
-                               bb.Write(SENTINEL);
-                               foreach (Type t in optionalParameterTypes)
-                               {
-                                       WriteCustomModifiers(module, bb, sig.GetParameterCustomModifiers(index++));
-                                       WriteType(module, bb, t);
-                               }
-                       }
-               }
-
-               internal static void WriteTypeSpec(ModuleBuilder module, ByteBuffer bb, Type type)
-               {
-                       WriteType(module, bb, type);
-               }
-
-               internal static void WriteMethodSpec(ModuleBuilder module, ByteBuffer bb, Type[] genArgs)
-               {
-                       bb.Write(GENERICINST);
-                       bb.WriteCompressedInt(genArgs.Length);
-                       foreach (Type arg in genArgs)
-                       {
-                               WriteType(module, bb, arg);
-                       }
-               }
-
-               // this reads just the optional parameter types, from a MethodRefSig
-               internal static Type[] ReadOptionalParameterTypes(ModuleReader module, ByteReader br, IGenericContext context, out CustomModifiers[] customModifiers)
-               {
-                       br.ReadByte();
-                       int paramCount = br.ReadCompressedInt();
-                       CustomModifiers.Skip(br);
-                       ReadRetType(module, br, context);
-                       for (int i = 0; i < paramCount; i++)
-                       {
-                               if (br.PeekByte() == SENTINEL)
-                               {
-                                       br.ReadByte();
-                                       Type[] types = new Type[paramCount - i];
-                                       customModifiers = new CustomModifiers[types.Length];
-                                       for (int j = 0; j < types.Length; j++)
-                                       {
-                                               customModifiers[j] = CustomModifiers.Read(module, br, context);
-                                               types[j] = ReadType(module, br, context);
-                                       }
-                                       return types;
-                               }
-                               CustomModifiers.Skip(br);
-                               ReadType(module, br, context);
-                       }
-                       customModifiers = Empty<CustomModifiers>.Array;
-                       return Type.EmptyTypes;
-               }
-
-               protected static Type[] BindTypeParameters(IGenericBinder binder, Type[] types)
-               {
-                       if (types == null || types.Length == 0)
-                       {
-                               return Type.EmptyTypes;
-                       }
-                       Type[] expanded = new Type[types.Length];
-                       for (int i = 0; i < types.Length; i++)
-                       {
-                               expanded[i] = types[i].BindTypeParameters(binder);
-                       }
-                       return expanded;
-               }
-
-               internal static void WriteSignatureHelper(ModuleBuilder module, ByteBuffer bb, byte flags, ushort paramCount, List<Type> args)
-               {
-                       bb.Write(flags);
-                       if (flags != FIELD)
-                       {
-                               bb.WriteCompressedInt(paramCount);
-                       }
-                       foreach (Type type in args)
-                       {
-                               if (type == MarkerType.ModOpt)
-                               {
-                                       bb.Write(ELEMENT_TYPE_CMOD_OPT);
-                               }
-                               else if (type == MarkerType.ModReq)
-                               {
-                                       bb.Write(ELEMENT_TYPE_CMOD_REQD);
-                               }
-                               else if (type == MarkerType.Sentinel)
-                               {
-                                       bb.Write(SENTINEL);
-                               }
-                               else if (type == MarkerType.Pinned)
-                               {
-                                       bb.Write(ELEMENT_TYPE_PINNED);
-                               }
-                               else if (type == null)
-                               {
-                                       bb.Write(ELEMENT_TYPE_VOID);
-                               }
-                               else
-                               {
-                                       WriteType(module, bb, type);
-                               }
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/StandAloneMethodSig.cs b/mcs/class/IKVM.Reflection/StandAloneMethodSig.cs
deleted file mode 100644 (file)
index 1d9425d..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-  Copyright (C) 2010 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.InteropServices;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection
-{
-       public sealed class __StandAloneMethodSig
-       {
-               private readonly bool unmanaged;
-               private readonly CallingConvention unmanagedCallingConvention;
-               private readonly CallingConventions callingConvention;
-               private readonly Type returnType;
-               private readonly Type[] parameterTypes;
-               private readonly Type[] optionalParameterTypes;
-               private readonly PackedCustomModifiers customModifiers;
-
-               internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       this.unmanaged = unmanaged;
-                       this.unmanagedCallingConvention = unmanagedCallingConvention;
-                       this.callingConvention = callingConvention;
-                       this.returnType = returnType;
-                       this.parameterTypes = parameterTypes;
-                       this.optionalParameterTypes = optionalParameterTypes;
-                       this.customModifiers = customModifiers;
-               }
-
-               public bool Equals(__StandAloneMethodSig other)
-               {
-                       return other != null
-                               && other.unmanaged == unmanaged
-                               && other.unmanagedCallingConvention == unmanagedCallingConvention
-                               && other.callingConvention == callingConvention
-                               && other.returnType == returnType
-                               && Util.ArrayEquals(other.parameterTypes, parameterTypes)
-                               && Util.ArrayEquals(other.optionalParameterTypes, optionalParameterTypes)
-                               && other.customModifiers.Equals(customModifiers);
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return Equals(obj as __StandAloneMethodSig);
-               }
-
-               public override int GetHashCode()
-               {
-                       return returnType.GetHashCode()
-                               ^ Util.GetHashCode(parameterTypes);
-               }
-
-               public bool IsUnmanaged
-               {
-                       get { return unmanaged; }
-               }
-
-               public CallingConventions CallingConvention
-               {
-                       get { return callingConvention; }
-               }
-
-               public CallingConvention UnmanagedCallingConvention
-               {
-                       get { return unmanagedCallingConvention; }
-               }
-
-               public Type ReturnType
-               {
-                       get { return returnType; }
-               }
-
-               public CustomModifiers GetReturnTypeCustomModifiers()
-               {
-                       return customModifiers.GetReturnTypeCustomModifiers();
-               }
-
-               public Type[] ParameterTypes
-               {
-                       get { return Util.Copy(parameterTypes); }
-               }
-
-               public Type[] OptionalParameterTypes
-               {
-                       get { return Util.Copy(optionalParameterTypes); }
-               }
-
-               public CustomModifiers GetParameterCustomModifiers(int index)
-               {
-                       return customModifiers.GetParameterCustomModifiers(index);
-               }
-
-               internal int ParameterCount
-               {
-                       get { return parameterTypes.Length + optionalParameterTypes.Length; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/StrongNameKeyPair.cs b/mcs/class/IKVM.Reflection/StrongNameKeyPair.cs
deleted file mode 100644 (file)
index 7d35447..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using System.Security.Cryptography;
-
-namespace IKVM.Reflection
-{
-       public sealed class StrongNameKeyPair
-       {
-               private readonly byte[] keyPairArray;
-               private readonly string keyPairContainer;
-
-               public StrongNameKeyPair(string keyPairContainer)
-               {
-                       if (keyPairContainer == null)
-                       {
-                               throw new ArgumentNullException("keyPairContainer");
-                       }
-                       if (Universe.MonoRuntime && Environment.OSVersion.Platform == PlatformID.Win32NT)
-                       {
-                               throw new NotSupportedException("IKVM.Reflection does not support key containers when running on Mono");
-                       }
-                       this.keyPairContainer = keyPairContainer;
-               }
-
-               public StrongNameKeyPair(byte[] keyPairArray)
-               {
-                       if (keyPairArray == null)
-                       {
-                               throw new ArgumentNullException("keyPairArray");
-                       }
-                       this.keyPairArray = (byte[])keyPairArray.Clone();
-               }
-
-               public StrongNameKeyPair(FileStream keyPairFile)
-                       : this(ReadAllBytes(keyPairFile))
-               {
-               }
-
-               private static byte[] ReadAllBytes(FileStream keyPairFile)
-               {
-                       if (keyPairFile == null)
-                       {
-                               throw new ArgumentNullException("keyPairFile");
-                       }
-                       byte[] buf = new byte[keyPairFile.Length - keyPairFile.Position];
-                       keyPairFile.Read(buf, 0, buf.Length);
-                       return buf;
-               }
-
-               public byte[] PublicKey
-               {
-                       get
-                       {
-                               if (Universe.MonoRuntime)
-                               {
-                                       // MONOBUG workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=5299
-                                       return MonoGetPublicKey();
-                               }
-                               using (RSACryptoServiceProvider rsa = CreateRSA())
-                               {
-                                       byte[] cspBlob = rsa.ExportCspBlob(false);
-                                       byte[] publicKey = new byte[12 + cspBlob.Length];
-                                       Buffer.BlockCopy(cspBlob, 0, publicKey, 12, cspBlob.Length);
-                                       publicKey[1] = 36;
-                                       publicKey[4] = 4;
-                                       publicKey[5] = 128;
-                                       publicKey[8] = (byte)(cspBlob.Length >> 0);
-                                       publicKey[9] = (byte)(cspBlob.Length >> 8);
-                                       publicKey[10] = (byte)(cspBlob.Length >> 16);
-                                       publicKey[11] = (byte)(cspBlob.Length >> 24);
-                                       return publicKey;
-                               }
-                       }
-               }
-
-               internal RSACryptoServiceProvider CreateRSA()
-               {
-                       try
-                       {
-                               if (keyPairArray != null)
-                               {
-                                       RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
-                                       rsa.ImportCspBlob(keyPairArray);
-                                       return rsa;
-                               }
-                               else
-                               {
-                                       CspParameters parm = new CspParameters();
-                                       parm.KeyContainerName = keyPairContainer;
-                                       // MONOBUG Mono doesn't like it when Flags or KeyNumber are set
-                                       if (!Universe.MonoRuntime)
-                                       {
-                                               parm.Flags = CspProviderFlags.UseMachineKeyStore | CspProviderFlags.UseExistingKey;
-                                               parm.KeyNumber = 2;     // Signature
-                                       }
-                                       return new RSACryptoServiceProvider(parm);
-                               }
-                       }
-                       catch
-                       {
-                               throw new ArgumentException("Unable to obtain public key for StrongNameKeyPair.");
-                       }
-               }
-
-               [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
-               private byte[] MonoGetPublicKey()
-               {
-                       return keyPairArray != null
-                               ? new System.Reflection.StrongNameKeyPair(keyPairArray).PublicKey
-                               : new System.Reflection.StrongNameKeyPair(keyPairContainer).PublicKey;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Type.cs b/mcs/class/IKVM.Reflection/Type.cs
deleted file mode 100644 (file)
index bb0273c..0000000
+++ /dev/null
@@ -1,3000 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Collections.Generic;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
-       interface IGenericContext
-       {
-               Type GetGenericTypeArgument(int index);
-               Type GetGenericMethodArgument(int index);
-       }
-
-       interface IGenericBinder
-       {
-               Type BindTypeParameter(Type type);
-               Type BindMethodParameter(Type type);
-       }
-
-       public abstract class Type : MemberInfo, IGenericContext, IGenericBinder
-       {
-               public static readonly Type[] EmptyTypes = Empty<Type>.Array;
-               protected readonly Type underlyingType;
-               protected TypeFlags typeFlags;
-
-               [Flags]
-               protected enum TypeFlags
-               {
-                       // for use by TypeBuilder or TypeDefImpl
-                       IsGenericTypeDefinition = 1,
-
-                       // for use by TypeBuilder
-                       HasNestedTypes = 2,
-                       Baked = 4,
-
-                       // for use by MissingType
-                       ValueType = 8,
-                       NotValueType = 16,
-
-                       // for use by TypeDefImpl, TypeBuilder or MissingType
-                       PotentialEnumOrValueType = 32,
-                       EnumOrValueType = 64,
-
-                       // for use by TypeDefImpl
-                       NotGenericTypeDefinition = 128,
-               }
-
-               // prevent subclassing by outsiders
-               internal Type()
-               {
-                       this.underlyingType = this;
-               }
-
-               internal Type(Type underlyingType)
-               {
-                       System.Diagnostics.Debug.Assert(underlyingType.underlyingType == underlyingType);
-                       this.underlyingType = underlyingType;
-                       this.typeFlags = underlyingType.typeFlags;
-               }
-
-               public static Binder DefaultBinder
-               {
-                       get { return new DefaultBinder(); }
-               }
-
-               public sealed override MemberTypes MemberType
-               {
-                       get { return IsNested ? MemberTypes.NestedType : MemberTypes.TypeInfo; }
-               }
-
-               public virtual string AssemblyQualifiedName
-               {
-                       // NOTE the assembly name is not escaped here, only when used in a generic type instantiation
-                       get { return this.FullName + ", " + this.Assembly.FullName; }
-               }
-
-               public abstract Type BaseType
-               {
-                       get;
-               }
-
-               public abstract TypeAttributes Attributes
-               {
-                       get;
-               }
-
-               public virtual Type GetElementType()
-               {
-                       return null;
-               }
-
-               internal virtual void CheckBaked()
-               {
-               }
-
-               public virtual Type[] __GetDeclaredTypes()
-               {
-                       return Type.EmptyTypes;
-               }
-
-               public virtual Type[] __GetDeclaredInterfaces()
-               {
-                       return Type.EmptyTypes;
-               }
-
-               public virtual MethodBase[] __GetDeclaredMethods()
-               {
-                       return Empty<MethodBase>.Array;
-               }
-
-               public virtual __MethodImplMap __GetMethodImplMap()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual FieldInfo[] __GetDeclaredFields()
-               {
-                       return Empty<FieldInfo>.Array;
-               }
-
-               public virtual EventInfo[] __GetDeclaredEvents()
-               {
-                       return Empty<EventInfo>.Array;
-               }
-
-               public virtual PropertyInfo[] __GetDeclaredProperties()
-               {
-                       return Empty<PropertyInfo>.Array;
-               }
-
-               public virtual CustomModifiers __GetCustomModifiers()
-               {
-                       return new CustomModifiers();
-               }
-
-               [Obsolete("Please use __GetCustomModifiers() instead.")]
-               public Type[] __GetRequiredCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetRequired();
-               }
-
-               [Obsolete("Please use __GetCustomModifiers() instead.")]
-               public Type[] __GetOptionalCustomModifiers()
-               {
-                       return __GetCustomModifiers().GetOptional();
-               }
-
-               public virtual __StandAloneMethodSig __MethodSignature
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public virtual bool HasElementType
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsArray
-               {
-                       get { return false; }
-               }
-
-               public virtual bool __IsVector
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsByRef
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsPointer
-               {
-                       get { return false; }
-               }
-
-               public virtual bool __IsFunctionPointer
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsValueType
-               {
-                       get
-                       {
-                               Type baseType = this.BaseType;
-                               return baseType != null
-                                       && baseType.IsEnumOrValueType
-                                       && !this.IsEnumOrValueType;
-                       }
-               }
-
-               public virtual bool IsGenericParameter
-               {
-                       get { return false; }
-               }
-
-               public virtual int GenericParameterPosition
-               {
-                       get { throw new NotSupportedException(); }
-               }
-
-               public virtual MethodBase DeclaringMethod
-               {
-                       get { return null; }
-               }
-
-               public Type UnderlyingSystemType
-               {
-                       get { return underlyingType; }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return null; }
-               }
-
-               public virtual string __Name
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public virtual string __Namespace
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public abstract override string Name
-               {
-                       get;
-               }
-
-               public virtual string Namespace
-               {
-                       get
-                       {
-                               if (IsNested)
-                               {
-                                       return DeclaringType.Namespace;
-                               }
-                               return __Namespace;
-                       }
-               }
-
-               internal virtual int GetModuleBuilderToken()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public static bool operator ==(Type t1, Type t2)
-               {
-                       // Casting to object results in smaller code than calling ReferenceEquals and makes
-                       // this method more likely to be inlined.
-                       // On CLR v2 x86, microbenchmarks show this to be faster than calling ReferenceEquals.
-                       return (object)t1 == (object)t2
-                               || ((object)t1 != null && (object)t2 != null && (object)t1.underlyingType == (object)t2.underlyingType);
-               }
-
-               public static bool operator !=(Type t1, Type t2)
-               {
-                       return !(t1 == t2);
-               }
-
-               public bool Equals(Type type)
-               {
-                       return this == type;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       return Equals(obj as Type);
-               }
-
-               public override int GetHashCode()
-               {
-                       Type type = this.UnderlyingSystemType;
-                       return ReferenceEquals(type, this) ? base.GetHashCode() : type.GetHashCode();
-               }
-
-               public virtual Type[] GetGenericArguments()
-               {
-                       return Type.EmptyTypes;
-               }
-
-               public virtual CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       return Empty<CustomModifiers>.Array;
-               }
-
-               [Obsolete("Please use __GetGenericArgumentsCustomModifiers() instead")]
-               public Type[][] __GetGenericArgumentsRequiredCustomModifiers()
-               {
-                       CustomModifiers[] customModifiers = __GetGenericArgumentsCustomModifiers();
-                       Type[][] array = new Type[customModifiers.Length][];
-                       for (int i = 0; i < array.Length; i++)
-                       {
-                               array[i] = customModifiers[i].GetRequired();
-                       }
-                       return array;
-               }
-
-               [Obsolete("Please use __GetGenericArgumentsCustomModifiers() instead")]
-               public Type[][] __GetGenericArgumentsOptionalCustomModifiers()
-               {
-                       CustomModifiers[] customModifiers = __GetGenericArgumentsCustomModifiers();
-                       Type[][] array = new Type[customModifiers.Length][];
-                       for (int i = 0; i < array.Length; i++)
-                       {
-                               array[i] = customModifiers[i].GetOptional();
-                       }
-                       return array;
-               }
-
-               public virtual Type GetGenericTypeDefinition()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public virtual StructLayoutAttribute StructLayoutAttribute
-               {
-                       get { return null; }
-               }
-
-               public virtual bool __GetLayout(out int packingSize, out int typeSize)
-               {
-                       packingSize = 0;
-                       typeSize = 0;
-                       return false;
-               }
-
-               public virtual bool IsGenericType
-               {
-                       get { return false; }
-               }
-
-               public virtual bool IsGenericTypeDefinition
-               {
-                       get { return false; }
-               }
-
-               // .NET 4.5 API
-               public virtual bool IsConstructedGenericType
-               {
-                       get { return false; }
-               }
-
-               public virtual bool ContainsGenericParameters
-               {
-                       get
-                       {
-                               if (this.IsGenericParameter)
-                               {
-                                       return true;
-                               }
-                               foreach (Type arg in this.GetGenericArguments())
-                               {
-                                       if (arg.ContainsGenericParameters)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               public virtual Type[] GetGenericParameterConstraints()
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public virtual GenericParameterAttributes GenericParameterAttributes
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public virtual int GetArrayRank()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual int[] __GetArraySizes()
-               {
-                       throw new NotSupportedException();
-               }
-
-               public virtual int[] __GetArrayLowerBounds()
-               {
-                       throw new NotSupportedException();
-               }
-
-               // .NET 4.0 API
-               public virtual Type GetEnumUnderlyingType()
-               {
-                       if (!this.IsEnum)
-                       {
-                               throw new ArgumentException();
-                       }
-                       CheckBaked();
-                       return GetEnumUnderlyingTypeImpl();
-               }
-
-               internal Type GetEnumUnderlyingTypeImpl()
-               {
-                       foreach (FieldInfo field in __GetDeclaredFields())
-                       {
-                               if (!field.IsStatic)
-                               {
-                                       // the CLR assumes that an enum has only one instance field, so we can do the same
-                                       return field.FieldType;
-                               }
-                       }
-                       throw new InvalidOperationException();
-               }
-
-               public override string ToString()
-               {
-                       return FullName;
-               }
-
-               public abstract string FullName
-               {
-                       get;
-               }
-
-               protected string GetFullName()
-               {
-                       string ns = TypeNameParser.Escape(this.__Namespace);
-                       Type decl = this.DeclaringType;
-                       if (decl == null)
-                       {
-                               if (ns == null)
-                               {
-                                       return this.Name;
-                               }
-                               else
-                               {
-                                       return ns + "." + this.Name;
-                               }
-                       }
-                       else
-                       {
-                               if (ns == null)
-                               {
-                                       return decl.FullName + "+" + this.Name;
-                               }
-                               else
-                               {
-                                       return decl.FullName + "+" + ns + "." + this.Name;
-                               }
-                       }
-               }
-
-               internal virtual bool IsModulePseudoType
-               {
-                       get { return false; }
-               }
-
-               internal virtual Type GetGenericTypeArgument(int index)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               public MemberInfo[] GetDefaultMembers()
-               {
-                       Type defaultMemberAttribute = this.Module.universe.Import(typeof(System.Reflection.DefaultMemberAttribute));
-                       foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(this))
-                       {
-                               if (cad.Constructor.DeclaringType.Equals(defaultMemberAttribute))
-                               {
-                                       return GetMember((string)cad.ConstructorArguments[0].Value);
-                               }
-                       }
-                       return Empty<MemberInfo>.Array;
-               }
-
-               public MemberInfo[] GetMember(string name)
-               {
-                       return GetMember(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public MemberInfo[] GetMember(string name, BindingFlags bindingAttr)
-               {
-                       return GetMember(name, MemberTypes.All, bindingAttr);
-               }
-
-               public MemberInfo[] GetMembers()
-               {
-                       return GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public MemberInfo[] GetMembers(BindingFlags bindingAttr)
-               {
-                       List<MemberInfo> members = new List<MemberInfo>();
-                       members.AddRange(GetConstructors(bindingAttr));
-                       members.AddRange(GetMethods(bindingAttr));
-                       members.AddRange(GetFields(bindingAttr));
-                       members.AddRange(GetProperties(bindingAttr));
-                       members.AddRange(GetEvents(bindingAttr));
-                       members.AddRange(GetNestedTypes(bindingAttr));
-                       return members.ToArray();
-               }
-
-               public MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)
-               {
-                       MemberFilter filter;
-                       if ((bindingAttr & BindingFlags.IgnoreCase) != 0)
-                       {
-                               name = name.ToLowerInvariant();
-                               filter = delegate(MemberInfo member, object filterCriteria) { return member.Name.ToLowerInvariant().Equals(filterCriteria); };
-                       }
-                       else
-                       {
-                               filter = delegate(MemberInfo member, object filterCriteria) { return member.Name.Equals(filterCriteria); };
-                       }
-                       return FindMembers(type, bindingAttr, filter, name);
-               }
-
-               private static void AddMembers(List<MemberInfo> list, MemberFilter filter, object filterCriteria, MemberInfo[] members)
-               {
-                       foreach (MemberInfo member in members)
-                       {
-                               if (filter == null || filter(member, filterCriteria))
-                               {
-                                       list.Add(member);
-                               }
-                       }
-               }
-
-               public MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
-               {
-                       List<MemberInfo> members = new List<MemberInfo>();
-                       if ((memberType & MemberTypes.Constructor) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetConstructors(bindingAttr));
-                       }
-                       if ((memberType & MemberTypes.Method) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetMethods(bindingAttr));
-                       }
-                       if ((memberType & MemberTypes.Field) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetFields(bindingAttr));
-                       }
-                       if ((memberType & MemberTypes.Property) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetProperties(bindingAttr));
-                       }
-                       if ((memberType & MemberTypes.Event) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetEvents(bindingAttr));
-                       }
-                       if ((memberType & MemberTypes.NestedType) != 0)
-                       {
-                               AddMembers(members, filter, filterCriteria, GetNestedTypes(bindingAttr));
-                       }
-                       return members.ToArray();
-               }
-
-               private MemberInfo[] GetMembers<T>()
-               {
-                       if (typeof(T) == typeof(ConstructorInfo) || typeof(T) == typeof(MethodInfo))
-                       {
-                               return __GetDeclaredMethods();
-                       }
-                       else if (typeof(T) == typeof(FieldInfo))
-                       {
-                               return __GetDeclaredFields();
-                       }
-                       else if (typeof(T) == typeof(PropertyInfo))
-                       {
-                               return __GetDeclaredProperties();
-                       }
-                       else if (typeof(T) == typeof(EventInfo))
-                       {
-                               return __GetDeclaredEvents();
-                       }
-                       else if (typeof(T) == typeof(Type))
-                       {
-                               return __GetDeclaredTypes();
-                       }
-                       else
-                       {
-                               throw new InvalidOperationException();
-                       }
-               }
-
-               private T[] GetMembers<T>(BindingFlags flags)
-                       where T : MemberInfo
-               {
-                       CheckBaked();
-                       List<T> list = new List<T>();
-                       foreach (MemberInfo member in GetMembers<T>())
-                       {
-                               if (member is T && member.BindingFlagsMatch(flags))
-                               {
-                                       list.Add((T)member);
-                               }
-                       }
-                       if ((flags & BindingFlags.DeclaredOnly) == 0)
-                       {
-                               for (Type type = this.BaseType; type != null; type = type.BaseType)
-                               {
-                                       type.CheckBaked();
-                                       foreach (MemberInfo member in type.GetMembers<T>())
-                                       {
-                                               if (member is T && member.BindingFlagsMatchInherited(flags))
-                                               {
-                                                       list.Add((T)member.SetReflectedType(this));
-                                               }
-                                       }
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               private T GetMemberByName<T>(string name, BindingFlags flags, Predicate<T> filter)
-                       where T : MemberInfo
-               {
-                       CheckBaked();
-                       if ((flags & BindingFlags.IgnoreCase) != 0)
-                       {
-                               name = name.ToLowerInvariant();
-                       }
-                       T found = null;
-                       foreach (MemberInfo member in GetMembers<T>())
-                       {
-                               if (member is T && member.BindingFlagsMatch(flags))
-                               {
-                                       string memberName = member.Name;
-                                       if ((flags & BindingFlags.IgnoreCase) != 0)
-                                       {
-                                               memberName = memberName.ToLowerInvariant();
-                                       }
-                                       if (memberName == name && (filter == null || filter((T)member)))
-                                       {
-                                               if (found != null)
-                                               {
-                                                       throw new AmbiguousMatchException();
-                                               }
-                                               found = (T)member;
-                                       }
-                               }
-                       }
-                       if ((flags & BindingFlags.DeclaredOnly) == 0)
-                       {
-                               for (Type type = this.BaseType; (found == null || typeof(T) == typeof(MethodInfo)) && type != null; type = type.BaseType)
-                               {
-                                       type.CheckBaked();
-                                       foreach (MemberInfo member in type.GetMembers<T>())
-                                       {
-                                               if (member is T && member.BindingFlagsMatchInherited(flags))
-                                               {
-                                                       string memberName = member.Name;
-                                                       if ((flags & BindingFlags.IgnoreCase) != 0)
-                                                       {
-                                                               memberName = memberName.ToLowerInvariant();
-                                                       }
-                                                       if (memberName == name && (filter == null || filter((T)member)))
-                                                       {
-                                                               if (found != null)
-                                                               {
-                                                                       MethodInfo mi;
-                                                                       // TODO does this depend on HideBySig vs HideByName?
-                                                                       if ((mi = found as MethodInfo) != null
-                                                                               && mi.MethodSignature.MatchParameterTypes(((MethodBase)member).MethodSignature))
-                                                                       {
-                                                                               continue;
-                                                                       }
-                                                                       throw new AmbiguousMatchException();
-                                                               }
-                                                               found = (T)member.SetReflectedType(this);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       return found;
-               }
-
-               private T GetMemberByName<T>(string name, BindingFlags flags)
-                       where T : MemberInfo
-               {
-                       return GetMemberByName<T>(name, flags, null);
-               }
-
-               public EventInfo GetEvent(string name)
-               {
-                       return GetEvent(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public EventInfo GetEvent(string name, BindingFlags bindingAttr)
-               {
-                       return GetMemberByName<EventInfo>(name, bindingAttr);
-               }
-
-               public EventInfo[] GetEvents()
-               {
-                       return GetEvents(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public EventInfo[] GetEvents(BindingFlags bindingAttr)
-               {
-                       return GetMembers<EventInfo>(bindingAttr);
-               }
-
-               public FieldInfo GetField(string name)
-               {
-                       return GetField(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public FieldInfo GetField(string name, BindingFlags bindingAttr)
-               {
-                       return GetMemberByName<FieldInfo>(name, bindingAttr);
-               }
-
-               public FieldInfo[] GetFields()
-               {
-                       return GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
-               }
-
-               public FieldInfo[] GetFields(BindingFlags bindingAttr)
-               {
-                       return GetMembers<FieldInfo>(bindingAttr);
-               }
-
-               public Type[] GetInterfaces()
-               {
-                       List<Type> list = new List<Type>();
-                       for (Type type = this; type != null; type = type.BaseType)
-                       {
-                               AddInterfaces(list, type);
-                       }
-                       return list.ToArray();
-               }
-
-               private static void AddInterfaces(List<Type> list, Type type)
-               {
-                       foreach (Type iface in type.__GetDeclaredInterfaces())
-                       {
-                               if (!list.Contains(iface))
-                               {
-                                       list.Add(iface);
-                                       AddInterfaces(list, iface);
-                               }
-                       }
-               }
-
-               public MethodInfo[] GetMethods(BindingFlags bindingAttr)
-               {
-                       CheckBaked();
-                       List<MethodInfo> list = new List<MethodInfo>();
-                       foreach (MethodBase mb in __GetDeclaredMethods())
-                       {
-                               MethodInfo mi = mb as MethodInfo;
-                               if (mi != null && mi.BindingFlagsMatch(bindingAttr))
-                               {
-                                       list.Add(mi);
-                               }
-                       }
-                       if ((bindingAttr & BindingFlags.DeclaredOnly) == 0)
-                       {
-                               List<MethodInfo> baseMethods = new List<MethodInfo>();
-                               foreach (MethodInfo mi in list)
-                               {
-                                       if (mi.IsVirtual)
-                                       {
-                                               baseMethods.Add(mi.GetBaseDefinition());
-                                       }
-                               }
-                               for (Type type = this.BaseType; type != null; type = type.BaseType)
-                               {
-                                       type.CheckBaked();
-                                       foreach (MethodBase mb in type.__GetDeclaredMethods())
-                                       {
-                                               MethodInfo mi = mb as MethodInfo;
-                                               if (mi != null && mi.BindingFlagsMatchInherited(bindingAttr))
-                                               {
-                                                       if (mi.IsVirtual)
-                                                       {
-                                                               if (baseMethods == null)
-                                                               {
-                                                                       baseMethods = new List<MethodInfo>();
-                                                               }
-                                                               else if (baseMethods.Contains(mi.GetBaseDefinition()))
-                                                               {
-                                                                       continue;
-                                                               }
-                                                               baseMethods.Add(mi.GetBaseDefinition());
-                                                       }
-                                                       list.Add((MethodInfo)mi.SetReflectedType(this));
-                                               }
-                                       }
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public MethodInfo[] GetMethods()
-               {
-                       return GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
-               }
-
-               public MethodInfo GetMethod(string name)
-               {
-                       return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
-               }
-
-               public MethodInfo GetMethod(string name, BindingFlags bindingAttr)
-               {
-                       return GetMemberByName<MethodInfo>(name, bindingAttr);
-               }
-
-               public MethodInfo GetMethod(string name, Type[] types)
-               {
-                       return GetMethod(name, types, null);
-               }
-
-               public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers)
-               {
-                       return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, types, modifiers);
-               }
-
-               public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
-               {
-                       // first we try an exact match and only if that fails we fall back to using the binder
-                       return GetMemberByName<MethodInfo>(name, bindingAttr,
-                               delegate(MethodInfo method) { return method.MethodSignature.MatchParameterTypes(types); })
-                               ?? GetMethodWithBinder<MethodInfo>(name, bindingAttr, binder ?? DefaultBinder, types, modifiers);
-               }
-
-               private T GetMethodWithBinder<T>(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
-                       where T : MethodBase
-               {
-                       List<MethodBase> list = new List<MethodBase>();
-                       GetMemberByName<T>(name, bindingAttr, delegate(T method) {
-                               list.Add(method);
-                               return false;
-                       });
-                       return (T)binder.SelectMethod(bindingAttr, list.ToArray(), types, modifiers);
-               }
-
-               public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       // FXBUG callConvention seems to be ignored
-                       return GetMethod(name, bindingAttr, binder, types, modifiers);
-               }
-
-               public ConstructorInfo[] GetConstructors()
-               {
-                       return GetConstructors(BindingFlags.Public | BindingFlags.Instance);
-               }
-
-               public ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
-               {
-                       return GetMembers<ConstructorInfo>(bindingAttr | BindingFlags.DeclaredOnly);
-               }
-
-               public ConstructorInfo GetConstructor(Type[] types)
-               {
-                       return GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, CallingConventions.Standard, types, null);
-               }
-
-               public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
-               {
-                       ConstructorInfo ci1 = null;
-                       if ((bindingAttr & BindingFlags.Instance) != 0)
-                       {
-                               ci1 = GetConstructorImpl(ConstructorInfo.ConstructorName, bindingAttr, binder, types, modifiers);
-                       }
-                       if ((bindingAttr & BindingFlags.Static) != 0)
-                       {
-                               ConstructorInfo ci2 = GetConstructorImpl(ConstructorInfo.TypeConstructorName, bindingAttr, binder, types, modifiers);
-                               if (ci2 != null)
-                               {
-                                       if (ci1 != null)
-                                       {
-                                               throw new AmbiguousMatchException();
-                                       }
-                                       return ci2;
-                               }
-                       }
-                       return ci1;
-               }
-
-               private ConstructorInfo GetConstructorImpl(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
-               {
-                       // first we try an exact match and only if that fails we fall back to using the binder
-                       return GetMemberByName<ConstructorInfo>(name, bindingAttr | BindingFlags.DeclaredOnly,
-                               delegate(ConstructorInfo ctor) { return ctor.MethodSignature.MatchParameterTypes(types); })
-                               ?? GetMethodWithBinder<ConstructorInfo>(name, bindingAttr, binder ?? DefaultBinder, types, modifiers);
-               }
-
-               public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callingConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       // FXBUG callConvention seems to be ignored
-                       return GetConstructor(bindingAttr, binder, types, modifiers);
-               }
-
-               internal Type ResolveNestedType(TypeName typeName)
-               {
-                       return FindNestedType(typeName) ?? Module.universe.GetMissingTypeOrThrow(Module, this, typeName);
-               }
-
-               // unlike the public API, this takes the namespace and name into account
-               internal virtual Type FindNestedType(TypeName name)
-               {
-                       foreach (Type type in __GetDeclaredTypes())
-                       {
-                               if (type.__Namespace == name.Namespace && type.__Name == name.Name)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               internal virtual Type FindNestedTypeIgnoreCase(TypeName lowerCaseName)
-               {
-                       foreach (Type type in __GetDeclaredTypes())
-                       {
-                               if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
-                               {
-                                       return type;
-                               }
-                       }
-                       return null;
-               }
-
-               public Type GetNestedType(string name)
-               {
-                       return GetNestedType(name, BindingFlags.Public);
-               }
-
-               public Type GetNestedType(string name, BindingFlags bindingAttr)
-               {
-                       // FXBUG the namespace is ignored, so we can use GetMemberByName
-                       return GetMemberByName<Type>(name, bindingAttr | BindingFlags.DeclaredOnly);
-               }
-
-               public Type[] GetNestedTypes()
-               {
-                       return GetNestedTypes(BindingFlags.Public);
-               }
-
-               public Type[] GetNestedTypes(BindingFlags bindingAttr)
-               {
-                       // FXBUG the namespace is ignored, so we can use GetMember
-                       return GetMembers<Type>(bindingAttr | BindingFlags.DeclaredOnly);
-               }
-
-               public PropertyInfo[] GetProperties()
-               {
-                       return GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public PropertyInfo[] GetProperties(BindingFlags bindingAttr)
-               {
-                       return GetMembers<PropertyInfo>(bindingAttr);
-               }
-
-               public PropertyInfo GetProperty(string name)
-               {
-                       return GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
-               }
-
-               public PropertyInfo GetProperty(string name, BindingFlags bindingAttr)
-               {
-                       return GetMemberByName<PropertyInfo>(name, bindingAttr);
-               }
-
-               public PropertyInfo GetProperty(string name, Type returnType)
-               {
-                       const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
-                       return GetMemberByName<PropertyInfo>(name, flags, delegate(PropertyInfo prop) { return prop.PropertyType.Equals(returnType); })
-                               ?? GetPropertyWithBinder(name, flags, DefaultBinder, returnType, null, null);
-               }
-
-               public PropertyInfo GetProperty(string name, Type[] types)
-               {
-                       const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
-                       return GetMemberByName<PropertyInfo>(name, flags, delegate(PropertyInfo prop) { return prop.PropertySignature.MatchParameterTypes(types); })
-                               ?? GetPropertyWithBinder(name, flags, DefaultBinder, null, types, null);
-               }
-
-               public PropertyInfo GetProperty(string name, Type returnType, Type[] types)
-               {
-                       return GetProperty(name, returnType, types, null);
-               }
-
-               public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       return GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static, null, returnType, types, modifiers);
-               }
-
-               public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       return GetMemberByName<PropertyInfo>(name, bindingAttr,
-                               delegate(PropertyInfo prop) {
-                                       return prop.PropertyType.Equals(returnType) && prop.PropertySignature.MatchParameterTypes(types);
-                               })
-                               ?? GetPropertyWithBinder(name, bindingAttr, binder ?? DefaultBinder, returnType, types, modifiers);
-               }
-
-               private PropertyInfo GetPropertyWithBinder(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       List<PropertyInfo> list = new List<PropertyInfo>();
-                       GetMemberByName<PropertyInfo>(name, bindingAttr, delegate(PropertyInfo property) {
-                               list.Add(property);
-                               return false;
-                       });
-                       return binder.SelectProperty(bindingAttr, list.ToArray(), returnType, types, modifiers);
-               }
-
-               public Type GetInterface(string name)
-               {
-                       return GetInterface(name, false);
-               }
-
-               public Type GetInterface(string name, bool ignoreCase)
-               {
-                       if (ignoreCase)
-                       {
-                               name = name.ToLowerInvariant();
-                       }
-                       Type found = null;
-                       foreach (Type type in GetInterfaces())
-                       {
-                               string typeName = type.FullName;
-                               if (ignoreCase)
-                               {
-                                       typeName = typeName.ToLowerInvariant();
-                               }
-                               if (typeName == name)
-                               {
-                                       if (found != null)
-                                       {
-                                               throw new AmbiguousMatchException();
-                                       }
-                                       found = type;
-                               }
-                       }
-                       return found;
-               }
-
-               public Type[] FindInterfaces(TypeFilter filter, object filterCriteria)
-               {
-                       List<Type> list = new List<Type>();
-                       foreach (Type type in GetInterfaces())
-                       {
-                               if (filter(type, filterCriteria))
-                               {
-                                       list.Add(type);
-                               }
-                       }
-                       return list.ToArray();
-               }
-
-               public ConstructorInfo TypeInitializer
-               {
-                       get { return GetConstructor(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); }
-               }
-
-               public bool IsPrimitive
-               {
-                       get
-                       {
-                               Universe u = this.Universe;
-                               return this == u.System_Boolean
-                                       || this == u.System_Byte
-                                       || this == u.System_SByte
-                                       || this == u.System_Int16
-                                       || this == u.System_UInt16
-                                       || this == u.System_Int32
-                                       || this == u.System_UInt32
-                                       || this == u.System_Int64
-                                       || this == u.System_UInt64
-                                       || this == u.System_IntPtr
-                                       || this == u.System_UIntPtr
-                                       || this == u.System_Char
-                                       || this == u.System_Double
-                                       || this == u.System_Single
-                                       ;
-                       }
-               }
-
-               public bool IsEnum
-               {
-                       get
-                       {
-                               Type baseType = this.BaseType;
-                               return baseType != null
-                                       && baseType.IsEnumOrValueType
-                                       && baseType.__Name[0] == 'E';
-                       }
-               }
-
-               public bool IsSealed
-               {
-                       get { return (Attributes & TypeAttributes.Sealed) != 0; }
-               }
-
-               public bool IsAbstract
-               {
-                       get { return (Attributes & TypeAttributes.Abstract) != 0; }
-               }
-
-               private bool CheckVisibility(TypeAttributes access)
-               {
-                       return (Attributes & TypeAttributes.VisibilityMask) == access;
-               }
-
-               public bool IsPublic
-               {
-                       get { return CheckVisibility(TypeAttributes.Public); }
-               }
-
-               public bool IsNestedPublic
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedPublic); }
-               }
-
-               public bool IsNestedPrivate
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedPrivate); }
-               }
-
-               public bool IsNestedFamily
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedFamily); }
-               }
-
-               public bool IsNestedAssembly
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedAssembly); }
-               }
-
-               public bool IsNestedFamANDAssem
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedFamANDAssem); }
-               }
-
-               public bool IsNestedFamORAssem
-               {
-                       get { return CheckVisibility(TypeAttributes.NestedFamORAssem); }
-               }
-
-               public bool IsNotPublic
-               {
-                       get { return CheckVisibility(TypeAttributes.NotPublic); }
-               }
-
-               public bool IsImport
-               {
-                       get { return (Attributes & TypeAttributes.Import) != 0; }
-               }
-
-               public bool IsCOMObject
-               {
-                       get { return IsClass && IsImport; }
-               }
-
-               public bool IsContextful
-               {
-                       get { return IsSubclassOf(this.Module.universe.Import(typeof(ContextBoundObject))); }
-               }
-
-               public bool IsMarshalByRef
-               {
-                       get { return IsSubclassOf(this.Module.universe.Import(typeof(MarshalByRefObject))); }
-               }
-
-               public virtual bool IsVisible
-               {
-                       get { return IsPublic || (IsNestedPublic && this.DeclaringType.IsVisible); }
-               }
-
-               public bool IsAnsiClass
-               {
-                       get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass; }
-               }
-
-               public bool IsUnicodeClass
-               {
-                       get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass; }
-               }
-
-               public bool IsAutoClass
-               {
-                       get { return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass; }
-               }
-
-               public bool IsAutoLayout
-               {
-                       get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout; }
-               }
-
-               public bool IsLayoutSequential
-               {
-                       get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout; }
-               }
-
-               public bool IsExplicitLayout
-               {
-                       get { return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout; }
-               }
-
-               public bool IsSpecialName
-               {
-                       get { return (Attributes & TypeAttributes.SpecialName) != 0; }
-               }
-
-               public bool IsSerializable
-               {
-                       get { return (Attributes & TypeAttributes.Serializable) != 0; }
-               }
-
-               public bool IsClass
-               {
-                       get { return !IsInterface && !IsValueType; }
-               }
-
-               public bool IsInterface
-               {
-                       get { return (Attributes & TypeAttributes.Interface) != 0; }
-               }
-
-               public bool IsNested
-               {
-                       // FXBUG we check the declaring type (like .NET) and this results
-                       // in IsNested returning true for a generic type parameter
-                       get { return this.DeclaringType != null; }
-               }
-
-               public virtual bool __ContainsMissingType
-               {
-                       get
-                       {
-                               if (this.__IsMissing)
-                               {
-                                       return true;
-                               }
-                               foreach (Type arg in this.GetGenericArguments())
-                               {
-                                       if (arg.__ContainsMissingType)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               public Type MakeArrayType()
-               {
-                       return ArrayType.Make(this, new CustomModifiers());
-               }
-
-               public Type __MakeArrayType(CustomModifiers customModifiers)
-               {
-                       return ArrayType.Make(this, customModifiers);
-               }
-
-               [Obsolete("Please use __MakeArrayType(CustomModifiers) instead.")]
-               public Type __MakeArrayType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __MakeArrayType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public Type MakeArrayType(int rank)
-               {
-                       return __MakeArrayType(rank, new CustomModifiers());
-               }
-
-               public Type __MakeArrayType(int rank, CustomModifiers customModifiers)
-               {
-                       return MultiArrayType.Make(this, rank, Empty<int>.Array, new int[rank], customModifiers);
-               }
-
-               [Obsolete("Please use __MakeArrayType(int, CustomModifiers) instead.")]
-               public Type __MakeArrayType(int rank, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __MakeArrayType(rank, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public Type __MakeArrayType(int rank, int[] sizes, int[] lobounds, CustomModifiers customModifiers)
-               {
-                       return MultiArrayType.Make(this, rank, sizes ?? Empty<int>.Array, lobounds ?? Empty<int>.Array, customModifiers);
-               }
-
-               [Obsolete("Please use __MakeArrayType(int, int[], int[], CustomModifiers) instead.")]
-               public Type __MakeArrayType(int rank, int[] sizes, int[] lobounds, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __MakeArrayType(rank, sizes, lobounds, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public Type MakeByRefType()
-               {
-                       return ByRefType.Make(this, new CustomModifiers());
-               }
-
-               public Type __MakeByRefType(CustomModifiers customModifiers)
-               {
-                       return ByRefType.Make(this, customModifiers);
-               }
-
-               [Obsolete("Please use __MakeByRefType(CustomModifiers) instead.")]
-               public Type __MakeByRefType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __MakeByRefType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public Type MakePointerType()
-               {
-                       return PointerType.Make(this, new CustomModifiers());
-               }
-
-               public Type __MakePointerType(CustomModifiers customModifiers)
-               {
-                       return PointerType.Make(this, customModifiers);
-               }
-
-               [Obsolete("Please use __MakeByRefType(CustomModifiers) instead.")]
-               public Type __MakePointerType(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __MakePointerType(CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public Type MakeGenericType(params Type[] typeArguments)
-               {
-                       return __MakeGenericType(typeArguments, null);
-               }
-
-               public Type __MakeGenericType(Type[] typeArguments, CustomModifiers[] customModifiers)
-               {
-                       if (!this.__IsMissing && !this.IsGenericTypeDefinition)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       return GenericTypeInstance.Make(this, Util.Copy(typeArguments), customModifiers == null ? null : (CustomModifiers[])customModifiers.Clone());
-               }
-
-               [Obsolete("Please use __MakeGenericType(Type[], CustomModifiers[]) instead.")]
-               public Type __MakeGenericType(Type[] typeArguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
-               {
-                       if (!this.__IsMissing && !this.IsGenericTypeDefinition)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       CustomModifiers[] mods = null;
-                       if (requiredCustomModifiers != null || optionalCustomModifiers != null)
-                       {
-                               mods = new CustomModifiers[typeArguments.Length];
-                               for (int i = 0; i < mods.Length; i++)
-                               {
-                                       mods[i] = CustomModifiers.FromReqOpt(Util.NullSafeElementAt(requiredCustomModifiers, i), Util.NullSafeElementAt(optionalCustomModifiers, i));
-                               }
-                       }
-                       return GenericTypeInstance.Make(this, Util.Copy(typeArguments), mods);
-               }
-
-               public static System.Type __GetSystemType(TypeCode typeCode)
-               {
-                       switch (typeCode)
-                       {
-                               case TypeCode.Boolean:
-                                       return typeof(System.Boolean);
-                               case TypeCode.Byte:
-                                       return typeof(System.Byte);
-                               case TypeCode.Char:
-                                       return typeof(System.Char);
-                               case TypeCode.DBNull:
-                                       return typeof(System.DBNull);
-                               case TypeCode.DateTime:
-                                       return typeof(System.DateTime);
-                               case TypeCode.Decimal:
-                                       return typeof(System.Decimal);
-                               case TypeCode.Double:
-                                       return typeof(System.Double);
-                               case TypeCode.Empty:
-                                       return null;
-                               case TypeCode.Int16:
-                                       return typeof(System.Int16);
-                               case TypeCode.Int32:
-                                       return typeof(System.Int32);
-                               case TypeCode.Int64:
-                                       return typeof(System.Int64);
-                               case TypeCode.Object:
-                                       return typeof(System.Object);
-                               case TypeCode.SByte:
-                                       return typeof(System.SByte);
-                               case TypeCode.Single:
-                                       return typeof(System.Single);
-                               case TypeCode.String:
-                                       return typeof(System.String);
-                               case TypeCode.UInt16:
-                                       return typeof(System.UInt16);
-                               case TypeCode.UInt32:
-                                       return typeof(System.UInt32);
-                               case TypeCode.UInt64:
-                                       return typeof(System.UInt64);
-                               default:
-                                       throw new ArgumentOutOfRangeException();
-                       }
-               }
-
-               public static TypeCode GetTypeCode(Type type)
-               {
-                       if (type == null)
-                       {
-                               return TypeCode.Empty;
-                       }
-                       if (!type.__IsMissing && type.IsEnum)
-                       {
-                               type = type.GetEnumUnderlyingType();
-                       }
-                       Universe u = type.Module.universe;
-                       if (type == u.System_Boolean)
-                       {
-                               return TypeCode.Boolean;
-                       }
-                       else if (type == u.System_Char)
-                       {
-                               return TypeCode.Char;
-                       }
-                       else if (type == u.System_SByte)
-                       {
-                               return TypeCode.SByte;
-                       }
-                       else if (type == u.System_Byte)
-                       {
-                               return TypeCode.Byte;
-                       }
-                       else if (type == u.System_Int16)
-                       {
-                               return TypeCode.Int16;
-                       }
-                       else if (type == u.System_UInt16)
-                       {
-                               return TypeCode.UInt16;
-                       }
-                       else if (type == u.System_Int32)
-                       {
-                               return TypeCode.Int32;
-                       }
-                       else if (type == u.System_UInt32)
-                       {
-                               return TypeCode.UInt32;
-                       }
-                       else if (type == u.System_Int64)
-                       {
-                               return TypeCode.Int64;
-                       }
-                       else if (type == u.System_UInt64)
-                       {
-                               return TypeCode.UInt64;
-                       }
-                       else if (type == u.System_Single)
-                       {
-                               return TypeCode.Single;
-                       }
-                       else if (type == u.System_Double)
-                       {
-                               return TypeCode.Double;
-                       }
-                       else if (type == u.System_DateTime)
-                       {
-                               return TypeCode.DateTime;
-                       }
-                       else if (type == u.System_DBNull)
-                       {
-                               return TypeCode.DBNull;
-                       }
-                       else if (type == u.System_Decimal)
-                       {
-                               return TypeCode.Decimal;
-                       }
-                       else if (type == u.System_String)
-                       {
-                               return TypeCode.String;
-                       }
-                       else if (type.__IsMissing)
-                       {
-                               throw new MissingMemberException(type);
-                       }
-                       else
-                       {
-                               return TypeCode.Object;
-                       }
-               }
-
-               public Assembly Assembly
-               {
-                       get { return Module.Assembly; }
-               }
-
-               public bool IsAssignableFrom(Type type)
-               {
-                       if (this.Equals(type))
-                       {
-                               return true;
-                       }
-                       else if (type == null)
-                       {
-                               return false;
-                       }
-                       else if (this.IsArray && type.IsArray)
-                       {
-                               if (this.GetArrayRank() != type.GetArrayRank())
-                               {
-                                       return false;
-                               }
-                               else if (this.__IsVector && !type.__IsVector)
-                               {
-                                       return false;
-                               }
-                               Type e1 = this.GetElementType();
-                               Type e2 = type.GetElementType();
-                               return e1.IsValueType == e2.IsValueType && e1.IsAssignableFrom(e2);
-                       }
-                       else if (this.IsCovariant(type))
-                       {
-                               return true;
-                       }
-                       else if (this.IsSealed)
-                       {
-                               return false;
-                       }
-                       else if (this.IsInterface)
-                       {
-                               foreach (Type iface in type.GetInterfaces())
-                               {
-                                       if (this.Equals(iface) || this.IsCovariant(iface))
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-                       else if (type.IsInterface)
-                       {
-                               return this == this.Module.universe.System_Object;
-                       }
-                       else if (type.IsPointer)
-                       {
-                               return this == this.Module.universe.System_Object || this == this.Module.universe.System_ValueType;
-                       }
-                       else
-                       {
-                               return type.IsSubclassOf(this);
-                       }
-               }
-
-               private bool IsCovariant(Type other)
-               {
-                       if (this.IsConstructedGenericType
-                               && other.IsConstructedGenericType
-                               && this.GetGenericTypeDefinition() == other.GetGenericTypeDefinition())
-                       {
-                               Type[] typeParameters = GetGenericTypeDefinition().GetGenericArguments();
-                               for (int i = 0; i < typeParameters.Length; i++)
-                               {
-                                       Type t1 = this.GetGenericTypeArgument(i);
-                                       Type t2 = other.GetGenericTypeArgument(i);
-                                       if (t1.IsValueType != t2.IsValueType)
-                                       {
-                                               return false;
-                                       }
-                                       switch (typeParameters[i].GenericParameterAttributes & GenericParameterAttributes.VarianceMask)
-                                       {
-                                               case GenericParameterAttributes.Covariant:
-                                                       if (!t1.IsAssignableFrom(t2))
-                                                       {
-                                                               return false;
-                                                       }
-                                                       break;
-                                               case GenericParameterAttributes.Contravariant:
-                                                       if (!t2.IsAssignableFrom(t1))
-                                                       {
-                                                               return false;
-                                                       }
-                                                       break;
-                                               case GenericParameterAttributes.None:
-                                                       if (t1 != t2)
-                                                       {
-                                                               return false;
-                                                       }
-                                                       break;
-                                       }
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-
-               public bool IsSubclassOf(Type type)
-               {
-                       Type thisType = this.BaseType;
-                       while (thisType != null)
-                       {
-                               if (thisType.Equals(type))
-                               {
-                                       return true;
-                               }
-                               thisType = thisType.BaseType;
-                       }
-                       return false;
-               }
-
-               // This returns true if this type directly (i.e. not inherited from the base class) implements the interface.
-               // Note that a complicating factor is that the interface itself can be implemented by an interface that extends it.
-               private bool IsDirectlyImplementedInterface(Type interfaceType)
-               {
-                       foreach (Type iface in __GetDeclaredInterfaces())
-                       {
-                               if (interfaceType.IsAssignableFrom(iface))
-                               {
-                                       return true;
-                               }
-                       }
-                       return false;
-               }
-
-               public InterfaceMapping GetInterfaceMap(Type interfaceType)
-               {
-                       CheckBaked();
-                       InterfaceMapping map = new InterfaceMapping();
-                       if (!IsDirectlyImplementedInterface(interfaceType))
-                       {
-                               Type baseType = this.BaseType;
-                               if (baseType == null)
-                               {
-                                       throw new ArgumentException();
-                               }
-                               else
-                               {
-                                       map = baseType.GetInterfaceMap(interfaceType);
-                               }
-                       }
-                       else
-                       {
-                               map.InterfaceMethods = interfaceType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
-                               map.InterfaceType = interfaceType;
-                               map.TargetMethods = new MethodInfo[map.InterfaceMethods.Length];
-                               FillInExplicitInterfaceMethods(map.InterfaceMethods, map.TargetMethods);
-                               MethodInfo[] methods = GetMethods(BindingFlags.Instance | BindingFlags.Public);
-                               for (int i = 0; i < map.TargetMethods.Length; i++)
-                               {
-                                       if (map.TargetMethods[i] == null)
-                                       {
-                                               // TODO use proper method resolution (also take into account that no implicit base class implementation is used across assembly boundaries)
-                                               for (int j = 0; j < methods.Length; j++)
-                                               {
-                                                       if (methods[j].Name == map.InterfaceMethods[i].Name
-                                                               && methods[j].MethodSignature.Equals(map.InterfaceMethods[i].MethodSignature))
-                                                       {
-                                                               map.TargetMethods[i] = methods[j];
-                                                       }
-                                               }
-                                       }
-                               }
-                               for (Type baseType = this.BaseType; baseType != null && interfaceType.IsAssignableFrom(baseType); baseType = baseType.BaseType)
-                               {
-                                       baseType.FillInExplicitInterfaceMethods(map.InterfaceMethods, map.TargetMethods);
-                               }
-                       }
-                       map.TargetType = this;
-                       return map;
-               }
-
-               internal void FillInExplicitInterfaceMethods(MethodInfo[] interfaceMethods, MethodInfo[] targetMethods)
-               {
-                       __MethodImplMap impl = __GetMethodImplMap();
-                       for (int i = 0; i < impl.MethodDeclarations.Length; i++)
-                       {
-                               for (int j = 0; j < impl.MethodDeclarations[i].Length; j++)
-                               {
-                                       int index = Array.IndexOf(interfaceMethods, impl.MethodDeclarations[i][j]);
-                                       if (index != -1 && targetMethods[index] == null)
-                                       {
-                                               targetMethods[index] = impl.MethodBodies[i];
-                                       }
-                               }
-                       }
-               }
-
-               Type IGenericContext.GetGenericTypeArgument(int index)
-               {
-                       return GetGenericTypeArgument(index);
-               }
-
-               Type IGenericContext.GetGenericMethodArgument(int index)
-               {
-                       throw new BadImageFormatException();
-               }
-
-               Type IGenericBinder.BindTypeParameter(Type type)
-               {
-                       return GetGenericTypeArgument(type.GenericParameterPosition);
-               }
-
-               Type IGenericBinder.BindMethodParameter(Type type)
-               {
-                       throw new BadImageFormatException();
-               }
-
-               internal virtual Type BindTypeParameters(IGenericBinder binder)
-               {
-                       if (IsGenericTypeDefinition)
-                       {
-                               Type[] args = GetGenericArguments();
-                               Type.InplaceBindTypeParameters(binder, args);
-                               return GenericTypeInstance.Make(this, args, null);
-                       }
-                       else
-                       {
-                               return this;
-                       }
-               }
-
-               private static void InplaceBindTypeParameters(IGenericBinder binder, Type[] types)
-               {
-                       for (int i = 0; i < types.Length; i++)
-                       {
-                               types[i] = types[i].BindTypeParameters(binder);
-                       }
-               }
-
-               internal virtual MethodBase FindMethod(string name, MethodSignature signature)
-               {
-                       foreach (MethodBase method in __GetDeclaredMethods())
-                       {
-                               if (method.Name == name && method.MethodSignature.Equals(signature))
-                               {
-                                       return method;
-                               }
-                       }
-                       return null;
-               }
-
-               internal virtual FieldInfo FindField(string name, FieldSignature signature)
-               {
-                       foreach (FieldInfo field in __GetDeclaredFields())
-                       {
-                               if (field.Name == name && field.FieldSignature.Equals(signature))
-                               {
-                                       return field;
-                               }
-                       }
-                       return null;
-               }
-
-               internal bool IsAllowMultipleCustomAttribute
-               {
-                       get
-                       {
-                               IList<CustomAttributeData> cad = CustomAttributeData.__GetCustomAttributes(this, this.Module.universe.System_AttributeUsageAttribute, false);
-                               if (cad.Count == 1)
-                               {
-                                       foreach (CustomAttributeNamedArgument arg in cad[0].NamedArguments)
-                                       {
-                                               if (arg.MemberInfo.Name == "AllowMultiple")
-                                               {
-                                                       return (bool)arg.TypedValue.Value;
-                                               }
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               internal bool IsPseudoCustomAttribute
-               {
-                       get
-                       {
-                               Universe u = this.Module.universe;
-                               return this == u.System_NonSerializedAttribute
-                                       || this == u.System_SerializableAttribute
-                                       || this == u.System_Runtime_InteropServices_DllImportAttribute
-                                       || this == u.System_Runtime_InteropServices_FieldOffsetAttribute
-                                       || this == u.System_Runtime_InteropServices_InAttribute
-                                       || this == u.System_Runtime_InteropServices_MarshalAsAttribute
-                                       || this == u.System_Runtime_InteropServices_OutAttribute
-                                       || this == u.System_Runtime_InteropServices_StructLayoutAttribute
-                                       || this == u.System_Runtime_InteropServices_OptionalAttribute
-                                       || this == u.System_Runtime_InteropServices_PreserveSigAttribute
-                                       || this == u.System_Runtime_InteropServices_ComImportAttribute
-                                       || this == u.System_Runtime_CompilerServices_SpecialNameAttribute
-                                       || this == u.System_Runtime_CompilerServices_MethodImplAttribute
-                                       ;
-                       }
-               }
-
-               internal Type MarkNotValueType()
-               {
-                       typeFlags |= TypeFlags.NotValueType;
-                       return this;
-               }
-
-               internal Type MarkValueType()
-               {
-                       typeFlags |= TypeFlags.ValueType;
-                       return this;
-               }
-
-               internal ConstructorInfo GetPseudoCustomAttributeConstructor(params Type[] parameterTypes)
-               {
-                       Universe u = this.Module.universe;
-                       MethodSignature methodSig = MethodSignature.MakeFromBuilder(u.System_Void, parameterTypes, new PackedCustomModifiers(), CallingConventions.Standard | CallingConventions.HasThis, 0);
-                       MethodBase mb =
-                               FindMethod(".ctor", methodSig) ??
-                               u.GetMissingMethodOrThrow(this, ".ctor", methodSig);
-                       return (ConstructorInfo)mb;
-               }
-
-               public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       return CreateMissingMethod(name, callingConvention, returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, parameterTypes.Length));
-               }
-
-               private MethodBase CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, PackedCustomModifiers customModifiers)
-               {
-                       MethodSignature sig = new MethodSignature(
-                               returnType ?? this.Module.universe.System_Void,
-                               Util.Copy(parameterTypes),
-                               customModifiers,
-                               callingConvention,
-                               0);
-                       MethodInfo method = new MissingMethod(this, name, sig);
-                       if (name == ".ctor" || name == ".cctor")
-                       {
-                               return new ConstructorInfoImpl(method);
-                       }
-                       return method;
-               }
-
-               [Obsolete("Please use __CreateMissingMethod(string, CallingConventions, Type, CustomModifiers, Type[], CustomModifiers[]) instead")]
-               public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
-               {
-                       return CreateMissingMethod(name, callingConvention, returnType, parameterTypes, PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length));
-               }
-
-               public FieldInfo __CreateMissingField(string name, Type fieldType, CustomModifiers customModifiers)
-               {
-                       return new MissingField(this, name, FieldSignature.Create(fieldType, customModifiers));
-               }
-
-               [Obsolete("Please use __CreateMissingField(string, Type, CustomModifiers) instead")]
-               public FieldInfo __CreateMissingField(string name, Type fieldType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
-               {
-                       return __CreateMissingField(name, fieldType, CustomModifiers.FromReqOpt(requiredCustomModifiers, optionalCustomModifiers));
-               }
-
-               public PropertyInfo __CreateMissingProperty(string name, CallingConventions callingConvention, Type propertyType, CustomModifiers propertyTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       PropertySignature sig = PropertySignature.Create(callingConvention,
-                               propertyType,
-                               parameterTypes,
-                               PackedCustomModifiers.CreateFromExternal(propertyTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
-                       return new MissingProperty(this, name, sig);
-               }
-
-               internal virtual Type SetMetadataTokenForMissing(int token)
-               {
-                       return this;
-               }
-
-               protected void MarkEnumOrValueType(string typeNamespace, string typeName)
-               {
-                       // we assume that mscorlib won't have nested types with these names,
-                       // so we don't check that we're not a nested type
-                       if (typeNamespace == "System"
-                               && (typeName == "Enum" || typeName == "ValueType"))
-                       {
-                               typeFlags |= TypeFlags.PotentialEnumOrValueType;
-                       }
-               }
-
-               private bool ResolvePotentialEnumOrValueType()
-               {
-                       if (this.Assembly == this.Universe.Mscorlib
-                               || this.Assembly.GetName().Name.Equals("mscorlib", StringComparison.OrdinalIgnoreCase)
-                               // check if mscorlib forwards the type (.NETCore profile reference mscorlib forwards System.Enum and System.ValueType to System.Runtime.dll)
-                               || this.Universe.Mscorlib.FindType(new TypeName(__Namespace, __Name)) == this)
-                       {
-                               typeFlags = (typeFlags & ~TypeFlags.PotentialEnumOrValueType) | TypeFlags.EnumOrValueType;
-                               return true;
-                       }
-                       else
-                       {
-                               typeFlags &= ~TypeFlags.PotentialEnumOrValueType;
-                               return false;
-                       }
-               }
-
-               private bool IsEnumOrValueType
-               {
-                       get
-                       {
-                               return (typeFlags & (TypeFlags.EnumOrValueType | TypeFlags.PotentialEnumOrValueType)) != 0
-                                       && ((typeFlags & TypeFlags.EnumOrValueType) != 0 || ResolvePotentialEnumOrValueType());
-                       }
-               }
-
-               internal virtual Universe Universe
-               {
-                       get { return Module.universe; }
-               }
-
-               internal sealed override bool BindingFlagsMatch(BindingFlags flags)
-               {
-                       return BindingFlagsMatch(IsNestedPublic, flags, BindingFlags.Public, BindingFlags.NonPublic);
-               }
-
-               internal sealed override MemberInfo SetReflectedType(Type type)
-               {
-                       throw new InvalidOperationException();
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return this.MetadataToken;
-               }
-
-               internal sealed override List<CustomAttributeData> GetPseudoCustomAttributes(Type attributeType)
-               {
-                       // types don't have pseudo custom attributes
-                       return null;
-               }
-
-               // in .NET this is an extension method, but we target .NET 2.0, so we have an instance method
-               public TypeInfo GetTypeInfo()
-               {
-                       TypeInfo type = this as TypeInfo;
-                       if (type == null)
-                       {
-                               throw new MissingMemberException(this);
-                       }
-                       return type;
-               }
-       }
-
-       abstract class ElementHolderType : TypeInfo
-       {
-               protected readonly Type elementType;
-               private int token;
-               private readonly CustomModifiers mods;
-
-               protected ElementHolderType(Type elementType, CustomModifiers mods)
-               {
-                       this.elementType = elementType;
-                       this.mods = mods;
-               }
-
-               protected bool EqualsHelper(ElementHolderType other)
-               {
-                       return other != null
-                               && other.elementType.Equals(elementType)
-                               && other.mods.Equals(mods);
-               }
-
-               public override CustomModifiers __GetCustomModifiers()
-               {
-                       return mods;
-               }
-
-               public sealed override string Name
-               {
-                       get { return elementType.Name + GetSuffix(); }
-               }
-
-               public sealed override string Namespace
-               {
-                       get { return elementType.Namespace; }
-               }
-
-               public sealed override string FullName
-               {
-                       get { return elementType.FullName + GetSuffix(); }
-               }
-
-               public sealed override string ToString()
-               {
-                       return elementType.ToString() + GetSuffix();
-               }
-
-               public sealed override Type GetElementType()
-               {
-                       return elementType;
-               }
-
-               public sealed override bool HasElementType
-               {
-                       get { return true; }
-               }
-
-               public sealed override Module Module
-               {
-                       get { return elementType.Module; }
-               }
-
-               internal sealed override int GetModuleBuilderToken()
-               {
-                       if (token == 0)
-                       {
-                               token = ((ModuleBuilder)elementType.Module).ImportType(this);
-                       }
-                       return token;
-               }
-
-               public sealed override bool ContainsGenericParameters
-               {
-                       get
-                       {
-                               Type type = elementType;
-                               while (type.HasElementType)
-                               {
-                                       type = type.GetElementType();
-                               }
-                               return type.ContainsGenericParameters;
-                       }
-               }
-
-               public sealed override bool __ContainsMissingType
-               {
-                       get
-                       {
-                               Type type = elementType;
-                               while (type.HasElementType)
-                               {
-                                       type = type.GetElementType();
-                               }
-                               return type.__ContainsMissingType;
-                       }
-               }
-
-               internal sealed override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       Type type = elementType.BindTypeParameters(binder);
-                       CustomModifiers mods = this.mods.Bind(binder);
-                       if (ReferenceEquals(type, elementType)
-                               && mods.Equals(this.mods))
-                       {
-                               return this;
-                       }
-                       return Wrap(type, mods);
-               }
-
-               internal override void CheckBaked()
-               {
-                       elementType.CheckBaked();
-               }
-
-               internal sealed override Universe Universe
-               {
-                       get { return elementType.Universe; }
-               }
-
-               internal sealed override bool IsBaked
-               {
-                       get { return elementType.IsBaked; }
-               }
-
-               internal sealed override int GetCurrentToken()
-               {
-                       // we don't have a token, so we return 0 (which is never a valid token)
-                       return 0;
-               }
-
-               internal abstract string GetSuffix();
-
-               protected abstract Type Wrap(Type type, CustomModifiers mods);
-       }
-
-       sealed class ArrayType : ElementHolderType
-       {
-               internal static Type Make(Type type, CustomModifiers mods)
-               {
-                       return type.Universe.CanonicalizeType(new ArrayType(type, mods));
-               }
-
-               private ArrayType(Type type, CustomModifiers mods)
-                       : base(type, mods)
-               {
-               }
-
-               public override Type BaseType
-               {
-                       get { return elementType.Module.universe.System_Array; }
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       return new Type[] {
-                               this.Module.universe.Import(typeof(IList<>)).MakeGenericType(elementType),
-                               this.Module.universe.Import(typeof(ICollection<>)).MakeGenericType(elementType),
-                               this.Module.universe.Import(typeof(IEnumerable<>)).MakeGenericType(elementType)
-                       };
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       Type[] int32 = new Type[] { this.Module.universe.System_Int32 };
-                       List<MethodBase> list = new List<MethodBase>();
-                       list.Add(new BuiltinArrayMethod(this.Module, this, "Set", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, new Type[] { this.Module.universe.System_Int32, elementType }));
-                       list.Add(new BuiltinArrayMethod(this.Module, this, "Address", CallingConventions.Standard | CallingConventions.HasThis, elementType.MakeByRefType(), int32));
-                       list.Add(new BuiltinArrayMethod(this.Module, this, "Get", CallingConventions.Standard | CallingConventions.HasThis, elementType, int32));
-                       list.Add(new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, int32)));
-                       for (Type type = elementType; type.__IsVector; type = type.GetElementType())
-                       {
-                               Array.Resize(ref int32, int32.Length + 1);
-                               int32[int32.Length - 1] = int32[0];
-                               list.Add(new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, int32)));
-                       }
-                       return list.ToArray();
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Serializable; }
-               }
-
-               public override bool IsArray
-               {
-                       get { return true; }
-               }
-
-               public override bool __IsVector
-               {
-                       get { return true; }
-               }
-
-               public override int GetArrayRank()
-               {
-                       return 1;
-               }
-
-               public override bool Equals(object o)
-               {
-                       return EqualsHelper(o as ArrayType);
-               }
-
-               public override int GetHashCode()
-               {
-                       return elementType.GetHashCode() * 5;
-               }
-
-               internal override string GetSuffix()
-               {
-                       return "[]";
-               }
-
-               protected override Type Wrap(Type type, CustomModifiers mods)
-               {
-                       return Make(type, mods);
-               }
-       }
-
-       sealed class MultiArrayType : ElementHolderType
-       {
-               private readonly int rank;
-               private readonly int[] sizes;
-               private readonly int[] lobounds;
-
-               internal static Type Make(Type type, int rank, int[] sizes, int[] lobounds, CustomModifiers mods)
-               {
-                       return type.Universe.CanonicalizeType(new MultiArrayType(type, rank, sizes, lobounds, mods));
-               }
-
-               private MultiArrayType(Type type, int rank, int[] sizes, int[] lobounds, CustomModifiers mods)
-                       : base(type, mods)
-               {
-                       this.rank = rank;
-                       this.sizes = sizes;
-                       this.lobounds = lobounds;
-               }
-
-               public override Type BaseType
-               {
-                       get { return elementType.Module.universe.System_Array; }
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       Type int32 = this.Module.universe.System_Int32;
-                       Type[] setArgs = new Type[rank + 1];
-                       Type[] getArgs = new Type[rank];
-                       Type[] ctorArgs = new Type[rank * 2];
-                       for (int i = 0; i < rank; i++)
-                       {
-                               setArgs[i] = int32;
-                               getArgs[i] = int32;
-                               ctorArgs[i * 2 + 0] = int32;
-                               ctorArgs[i * 2 + 1] = int32;
-                       }
-                       setArgs[rank] = elementType;
-                       return new MethodBase[] {
-                               new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, getArgs)),
-                               new ConstructorInfoImpl(new BuiltinArrayMethod(this.Module, this, ".ctor", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, ctorArgs)),
-                               new BuiltinArrayMethod(this.Module, this, "Set", CallingConventions.Standard | CallingConventions.HasThis, this.Module.universe.System_Void, setArgs),
-                               new BuiltinArrayMethod(this.Module, this, "Address", CallingConventions.Standard | CallingConventions.HasThis, elementType.MakeByRefType(), getArgs),
-                               new BuiltinArrayMethod(this.Module, this, "Get", CallingConventions.Standard | CallingConventions.HasThis, elementType, getArgs),
-                       };
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Serializable; }
-               }
-
-               public override bool IsArray
-               {
-                       get { return true; }
-               }
-
-               public override int GetArrayRank()
-               {
-                       return rank;
-               }
-
-               public override int[] __GetArraySizes()
-               {
-                       return Util.Copy(sizes);
-               }
-
-               public override int[] __GetArrayLowerBounds()
-               {
-                       return Util.Copy(lobounds);
-               }
-
-               public override bool Equals(object o)
-               {
-                       MultiArrayType at = o as MultiArrayType;
-                       return EqualsHelper(at)
-                               && at.rank == rank
-                               && ArrayEquals(at.sizes, sizes)
-                               && ArrayEquals(at.lobounds, lobounds);
-               }
-
-               private static bool ArrayEquals(int[] i1, int[] i2)
-               {
-                       if (i1.Length == i2.Length)
-                       {
-                               for (int i = 0; i < i1.Length; i++)
-                               {
-                                       if (i1[i] != i2[i])
-                                       {
-                                               return false;
-                                       }
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-
-               public override int GetHashCode()
-               {
-                       return elementType.GetHashCode() * 9 + rank;
-               }
-
-               internal override string GetSuffix()
-               {
-                       if (rank == 1)
-                       {
-                               return "[*]";
-                       }
-                       else
-                       {
-                               return "[" + new String(',', rank - 1) + "]";
-                       }
-               }
-
-               protected override Type Wrap(Type type, CustomModifiers mods)
-               {
-                       return Make(type, rank, sizes, lobounds, mods);
-               }
-       }
-
-       sealed class BuiltinArrayMethod : ArrayMethod
-       {
-               internal BuiltinArrayMethod(Module module, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
-                       : base(module, arrayClass, methodName, callingConvention, returnType, parameterTypes)
-               {
-               }
-
-               public override MethodAttributes Attributes
-               {
-                       get { return this.Name == ".ctor" ? MethodAttributes.RTSpecialName | MethodAttributes.Public : MethodAttributes.Public; }
-               }
-
-               public override MethodImplAttributes GetMethodImplementationFlags()
-               {
-                       return MethodImplAttributes.IL;
-               }
-
-               public override int MetadataToken
-               {
-                       get { return 0x06000000; }
-               }
-
-               public override MethodBody GetMethodBody()
-               {
-                       return null;
-               }
-
-               public override ParameterInfo[] GetParameters()
-               {
-                       ParameterInfo[] parameterInfos = new ParameterInfo[parameterTypes.Length];
-                       for (int i = 0; i < parameterInfos.Length; i++)
-                       {
-                               parameterInfos[i] = new ParameterInfoImpl(this, parameterTypes[i], i);
-                       }
-                       return parameterInfos;
-               }
-
-               public override ParameterInfo ReturnParameter
-               {
-                       get { return new ParameterInfoImpl(this, this.ReturnType, -1); }
-               }
-
-               private sealed class ParameterInfoImpl : ParameterInfo
-               {
-                       private readonly MethodInfo method;
-                       private readonly Type type;
-                       private readonly int pos;
-
-                       internal ParameterInfoImpl(MethodInfo method, Type type, int pos)
-                       {
-                               this.method = method;
-                               this.type = type;
-                               this.pos = pos;
-                       }
-
-                       public override Type ParameterType
-                       {
-                               get { return type; }
-                       }
-
-                       public override string Name
-                       {
-                               get { return null; }
-                       }
-
-                       public override ParameterAttributes Attributes
-                       {
-                               get { return ParameterAttributes.None; }
-                       }
-
-                       public override int Position
-                       {
-                               get { return pos; }
-                       }
-
-                       public override object RawDefaultValue
-                       {
-                               get { return null; }
-                       }
-
-                       public override CustomModifiers __GetCustomModifiers()
-                       {
-                               return new CustomModifiers();
-                       }
-
-                       public override bool __TryGetFieldMarshal(out FieldMarshal fieldMarshal)
-                       {
-                               fieldMarshal = new FieldMarshal();
-                               return false;
-                       }
-
-                       public override MemberInfo Member
-                       {
-                               get { return method.IsConstructor ? (MethodBase)new ConstructorInfoImpl(method) : method; }
-                       }
-
-                       public override int MetadataToken
-                       {
-                               get { return 0x08000000; }
-                       }
-
-                       internal override Module Module
-                       {
-                               get { return method.Module; }
-                       }
-               }
-       }
-
-       sealed class ByRefType : ElementHolderType
-       {
-               internal static Type Make(Type type, CustomModifiers mods)
-               {
-                       return type.Universe.CanonicalizeType(new ByRefType(type, mods));
-               }
-
-               private ByRefType(Type type, CustomModifiers mods)
-                       : base(type, mods)
-               {
-               }
-
-               public override bool Equals(object o)
-               {
-                       return EqualsHelper(o as ByRefType);
-               }
-
-               public override int GetHashCode()
-               {
-                       return elementType.GetHashCode() * 3;
-               }
-
-               public override Type BaseType
-               {
-                       get { return null; }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return 0; }
-               }
-
-               public override bool IsByRef
-               {
-                       get { return true; }
-               }
-
-               internal override string GetSuffix()
-               {
-                       return "&";
-               }
-
-               protected override Type Wrap(Type type, CustomModifiers mods)
-               {
-                       return Make(type, mods);
-               }
-       }
-
-       sealed class PointerType : ElementHolderType
-       {
-               internal static Type Make(Type type, CustomModifiers mods)
-               {
-                       return type.Universe.CanonicalizeType(new PointerType(type, mods));
-               }
-
-               private PointerType(Type type, CustomModifiers mods)
-                       : base(type, mods)
-               {
-               }
-
-               public override bool Equals(object o)
-               {
-                       return EqualsHelper(o as PointerType);
-               }
-
-               public override int GetHashCode()
-               {
-                       return elementType.GetHashCode() * 7;
-               }
-
-               public override Type BaseType
-               {
-                       get { return null; }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return 0; }
-               }
-
-               public override bool IsPointer
-               {
-                       get { return true; }
-               }
-
-               internal override string GetSuffix()
-               {
-                       return "*";
-               }
-
-               protected override Type Wrap(Type type, CustomModifiers mods)
-               {
-                       return Make(type, mods);
-               }
-       }
-
-       sealed class GenericTypeInstance : TypeInfo
-       {
-               private readonly Type type;
-               private readonly Type[] args;
-               private readonly CustomModifiers[] mods;
-               private Type baseType;
-               private int token;
-
-               internal static Type Make(Type type, Type[] typeArguments, CustomModifiers[] mods)
-               {
-                       bool identity = true;
-                       if (type is TypeBuilder || type is BakedType || type.__IsMissing)
-                       {
-                               // a TypeBuiler identity must be instantiated
-                               identity = false;
-                       }
-                       else
-                       {
-                               // we must not instantiate the identity instance, because typeof(Foo<>).MakeGenericType(typeof(Foo<>).GetGenericArguments()) == typeof(Foo<>)
-                               for (int i = 0; i < typeArguments.Length; i++)
-                               {
-                                       if (typeArguments[i] != type.GetGenericTypeArgument(i)
-                                               || !IsEmpty(mods, i))
-                                       {
-                                               identity = false;
-                                               break;
-                                       }
-                               }
-                       }
-                       if (identity)
-                       {
-                               return type;
-                       }
-                       else
-                       {
-                               return type.Universe.CanonicalizeType(new GenericTypeInstance(type, typeArguments, mods));
-                       }
-               }
-
-               private static bool IsEmpty(CustomModifiers[] mods, int i)
-               {
-                       // we need to be extra careful, because mods doesn't not need to be in canonical format
-                       // (Signature.ReadGenericInst() calls Make() directly, without copying the modifier arrays)
-                       return mods == null || mods[i].IsEmpty;
-               }
-
-               private GenericTypeInstance(Type type, Type[] args, CustomModifiers[] mods)
-               {
-                       this.type = type;
-                       this.args = args;
-                       this.mods = mods;
-               }
-
-               public override bool Equals(object o)
-               {
-                       GenericTypeInstance gt = o as GenericTypeInstance;
-                       return gt != null && gt.type.Equals(type) && Util.ArrayEquals(gt.args, args)
-                               && Util.ArrayEquals(gt.mods, mods);
-               }
-
-               public override int GetHashCode()
-               {
-                       return type.GetHashCode() * 3 ^ Util.GetHashCode(args);
-               }
-
-               public override string AssemblyQualifiedName
-               {
-                       get
-                       {
-                               string fn = FullName;
-                               return fn == null ? null : fn + ", " + type.Assembly.FullName;
-                       }
-               }
-
-               public override Type BaseType
-               {
-                       get
-                       {
-                               if (baseType == null)
-                               {
-                                       Type rawBaseType = type.BaseType;
-                                       if (rawBaseType == null)
-                                       {
-                                               baseType = rawBaseType;
-                                       }
-                                       else
-                                       {
-                                               baseType = rawBaseType.BindTypeParameters(this);
-                                       }
-                               }
-                               return baseType;
-                       }
-               }
-
-               public override bool IsValueType
-               {
-                       get { return type.IsValueType; }
-               }
-
-               public override bool IsVisible
-               {
-                       get
-                       {
-                               if (base.IsVisible)
-                               {
-                                       foreach (Type arg in args)
-                                       {
-                                               if (!arg.IsVisible)
-                                               {
-                                                       return false;
-                                               }
-                                       }
-                                       return true;
-                               }
-                               return false;
-                       }
-               }
-
-               public override Type DeclaringType
-               {
-                       get { return type.DeclaringType; }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return type.Attributes; }
-               }
-
-               internal override void CheckBaked()
-               {
-                       type.CheckBaked();
-               }
-
-               public override FieldInfo[] __GetDeclaredFields()
-               {
-                       FieldInfo[] fields = type.__GetDeclaredFields();
-                       for (int i = 0; i < fields.Length; i++)
-                       {
-                               fields[i] = fields[i].BindTypeParameters(this);
-                       }
-                       return fields;
-               }
-
-               public override Type[] __GetDeclaredInterfaces()
-               {
-                       Type[] interfaces = type.__GetDeclaredInterfaces();
-                       for (int i = 0; i < interfaces.Length; i++)
-                       {
-                               interfaces[i] = interfaces[i].BindTypeParameters(this);
-                       }
-                       return interfaces;
-               }
-
-               public override MethodBase[] __GetDeclaredMethods()
-               {
-                       MethodBase[] methods = type.__GetDeclaredMethods();
-                       for (int i = 0; i < methods.Length; i++)
-                       {
-                               methods[i] = methods[i].BindTypeParameters(this);
-                       }
-                       return methods;
-               }
-
-               public override Type[] __GetDeclaredTypes()
-               {
-                       return type.__GetDeclaredTypes();
-               }
-
-               public override EventInfo[] __GetDeclaredEvents()
-               {
-                       EventInfo[] events = type.__GetDeclaredEvents();
-                       for (int i = 0; i < events.Length; i++)
-                       {
-                               events[i] = events[i].BindTypeParameters(this);
-                       }
-                       return events;
-               }
-
-               public override PropertyInfo[] __GetDeclaredProperties()
-               {
-                       PropertyInfo[] properties = type.__GetDeclaredProperties();
-                       for (int i = 0; i < properties.Length; i++)
-                       {
-                               properties[i] = properties[i].BindTypeParameters(this);
-                       }
-                       return properties;
-               }
-
-               public override __MethodImplMap __GetMethodImplMap()
-               {
-                       __MethodImplMap map = type.__GetMethodImplMap();
-                       map.TargetType = this;
-                       for (int i = 0; i < map.MethodBodies.Length; i++)
-                       {
-                               map.MethodBodies[i] = (MethodInfo)map.MethodBodies[i].BindTypeParameters(this);
-                               for (int j = 0; j < map.MethodDeclarations[i].Length; j++)
-                               {
-                                       Type interfaceType = map.MethodDeclarations[i][j].DeclaringType;
-                                       if (interfaceType.IsGenericType)
-                                       {
-                                               map.MethodDeclarations[i][j] = (MethodInfo)map.MethodDeclarations[i][j].BindTypeParameters(this);
-                                       }
-                               }
-                       }
-                       return map;
-               }
-
-               public override string Namespace
-               {
-                       get { return type.Namespace; }
-               }
-
-               public override string Name
-               {
-                       get { return type.Name; }
-               }
-
-               public override string FullName
-               {
-                       get
-                       {
-                               if (!this.__ContainsMissingType && this.ContainsGenericParameters)
-                               {
-                                       return null;
-                               }
-                               StringBuilder sb = new StringBuilder(this.type.FullName);
-                               sb.Append('[');
-                               string sep = "";
-                               foreach (Type type in args)
-                               {
-                                       sb.Append(sep).Append('[').Append(type.FullName).Append(", ").Append(type.Assembly.FullName.Replace("]", "\\]")).Append(']');
-                                       sep = ",";
-                               }
-                               sb.Append(']');
-                               return sb.ToString();
-                       }
-               }
-
-               public override string ToString()
-               {
-                       StringBuilder sb = new StringBuilder(type.FullName);
-                       sb.Append('[');
-                       string sep = "";
-                       foreach (Type arg in args)
-                       {
-                               sb.Append(sep);
-                               sb.Append(arg);
-                               sep = ",";
-                       }
-                       sb.Append(']');
-                       return sb.ToString();
-               }
-
-               public override Module Module
-               {
-                       get { return type.Module; }
-               }
-
-               public override bool IsGenericType
-               {
-                       get { return true; }
-               }
-
-               public override bool IsConstructedGenericType
-               {
-                       get { return true; }
-               }
-
-               public override Type GetGenericTypeDefinition()
-               {
-                       return type;
-               }
-
-               public override Type[] GetGenericArguments()
-               {
-                       return Util.Copy(args);
-               }
-
-               public override CustomModifiers[] __GetGenericArgumentsCustomModifiers()
-               {
-                       return mods != null ? (CustomModifiers[])mods.Clone() : new CustomModifiers[args.Length];
-               }
-
-               internal override Type GetGenericTypeArgument(int index)
-               {
-                       return args[index];
-               }
-
-               public override bool ContainsGenericParameters
-               {
-                       get
-                       {
-                               foreach (Type type in args)
-                               {
-                                       if (type.ContainsGenericParameters)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
-               }
-
-               public override bool __ContainsMissingType
-               {
-                       get
-                       {
-                               foreach (Type type in args)
-                               {
-                                       if (type.__ContainsMissingType)
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return this.type.__IsMissing;
-                       }
-               }
-
-               public override StructLayoutAttribute StructLayoutAttribute
-               {
-                       get { return type.StructLayoutAttribute; }
-               }
-
-               internal override int GetModuleBuilderToken()
-               {
-                       if (token == 0)
-                       {
-                               token = ((ModuleBuilder)type.Module).ImportType(this);
-                       }
-                       return token;
-               }
-
-               internal override Type BindTypeParameters(IGenericBinder binder)
-               {
-                       for (int i = 0; i < args.Length; i++)
-                       {
-                               Type xarg = args[i].BindTypeParameters(binder);
-                               if (!ReferenceEquals(xarg, args[i]))
-                               {
-                                       Type[] xargs = new Type[args.Length];
-                                       Array.Copy(args, xargs, i);
-                                       xargs[i++] = xarg;
-                                       for (; i < args.Length; i++)
-                                       {
-                                               xargs[i] = args[i].BindTypeParameters(binder);
-                                       }
-                                       return Make(type, xargs, null);
-                               }
-                       }
-                       return this;
-               }
-
-               internal override int GetCurrentToken()
-               {
-                       return type.GetCurrentToken();
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return type.IsBaked; }
-               }
-       }
-
-       sealed class FunctionPointerType : TypeInfo
-       {
-               private readonly Universe universe;
-               private readonly __StandAloneMethodSig sig;
-
-               internal static Type Make(Universe universe, __StandAloneMethodSig sig)
-               {
-                       return universe.CanonicalizeType(new FunctionPointerType(universe, sig));
-               }
-
-               private FunctionPointerType(Universe universe, __StandAloneMethodSig sig)
-               {
-                       this.universe = universe;
-                       this.sig = sig;
-               }
-
-               public override bool Equals(object obj)
-               {
-                       FunctionPointerType other = obj as FunctionPointerType;
-                       return other != null
-                               && other.universe == universe
-                               && other.sig.Equals(sig);
-               }
-
-               public override int GetHashCode()
-               {
-                       return sig.GetHashCode();
-               }
-
-               public override bool __IsFunctionPointer
-               {
-                       get { return true; }
-               }
-
-               public override __StandAloneMethodSig __MethodSignature
-               {
-                       get { return sig; }
-               }
-
-               public override Type BaseType
-               {
-                       get { return null; }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { return 0; }
-               }
-
-               public override string Name
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override string FullName
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override Module Module
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               internal override Universe Universe
-               {
-                       get { return universe; }
-               }
-
-               public override string ToString()
-               {
-                       return "<FunctionPtr>";
-               }
-
-               internal override bool IsBaked
-               {
-                       get { return true; }
-               }
-       }
-
-       sealed class MarkerType : Type
-       {
-               // used by ILGenerator
-               internal static readonly Type Fault = new MarkerType();
-               internal static readonly Type Finally = new MarkerType();
-               internal static readonly Type Filter = new MarkerType();
-               // used by CustomModifiers and SignatureHelper
-               internal static readonly Type ModOpt = new MarkerType();
-               internal static readonly Type ModReq = new MarkerType();
-               // used by SignatureHelper
-               internal static readonly Type Sentinel = new MarkerType();
-               internal static readonly Type Pinned = new MarkerType();
-
-               private MarkerType() { }
-
-               public override Type BaseType
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override TypeAttributes Attributes
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override string Name
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override string FullName
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override Module Module
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               internal override bool IsBaked
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-
-               public override bool __IsMissing
-               {
-                       get { throw new InvalidOperationException(); }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/TypeInfo.cs b/mcs/class/IKVM.Reflection/TypeInfo.cs
deleted file mode 100644 (file)
index cd1c1e1..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-  Copyright (C) 2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-
-namespace IKVM.Reflection
-{
-       public interface IReflectableType
-       {
-               TypeInfo GetTypeInfo();
-       }
-
-       public static class IntrospectionExtensions
-       {
-               // we target .NET 2.0 so we can't define an extension method
-               public static TypeInfo GetTypeInfo(/*this*/ Type type)
-               {
-                       return type.GetTypeInfo();
-               }
-       }
-
-       public abstract class TypeInfo : Type, IReflectableType
-       {
-               private const BindingFlags Flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-               internal TypeInfo()
-               {
-               }
-
-               internal TypeInfo(Type underlyingType)
-                       : base(underlyingType)
-               {
-               }
-
-               public IEnumerable<ConstructorInfo> DeclaredConstructors
-               {
-                       get { return GetConstructors(Flags); }
-               }
-
-               public IEnumerable<EventInfo> DeclaredEvents
-               {
-                       get { return GetEvents(Flags); }
-               }
-
-               public IEnumerable<FieldInfo> DeclaredFields
-               {
-                       get { return GetFields(Flags); }
-               }
-
-               public IEnumerable<MemberInfo> DeclaredMembers
-               {
-                       get { return GetMembers(Flags); }
-               }
-
-               public IEnumerable<MethodInfo> DeclaredMethods
-               {
-                       get { return GetMethods(Flags); }
-               }
-
-               public IEnumerable<TypeInfo> DeclaredNestedTypes
-               {
-                       get
-                       {
-                               Type[] types = GetNestedTypes(Flags);
-                               TypeInfo[] typeInfos = new TypeInfo[types.Length];
-                               for (int i = 0; i < types.Length; i++)
-                               {
-                                       typeInfos[i] = types[i].GetTypeInfo();
-                               }
-                               return typeInfos;
-                       }
-               }
-
-               public IEnumerable<PropertyInfo> DeclaredProperties
-               {
-                       get { return GetProperties(Flags); }
-               }
-
-               public Type[] GenericTypeParameters
-               {
-                       get { return IsGenericTypeDefinition ? GetGenericArguments() : Type.EmptyTypes; }
-               }
-
-               public IEnumerable<Type> ImplementedInterfaces
-               {
-                       get { return __GetDeclaredInterfaces(); }
-               }
-
-               public Type AsType()
-               {
-                       return this;
-               }
-
-               public EventInfo GetDeclaredEvent(string name)
-               {
-                       return GetEvent(name, Flags);
-               }
-
-               public FieldInfo GetDeclaredField(string name)
-               {
-                       return GetField(name, Flags);
-               }
-
-               public MethodInfo GetDeclaredMethod(string name)
-               {
-                       return GetMethod(name, Flags);
-               }
-
-               public IEnumerable<MethodInfo> GetDeclaredMethods(string name)
-               {
-                       List<MethodInfo> methods = new List<MethodInfo>();
-                       foreach (MethodInfo method in GetMethods(Flags))
-                       {
-                               if (method.Name == name)
-                               {
-                                       methods.Add(method);
-                               }
-                       }
-                       return methods;
-               }
-
-               public TypeInfo GetDeclaredNestedType(string name)
-               {
-                       return GetNestedType(name, Flags).GetTypeInfo();
-               }
-
-               public PropertyInfo GetDeclaredProperty(string name)
-               {
-                       return GetProperty(name, Flags);
-               }
-
-               public bool IsAssignableFrom(TypeInfo typeInfo)
-               {
-                       return base.IsAssignableFrom(typeInfo);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/TypeNameParser.cs b/mcs/class/IKVM.Reflection/TypeNameParser.cs
deleted file mode 100644 (file)
index 781fe1b..0000000
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-
-namespace IKVM.Reflection
-{
-       // this respresents a type name as in metadata:
-       // - ns will be null for empty the namespace (never the empty string)
-       // - the strings are not escaped
-       struct TypeName : IEquatable<TypeName>
-       {
-               private readonly string ns;
-               private readonly string name;
-
-               internal TypeName(string ns, string name)
-               {
-                       if (name == null)
-                       {
-                               throw new ArgumentNullException("name");
-                       }
-                       this.ns = ns;
-                       this.name = name;
-               }
-
-               internal string Name
-               {
-                       get { return name; }
-               }
-
-               internal string Namespace
-               {
-                       get { return ns; }
-               }
-
-               public static bool operator ==(TypeName o1, TypeName o2)
-               {
-                       return o1.ns == o2.ns && o1.name == o2.name;
-               }
-
-               public static bool operator !=(TypeName o1, TypeName o2)
-               {
-                       return o1.ns != o2.ns || o1.name != o2.name;
-               }
-
-               public override int GetHashCode()
-               {
-                       return ns == null ? name.GetHashCode() : ns.GetHashCode() * 37 + name.GetHashCode();
-               }
-
-               public override bool Equals(object obj)
-               {
-                       TypeName? other = obj as TypeName?;
-                       return other != null && other.Value == this;
-               }
-
-               public override string ToString()
-               {
-                       return ns == null ? name : ns + "." + name;
-               }
-
-               bool IEquatable<TypeName>.Equals(TypeName other)
-               {
-                       return this == other;
-               }
-
-               internal TypeName ToLowerInvariant()
-               {
-                       return new TypeName(ns == null ? null : ns.ToLowerInvariant(), name.ToLowerInvariant());
-               }
-
-               internal static TypeName Split(string name)
-               {
-                       int dot = name.LastIndexOf('.');
-                       if (dot == -1)
-                       {
-                               return new TypeName(null, name);
-                       }
-                       else
-                       {
-                               return new TypeName(name.Substring(0, dot), name.Substring(dot + 1));
-                       }
-               }
-       }
-
-       struct TypeNameParser
-       {
-               private const string SpecialChars = "\\+,[]*&";
-               private const short SZARRAY = -1;
-               private const short BYREF = -2;
-               private const short POINTER = -3;
-               private readonly string name;
-               private readonly string[] nested;
-               private readonly string assemblyName;
-               private readonly short[] modifiers;
-               private readonly TypeNameParser[] genericParameters;
-
-               internal static string Escape(string name)
-               {
-                       if (name == null)
-                       {
-                               return null;
-                       }
-                       StringBuilder sb = null;
-                       for (int pos = 0; pos < name.Length; pos++)
-                       {
-                               char c = name[pos];
-                               switch (c)
-                               {
-                                       case '\\':
-                                       case '+':
-                                       case ',':
-                                       case '[':
-                                       case ']':
-                                       case '*':
-                                       case '&':
-                                               if (sb == null)
-                                               {
-                                                       sb = new StringBuilder(name, 0, pos, name.Length + 3);
-                                               }
-                                               sb.Append("\\").Append(c);
-                                               break;
-                                       default:
-                                               if (sb != null)
-                                               {
-                                                       sb.Append(c);
-                                               }
-                                               break;
-                               }
-                       }
-                       return sb != null ? sb.ToString() : name;
-               }
-
-               internal static string Unescape(string name)
-               {
-                       int pos = name.IndexOf('\\');
-                       if (pos == -1)
-                       {
-                               return name;
-                       }
-                       StringBuilder sb = new StringBuilder(name, 0, pos, name.Length - 1);
-                       for (; pos < name.Length; pos++)
-                       {
-                               char c = name[pos];
-                               if (c == '\\')
-                               {
-                                       c = name[++pos];
-                               }
-                               sb.Append(c);
-                       }
-                       return sb.ToString();
-               }
-
-               internal static TypeNameParser Parse(string typeName, bool throwOnError)
-               {
-                       if (throwOnError)
-                       {
-                               Parser parser = new Parser(typeName);
-                               return new TypeNameParser(ref parser, true);
-                       }
-                       else
-                       {
-                               try
-                               {
-                                       Parser parser = new Parser(typeName);
-                                       return new TypeNameParser(ref parser, true);
-                               }
-                               catch (ArgumentException)
-                               {
-                                       return new TypeNameParser();
-                               }
-                       }
-               }
-
-               private TypeNameParser(ref Parser parser, bool withAssemblyName)
-               {
-                       bool genericParameter = parser.pos != 0;
-                       name = parser.NextNamePart();
-                       nested = null;
-                       parser.ParseNested(ref nested);
-                       genericParameters = null;
-                       parser.ParseGenericParameters(ref genericParameters);
-                       modifiers = null;
-                       parser.ParseModifiers(ref modifiers);
-                       assemblyName = null;
-                       if (withAssemblyName)
-                       {
-                               parser.ParseAssemblyName(genericParameter, ref assemblyName);
-                       }
-               }
-
-               internal bool Error
-               {
-                       get { return name == null; }
-               }
-
-               internal string FirstNamePart
-               {
-                       get { return name; }
-               }
-
-               internal string AssemblyName
-               {
-                       get { return assemblyName; }
-               }
-
-               private struct Parser
-               {
-                       private readonly string typeName;
-                       internal int pos;
-
-                       internal Parser(string typeName)
-                       {
-                               this.typeName = typeName;
-                               this.pos = 0;
-                       }
-
-                       private void Check(bool condition)
-                       {
-                               if (!condition)
-                               {
-                                       throw new ArgumentException("Invalid type name '" + typeName + "'");
-                               }
-                       }
-
-                       private void Consume(char c)
-                       {
-                               Check(pos < typeName.Length && typeName[pos++] == c);
-                       }
-
-                       private bool TryConsume(char c)
-                       {
-                               if (pos < typeName.Length && typeName[pos] == c)
-                               {
-                                       pos++;
-                                       return true;
-                               }
-                               else
-                               {
-                                       return false;
-                               }
-                       }
-
-                       internal string NextNamePart()
-                       {
-                               SkipWhiteSpace();
-                               int start = pos;
-                               for (; pos < typeName.Length; pos++)
-                               {
-                                       char c = typeName[pos];
-                                       if (c == '\\')
-                                       {
-                                               pos++;
-                                               Check(pos < typeName.Length && SpecialChars.IndexOf(typeName[pos]) != -1);
-                                       }
-                                       else if (SpecialChars.IndexOf(c) != -1)
-                                       {
-                                               break;
-                                       }
-                               }
-                               Check(pos - start != 0);
-                               if (start == 0 && pos == typeName.Length)
-                               {
-                                       return typeName;
-                               }
-                               else
-                               {
-                                       return typeName.Substring(start, pos - start);
-                               }
-                       }
-
-                       internal void ParseNested(ref string[] nested)
-                       {
-                               while (TryConsume('+'))
-                               {
-                                       Add(ref nested, NextNamePart());
-                               }
-                       }
-
-                       internal void ParseGenericParameters(ref TypeNameParser[] genericParameters)
-                       {
-                               int saved = pos;
-                               if (TryConsume('['))
-                               {
-                                       SkipWhiteSpace();
-                                       if (TryConsume(']') || TryConsume('*') || TryConsume(','))
-                                       {
-                                               // it's not a generic parameter list, but an array instead
-                                               pos = saved;
-                                               return;
-                                       }
-                                       do
-                                       {
-                                               SkipWhiteSpace();
-                                               if (TryConsume('['))
-                                               {
-                                                       Add(ref genericParameters, new TypeNameParser(ref this, true));
-                                                       Consume(']');
-                                               }
-                                               else
-                                               {
-                                                       Add(ref genericParameters, new TypeNameParser(ref this, false));
-                                               }
-                                       }
-                                       while (TryConsume(','));
-                                       Consume(']');
-                                       SkipWhiteSpace();
-                               }
-                       }
-
-                       internal void ParseModifiers(ref short[] modifiers)
-                       {
-                               while (pos < typeName.Length)
-                               {
-                                       switch (typeName[pos])
-                                       {
-                                               case '*':
-                                                       pos++;
-                                                       Add(ref modifiers, POINTER);
-                                                       break;
-                                               case '&':
-                                                       pos++;
-                                                       Add(ref modifiers, BYREF);
-                                                       break;
-                                               case '[':
-                                                       pos++;
-                                                       Add(ref modifiers, ParseArray());
-                                                       Consume(']');
-                                                       break;
-                                               default:
-                                                       return;
-                                       }
-                                       SkipWhiteSpace();
-                               }
-                       }
-
-                       internal void ParseAssemblyName(bool genericParameter, ref string assemblyName)
-                       {
-                               if (pos < typeName.Length)
-                               {
-                                       if (typeName[pos] == ']' && genericParameter)
-                                       {
-                                               // ok
-                                       }
-                                       else
-                                       {
-                                               Consume(',');
-                                               SkipWhiteSpace();
-                                               if (genericParameter)
-                                               {
-                                                       int start = pos;
-                                                       while (pos < typeName.Length)
-                                                       {
-                                                               char c = typeName[pos];
-                                                               if (c == '\\')
-                                                               {
-                                                                       pos++;
-                                                                       // a backslash itself is not legal in an assembly name, so we don't need to check for an escaped backslash
-                                                                       Check(pos < typeName.Length && typeName[pos++] == ']');
-                                                               }
-                                                               else if (c == ']')
-                                                               {
-                                                                       break;
-                                                               }
-                                                               else
-                                                               {
-                                                                       pos++;
-                                                               }
-                                                       }
-                                                       Check(pos < typeName.Length && typeName[pos] == ']');
-                                                       assemblyName = typeName.Substring(start, pos - start).Replace("\\]", "]");
-                                               }
-                                               else
-                                               {
-                                                       // only when an assembly name is used in a generic type parameter, will it be escaped
-                                                       assemblyName = typeName.Substring(pos);
-                                               }
-                                               Check(assemblyName.Length != 0);
-                                       }
-                               }
-                               else
-                               {
-                                       Check(!genericParameter);
-                               }
-                       }
-
-                       private short ParseArray()
-                       {
-                               SkipWhiteSpace();
-                               Check(pos < typeName.Length);
-                               char c = typeName[pos];
-                               if (c == ']')
-                               {
-                                       return SZARRAY;
-                               }
-                               else if (c == '*')
-                               {
-                                       pos++;
-                                       SkipWhiteSpace();
-                                       return 1;
-                               }
-                               else
-                               {
-                                       short rank = 1;
-                                       while (TryConsume(','))
-                                       {
-                                               Check(rank < short.MaxValue);
-                                               rank++;
-                                               SkipWhiteSpace();
-                                       }
-                                       return rank;
-                               }
-                       }
-
-                       private void SkipWhiteSpace()
-                       {
-                               while (pos < typeName.Length && Char.IsWhiteSpace(typeName[pos]))
-                               {
-                                       pos++;
-                               }
-                       }
-
-                       private static void Add<T>(ref T[] array, T elem)
-                       {
-                               if (array == null)
-                               {
-                                       array = new T[] { elem };
-                                       return;
-                               }
-                               Array.Resize(ref array, array.Length + 1);
-                               array[array.Length - 1] = elem;
-                       }
-               }
-
-               internal Type GetType(Universe universe, Assembly context, bool throwOnError, string originalName, bool resolve, bool ignoreCase)
-               {
-                       Debug.Assert(!resolve || !ignoreCase);
-                       TypeName name = TypeName.Split(this.name);
-                       Type type;
-                       if (assemblyName != null)
-                       {
-                               Assembly asm = universe.Load(assemblyName, context, throwOnError);
-                               if (asm == null)
-                               {
-                                       return null;
-                               }
-                               if (resolve)
-                               {
-                                       type = asm.ResolveType(name);
-                               }
-                               else if (ignoreCase)
-                               {
-                                       type = asm.FindTypeIgnoreCase(name.ToLowerInvariant());
-                               }
-                               else
-                               {
-                                       type = asm.FindType(name);
-                               }
-                       }
-                       else if (context == null)
-                       {
-                               if (resolve)
-                               {
-                                       type = universe.Mscorlib.ResolveType(name);
-                               }
-                               else if (ignoreCase)
-                               {
-                                       type = universe.Mscorlib.FindTypeIgnoreCase(name.ToLowerInvariant());
-                               }
-                               else
-                               {
-                                       type = universe.Mscorlib.FindType(name);
-                               }
-                       }
-                       else
-                       {
-                               if (ignoreCase)
-                               {
-                                       name = name.ToLowerInvariant();
-                                       type = context.FindTypeIgnoreCase(name);
-                               }
-                               else
-                               {
-                                       type = context.FindType(name);
-                               }
-                               if (type == null && context != universe.Mscorlib)
-                               {
-                                       if (ignoreCase)
-                                       {
-                                               type = universe.Mscorlib.FindTypeIgnoreCase(name);
-                                       }
-                                       else
-                                       {
-                                               type = universe.Mscorlib.FindType(name);
-                                       }
-                               }
-                               if (type == null && resolve)
-                               {
-                                       if (universe.Mscorlib.__IsMissing && !context.__IsMissing)
-                                       {
-                                               type = universe.Mscorlib.ResolveType(name);
-                                       }
-                                       else
-                                       {
-                                               type = context.ResolveType(name);
-                                       }
-                               }
-                       }
-                       return Expand(type, context, throwOnError, originalName, resolve, ignoreCase);
-               }
-
-               internal Type Expand(Type type, Assembly context, bool throwOnError, string originalName, bool resolve, bool ignoreCase)
-               {
-                       Debug.Assert(!resolve || !ignoreCase);
-                       if (type == null)
-                       {
-                               if (throwOnError)
-                               {
-                                       throw new TypeLoadException(originalName);
-                               }
-                               return null;
-                       }
-                       if (nested != null)
-                       {
-                               Type outer;
-                               foreach (string nest in nested)
-                               {
-                                       outer = type;
-                                       TypeName name = TypeName.Split(TypeNameParser.Unescape(nest));
-                                       type = ignoreCase
-                                               ? outer.FindNestedTypeIgnoreCase(name.ToLowerInvariant())
-                                               : outer.FindNestedType(name);
-                                       if (type == null)
-                                       {
-                                               if (resolve)
-                                               {
-                                                       type = outer.Module.universe.GetMissingTypeOrThrow(outer.Module, outer, name);
-                                               }
-                                               else if (throwOnError)
-                                               {
-                                                       throw new TypeLoadException(originalName);
-                                               }
-                                               else
-                                               {
-                                                       return null;
-                                               }
-                                       }
-                               }
-                       }
-                       if (genericParameters != null)
-                       {
-                               Type[] typeArgs = new Type[genericParameters.Length];
-                               for (int i = 0; i < typeArgs.Length; i++)
-                               {
-                                       typeArgs[i] = genericParameters[i].GetType(type.Assembly.universe, context, throwOnError, originalName, resolve, ignoreCase);
-                                       if (typeArgs[i] == null)
-                                       {
-                                               return null;
-                                       }
-                               }
-                               type = type.MakeGenericType(typeArgs);
-                       }
-                       if (modifiers != null)
-                       {
-                               foreach (short modifier in modifiers)
-                               {
-                                       switch (modifier)
-                                       {
-                                               case SZARRAY:
-                                                       type = type.MakeArrayType();
-                                                       break;
-                                               case BYREF:
-                                                       type = type.MakeByRefType();
-                                                       break;
-                                               case POINTER:
-                                                       type = type.MakePointerType();
-                                                       break;
-                                               default:
-                                                       type = type.MakeArrayType(modifier);
-                                                       break;
-                                       }
-                               }
-                       }
-                       return type;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Universe.cs b/mcs/class/IKVM.Reflection/Universe.cs
deleted file mode 100644 (file)
index 4999d3b..0000000
+++ /dev/null
@@ -1,1092 +0,0 @@
-/*
-  Copyright (C) 2009-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Security;
-using System.Text;
-using System.Diagnostics;
-using IKVM.Reflection.Reader;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection
-{
-       public sealed class ResolveEventArgs : EventArgs
-       {
-               private readonly string name;
-               private readonly Assembly requestingAssembly;
-
-               public ResolveEventArgs(string name)
-                       : this(name, null)
-               {
-               }
-
-               public ResolveEventArgs(string name, Assembly requestingAssembly)
-               {
-                       this.name = name;
-                       this.requestingAssembly = requestingAssembly;
-               }
-
-               public string Name
-               {
-                       get { return name; }
-               }
-
-               public Assembly RequestingAssembly
-               {
-                       get { return requestingAssembly; }
-               }
-       }
-
-       public enum AssemblyComparisonResult
-       {
-               Unknown = 0,
-               EquivalentFullMatch = 1,
-               EquivalentWeakNamed = 2,
-               EquivalentFXUnified = 3,
-               EquivalentUnified = 4,
-               NonEquivalentVersion = 5,
-               NonEquivalent = 6,
-               EquivalentPartialMatch = 7,
-               EquivalentPartialWeakNamed = 8,
-               EquivalentPartialUnified = 9,
-               EquivalentPartialFXUnified = 10,
-               NonEquivalentPartialVersion = 11,
-       }
-
-       public delegate Assembly ResolveEventHandler(object sender, ResolveEventArgs args);
-
-       [Flags]
-       public enum UniverseOptions
-       {
-               None = 0,
-               EnableFunctionPointers = 1,
-               DisableFusion = 2,
-               DisablePseudoCustomAttributeRetrieval = 4,
-       }
-
-       public sealed class Universe : IDisposable
-       {
-               internal static readonly bool MonoRuntime = System.Type.GetType("Mono.Runtime") != null;
-               private readonly Dictionary<Type, Type> canonicalizedTypes = new Dictionary<Type, Type>();
-               private readonly List<AssemblyReader> assemblies = new List<AssemblyReader>();
-               private readonly List<AssemblyBuilder> dynamicAssemblies = new List<AssemblyBuilder>();
-               private readonly Dictionary<string, Assembly> assembliesByName = new Dictionary<string, Assembly>();
-               private readonly Dictionary<System.Type, Type> importedTypes = new Dictionary<System.Type, Type>();
-               private Dictionary<ScopedTypeName, Type> missingTypes;
-               private bool resolveMissingMembers;
-               private readonly bool enableFunctionPointers;
-               private readonly bool useNativeFusion;
-               private readonly bool returnPseudoCustomAttributes;
-               private Type typeof_System_Object;
-               private Type typeof_System_ValueType;
-               private Type typeof_System_Enum;
-               private Type typeof_System_Void;
-               private Type typeof_System_Boolean;
-               private Type typeof_System_Char;
-               private Type typeof_System_SByte;
-               private Type typeof_System_Byte;
-               private Type typeof_System_Int16;
-               private Type typeof_System_UInt16;
-               private Type typeof_System_Int32;
-               private Type typeof_System_UInt32;
-               private Type typeof_System_Int64;
-               private Type typeof_System_UInt64;
-               private Type typeof_System_Single;
-               private Type typeof_System_Double;
-               private Type typeof_System_String;
-               private Type typeof_System_IntPtr;
-               private Type typeof_System_UIntPtr;
-               private Type typeof_System_TypedReference;
-               private Type typeof_System_Type;
-               private Type typeof_System_Array;
-               private Type typeof_System_DateTime;
-               private Type typeof_System_DBNull;
-               private Type typeof_System_Decimal;
-               private Type typeof_System_NonSerializedAttribute;
-               private Type typeof_System_SerializableAttribute;
-               private Type typeof_System_AttributeUsageAttribute;
-               private Type typeof_System_Runtime_InteropServices_DllImportAttribute;
-               private Type typeof_System_Runtime_InteropServices_FieldOffsetAttribute;
-               private Type typeof_System_Runtime_InteropServices_InAttribute;
-               private Type typeof_System_Runtime_InteropServices_MarshalAsAttribute;
-               private Type typeof_System_Runtime_InteropServices_UnmanagedType;
-               private Type typeof_System_Runtime_InteropServices_VarEnum;
-               private Type typeof_System_Runtime_InteropServices_OutAttribute;
-               private Type typeof_System_Runtime_InteropServices_StructLayoutAttribute;
-               private Type typeof_System_Runtime_InteropServices_OptionalAttribute;
-               private Type typeof_System_Runtime_InteropServices_PreserveSigAttribute;
-               private Type typeof_System_Runtime_InteropServices_CallingConvention;
-               private Type typeof_System_Runtime_InteropServices_CharSet;
-               private Type typeof_System_Runtime_InteropServices_ComImportAttribute;
-               private Type typeof_System_Runtime_CompilerServices_DecimalConstantAttribute;
-               private Type typeof_System_Runtime_CompilerServices_SpecialNameAttribute;
-               private Type typeof_System_Runtime_CompilerServices_MethodImplAttribute;
-               private Type typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute;
-               private Type typeof_System_Reflection_AssemblyCopyrightAttribute;
-               private Type typeof_System_Reflection_AssemblyTrademarkAttribute;
-               private Type typeof_System_Reflection_AssemblyProductAttribute;
-               private Type typeof_System_Reflection_AssemblyCompanyAttribute;
-               private Type typeof_System_Reflection_AssemblyDescriptionAttribute;
-               private Type typeof_System_Reflection_AssemblyTitleAttribute;
-               private Type typeof_System_Reflection_AssemblyInformationalVersionAttribute;
-               private Type typeof_System_Reflection_AssemblyFileVersionAttribute;
-               private Type typeof_System_Security_Permissions_CodeAccessSecurityAttribute;
-               private Type typeof_System_Security_Permissions_PermissionSetAttribute;
-               private Type typeof_System_Security_Permissions_SecurityAction;
-               private List<ResolveEventHandler> resolvers = new List<ResolveEventHandler>();
-               private Predicate<Type> missingTypeIsValueType;
-
-               public Universe()
-                       : this(UniverseOptions.None)
-               {
-               }
-
-               public Universe(UniverseOptions options)
-               {
-                       enableFunctionPointers = (options & UniverseOptions.EnableFunctionPointers) != 0;
-                       useNativeFusion = (options & UniverseOptions.DisableFusion) == 0 && GetUseNativeFusion();
-                       returnPseudoCustomAttributes = (options & UniverseOptions.DisablePseudoCustomAttributeRetrieval) == 0;
-               }
-
-               private static bool GetUseNativeFusion()
-               {
-                       try
-                       {
-                               return Environment.OSVersion.Platform == PlatformID.Win32NT
-                                       && !MonoRuntime
-                                       && Environment.GetEnvironmentVariable("IKVM_DISABLE_FUSION") == null;
-                       }
-                       catch (System.Security.SecurityException)
-                       {
-                               return false;
-                       }
-               }
-
-               internal Assembly Mscorlib
-               {
-                       get { return Load("mscorlib"); }
-               }
-
-               private Type ImportMscorlibType(System.Type type)
-               {
-                       if (Mscorlib.__IsMissing)
-                       {
-                               return Mscorlib.ResolveType(new TypeName(type.Namespace, type.Name));
-                       }
-                       // We use FindType instead of ResolveType here, because on some versions of mscorlib some of
-                       // the special types we use/support are missing and the type properties are defined to
-                       // return null in that case.
-                       // Note that we don't have to unescape type.Name here, because none of the names contain special characters.
-                       return Mscorlib.FindType(new TypeName(type.Namespace, type.Name));
-               }
-
-               private Type ResolvePrimitive(string name)
-               {
-                       // Primitive here means that these types have a special metadata encoding, which means that
-                       // there can be references to them without referring to them by name explicitly.
-                       // We want these types to be usable even when they don't exist in mscorlib or there is no mscorlib loaded.
-                       return Mscorlib.FindType(new TypeName("System", name)) ?? GetMissingType(Mscorlib.ManifestModule, null, new TypeName("System", name));
-               }
-
-               internal Type System_Object
-               {
-                       get { return typeof_System_Object ?? (typeof_System_Object = ResolvePrimitive("Object")); }
-               }
-
-               internal Type System_ValueType
-               {
-                       // System.ValueType is not a primitive, but generic type parameters can have a ValueType constraint
-                       // (we also don't want to return null here)
-                       get { return typeof_System_ValueType ?? (typeof_System_ValueType = ResolvePrimitive("ValueType")); }
-               }
-
-               internal Type System_Enum
-               {
-                       // System.Enum is not a primitive, but we don't want to return null
-                       get { return typeof_System_Enum ?? (typeof_System_Enum = ResolvePrimitive("Enum")); }
-               }
-
-               internal Type System_Void
-               {
-                       get { return typeof_System_Void ?? (typeof_System_Void = ResolvePrimitive("Void")); }
-               }
-
-               internal Type System_Boolean
-               {
-                       get { return typeof_System_Boolean ?? (typeof_System_Boolean = ResolvePrimitive("Boolean")); }
-               }
-
-               internal Type System_Char
-               {
-                       get { return typeof_System_Char ?? (typeof_System_Char = ResolvePrimitive("Char")); }
-               }
-
-               internal Type System_SByte
-               {
-                       get { return typeof_System_SByte ?? (typeof_System_SByte = ResolvePrimitive("SByte")); }
-               }
-
-               internal Type System_Byte
-               {
-                       get { return typeof_System_Byte ?? (typeof_System_Byte = ResolvePrimitive("Byte")); }
-               }
-
-               internal Type System_Int16
-               {
-                       get { return typeof_System_Int16 ?? (typeof_System_Int16 = ResolvePrimitive("Int16")); }
-               }
-
-               internal Type System_UInt16
-               {
-                       get { return typeof_System_UInt16 ?? (typeof_System_UInt16 = ResolvePrimitive("UInt16")); }
-               }
-
-               internal Type System_Int32
-               {
-                       get { return typeof_System_Int32 ?? (typeof_System_Int32 = ResolvePrimitive("Int32")); }
-               }
-
-               internal Type System_UInt32
-               {
-                       get { return typeof_System_UInt32 ?? (typeof_System_UInt32 = ResolvePrimitive("UInt32")); }
-               }
-
-               internal Type System_Int64
-               {
-                       get { return typeof_System_Int64 ?? (typeof_System_Int64 = ResolvePrimitive("Int64")); }
-               }
-
-               internal Type System_UInt64
-               {
-                       get { return typeof_System_UInt64 ?? (typeof_System_UInt64 = ResolvePrimitive("UInt64")); }
-               }
-
-               internal Type System_Single
-               {
-                       get { return typeof_System_Single ?? (typeof_System_Single = ResolvePrimitive("Single")); }
-               }
-
-               internal Type System_Double
-               {
-                       get { return typeof_System_Double ?? (typeof_System_Double = ResolvePrimitive("Double")); }
-               }
-
-               internal Type System_String
-               {
-                       get { return typeof_System_String ?? (typeof_System_String = ResolvePrimitive("String")); }
-               }
-
-               internal Type System_IntPtr
-               {
-                       get { return typeof_System_IntPtr ?? (typeof_System_IntPtr = ResolvePrimitive("IntPtr")); }
-               }
-
-               internal Type System_UIntPtr
-               {
-                       get { return typeof_System_UIntPtr ?? (typeof_System_UIntPtr = ResolvePrimitive("UIntPtr")); }
-               }
-
-               internal Type System_TypedReference
-               {
-                       get { return typeof_System_TypedReference ?? (typeof_System_TypedReference = ResolvePrimitive("TypedReference")); }
-               }
-
-               internal Type System_Type
-               {
-                       // System.Type is not a primitive, but it does have a special encoding in custom attributes
-                       get { return typeof_System_Type ?? (typeof_System_Type = ResolvePrimitive("Type")); }
-               }
-
-               internal Type System_Array
-               {
-                       // System.Array is not a primitive, but it used as a base type for array types (that are primitives)
-                       get { return typeof_System_Array ?? (typeof_System_Array = ResolvePrimitive("Array")); }
-               }
-
-               internal Type System_DateTime
-               {
-                       get { return typeof_System_DateTime ?? (typeof_System_DateTime = ImportMscorlibType(typeof(System.DateTime))); }
-               }
-
-               internal Type System_DBNull
-               {
-                       get { return typeof_System_DBNull ?? (typeof_System_DBNull = ImportMscorlibType(typeof(System.DBNull))); }
-               }
-
-               internal Type System_Decimal
-               {
-                       get { return typeof_System_Decimal ?? (typeof_System_Decimal = ImportMscorlibType(typeof(System.Decimal))); }
-               }
-
-               internal Type System_NonSerializedAttribute
-               {
-                       get { return typeof_System_NonSerializedAttribute ?? (typeof_System_NonSerializedAttribute = ImportMscorlibType(typeof(System.NonSerializedAttribute))); }
-               }
-
-               internal Type System_SerializableAttribute
-               {
-                       get { return typeof_System_SerializableAttribute ?? (typeof_System_SerializableAttribute = ImportMscorlibType(typeof(System.SerializableAttribute))); }
-               }
-
-               internal Type System_AttributeUsageAttribute
-               {
-                       get { return typeof_System_AttributeUsageAttribute ?? (typeof_System_AttributeUsageAttribute = ImportMscorlibType(typeof(System.AttributeUsageAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_DllImportAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_DllImportAttribute ?? (typeof_System_Runtime_InteropServices_DllImportAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.DllImportAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_FieldOffsetAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_FieldOffsetAttribute ?? (typeof_System_Runtime_InteropServices_FieldOffsetAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.FieldOffsetAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_InAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_InAttribute ?? (typeof_System_Runtime_InteropServices_InAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.InAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_MarshalAsAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_MarshalAsAttribute ?? (typeof_System_Runtime_InteropServices_MarshalAsAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.MarshalAsAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_UnmanagedType
-               {
-                       get { return typeof_System_Runtime_InteropServices_UnmanagedType ?? (typeof_System_Runtime_InteropServices_UnmanagedType = ImportMscorlibType(typeof(System.Runtime.InteropServices.UnmanagedType))); }
-               }
-
-               internal Type System_Runtime_InteropServices_VarEnum
-               {
-                       get { return typeof_System_Runtime_InteropServices_VarEnum ?? (typeof_System_Runtime_InteropServices_VarEnum = ImportMscorlibType(typeof(System.Runtime.InteropServices.VarEnum))); }
-               }
-
-               internal Type System_Runtime_InteropServices_OutAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_OutAttribute ?? (typeof_System_Runtime_InteropServices_OutAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.OutAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_StructLayoutAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_StructLayoutAttribute ?? (typeof_System_Runtime_InteropServices_StructLayoutAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.StructLayoutAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_OptionalAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_OptionalAttribute ?? (typeof_System_Runtime_InteropServices_OptionalAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.OptionalAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_PreserveSigAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_PreserveSigAttribute ?? (typeof_System_Runtime_InteropServices_PreserveSigAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.PreserveSigAttribute))); }
-               }
-
-               internal Type System_Runtime_InteropServices_CallingConvention
-               {
-                       get { return typeof_System_Runtime_InteropServices_CallingConvention ?? (typeof_System_Runtime_InteropServices_CallingConvention = ImportMscorlibType(typeof(System.Runtime.InteropServices.CallingConvention))); }
-               }
-
-               internal Type System_Runtime_InteropServices_CharSet
-               {
-                       get { return typeof_System_Runtime_InteropServices_CharSet ?? (typeof_System_Runtime_InteropServices_CharSet = ImportMscorlibType(typeof(System.Runtime.InteropServices.CharSet))); }
-               }
-
-               internal Type System_Runtime_InteropServices_ComImportAttribute
-               {
-                       get { return typeof_System_Runtime_InteropServices_ComImportAttribute ?? (typeof_System_Runtime_InteropServices_ComImportAttribute = ImportMscorlibType(typeof(System.Runtime.InteropServices.ComImportAttribute))); }
-               }
-
-               internal Type System_Runtime_CompilerServices_DecimalConstantAttribute
-               {
-                       get { return typeof_System_Runtime_CompilerServices_DecimalConstantAttribute ?? (typeof_System_Runtime_CompilerServices_DecimalConstantAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.DecimalConstantAttribute))); }
-               }
-
-               internal Type System_Runtime_CompilerServices_SpecialNameAttribute
-               {
-                       get { return typeof_System_Runtime_CompilerServices_SpecialNameAttribute ?? (typeof_System_Runtime_CompilerServices_SpecialNameAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.SpecialNameAttribute))); }
-               }
-
-               internal Type System_Runtime_CompilerServices_MethodImplAttribute
-               {
-                       get { return typeof_System_Runtime_CompilerServices_MethodImplAttribute ?? (typeof_System_Runtime_CompilerServices_MethodImplAttribute = ImportMscorlibType(typeof(System.Runtime.CompilerServices.MethodImplAttribute))); }
-               }
-
-               internal Type System_Security_SuppressUnmanagedCodeSecurityAttribute
-               {
-                       get { return typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute ?? (typeof_System_Security_SuppressUnmanagedCodeSecurityAttribute = ImportMscorlibType(typeof(System.Security.SuppressUnmanagedCodeSecurityAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyCopyrightAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyCopyrightAttribute ?? (typeof_System_Reflection_AssemblyCopyrightAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyCopyrightAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyTrademarkAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyTrademarkAttribute ?? (typeof_System_Reflection_AssemblyTrademarkAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyTrademarkAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyProductAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyProductAttribute ?? (typeof_System_Reflection_AssemblyProductAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyProductAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyCompanyAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyCompanyAttribute ?? (typeof_System_Reflection_AssemblyCompanyAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyCompanyAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyDescriptionAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyDescriptionAttribute ?? (typeof_System_Reflection_AssemblyDescriptionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyDescriptionAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyTitleAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyTitleAttribute ?? (typeof_System_Reflection_AssemblyTitleAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyTitleAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyInformationalVersionAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyInformationalVersionAttribute ?? (typeof_System_Reflection_AssemblyInformationalVersionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyInformationalVersionAttribute))); }
-               }
-
-               internal Type System_Reflection_AssemblyFileVersionAttribute
-               {
-                       get { return typeof_System_Reflection_AssemblyFileVersionAttribute ?? (typeof_System_Reflection_AssemblyFileVersionAttribute = ImportMscorlibType(typeof(System.Reflection.AssemblyFileVersionAttribute))); }
-               }
-
-               internal Type System_Security_Permissions_CodeAccessSecurityAttribute
-               {
-                       get { return typeof_System_Security_Permissions_CodeAccessSecurityAttribute ?? (typeof_System_Security_Permissions_CodeAccessSecurityAttribute = ImportMscorlibType(typeof(System.Security.Permissions.CodeAccessSecurityAttribute))); }
-               }
-
-               internal Type System_Security_Permissions_PermissionSetAttribute
-               {
-                       get { return typeof_System_Security_Permissions_PermissionSetAttribute ?? (typeof_System_Security_Permissions_PermissionSetAttribute = ImportMscorlibType(typeof(System.Security.Permissions.PermissionSetAttribute))); }
-               }
-
-               internal Type System_Security_Permissions_SecurityAction
-               {
-                       get { return typeof_System_Security_Permissions_SecurityAction ?? (typeof_System_Security_Permissions_SecurityAction = ImportMscorlibType(typeof(System.Security.Permissions.SecurityAction))); }
-               }
-
-               internal bool HasMscorlib
-               {
-                       get { return GetLoadedAssembly("mscorlib") != null; }
-               }
-
-               public event ResolveEventHandler AssemblyResolve
-               {
-                       add { resolvers.Add(value); }
-                       remove { resolvers.Remove(value); }
-               }
-
-               public Type Import(System.Type type)
-               {
-                       Type imported;
-                       if (!importedTypes.TryGetValue(type, out imported))
-                       {
-                               imported = ImportImpl(type);
-                               if (imported != null)
-                               {
-                                       importedTypes.Add(type, imported);
-                               }
-                       }
-                       return imported;
-               }
-
-               private Type ImportImpl(System.Type type)
-               {
-                       if (type.Assembly == typeof(IKVM.Reflection.Type).Assembly)
-                       {
-                               throw new ArgumentException("Did you really want to import " + type.FullName + "?");
-                       }
-                       if (type.HasElementType)
-                       {
-                               if (type.IsArray)
-                               {
-                                       if (type.Name.EndsWith("[]"))
-                                       {
-                                               return Import(type.GetElementType()).MakeArrayType();
-                                       }
-                                       else
-                                       {
-                                               return Import(type.GetElementType()).MakeArrayType(type.GetArrayRank());
-                                       }
-                               }
-                               else if (type.IsByRef)
-                               {
-                                       return Import(type.GetElementType()).MakeByRefType();
-                               }
-                               else if (type.IsPointer)
-                               {
-                                       return Import(type.GetElementType()).MakePointerType();
-                               }
-                               else
-                               {
-                                       throw new InvalidOperationException();
-                               }
-                       }
-                       else if (type.IsGenericParameter)
-                       {
-                               if (type.DeclaringMethod != null)
-                               {
-                                       throw new NotImplementedException();
-                               }
-                               else
-                               {
-                                       return Import(type.DeclaringType).GetGenericArguments()[type.GenericParameterPosition];
-                               }
-                       }
-                       else if (type.IsGenericType && !type.IsGenericTypeDefinition)
-                       {
-                               System.Type[] args = type.GetGenericArguments();
-                               Type[] importedArgs = new Type[args.Length];
-                               for (int i = 0; i < args.Length; i++)
-                               {
-                                       importedArgs[i] = Import(args[i]);
-                               }
-                               return Import(type.GetGenericTypeDefinition()).MakeGenericType(importedArgs);
-                       }
-                       else if (type.IsNested)
-                       {
-                               // note that we can't pass in the namespace here, because .NET's Type.Namespace implementation is broken for nested types
-                               // (it returns the namespace of the declaring type)
-                               return Import(type.DeclaringType).ResolveNestedType(new TypeName(null, type.Name));
-                       }
-                       else if (type.Assembly == typeof(object).Assembly)
-                       {
-                               // make sure mscorlib types always end up in our mscorlib
-                               return Mscorlib.ResolveType(new TypeName(type.Namespace, type.Name));
-                       }
-                       else
-                       {
-                               return Import(type.Assembly).ResolveType(new TypeName(type.Namespace, type.Name));
-                       }
-               }
-
-               private Assembly Import(System.Reflection.Assembly asm)
-               {
-                       return Load(asm.FullName);
-               }
-
-               public RawModule OpenRawModule(string path)
-               {
-                       path = Path.GetFullPath(path);
-                       return OpenRawModule(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read), path);
-               }
-
-               public RawModule OpenRawModule(Stream stream, string location)
-               {
-                       if (!stream.CanRead || !stream.CanSeek || stream.Position != 0)
-                       {
-                               throw new ArgumentException("Stream must support read/seek and current position must be zero.", "stream");
-                       }
-                       return new RawModule(new ModuleReader(null, this, stream, location));
-               }
-
-               public Assembly LoadAssembly(RawModule module)
-               {
-                       string refname = module.GetAssemblyName().FullName;
-                       Assembly asm = GetLoadedAssembly(refname);
-                       if (asm == null)
-                       {
-                               AssemblyReader asm1 = module.ToAssembly();
-                               assemblies.Add(asm1);
-                               asm = asm1;
-                       }
-                       return asm;
-               }
-
-               public Assembly LoadFile(string path)
-               {
-                       try
-                       {
-                               using (RawModule module = OpenRawModule(path))
-                               {
-                                       return LoadAssembly(module);
-                               }
-                       }
-                       catch (IOException x)
-                       {
-                               throw new FileNotFoundException(x.Message, x);
-                       }
-                       catch (UnauthorizedAccessException x)
-                       {
-                               throw new FileNotFoundException(x.Message, x);
-                       }
-               }
-
-               private static string GetSimpleAssemblyName(string refname)
-               {
-                       int pos;
-                       string name;
-                       if (Fusion.ParseAssemblySimpleName(refname, out pos, out name) != ParseAssemblyResult.OK)
-                       {
-                               throw new ArgumentException();
-                       }
-                       return name;
-               }
-
-               private Assembly GetLoadedAssembly(string refname)
-               {
-                       Assembly asm;
-                       if (!assembliesByName.TryGetValue(refname, out asm))
-                       {
-                               string simpleName = GetSimpleAssemblyName(refname);
-                               for (int i = 0; i < assemblies.Count; i++)
-                               {
-                                       AssemblyComparisonResult result;
-                                       if (simpleName.Equals(assemblies[i].Name, StringComparison.InvariantCultureIgnoreCase)
-                                               && CompareAssemblyIdentity(refname, false, assemblies[i].FullName, false, out result))
-                                       {
-                                               asm = assemblies[i];
-                                               assembliesByName.Add(refname, asm);
-                                               break;
-                                       }
-                               }
-                       }
-                       return asm;
-               }
-
-               private Assembly GetDynamicAssembly(string refname)
-               {
-                       string simpleName = GetSimpleAssemblyName(refname);
-                       foreach (AssemblyBuilder asm in dynamicAssemblies)
-                       {
-                               AssemblyComparisonResult result;
-                               if (simpleName.Equals(asm.Name, StringComparison.InvariantCultureIgnoreCase)
-                                       && CompareAssemblyIdentity(refname, false, asm.FullName, false, out result))
-                               {
-                                       return asm;
-                               }
-                       }
-                       return null;
-               }
-
-               public Assembly Load(string refname)
-               {
-                       return Load(refname, null, true);
-               }
-
-               internal Assembly Load(string refname, Assembly requestingAssembly, bool throwOnError)
-               {
-                       Assembly asm = GetLoadedAssembly(refname);
-                       if (asm != null)
-                       {
-                               return asm;
-                       }
-                       if (resolvers.Count == 0)
-                       {
-                               asm = DefaultResolver(refname, throwOnError);
-                       }
-                       else
-                       {
-                               ResolveEventArgs args = new ResolveEventArgs(refname, requestingAssembly);
-                               foreach (ResolveEventHandler evt in resolvers)
-                               {
-                                       asm = evt(this, args);
-                                       if (asm != null)
-                                       {
-                                               break;
-                                       }
-                               }
-                               if (asm == null)
-                               {
-                                       asm = GetDynamicAssembly(refname);
-                               }
-                       }
-                       if (asm != null)
-                       {
-                               string defname = asm.FullName;
-                               if (refname != defname)
-                               {
-                                       assembliesByName.Add(refname, asm);
-                               }
-                               return asm;
-                       }
-                       if (throwOnError)
-                       {
-                               throw new FileNotFoundException(refname);
-                       }
-                       return null;
-               }
-
-               private Assembly DefaultResolver(string refname, bool throwOnError)
-               {
-                       Assembly asm = GetDynamicAssembly(refname);
-                       if (asm != null)
-                       {
-                               return asm;
-                       }
-                       string fileName;
-                       if (throwOnError)
-                       {
-                               try
-                               {
-                                       fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
-                               }
-                               catch (System.BadImageFormatException x)
-                               {
-                                       throw new BadImageFormatException(x.Message, x);
-                               }
-                       }
-                       else
-                       {
-                               try
-                               {
-                                       fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
-                               }
-                               catch (System.BadImageFormatException x)
-                               {
-                                       throw new BadImageFormatException(x.Message, x);
-                               }
-                               catch (FileNotFoundException)
-                               {
-                                       // we intentionally only swallow the FileNotFoundException, if the file exists but isn't a valid assembly,
-                                       // we should throw an exception
-                                       return null;
-                               }
-                       }
-                       return LoadFile(fileName);
-               }
-
-               public Type GetType(string assemblyQualifiedTypeName)
-               {
-                       // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
-                       // import that assembly and pass it as the context, but implicitly importing is considered evil
-                       return GetType(null, assemblyQualifiedTypeName, false, false);
-               }
-
-               public Type GetType(string assemblyQualifiedTypeName, bool throwOnError)
-               {
-                       // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
-                       // import that assembly and pass it as the context, but implicitly importing is considered evil
-                       return GetType(null, assemblyQualifiedTypeName, throwOnError, false);
-               }
-
-               public Type GetType(string assemblyQualifiedTypeName, bool throwOnError, bool ignoreCase)
-               {
-                       // to be more compatible with Type.GetType(), we could call Assembly.GetCallingAssembly(),
-                       // import that assembly and pass it as the context, but implicitly importing is considered evil
-                       return GetType(null, assemblyQualifiedTypeName, throwOnError, ignoreCase);
-               }
-
-               // note that context is slightly different from the calling assembly (System.Type.GetType),
-               // because context is passed to the AssemblyResolve event as the RequestingAssembly
-               public Type GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError)
-               {
-                       return GetType(context, assemblyQualifiedTypeName, throwOnError, false);
-               }
-
-               // note that context is slightly different from the calling assembly (System.Type.GetType),
-               // because context is passed to the AssemblyResolve event as the RequestingAssembly
-               public Type GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError, bool ignoreCase)
-               {
-                       TypeNameParser parser = TypeNameParser.Parse(assemblyQualifiedTypeName, throwOnError);
-                       if (parser.Error)
-                       {
-                               return null;
-                       }
-                       return parser.GetType(this, context, throwOnError, assemblyQualifiedTypeName, false, ignoreCase);
-               }
-
-               // this is similar to GetType(Assembly context, string assemblyQualifiedTypeName, bool throwOnError),
-               // but instead it assumes that the type must exist (i.e. if EnableMissingMemberResolution is enabled
-               // it will create a missing type)
-               public Type ResolveType(Assembly context, string assemblyQualifiedTypeName)
-               {
-                       TypeNameParser parser = TypeNameParser.Parse(assemblyQualifiedTypeName, false);
-                       if (parser.Error)
-                       {
-                               return null;
-                       }
-                       return parser.GetType(this, context, false, assemblyQualifiedTypeName, true, false);
-               }
-
-               public Assembly[] GetAssemblies()
-               {
-                       Assembly[] array = new Assembly[assemblies.Count + dynamicAssemblies.Count];
-                       for (int i = 0; i < assemblies.Count; i++)
-                       {
-                               array[i] = assemblies[i];
-                       }
-                       for (int i = 0, j = assemblies.Count; j < array.Length; i++, j++)
-                       {
-                               array[j] = dynamicAssemblies[i];
-                       }
-                       return array;
-               }
-
-               // this is equivalent to the Fusion CompareAssemblyIdentity API
-               public bool CompareAssemblyIdentity(string assemblyIdentity1, bool unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult result)
-               {
-                       return useNativeFusion
-                               ? Fusion.CompareAssemblyIdentityNative(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out result)
-                               : Fusion.CompareAssemblyIdentityPure(assemblyIdentity1, unified1, assemblyIdentity2, unified2, out result);
-               }
-
-               public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access)
-               {
-                       return DefineDynamicAssemblyImpl(name, access, null, null, null, null);
-               }
-
-               public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, string dir)
-               {
-                       return DefineDynamicAssemblyImpl(name, access, dir, null, null, null);
-               }
-
-#if NET_4_0
-               [Obsolete]
-#endif
-               public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
-               {
-                       return DefineDynamicAssemblyImpl(name, access, dir, requiredPermissions, optionalPermissions, refusedPermissions);
-               }
-
-               private AssemblyBuilder DefineDynamicAssemblyImpl(AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
-               {
-                       AssemblyBuilder asm = new AssemblyBuilder(this, name, dir, requiredPermissions, optionalPermissions, refusedPermissions);
-                       dynamicAssemblies.Add(asm);
-                       return asm;
-               }
-
-               internal void RenameAssembly(Assembly assembly, AssemblyName oldName)
-               {
-                       List<string> remove = new List<string>();
-                       foreach (KeyValuePair<string, Assembly> kv in assembliesByName)
-                       {
-                               if (kv.Value == assembly)
-                               {
-                                       remove.Add(kv.Key);
-                               }
-                       }
-                       foreach (string key in remove)
-                       {
-                               assembliesByName.Remove(key);
-                       }
-               }
-
-               public void Dispose()
-               {
-                       foreach (Assembly asm in assemblies)
-                       {
-                               foreach (Module mod in asm.GetLoadedModules())
-                               {
-                                       mod.Dispose();
-                               }
-                       }
-                       foreach (AssemblyBuilder asm in dynamicAssemblies)
-                       {
-                               foreach (Module mod in asm.GetLoadedModules())
-                               {
-                                       mod.Dispose();
-                               }
-                       }
-               }
-
-               public Assembly CreateMissingAssembly(string assemblyName)
-               {
-                       Assembly asm = new MissingAssembly(this, assemblyName);
-                       string name = asm.FullName;
-                       if (!assembliesByName.ContainsKey(name))
-                       {
-                               assembliesByName.Add(name, asm);
-                       }
-                       return asm;
-               }
-
-               public void EnableMissingMemberResolution()
-               {
-                       resolveMissingMembers = true;
-               }
-
-               internal bool MissingMemberResolution
-               {
-                       get { return resolveMissingMembers; }
-               }
-
-               internal bool EnableFunctionPointers
-               {
-                       get { return enableFunctionPointers; }
-               }
-
-               private struct ScopedTypeName : IEquatable<ScopedTypeName>
-               {
-                       private readonly object scope;
-                       private readonly TypeName name;
-
-                       internal ScopedTypeName(object scope, TypeName name)
-                       {
-                               this.scope = scope;
-                               this.name = name;
-                       }
-
-                       public override bool Equals(object obj)
-                       {
-                               ScopedTypeName? other = obj as ScopedTypeName?;
-                               return other != null && ((IEquatable<ScopedTypeName>)other.Value).Equals(this);
-                       }
-
-                       public override int GetHashCode()
-                       {
-                               return scope.GetHashCode() * 7 + name.GetHashCode();
-                       }
-
-                       bool IEquatable<ScopedTypeName>.Equals(ScopedTypeName other)
-                       {
-                               return other.scope == scope && other.name == name;
-                       }
-               }
-
-               private Type GetMissingType(Module module, Type declaringType, TypeName typeName)
-               {
-                       if (missingTypes == null)
-                       {
-                               missingTypes = new Dictionary<ScopedTypeName, Type>();
-                       }
-                       ScopedTypeName stn = new ScopedTypeName(declaringType ?? (object)module, typeName);
-                       Type type;
-                       if (!missingTypes.TryGetValue(stn, out type))
-                       {
-                               type = new MissingType(module, declaringType, typeName.Namespace, typeName.Name);
-                               missingTypes.Add(stn, type);
-                       }
-                       return type;
-               }
-
-               internal Type GetMissingTypeOrThrow(Module module, Type declaringType, TypeName typeName)
-               {
-                       if (resolveMissingMembers || module.Assembly.__IsMissing)
-                       {
-                               return GetMissingType(module, declaringType, typeName);
-                       }
-                       string fullName = TypeNameParser.Escape(typeName.ToString());
-                       if (declaringType != null)
-                       {
-                               fullName = declaringType.FullName + "+" + fullName;
-                       }
-                       throw new TypeLoadException(String.Format("Type '{0}' not found in assembly '{1}'", fullName, module.Assembly.FullName));
-               }
-
-               internal MethodBase GetMissingMethodOrThrow(Type declaringType, string name, MethodSignature signature)
-               {
-                       if (resolveMissingMembers)
-                       {
-                               MethodInfo method = new MissingMethod(declaringType, name, signature);
-                               if (name == ".ctor")
-                               {
-                                       return new ConstructorInfoImpl(method);
-                               }
-                               return method;
-                       }
-                       throw new MissingMethodException(declaringType.ToString(), name);
-               }
-
-               internal FieldInfo GetMissingFieldOrThrow(Type declaringType, string name, FieldSignature signature)
-               {
-                       if (resolveMissingMembers)
-                       {
-                               return new MissingField(declaringType, name, signature);
-                       }
-                       throw new MissingFieldException(declaringType.ToString(), name);
-               }
-
-               internal PropertyInfo GetMissingPropertyOrThrow(Type declaringType, string name, PropertySignature propertySignature)
-               {
-                       // HACK we need to check __IsMissing here, because Type doesn't have a FindProperty API
-                       // since properties are never resolved, except by custom attributes
-                       if (resolveMissingMembers || declaringType.__IsMissing)
-                       {
-                               return new MissingProperty(declaringType, name, propertySignature);
-                       }
-                       throw new System.MissingMemberException(declaringType.ToString(), name);
-               }
-
-               internal Type CanonicalizeType(Type type)
-               {
-                       Type canon;
-                       if (!canonicalizedTypes.TryGetValue(type, out canon))
-                       {
-                               canon = type;
-                               canonicalizedTypes.Add(canon, canon);
-                       }
-                       return canon;
-               }
-
-               public Type MakeFunctionPointer(__StandAloneMethodSig sig)
-               {
-                       return FunctionPointerType.Make(this, sig);
-               }
-
-               public __StandAloneMethodSig MakeStandAloneMethodSig(System.Runtime.InteropServices.CallingConvention callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       return new __StandAloneMethodSig(true, callingConvention, 0, returnType ?? this.System_Void, Util.Copy(parameterTypes), Type.EmptyTypes,
-                               PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes)));
-               }
-
-               public __StandAloneMethodSig MakeStandAloneMethodSig(CallingConventions callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, Type[] optionalParameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
-               {
-                       return new __StandAloneMethodSig(false, 0, callingConvention, returnType ?? this.System_Void, Util.Copy(parameterTypes), Util.Copy(optionalParameterTypes),
-                               PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes) + Util.NullSafeLength(optionalParameterTypes)));
-               }
-
-               public event Predicate<Type> MissingTypeIsValueType
-               {
-                       add
-                       {
-                               if (missingTypeIsValueType != null)
-                               {
-                                       throw new InvalidOperationException("Only a single MissingTypeIsValueType handler can be registered.");
-                               }
-                               missingTypeIsValueType = value;
-                       }
-                       remove
-                       {
-                               if (value.Equals(missingTypeIsValueType))
-                               {
-                                       missingTypeIsValueType = null;
-                               }
-                       }
-               }
-
-               internal bool ResolveMissingTypeIsValueType(MissingType missingType)
-               {
-                       if (missingTypeIsValueType != null)
-                       {
-                               return missingTypeIsValueType(missingType);
-                       }
-                       throw new MissingMemberException(missingType);
-               }
-
-               internal bool ReturnPseudoCustomAttributes
-               {
-                       get { return returnPseudoCustomAttributes; }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Util.cs b/mcs/class/IKVM.Reflection/Util.cs
deleted file mode 100644 (file)
index e05b5db..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace IKVM.Reflection
-{
-       public interface ICustomAttributeProvider
-       {
-               bool IsDefined(Type attributeType, bool inherit);
-               IList<CustomAttributeData> __GetCustomAttributes(Type attributeType, bool inherit);
-       }
-
-       [Serializable]
-       public sealed class FileFormatLimitationExceededException : InvalidOperationException
-       {
-               public const int META_E_STRINGSPACE_FULL = unchecked((int)0x80131198);
-
-               public FileFormatLimitationExceededException(string message, int hresult)
-                       : base(message)
-               {
-                       this.HResult = hresult;
-               }
-
-               private FileFormatLimitationExceededException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
-                       : base(info, context)
-               {
-               }
-
-               public int ErrorCode
-               {
-                       get { return this.HResult; }
-               }
-       }
-
-       [Serializable]
-       public sealed class Missing : ISerializable
-       {
-               public static readonly Missing Value = new Missing();
-
-               private Missing() { }
-
-               void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
-               {
-                       info.SetType(typeof(SingletonSerializationHelper));
-               }
-
-               [Serializable]
-               private sealed class SingletonSerializationHelper : IObjectReference
-               {
-                       public object GetRealObject(StreamingContext context)
-                       {
-                               return Value;
-                       }
-               }
-       }
-
-       static class Empty<T>
-       {
-               internal static readonly T[] Array = new T[0];
-       }
-
-       static class Util
-       {
-               internal static int[] Copy(int[] array)
-               {
-                       if (array == null || array.Length == 0)
-                       {
-                               return Empty<int>.Array;
-                       }
-                       int[] copy = new int[array.Length];
-                       Array.Copy(array, copy, array.Length);
-                       return copy;
-               }
-
-               internal static Type[] Copy(Type[] array)
-               {
-                       if (array == null || array.Length == 0)
-                       {
-                               return Type.EmptyTypes;
-                       }
-                       Type[] copy = new Type[array.Length];
-                       Array.Copy(array, copy, array.Length);
-                       return copy;
-               }
-
-               internal static T[] ToArray<T, V>(List<V> list, T[] empty) where V : T
-               {
-                       if (list == null || list.Count == 0)
-                       {
-                               return empty;
-                       }
-                       T[] array = new T[list.Count];
-                       for (int i = 0; i < array.Length; i++)
-                       {
-                               array[i] = list[i];
-                       }
-                       return array;
-               }
-
-               internal static T[] ToArray<T>(IEnumerable<T> values)
-               {
-                       return values == null
-                               ? Empty<T>.Array
-                               : new List<T>(values).ToArray();
-               }
-
-               // note that an empty array matches a null reference
-               internal static bool ArrayEquals(Type[] t1, Type[] t2)
-               {
-                       if (t1 == t2)
-                       {
-                               return true;
-                       }
-                       if (t1 == null)
-                       {
-                               return t2.Length == 0;
-                       }
-                       else if (t2 == null)
-                       {
-                               return t1.Length == 0;
-                       }
-                       if (t1.Length == t2.Length)
-                       {
-                               for (int i = 0; i < t1.Length; i++)
-                               {
-                                       if (!TypeEquals(t1[i], t2[i]))
-                                       {
-                                               return false;
-                                       }
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-
-               internal static bool TypeEquals(Type t1, Type t2)
-               {
-                       if (t1 == t2)
-                       {
-                               return true;
-                       }
-                       if (t1 == null)
-                       {
-                               return false;
-                       }
-                       return t1.Equals(t2);
-               }
-
-               internal static int GetHashCode(Type[] types)
-               {
-                       if (types == null)
-                       {
-                               return 0;
-                       }
-                       int h = 0;
-                       foreach (Type t in types)
-                       {
-                               if (t != null)
-                               {
-                                       h *= 3;
-                                       h ^= t.GetHashCode();
-                               }
-                       }
-                       return h;
-               }
-
-               internal static bool ArrayEquals(CustomModifiers[] m1, CustomModifiers[] m2)
-               {
-                       if (m1 == null || m2 == null)
-                       {
-                               return m1 == m2;
-                       }
-                       if (m1.Length != m2.Length)
-                       {
-                               return false;
-                       }
-                       for (int i = 0; i < m1.Length; i++)
-                       {
-                               if (!m1[i].Equals(m2[i]))
-                               {
-                                       return false;
-                               }
-                       }
-                       return true;
-               }
-
-               internal static int GetHashCode(CustomModifiers[] mods)
-               {
-                       int h = 0;
-                       if (mods != null)
-                       {
-                               foreach (CustomModifiers mod in mods)
-                               {
-                                       h ^= mod.GetHashCode();
-                               }
-                       }
-                       return h;
-               }
-
-               internal static T NullSafeElementAt<T>(T[] array, int index)
-               {
-                       return array == null ? default(T) : array[index];
-               }
-
-               internal static int NullSafeLength<T>(T[] array)
-               {
-                       return array == null ? 0 : array.Length;
-               }
-       }
-
-       [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
-       struct SingleConverter
-       {
-               [System.Runtime.InteropServices.FieldOffset(0)]
-               private int i;
-               [System.Runtime.InteropServices.FieldOffset(0)]
-               private float f;
-
-               internal static int SingleToInt32Bits(float v)
-               {
-                       SingleConverter c = new SingleConverter();
-                       c.f = v;
-                       return c.i;
-               }
-
-               internal static float Int32BitsToSingle(int v)
-               {
-                       SingleConverter c = new SingleConverter();
-                       c.i = v;
-                       return c.f;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs b/mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs
deleted file mode 100644 (file)
index e67bd70..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class ByteBuffer
-       {
-               private byte[] buffer;
-               private int pos;
-               private int __length;   // __length is only valid if > pos, otherwise pos is the current length
-
-               internal ByteBuffer(int initialCapacity)
-               {
-                       buffer = new byte[initialCapacity];
-               }
-
-               private ByteBuffer(byte[] wrap, int length)
-               {
-                       this.buffer = wrap;
-                       this.pos = length;
-               }
-
-               internal int Position
-               {
-                       get { return pos; }
-                       set
-                       {
-                               if (value > this.Length || value > buffer.Length)
-                                       throw new ArgumentOutOfRangeException();
-                               __length = Math.Max(__length, pos);
-                               pos = value;
-                       }
-               }
-
-               internal int Length
-               {
-                       get { return Math.Max(pos, __length); }
-               }
-
-               // insert count bytes at the current position (without advancing the current position)
-               internal void Insert(int count)
-               {
-                       if (count > 0)
-                       {
-                               int len = this.Length;
-                               int free = buffer.Length - len;
-                               if (free < count)
-                               {
-                                       Grow(count - free);
-                               }
-                               Buffer.BlockCopy(buffer, pos, buffer, pos + count, len - pos);
-                               __length = Math.Max(__length, pos) + count;
-                       }
-                       else if (count < 0)
-                       {
-                               throw new ArgumentOutOfRangeException("count");
-                       }
-               }
-
-               private void Grow(int minGrow)
-               {
-                       byte[] newbuf = new byte[Math.Max(buffer.Length + minGrow, buffer.Length * 2)];
-                       Buffer.BlockCopy(buffer, 0, newbuf, 0, buffer.Length);
-                       buffer = newbuf;
-               }
-
-               // NOTE this does not advance the position
-               internal int GetInt32AtCurrentPosition()
-               {
-                       return buffer[pos]
-                               + (buffer[pos + 1] << 8)
-                               + (buffer[pos + 2] << 16)
-                               + (buffer[pos + 3] << 24);
-               }
-
-               // NOTE this does not advance the position
-               internal byte GetByteAtCurrentPosition()
-               {
-                       return buffer[pos];
-               }
-
-               // return the number of bytes that the compressed int at the current position takes
-               internal int GetCompressedIntLength()
-               {
-                       switch (buffer[pos] & 0xC0)
-                       {
-                               default:
-                                       return 1;
-                               case 0x80:
-                                       return 2;
-                               case 0xC0:
-                                       return 4;
-                       }
-               }
-
-               internal void Write(byte[] value)
-               {
-                       if (pos + value.Length > buffer.Length)
-                               Grow(value.Length);
-                       Buffer.BlockCopy(value, 0, buffer, pos, value.Length);
-                       pos += value.Length;
-               }
-
-               internal void Write(byte value)
-               {
-                       if (pos == buffer.Length)
-                               Grow(1);
-                       buffer[pos++] = value;
-               }
-
-               internal void Write(sbyte value)
-               {
-                       Write((byte)value);
-               }
-
-               internal void Write(ushort value)
-               {
-                       Write((short)value);
-               }
-
-               internal void Write(short value)
-               {
-                       if (pos + 2 > buffer.Length)
-                               Grow(2);
-                       buffer[pos++] = (byte)value;
-                       buffer[pos++] = (byte)(value >> 8);
-               }
-
-               internal void Write(uint value)
-               {
-                       Write((int)value);
-               }
-       
-               internal void Write(int value)
-               {
-                       if (pos + 4 > buffer.Length)
-                               Grow(4);
-                       buffer[pos++] = (byte)value;
-                       buffer[pos++] = (byte)(value >> 8);
-                       buffer[pos++] = (byte)(value >> 16);
-                       buffer[pos++] = (byte)(value >> 24);
-               }
-
-               internal void Write(ulong value)
-               {
-                       Write((long)value);
-               }
-
-               internal void Write(long value)
-               {
-                       if (pos + 8 > buffer.Length)
-                               Grow(8);
-                       buffer[pos++] = (byte)value;
-                       buffer[pos++] = (byte)(value >> 8);
-                       buffer[pos++] = (byte)(value >> 16);
-                       buffer[pos++] = (byte)(value >> 24);
-                       buffer[pos++] = (byte)(value >> 32);
-                       buffer[pos++] = (byte)(value >> 40);
-                       buffer[pos++] = (byte)(value >> 48);
-                       buffer[pos++] = (byte)(value >> 56);
-               }
-
-               internal void Write(float value)
-               {
-                       Write(SingleConverter.SingleToInt32Bits(value));
-               }
-
-               internal void Write(double value)
-               {
-                       Write(BitConverter.DoubleToInt64Bits(value));
-               }
-
-               internal void Write(string str)
-               {
-                       if (str == null)
-                       {
-                               Write((byte)0xFF);
-                       }
-                       else
-                       {
-                               byte[] buf = Encoding.UTF8.GetBytes(str);
-                               WriteCompressedInt(buf.Length);
-                               Write(buf);
-                       }
-               }
-
-               internal void WriteCompressedInt(int value)
-               {
-                       if (value <= 0x7F)
-                       {
-                               Write((byte)value);
-                       }
-                       else if (value <= 0x3FFF)
-                       {
-                               Write((byte)(0x80 | (value >> 8)));
-                               Write((byte)value);
-                       }
-                       else
-                       {
-                               Write((byte)(0xC0 | (value >> 24)));
-                               Write((byte)(value >> 16));
-                               Write((byte)(value >> 8));
-                               Write((byte)value);
-                       }
-               }
-
-               internal void Write(ByteBuffer bb)
-               {
-                       if (pos + bb.Length > buffer.Length)
-                               Grow(bb.Length);
-                       Buffer.BlockCopy(bb.buffer, 0, buffer, pos, bb.Length);
-                       pos += bb.Length;
-               }
-
-               internal void WriteTo(System.IO.Stream stream)
-               {
-                       stream.Write(buffer, 0, this.Length);
-               }
-
-               internal void Clear()
-               {
-                       pos = 0;
-                       __length = 0;
-               }
-
-               internal void Align(int alignment)
-               {
-                       if (pos + alignment > buffer.Length)
-                               Grow(alignment);
-                       int newpos = (pos + alignment - 1) & ~(alignment - 1);
-                       while (pos < newpos)
-                               buffer[pos++] = 0;
-               }
-
-               internal void WriteTypeDefOrRefEncoded(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case TypeDefTable.Index:
-                                       WriteCompressedInt((token & 0xFFFFFF) << 2 | 0);
-                                       break;
-                               case TypeRefTable.Index:
-                                       WriteCompressedInt((token & 0xFFFFFF) << 2 | 1);
-                                       break;
-                               case TypeSpecTable.Index:
-                                       WriteCompressedInt((token & 0xFFFFFF) << 2 | 2);
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-               }
-
-               internal void Write(System.IO.Stream stream)
-               {
-                       const int chunkSize = 8192;
-                       for (; ; )
-                       {
-                               if (pos + chunkSize > buffer.Length)
-                                       Grow(chunkSize);
-                               int read = stream.Read(buffer, pos, chunkSize);
-                               if (read <= 0)
-                               {
-                                       break;
-                               }
-                               pos += read;
-                       }
-               }
-
-               internal byte[] ToArray()
-               {
-                       int len = this.Length;
-                       byte[] buf = new byte[len];
-                       Buffer.BlockCopy(buffer, 0, buf, 0, len);
-                       return buf;
-               }
-
-               internal static ByteBuffer Wrap(byte[] buf)
-               {
-                       return new ByteBuffer(buf, buf.Length);
-               }
-
-               internal static ByteBuffer Wrap(byte[] buf, int length)
-               {
-                       return new ByteBuffer(buf, length);
-               }
-
-               internal bool Match(int pos, ByteBuffer bb2, int pos2, int len)
-               {
-                       for (int i = 0; i < len; i++)
-                       {
-                               if (buffer[pos + i] != bb2.buffer[pos2 + i])
-                               {
-                                       return false;
-                               }
-                       }
-                       return true;
-               }
-
-               internal int Hash()
-               {
-                       int hash = 0;
-                       int len = this.Length;
-                       for (int i = 0; i < len; i++)
-                       {
-                               hash *= 37;
-                               hash ^= buffer[i];
-                       }
-                       return hash;
-               }
-
-               internal IKVM.Reflection.Reader.ByteReader GetBlob(int offset)
-               {
-                       return IKVM.Reflection.Reader.ByteReader.FromBlob(buffer, offset);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/Heaps.cs b/mcs/class/IKVM.Reflection/Writer/Heaps.cs
deleted file mode 100644 (file)
index 78a5d60..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Diagnostics;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
-       abstract class Heap
-       {
-               protected bool frozen;
-               protected int unalignedlength;
-
-               internal void Write(MetadataWriter mw)
-               {
-                       int pos = mw.Position;
-                       WriteImpl(mw);
-                       Debug.Assert(mw.Position == pos + unalignedlength);
-                       int align = Length - unalignedlength;
-                       for (int i = 0; i < align; i++)
-                       {
-                               mw.Write((byte)0);
-                       }
-               }
-
-               internal bool IsBig
-               {
-                       get { return Length > 65535; }
-               }
-
-               internal int Length
-               {
-                       get
-                       {
-                               if (!frozen)
-                                       throw new InvalidOperationException();
-                               return (unalignedlength + 3) & ~3;
-                       }
-               }
-
-               protected abstract void WriteImpl(MetadataWriter mw);
-       }
-
-       abstract class SimpleHeap : Heap
-       {
-               internal void Freeze()
-               {
-                       if (frozen)
-                               throw new InvalidOperationException();
-                       frozen = true;
-                       unalignedlength = GetLength();
-               }
-
-               protected abstract int GetLength();
-       }
-
-       sealed class TableHeap : Heap
-       {
-               internal void Freeze(MetadataWriter mw)
-               {
-                       if (frozen)
-                               throw new InvalidOperationException();
-                       frozen = true;
-                       unalignedlength = GetLength(mw);
-               }
-
-               protected override void WriteImpl(MetadataWriter mw)
-               {
-                       Table[] tables = mw.ModuleBuilder.GetTables();
-                       // Header
-                       mw.Write(0);            // Reserved
-                       int ver = mw.ModuleBuilder.MDStreamVersion;
-                       mw.Write((byte)(ver >> 16));    // MajorVersion
-                       mw.Write((byte)ver);                    // MinorVersion
-                       byte heapSizes = 0;
-                       if (mw.ModuleBuilder.Strings.IsBig)
-                       {
-                               heapSizes |= 0x01;
-                       }
-                       if (mw.ModuleBuilder.Guids.IsBig)
-                       {
-                               heapSizes |= 0x02;
-                       }
-                       if (mw.ModuleBuilder.Blobs.IsBig)
-                       {
-                               heapSizes |= 0x04;
-                       }
-                       mw.Write(heapSizes);// HeapSizes
-                       // LAMESPEC spec says reserved, but .NET 2.0 Ref.Emit sets it to 0x10
-                       mw.Write((byte)0x10);   // Reserved
-                       long bit = 1;
-                       long valid = 0;
-                       foreach (Table table in tables)
-                       {
-                               if (table != null && table.RowCount > 0)
-                               {
-                                       valid |= bit;
-                               }
-                               bit <<= 1;
-                       }
-                       mw.Write(valid);        // Valid
-                       mw.Write(0x0016003301FA00L);    // Sorted
-                       // Rows
-                       foreach (Table table in tables)
-                       {
-                               if (table != null && table.RowCount > 0)
-                               {
-                                       mw.Write(table.RowCount);
-                               }
-                       }
-                       // Tables
-                       foreach (Table table in tables)
-                       {
-                               if (table != null && table.RowCount > 0)
-                               {
-                                       int pos = mw.Position;
-                                       table.Write(mw);
-                                       Debug.Assert(mw.Position - pos == table.GetLength(mw));
-                               }
-                       }
-                       // unexplained extra padding
-                       mw.Write((byte)0);
-               }
-
-               private static int GetLength(MetadataWriter mw)
-               {
-                       int len = 4 + 4 + 8 + 8;
-                       foreach (Table table in mw.ModuleBuilder.GetTables())
-                       {
-                               if (table != null && table.RowCount > 0)
-                               {
-                                       len += 4;       // row count
-                                       len += table.GetLength(mw);
-                               }
-                       }
-                       // note that we pad one extra (unexplained) byte
-                       return len + 1;
-               }
-       }
-
-       sealed class StringHeap : SimpleHeap
-       {
-               private List<string> list = new List<string>();
-               private Dictionary<string, int> strings = new Dictionary<string, int>();
-               private int nextOffset;
-
-               internal StringHeap()
-               {
-                       Add("");
-               }
-
-               internal int Add(string str)
-               {
-                       Debug.Assert(!frozen);
-                       int offset;
-                       if (!strings.TryGetValue(str, out offset))
-                       {
-                               offset = nextOffset;
-                               nextOffset += System.Text.Encoding.UTF8.GetByteCount(str) + 1;
-                               list.Add(str);
-                               strings.Add(str, offset);
-                       }
-                       return offset;
-               }
-
-               internal string Find(int index)
-               {
-                       foreach (KeyValuePair<string, int> kv in strings)
-                       {
-                               if (kv.Value == index)
-                               {
-                                       return kv.Key;
-                               }
-                       }
-                       return null;
-               }
-
-               protected override int GetLength()
-               {
-                       return nextOffset;
-               }
-
-               protected override void WriteImpl(MetadataWriter mw)
-               {
-                       foreach (string str in list)
-                       {
-                               mw.Write(System.Text.Encoding.UTF8.GetBytes(str));
-                               mw.Write((byte)0);
-                       }
-               }
-       }
-
-       sealed class UserStringHeap : SimpleHeap
-       {
-               private List<string> list = new List<string>();
-               private Dictionary<string, int> strings = new Dictionary<string, int>();
-               private int nextOffset;
-
-               internal UserStringHeap()
-               {
-                       nextOffset = 1;
-               }
-
-               internal bool IsEmpty
-               {
-                       get { return nextOffset == 1; }
-               }
-
-               internal int Add(string str)
-               {
-                       Debug.Assert(!frozen);
-                       int offset;
-                       if (!strings.TryGetValue(str, out offset))
-                       {
-                               int length = str.Length * 2 + 1 + MetadataWriter.GetCompressedIntLength(str.Length * 2 + 1);
-                               if (nextOffset + length > 0xFFFFFF)
-                               {
-                                       throw new FileFormatLimitationExceededException("No logical space left to create more user strings.", FileFormatLimitationExceededException.META_E_STRINGSPACE_FULL);
-                               }
-                               offset = nextOffset;
-                               nextOffset += length;
-                               list.Add(str);
-                               strings.Add(str, offset);
-                       }
-                       return offset;
-               }
-
-               protected override int GetLength()
-               {
-                       return nextOffset;
-               }
-
-               protected override void WriteImpl(MetadataWriter mw)
-               {
-                       mw.Write((byte)0);
-                       foreach (string str in list)
-                       {
-                               mw.WriteCompressedInt(str.Length * 2 + 1);
-                               byte hasSpecialChars = 0;
-                               foreach (char ch in str)
-                               {
-                                       mw.Write((ushort)ch);
-                                       if (hasSpecialChars == 0 && (ch < 0x20 || ch > 0x7E))
-                                       {
-                                               if (ch > 0x7E
-                                                       || (ch >= 0x01 && ch <= 0x08)
-                                                       || (ch >= 0x0E && ch <= 0x1F)
-                                                       || ch == 0x27
-                                                       || ch == 0x2D)
-                                               {
-                                                       hasSpecialChars = 1;
-                                               }
-                                       }
-                               }
-                               mw.Write(hasSpecialChars);
-                       }
-               }
-       }
-
-       sealed class GuidHeap : SimpleHeap
-       {
-               private List<Guid> list = new List<Guid>();
-
-               internal GuidHeap()
-               {
-               }
-
-               internal int Add(Guid guid)
-               {
-                       Debug.Assert(!frozen);
-                       list.Add(guid);
-                       return list.Count;
-               }
-
-               protected override int GetLength()
-               {
-                       return list.Count * 16;
-               }
-
-               protected override void WriteImpl(MetadataWriter mw)
-               {
-                       foreach (Guid guid in list)
-                       {
-                               mw.Write(guid.ToByteArray());
-                       }
-               }
-       }
-
-       sealed class BlobHeap : SimpleHeap
-       {
-               private Key[] map = new Key[8179];
-               private readonly ByteBuffer buf = new ByteBuffer(32);
-
-               private struct Key
-               {
-                       internal Key[] next;
-                       internal int len;
-                       internal int hash;
-                       internal int offset;
-               }
-
-               internal BlobHeap()
-               {
-                       buf.Write((byte)0);
-               }
-
-               internal int Add(ByteBuffer bb)
-               {
-                       Debug.Assert(!frozen);
-                       int bblen = bb.Length;
-                       if (bblen == 0)
-                       {
-                               return 0;
-                       }
-                       int lenlen = MetadataWriter.GetCompressedIntLength(bblen);
-                       int hash = bb.Hash();
-                       int index = (hash & 0x7FFFFFFF) % map.Length;
-                       Key[] keys = map;
-                       int last = index;
-                       while (keys[index].offset != 0)
-                       {
-                               if (keys[index].hash == hash
-                                       && keys[index].len == bblen
-                                       && buf.Match(keys[index].offset + lenlen, bb, 0, bblen))
-                               {
-                                       return keys[index].offset;
-                               }
-                               if (index == last)
-                               {
-                                       if (keys[index].next == null)
-                                       {
-                                               keys[index].next = new Key[4];
-                                               keys = keys[index].next;
-                                               index = 0;
-                                               break;
-                                       }
-                                       keys = keys[index].next;
-                                       index = -1;
-                                       last = keys.Length - 1;
-                               }
-                               index++;
-                       }
-                       int offset = buf.Position;
-                       buf.WriteCompressedInt(bblen);
-                       buf.Write(bb);
-                       keys[index].len = bblen;
-                       keys[index].hash = hash;
-                       keys[index].offset = offset;
-                       return offset;
-               }
-
-               protected override int GetLength()
-               {
-                       return buf.Position;
-               }
-
-               protected override void WriteImpl(MetadataWriter mw)
-               {
-                       mw.Write(buf);
-               }
-
-               internal bool IsEmpty
-               {
-                       get { return buf.Position == 1; }
-               }
-
-               internal IKVM.Reflection.Reader.ByteReader GetBlob(int blobIndex)
-               {
-                       return buf.GetBlob(blobIndex);
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/MetadataWriter.cs b/mcs/class/IKVM.Reflection/Writer/MetadataWriter.cs
deleted file mode 100644 (file)
index be5ced7..0000000
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class MetadataWriter : MetadataRW
-       {
-               private readonly ModuleBuilder moduleBuilder;
-               private readonly Stream stream;
-               private readonly byte[] buffer = new byte[8];
-
-               internal MetadataWriter(ModuleBuilder module, Stream stream)
-                       : base(module, module.Strings.IsBig, module.Guids.IsBig, module.Blobs.IsBig)
-               {
-                       this.moduleBuilder = module;
-                       this.stream = stream;
-               }
-
-               internal ModuleBuilder ModuleBuilder
-               {
-                       get { return moduleBuilder; }
-               }
-
-               internal int Position
-               {
-                       get { return (int)stream.Position; }
-               }
-
-               internal void Write(ByteBuffer bb)
-               {
-                       bb.WriteTo(stream);
-               }
-
-               internal void Write(byte[] value)
-               {
-                       stream.Write(value, 0, value.Length);
-               }
-
-               internal void Write(byte value)
-               {
-                       stream.WriteByte(value);
-               }
-
-               internal void Write(ushort value)
-               {
-                       Write((short)value);
-               }
-
-               internal void Write(short value)
-               {
-                       stream.WriteByte((byte)value);
-                       stream.WriteByte((byte)(value >> 8));
-               }
-
-               internal void Write(uint value)
-               {
-                       Write((int)value);
-               }
-
-               internal void Write(int value)
-               {
-                       buffer[0] = (byte)value;
-                       buffer[1] = (byte)(value >> 8);
-                       buffer[2] = (byte)(value >> 16);
-                       buffer[3] = (byte)(value >> 24);
-                       stream.Write(buffer, 0, 4);
-               }
-
-               internal void Write(ulong value)
-               {
-                       Write((long)value);
-               }
-
-               internal void Write(long value)
-               {
-                       buffer[0] = (byte)value;
-                       buffer[1] = (byte)(value >> 8);
-                       buffer[2] = (byte)(value >> 16);
-                       buffer[3] = (byte)(value >> 24);
-                       buffer[4] = (byte)(value >> 32);
-                       buffer[5] = (byte)(value >> 40);
-                       buffer[6] = (byte)(value >> 48);
-                       buffer[7] = (byte)(value >> 56);
-                       stream.Write(buffer, 0, 8);
-               }
-
-               internal void WriteCompressedInt(int value)
-               {
-                       if (value <= 0x7F)
-                       {
-                               Write((byte)value);
-                       }
-                       else if (value <= 0x3FFF)
-                       {
-                               Write((byte)(0x80 | (value >> 8)));
-                               Write((byte)value);
-                       }
-                       else
-                       {
-                               Write((byte)(0xC0 | (value >> 24)));
-                               Write((byte)(value >> 16));
-                               Write((byte)(value >> 8));
-                               Write((byte)value);
-                       }
-               }
-
-               internal static int GetCompressedIntLength(int value)
-               {
-                       if (value <= 0x7F)
-                       {
-                               return 1;
-                       }
-                       else if (value <= 0x3FFF)
-                       {
-                               return 2;
-                       }
-                       else
-                       {
-                               return 4;
-                       }
-               }
-
-               internal void WriteStringIndex(int index)
-               {
-                       if (bigStrings)
-                       {
-                               Write(index);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteGuidIndex(int index)
-               {
-                       if (bigGuids)
-                       {
-                               Write(index);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteBlobIndex(int index)
-               {
-                       if (bigBlobs)
-                       {
-                               Write(index);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteTypeDefOrRef(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case 0:
-                                       break;
-                               case TypeDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 0;
-                                       break;
-                               case TypeRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 1;
-                                       break;
-                               case TypeSpecTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 2;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigTypeDefOrRef)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteEncodedTypeDefOrRef(int encodedToken)
-               {
-                       if (bigTypeDefOrRef)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteHasCustomAttribute(int token)
-               {
-                       int encodedToken = CustomAttributeTable.EncodeHasCustomAttribute(token);
-                       if (bigHasCustomAttribute)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteCustomAttributeType(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case MethodDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 2;
-                                       break;
-                               case MemberRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 3;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigCustomAttributeType)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteField(int index)
-               {
-                       if (bigField)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteMethodDef(int index)
-               {
-                       if (bigMethodDef)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteParam(int index)
-               {
-                       if (bigParam)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteTypeDef(int index)
-               {
-                       if (bigTypeDef)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteEvent(int index)
-               {
-                       if (bigEvent)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteProperty(int index)
-               {
-                       if (bigProperty)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteGenericParam(int index)
-               {
-                       if (bigGenericParam)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteModuleRef(int index)
-               {
-                       if (bigModuleRef)
-                       {
-                               Write(index & 0xFFFFFF);
-                       }
-                       else
-                       {
-                               Write((short)index);
-                       }
-               }
-
-               internal void WriteResolutionScope(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case ModuleTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 0;
-                                       break;
-                               case ModuleRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 1;
-                                       break;
-                               case AssemblyRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 2;
-                                       break;
-                               case TypeRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 3;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigResolutionScope)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteMemberRefParent(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case TypeDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 0;
-                                       break;
-                               case TypeRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 1;
-                                       break;
-                               case ModuleRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 2;
-                                       break;
-                               case MethodDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 3;
-                                       break;
-                               case TypeSpecTable.Index:
-                                       token = (token & 0xFFFFFF) << 3 | 4;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigMemberRefParent)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteMethodDefOrRef(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case MethodDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 1 | 0;
-                                       break;
-                               case MemberRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 1 | 1;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigMethodDefOrRef)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteHasConstant(int token)
-               {
-                       int encodedToken = ConstantTable.EncodeHasConstant(token);
-                       if (bigHasConstant)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteHasSemantics(int encodedToken)
-               {
-                       // NOTE because we've already had to do the encoding (to be able to sort the table)
-                       // here we simple write the value
-                       if (bigHasSemantics)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteImplementation(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case 0:
-                                       break;
-                               case FileTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 0;
-                                       break;
-                               case AssemblyRefTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 1;
-                                       break;
-                               case ExportedTypeTable.Index:
-                                       token = (token & 0xFFFFFF) << 2 | 2;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigImplementation)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteTypeOrMethodDef(int encodedToken)
-               {
-                       // NOTE because we've already had to do the encoding (to be able to sort the table)
-                       // here we simple write the value
-                       if (bigTypeOrMethodDef)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteHasDeclSecurity(int encodedToken)
-               {
-                       // NOTE because we've already had to do the encoding (to be able to sort the table)
-                       // here we simple write the value
-                       if (bigHasDeclSecurity)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-
-               internal void WriteMemberForwarded(int token)
-               {
-                       switch (token >> 24)
-                       {
-                               case FieldTable.Index:
-                                       token = (token & 0xFFFFFF) << 1 | 0;
-                                   break;
-                               case MethodDefTable.Index:
-                                       token = (token & 0xFFFFFF) << 1 | 1;
-                                       break;
-                               default:
-                                       throw new InvalidOperationException();
-                       }
-                       if (bigMemberForwarded)
-                       {
-                               Write(token);
-                       }
-                       else
-                       {
-                               Write((short)token);
-                       }
-               }
-
-               internal void WriteHasFieldMarshal(int token)
-               {
-                       int encodedToken = FieldMarshalTable.EncodeHasFieldMarshal(token);
-                       if (bigHasFieldMarshal)
-                       {
-                               Write(encodedToken);
-                       }
-                       else
-                       {
-                               Write((short)encodedToken);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/ModuleWriter.cs b/mcs/class/IKVM.Reflection/Writer/ModuleWriter.cs
deleted file mode 100644 (file)
index 697ae97..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Security.Cryptography;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
-       static class ModuleWriter
-       {
-               internal static void WriteModule(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
-                       PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
-                       ResourceSection resources, int entryPointToken)
-               {
-                       WriteModule(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, null);
-               }
-
-               internal static void WriteModule(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
-                       PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
-                       ResourceSection resources, int entryPointToken, Stream stream)
-               {
-                       if (stream == null)
-                       {
-                               string fileName = moduleBuilder.FullyQualifiedName;
-                               bool mono = System.Type.GetType("Mono.Runtime") != null;
-                               if (mono)
-                               {
-                                       try
-                                       {
-                                               // Mono mmaps the file, so unlink the previous version since it may be in use
-                                               File.Delete(fileName);
-                                       }
-                                       catch { }
-                               }
-                               using (FileStream fs = new FileStream(fileName, FileMode.Create))
-                               {
-                                       WriteModuleImpl(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, fs);
-                               }
-                               // if we're running on Mono, mark the module as executable by using a Mono private API extension
-                               if (mono)
-                               {
-                                       File.SetAttributes(fileName, (FileAttributes)(unchecked((int)0x80000000)));
-                               }
-                       }
-                       else
-                       {
-                               WriteModuleImpl(keyPair, publicKey, moduleBuilder, fileKind, portableExecutableKind, imageFileMachine, resources, entryPointToken, stream);
-                       }
-               }
-
-               private static void WriteModuleImpl(StrongNameKeyPair keyPair, byte[] publicKey, ModuleBuilder moduleBuilder,
-                       PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine,
-                       ResourceSection resources, int entryPointToken, Stream stream)
-               {
-                       moduleBuilder.ApplyUnmanagedExports(imageFileMachine);
-                       moduleBuilder.FixupMethodBodyTokens();
-
-                       moduleBuilder.ModuleTable.Add(0, moduleBuilder.Strings.Add(moduleBuilder.moduleName), moduleBuilder.Guids.Add(moduleBuilder.ModuleVersionId), 0, 0);
-
-                       if (moduleBuilder.UserStrings.IsEmpty)
-                       {
-                               // for compat with Ref.Emit, if there aren't any user strings, we add one
-                               moduleBuilder.UserStrings.Add(" ");
-                       }
-
-                       if (resources != null)
-                       {
-                               resources.Finish();
-                       }
-
-                       PEWriter writer = new PEWriter(stream);
-                       writer.Headers.OptionalHeader.FileAlignment = (uint)moduleBuilder.__FileAlignment;
-                       switch (imageFileMachine)
-                       {
-                               case ImageFileMachine.I386:
-                                       writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386;
-                                       writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_32BIT_MACHINE;
-                                       writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x100000);
-                                       break;
-                               case ImageFileMachine.ARM:
-                                       writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM;
-                                       writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_32BIT_MACHINE;
-                                       writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x100000);
-                                       break;
-                               case ImageFileMachine.AMD64:
-                                       writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64;
-                                       writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_LARGE_ADDRESS_AWARE;
-                                       writer.Headers.FileHeader.SizeOfOptionalHeader = 0xF0;
-                                       writer.Headers.OptionalHeader.Magic = IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC;
-                                       writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x400000);
-                                       writer.Headers.OptionalHeader.SizeOfStackCommit = 0x4000;
-                                       writer.Headers.OptionalHeader.SizeOfHeapCommit = 0x2000;
-                                       break;
-                               case ImageFileMachine.IA64:
-                                       writer.Headers.FileHeader.Machine = IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64;
-                                       writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_LARGE_ADDRESS_AWARE;
-                                       writer.Headers.FileHeader.SizeOfOptionalHeader = 0xF0;
-                                       writer.Headers.OptionalHeader.Magic = IMAGE_OPTIONAL_HEADER.IMAGE_NT_OPTIONAL_HDR64_MAGIC;
-                                       writer.Headers.OptionalHeader.SizeOfStackReserve = moduleBuilder.GetStackReserve(0x400000);
-                                       writer.Headers.OptionalHeader.SizeOfStackCommit = 0x4000;
-                                       writer.Headers.OptionalHeader.SizeOfHeapCommit = 0x2000;
-                                       break;
-                               default:
-                                       throw new ArgumentOutOfRangeException("imageFileMachine");
-                       }
-                       if (fileKind == PEFileKinds.Dll)
-                       {
-                               writer.Headers.FileHeader.Characteristics |= IMAGE_FILE_HEADER.IMAGE_FILE_DLL;
-                       }
-
-                       switch (fileKind)
-                       {
-                               case PEFileKinds.WindowApplication:
-                                       writer.Headers.OptionalHeader.Subsystem = IMAGE_OPTIONAL_HEADER.IMAGE_SUBSYSTEM_WINDOWS_GUI;
-                                       break;
-                               default:
-                                       writer.Headers.OptionalHeader.Subsystem = IMAGE_OPTIONAL_HEADER.IMAGE_SUBSYSTEM_WINDOWS_CUI;
-                                       break;
-                       }
-                       writer.Headers.OptionalHeader.DllCharacteristics = (ushort)moduleBuilder.__DllCharacteristics;
-
-                       CliHeader cliHeader = new CliHeader();
-                       cliHeader.Cb = 0x48;
-                       cliHeader.MajorRuntimeVersion = 2;
-                       cliHeader.MinorRuntimeVersion = moduleBuilder.MDStreamVersion < 0x20000 ? (ushort)0 : (ushort)5;
-                       if ((portableExecutableKind & PortableExecutableKinds.ILOnly) != 0)
-                       {
-                               cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_ILONLY;
-                       }
-                       if ((portableExecutableKind & PortableExecutableKinds.Required32Bit) != 0)
-                       {
-                               cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_32BITREQUIRED;
-                       }
-                       if ((portableExecutableKind & PortableExecutableKinds.Preferred32Bit) != 0)
-                       {
-                               cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_32BITREQUIRED | CliHeader.COMIMAGE_FLAGS_32BITPREFERRED;
-                       }
-                       if (keyPair != null)
-                       {
-                               cliHeader.Flags |= CliHeader.COMIMAGE_FLAGS_STRONGNAMESIGNED;
-                       }
-                       if (moduleBuilder.IsPseudoToken(entryPointToken))
-                       {
-                               entryPointToken = moduleBuilder.ResolvePseudoToken(entryPointToken);
-                       }
-                       cliHeader.EntryPointToken = (uint)entryPointToken;
-
-                       moduleBuilder.Strings.Freeze();
-                       moduleBuilder.UserStrings.Freeze();
-                       moduleBuilder.Guids.Freeze();
-                       moduleBuilder.Blobs.Freeze();
-                       MetadataWriter mw = new MetadataWriter(moduleBuilder, stream);
-                       moduleBuilder.Tables.Freeze(mw);
-                       TextSection code = new TextSection(writer, cliHeader, moduleBuilder, ComputeStrongNameSignatureLength(publicKey));
-
-                       // Export Directory
-                       if (code.ExportDirectoryLength != 0)
-                       {
-                               writer.Headers.OptionalHeader.DataDirectory[0].VirtualAddress = code.ExportDirectoryRVA;
-                               writer.Headers.OptionalHeader.DataDirectory[0].Size = code.ExportDirectoryLength;
-                       }
-
-                       // Import Directory
-                       if (code.ImportDirectoryLength != 0)
-                       {
-                               writer.Headers.OptionalHeader.DataDirectory[1].VirtualAddress = code.ImportDirectoryRVA;
-                               writer.Headers.OptionalHeader.DataDirectory[1].Size = code.ImportDirectoryLength;
-                       }
-
-                       // Import Address Table Directory
-                       if (code.ImportAddressTableLength != 0)
-                       {
-                               writer.Headers.OptionalHeader.DataDirectory[12].VirtualAddress = code.ImportAddressTableRVA;
-                               writer.Headers.OptionalHeader.DataDirectory[12].Size = code.ImportAddressTableLength;
-                       }
-
-                       // COM Descriptor Directory
-                       writer.Headers.OptionalHeader.DataDirectory[14].VirtualAddress = code.ComDescriptorRVA;
-                       writer.Headers.OptionalHeader.DataDirectory[14].Size = code.ComDescriptorLength;
-
-                       // Debug Directory
-                       if (code.DebugDirectoryLength != 0)
-                       {
-                               writer.Headers.OptionalHeader.DataDirectory[6].VirtualAddress = code.DebugDirectoryRVA;
-                               writer.Headers.OptionalHeader.DataDirectory[6].Size = code.DebugDirectoryLength;
-                       }
-
-                       // we need to start by computing the number of sections, because code.PointerToRawData depends on that
-                       writer.Headers.FileHeader.NumberOfSections = 1;
-
-                       if (moduleBuilder.initializedData.Length != 0)
-                       {
-                               // .sdata
-                               writer.Headers.FileHeader.NumberOfSections++;
-                       }
-
-                       if (resources != null)
-                       {
-                               // .rsrc
-                               writer.Headers.FileHeader.NumberOfSections++;
-                       }
-
-                       if (imageFileMachine != ImageFileMachine.ARM)
-                       {
-                               // .reloc
-                               writer.Headers.FileHeader.NumberOfSections++;
-                       }
-
-                       SectionHeader text = new SectionHeader();
-                       text.Name = ".text";
-                       text.VirtualAddress = code.BaseRVA;
-                       text.VirtualSize = (uint)code.Length;
-                       text.PointerToRawData = code.PointerToRawData;
-                       text.SizeOfRawData = writer.ToFileAlignment((uint)code.Length);
-                       text.Characteristics = SectionHeader.IMAGE_SCN_CNT_CODE | SectionHeader.IMAGE_SCN_MEM_EXECUTE | SectionHeader.IMAGE_SCN_MEM_READ;
-
-                       SectionHeader sdata = new SectionHeader();
-                       sdata.Name = ".sdata";
-                       sdata.VirtualAddress = text.VirtualAddress + writer.ToSectionAlignment(text.VirtualSize);
-                       sdata.VirtualSize = (uint)moduleBuilder.initializedData.Length;
-                       sdata.PointerToRawData = text.PointerToRawData + text.SizeOfRawData;
-                       sdata.SizeOfRawData = writer.ToFileAlignment((uint)moduleBuilder.initializedData.Length);
-                       sdata.Characteristics = SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA | SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_MEM_WRITE;
-
-                       SectionHeader rsrc = new SectionHeader();
-                       rsrc.Name = ".rsrc";
-                       rsrc.VirtualAddress = sdata.VirtualAddress + writer.ToSectionAlignment(sdata.VirtualSize);
-                       rsrc.PointerToRawData = sdata.PointerToRawData + sdata.SizeOfRawData;
-                       rsrc.VirtualSize = resources == null ? 0 : (uint)resources.Length;
-                       rsrc.SizeOfRawData = writer.ToFileAlignment(rsrc.VirtualSize);
-                       rsrc.Characteristics = SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA;
-
-                       if (rsrc.SizeOfRawData != 0)
-                       {
-                               // Resource Directory
-                               writer.Headers.OptionalHeader.DataDirectory[2].VirtualAddress = rsrc.VirtualAddress;
-                               writer.Headers.OptionalHeader.DataDirectory[2].Size = rsrc.VirtualSize;
-                       }
-
-                       SectionHeader reloc = new SectionHeader();
-                       reloc.Name = ".reloc";
-                       reloc.VirtualAddress = rsrc.VirtualAddress + writer.ToSectionAlignment(rsrc.VirtualSize);
-                       if (imageFileMachine != ImageFileMachine.ARM)
-                       {
-                               reloc.VirtualSize = ((uint)moduleBuilder.unmanagedExports.Count + 1) * 12;
-                       }
-                       reloc.PointerToRawData = rsrc.PointerToRawData + rsrc.SizeOfRawData;
-                       reloc.SizeOfRawData = writer.ToFileAlignment(reloc.VirtualSize);
-                       reloc.Characteristics = SectionHeader.IMAGE_SCN_MEM_READ | SectionHeader.IMAGE_SCN_CNT_INITIALIZED_DATA | SectionHeader.IMAGE_SCN_MEM_DISCARDABLE;
-
-                       if (reloc.SizeOfRawData != 0)
-                       {
-                               // Base Relocation Directory
-                               writer.Headers.OptionalHeader.DataDirectory[5].VirtualAddress = reloc.VirtualAddress;
-                               writer.Headers.OptionalHeader.DataDirectory[5].Size = reloc.VirtualSize;
-                       }
-
-                       writer.Headers.OptionalHeader.SizeOfCode = text.SizeOfRawData;
-                       writer.Headers.OptionalHeader.SizeOfInitializedData = sdata.SizeOfRawData + rsrc.SizeOfRawData + reloc.SizeOfRawData;
-                       writer.Headers.OptionalHeader.SizeOfUninitializedData = 0;
-                       writer.Headers.OptionalHeader.SizeOfImage = reloc.VirtualAddress + writer.ToSectionAlignment(reloc.VirtualSize);
-                       writer.Headers.OptionalHeader.SizeOfHeaders = text.PointerToRawData;
-                       writer.Headers.OptionalHeader.BaseOfCode = code.BaseRVA;
-                       writer.Headers.OptionalHeader.BaseOfData = sdata.VirtualAddress;
-                       writer.Headers.OptionalHeader.ImageBase = (ulong)moduleBuilder.__ImageBase;
-
-                       if (imageFileMachine == ImageFileMachine.IA64)
-                       {
-                               // apparently for IA64 AddressOfEntryPoint points to the address of the entry point
-                               // (i.e. there is an additional layer of indirection), so we add the offset to the pointer
-                               writer.Headers.OptionalHeader.AddressOfEntryPoint = code.StartupStubRVA + 0x20;
-                       }
-                       else if (imageFileMachine != ImageFileMachine.ARM)
-                       {
-                               writer.Headers.OptionalHeader.AddressOfEntryPoint = code.StartupStubRVA;
-                       }
-
-                       writer.WritePEHeaders();
-                       writer.WriteSectionHeader(text);
-                       if (sdata.SizeOfRawData != 0)
-                       {
-                               writer.WriteSectionHeader(sdata);
-                       }
-                       if (rsrc.SizeOfRawData != 0)
-                       {
-                               writer.WriteSectionHeader(rsrc);
-                       }
-                       if (reloc.SizeOfRawData != 0)
-                       {
-                               writer.WriteSectionHeader(reloc);
-                       }
-
-                       stream.Seek(text.PointerToRawData, SeekOrigin.Begin);
-                       code.Write(mw, sdata.VirtualAddress);
-
-                       if (sdata.SizeOfRawData != 0)
-                       {
-                               stream.Seek(sdata.PointerToRawData, SeekOrigin.Begin);
-                               mw.Write(moduleBuilder.initializedData);
-                       }
-
-                       if (rsrc.SizeOfRawData != 0)
-                       {
-                               stream.Seek(rsrc.PointerToRawData, SeekOrigin.Begin);
-                               resources.Write(mw, rsrc.VirtualAddress);
-                       }
-
-                       if (reloc.SizeOfRawData != 0)
-                       {
-                               stream.Seek(reloc.PointerToRawData, SeekOrigin.Begin);
-                               code.WriteRelocations(mw);
-                       }
-
-                       // file alignment
-                       stream.SetLength(reloc.PointerToRawData + reloc.SizeOfRawData);
-
-                       // do the strong naming
-                       if (keyPair != null)
-                       {
-                               StrongName(stream, keyPair, writer.HeaderSize, text.PointerToRawData, code.StrongNameSignatureRVA - text.VirtualAddress + text.PointerToRawData, code.StrongNameSignatureLength);
-                       }
-
-                       if (moduleBuilder.symbolWriter != null)
-                       {
-                               moduleBuilder.WriteSymbolTokenMap();
-                               moduleBuilder.symbolWriter.Close();
-                       }
-               }
-
-               private static int ComputeStrongNameSignatureLength(byte[] publicKey)
-               {
-                       if (publicKey == null)
-                       {
-                               return 0;
-                       }
-                       else if (publicKey.Length == 16)
-                       {
-                               // it must be the ECMA pseudo public key, we don't know the key size of the real key, but currently both Mono and Microsoft use a 1024 bit key size
-                               return 128;
-                       }
-                       else
-                       {
-                               // for the supported strong naming algorithms, the signature size is the same as the key size
-                               // (we have to subtract 32 for the header)
-                               return publicKey.Length - 32;
-                       }
-               }
-
-               private static void StrongName(Stream stream, StrongNameKeyPair keyPair, uint headerLength, uint textSectionFileOffset, uint strongNameSignatureFileOffset, uint strongNameSignatureLength)
-               {
-                       SHA1Managed hash = new SHA1Managed();
-                       using (CryptoStream cs = new CryptoStream(Stream.Null, hash, CryptoStreamMode.Write))
-                       {
-                               stream.Seek(0, SeekOrigin.Begin);
-                               byte[] buf = new byte[8192];
-                               HashChunk(stream, cs, buf, (int)headerLength);
-                               stream.Seek(textSectionFileOffset, SeekOrigin.Begin);
-                               HashChunk(stream, cs, buf, (int)(strongNameSignatureFileOffset - textSectionFileOffset));
-                               stream.Seek(strongNameSignatureLength, SeekOrigin.Current);
-                               HashChunk(stream, cs, buf, (int)(stream.Length - (strongNameSignatureFileOffset + strongNameSignatureLength)));
-                       }
-                       using (RSA rsa = keyPair.CreateRSA())
-                       {
-                               RSAPKCS1SignatureFormatter sign = new RSAPKCS1SignatureFormatter(rsa);
-                               byte[] signature = sign.CreateSignature(hash);
-                               Array.Reverse(signature);
-                               if (signature.Length != strongNameSignatureLength)
-                               {
-                                       throw new InvalidOperationException("Signature length mismatch");
-                               }
-                               stream.Seek(strongNameSignatureFileOffset, SeekOrigin.Begin);
-                               stream.Write(signature, 0, signature.Length);
-                       }
-
-                       // compute the PE checksum
-                       stream.Seek(0, SeekOrigin.Begin);
-                       int count = (int)stream.Length / 4;
-                       BinaryReader br = new BinaryReader(stream);
-                       long sum = 0;
-                       for (int i = 0; i < count; i++)
-                       {
-                               sum += br.ReadUInt32();
-                               int carry = (int)(sum >> 32);
-                               sum &= 0xFFFFFFFFU;
-                               sum += carry;
-                       }
-                       while ((sum >> 16) != 0)
-                       {
-                               sum = (sum & 0xFFFF) + (sum >> 16);
-                       }
-                       sum += stream.Length;
-
-                       // write the PE checksum, note that it is always at offset 0xD8 in the file
-                       ByteBuffer bb = new ByteBuffer(4);
-                       bb.Write((int)sum);
-                       stream.Seek(0xD8, SeekOrigin.Begin);
-                       bb.WriteTo(stream);
-               }
-
-               internal static void HashChunk(Stream stream, CryptoStream cs, byte[] buf, int length)
-               {
-                       while (length > 0)
-                       {
-                               int read = stream.Read(buf, 0, Math.Min(buf.Length, length));
-                               cs.Write(buf, 0, read);
-                               length -= read;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/PEWriter.cs b/mcs/class/IKVM.Reflection/Writer/PEWriter.cs
deleted file mode 100644 (file)
index 665296e..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.IO;
-using BYTE = System.Byte;
-using WORD = System.UInt16;
-using DWORD = System.UInt32;
-using ULONGLONG = System.UInt64;
-using IMAGE_DATA_DIRECTORY = IKVM.Reflection.Reader.IMAGE_DATA_DIRECTORY;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class PEWriter
-       {
-               private readonly BinaryWriter bw;
-               private readonly IMAGE_NT_HEADERS hdr = new IMAGE_NT_HEADERS();
-
-               internal PEWriter(Stream stream)
-               {
-                       bw = new BinaryWriter(stream);
-                       WriteMSDOSHeader();
-               }
-
-               public IMAGE_NT_HEADERS Headers
-               {
-                       get { return hdr; }
-               }
-
-               public uint HeaderSize
-               {
-                       get
-                       {
-                               return (uint)
-                                       ((8 * 16) +     // MSDOS header
-                                       4 +                             // signature
-                                       20 +                    // IMAGE_FILE_HEADER
-                                       hdr.FileHeader.SizeOfOptionalHeader +
-                                       hdr.FileHeader.NumberOfSections * 40);
-                       }
-               }
-
-               private void WriteMSDOSHeader()
-               {
-                       bw.Write(new byte[] {
-                               0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00,
-                               0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
-                               0xB8, 0x00, 0x00, 0x00, 0x00, 0x00,     0x00, 0x00,
-                               0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                               0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-                               0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4, 0x09, 0xCD,
-                               0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68,
-                               0x69, 0x73, 0x20, 0x70, 0x72, 0x6F, 0x67, 0x72,
-                               0x61, 0x6D, 0x20, 0x63, 0x61, 0x6E, 0x6E, 0x6F,
-                               0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6E,
-                               0x20, 0x69, 0x6E, 0x20, 0x44, 0x4F, 0x53, 0x20,
-                               0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A,
-                               0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                       });
-               }
-
-               internal void WritePEHeaders()
-               {
-                       bw.Write(hdr.Signature);
-
-                       // IMAGE_FILE_HEADER
-                       bw.Write(hdr.FileHeader.Machine);
-                       bw.Write(hdr.FileHeader.NumberOfSections);
-                       bw.Write(hdr.FileHeader.TimeDateStamp);
-                       bw.Write(hdr.FileHeader.PointerToSymbolTable);
-                       bw.Write(hdr.FileHeader.NumberOfSymbols);
-                       bw.Write(hdr.FileHeader.SizeOfOptionalHeader);
-                       bw.Write(hdr.FileHeader.Characteristics);
-
-                       // IMAGE_OPTIONAL_HEADER
-                       hdr.OptionalHeader.Write(bw);
-               }
-
-               internal void WriteSectionHeader(SectionHeader sectionHeader)
-               {
-                       byte[] name = new byte[8];
-                       System.Text.Encoding.UTF8.GetBytes(sectionHeader.Name, 0, sectionHeader.Name.Length, name, 0);
-                       bw.Write(name);
-                       bw.Write(sectionHeader.VirtualSize);
-                       bw.Write(sectionHeader.VirtualAddress);
-                       bw.Write(sectionHeader.SizeOfRawData);
-                       bw.Write(sectionHeader.PointerToRawData);
-                       bw.Write(sectionHeader.PointerToRelocations);
-                       bw.Write(sectionHeader.PointerToLinenumbers);
-                       bw.Write(sectionHeader.NumberOfRelocations);
-                       bw.Write(sectionHeader.NumberOfLinenumbers);
-                       bw.Write(sectionHeader.Characteristics);
-               }
-
-               internal uint ToFileAlignment(uint p)
-               {
-                       return (p + (Headers.OptionalHeader.FileAlignment - 1)) & ~(Headers.OptionalHeader.FileAlignment - 1);
-               }
-
-               internal uint ToSectionAlignment(uint p)
-               {
-                       return (p + (Headers.OptionalHeader.SectionAlignment - 1)) & ~(Headers.OptionalHeader.SectionAlignment - 1);
-               }
-       }
-
-       sealed class IMAGE_NT_HEADERS
-       {
-               public DWORD Signature = 0x00004550;    // "PE\0\0"
-               public IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
-               public IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
-       }
-
-       sealed class IMAGE_FILE_HEADER
-       {
-               public const WORD IMAGE_FILE_MACHINE_I386 = 0x014c;
-               public const WORD IMAGE_FILE_MACHINE_ARM = 0x01c4;
-               public const WORD IMAGE_FILE_MACHINE_IA64 = 0x0200;
-               public const WORD IMAGE_FILE_MACHINE_AMD64 = 0x8664;
-
-               public const WORD IMAGE_FILE_32BIT_MACHINE = 0x0100;
-               public const WORD IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
-               public const WORD IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
-               public const WORD IMAGE_FILE_DLL = 0x2000;
-
-               public WORD Machine;
-               public WORD NumberOfSections;
-               public DWORD TimeDateStamp = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
-               public DWORD PointerToSymbolTable = 0;
-               public DWORD NumberOfSymbols = 0;
-               public WORD SizeOfOptionalHeader = 0xE0;
-               public WORD Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
-       }
-
-       sealed class IMAGE_OPTIONAL_HEADER
-       {
-               public const WORD IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
-               public const WORD IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
-
-               public const WORD IMAGE_SUBSYSTEM_WINDOWS_GUI = 2;
-               public const WORD IMAGE_SUBSYSTEM_WINDOWS_CUI = 3;
-
-               public WORD Magic = IMAGE_NT_OPTIONAL_HDR32_MAGIC;
-               public BYTE MajorLinkerVersion = 8;
-               public BYTE MinorLinkerVersion = 0;
-               public DWORD SizeOfCode;
-               public DWORD SizeOfInitializedData;
-               public DWORD SizeOfUninitializedData;
-               public DWORD AddressOfEntryPoint;
-               public DWORD BaseOfCode;
-               public DWORD BaseOfData;
-               public ULONGLONG ImageBase;
-               public DWORD SectionAlignment = 0x2000;
-               public DWORD FileAlignment;
-               public WORD MajorOperatingSystemVersion = 4;
-               public WORD MinorOperatingSystemVersion = 0;
-               public WORD MajorImageVersion = 0;
-               public WORD MinorImageVersion = 0;
-               public WORD MajorSubsystemVersion = 4;
-               public WORD MinorSubsystemVersion = 0;
-               public DWORD Win32VersionValue = 0;
-               public DWORD SizeOfImage;
-               public DWORD SizeOfHeaders;
-               public DWORD CheckSum = 0;
-               public WORD Subsystem;
-               public WORD DllCharacteristics;
-               public ULONGLONG SizeOfStackReserve;
-               public ULONGLONG SizeOfStackCommit = 0x1000;
-               public ULONGLONG SizeOfHeapReserve = 0x100000;
-               public ULONGLONG SizeOfHeapCommit = 0x1000;
-               public DWORD LoaderFlags = 0;
-               public DWORD NumberOfRvaAndSizes = 16;
-               public IMAGE_DATA_DIRECTORY[] DataDirectory = new IMAGE_DATA_DIRECTORY[16];
-
-               internal void Write(BinaryWriter bw)
-               {
-                       bw.Write(Magic);
-                       bw.Write(MajorLinkerVersion);
-                       bw.Write(MinorLinkerVersion);
-                       bw.Write(SizeOfCode);
-                       bw.Write(SizeOfInitializedData);
-                       bw.Write(SizeOfUninitializedData);
-                       bw.Write(AddressOfEntryPoint);
-                       bw.Write(BaseOfCode);
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               bw.Write(BaseOfData);
-                               bw.Write((DWORD)ImageBase);
-                       }
-                       else
-                       {
-                               bw.Write(ImageBase);
-                       }
-                       bw.Write(SectionAlignment);
-                       bw.Write(FileAlignment);
-                       bw.Write(MajorOperatingSystemVersion);
-                       bw.Write(MinorOperatingSystemVersion);
-                       bw.Write(MajorImageVersion);
-                       bw.Write(MinorImageVersion);
-                       bw.Write(MajorSubsystemVersion);
-                       bw.Write(MinorSubsystemVersion);
-                       bw.Write(Win32VersionValue);
-                       bw.Write(SizeOfImage);
-                       bw.Write(SizeOfHeaders);
-                       bw.Write(CheckSum);
-                       bw.Write(Subsystem);
-                       bw.Write(DllCharacteristics);
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               bw.Write((DWORD)SizeOfStackReserve);
-                       }
-                       else
-                       {
-                               bw.Write(SizeOfStackReserve);
-                       }
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               bw.Write((DWORD)SizeOfStackCommit);
-                       }
-                       else
-                       {
-                               bw.Write(SizeOfStackCommit);
-                       }
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               bw.Write((DWORD)SizeOfHeapReserve);
-                       }
-                       else
-                       {
-                               bw.Write(SizeOfHeapReserve);
-                       }
-                       if (Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
-                       {
-                               bw.Write((DWORD)SizeOfHeapCommit);
-                       }
-                       else
-                       {
-                               bw.Write(SizeOfHeapCommit);
-                       }
-                       bw.Write(LoaderFlags);
-                       bw.Write(NumberOfRvaAndSizes);
-                       for (int i = 0; i < DataDirectory.Length; i++)
-                       {
-                               bw.Write(DataDirectory[i].VirtualAddress);
-                               bw.Write(DataDirectory[i].Size);
-                       }
-               }
-       }
-
-       class SectionHeader
-       {
-               public const DWORD IMAGE_SCN_CNT_CODE = 0x00000020;
-               public const DWORD IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040;
-               public const DWORD IMAGE_SCN_MEM_DISCARDABLE = 0x02000000;
-               public const DWORD IMAGE_SCN_MEM_EXECUTE = 0x20000000;
-               public const DWORD IMAGE_SCN_MEM_READ = 0x40000000;
-               public const DWORD IMAGE_SCN_MEM_WRITE = 0x80000000;
-
-               public string Name;             // 8 byte UTF8 encoded 0-padded
-               public DWORD VirtualSize;
-               public DWORD VirtualAddress;
-               public DWORD SizeOfRawData;
-               public DWORD PointerToRawData;
-#pragma warning disable 649 // the follow fields are never assigned to
-               public DWORD PointerToRelocations;
-               public DWORD PointerToLinenumbers;
-               public WORD NumberOfRelocations;
-               public WORD NumberOfLinenumbers;
-#pragma warning restore 649
-               public DWORD Characteristics;
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/ResourceSection.cs b/mcs/class/IKVM.Reflection/Writer/ResourceSection.cs
deleted file mode 100644 (file)
index 3789ca2..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
-  Copyright (C) 2010-2012 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using IKVM.Reflection.Reader;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class ResourceSection
-       {
-               private const int RT_ICON = 3;
-               private const int RT_GROUP_ICON = 14;
-               private const int RT_VERSION = 16;
-               private const int RT_MANIFEST = 24;
-               private ResourceDirectoryEntry root = new ResourceDirectoryEntry(new OrdinalOrName("root"));
-               private ByteBuffer bb;
-               private List<int> linkOffsets;
-
-               internal void AddVersionInfo(ByteBuffer versionInfo)
-               {
-                       root[new OrdinalOrName(RT_VERSION)][new OrdinalOrName(1)][new OrdinalOrName(0)].Data = versionInfo;
-               }
-
-               internal void AddIcon(byte[] iconFile)
-               {
-                       BinaryReader br = new BinaryReader(new MemoryStream(iconFile));
-                       ushort idReserved = br.ReadUInt16();
-                       ushort idType = br.ReadUInt16();
-                       ushort idCount = br.ReadUInt16();
-                       if (idReserved != 0 || idType != 1)
-                       {
-                               throw new ArgumentException("The supplied byte array is not a valid .ico file.");
-                       }
-                       ByteBuffer group = new ByteBuffer(6 + 14 * idCount);
-                       group.Write(idReserved);
-                       group.Write(idType);
-                       group.Write(idCount);
-                       for (int i = 0; i < idCount; i++)
-                       {
-                               byte bWidth = br.ReadByte();
-                               byte bHeight = br.ReadByte();
-                               byte bColorCount = br.ReadByte();
-                               byte bReserved = br.ReadByte();
-                               ushort wPlanes = br.ReadUInt16();
-                               ushort wBitCount = br.ReadUInt16();
-                               uint dwBytesInRes = br.ReadUInt32();
-                               uint dwImageOffset = br.ReadUInt32();
-
-                               // we start the icon IDs at 2
-                               ushort id = (ushort)(2 + i);
-
-                               group.Write(bWidth);
-                               group.Write(bHeight);
-                               group.Write(bColorCount);
-                               group.Write(bReserved);
-                               group.Write(wPlanes);
-                               group.Write(wBitCount);
-                               group.Write(dwBytesInRes);
-                               group.Write(id);
-
-                               byte[] icon = new byte[dwBytesInRes];
-                               Buffer.BlockCopy(iconFile, (int)dwImageOffset, icon, 0, icon.Length);
-                               root[new OrdinalOrName(RT_ICON)][new OrdinalOrName(id)][new OrdinalOrName(0)].Data = ByteBuffer.Wrap(icon);
-                       }
-                       root[new OrdinalOrName(RT_GROUP_ICON)][new OrdinalOrName(32512)][new OrdinalOrName(0)].Data = group;
-               }
-
-               internal void AddManifest(byte[] manifest, ushort resourceID)
-               {
-                       root[new OrdinalOrName(RT_MANIFEST)][new OrdinalOrName(resourceID)][new OrdinalOrName(0)].Data = ByteBuffer.Wrap(manifest);
-               }
-
-               internal void ExtractResources(byte[] buf)
-               {
-                       ByteReader br = new ByteReader(buf, 0, buf.Length);
-                       while (br.Length >= 32)
-                       {
-                               br.Align(4);
-                               RESOURCEHEADER hdr = new RESOURCEHEADER(br);
-                               if (hdr.DataSize != 0)
-                               {
-                                       root[hdr.TYPE][hdr.NAME][new OrdinalOrName(hdr.LanguageId)].Data = ByteBuffer.Wrap(br.ReadBytes(hdr.DataSize));
-                               }
-                       }
-               }
-
-               internal void Finish()
-               {
-                       if (bb != null)
-                       {
-                               throw new InvalidOperationException();
-                       }
-                       bb = new ByteBuffer(1024);
-                       linkOffsets = new List<int>();
-                       root.Write(bb, linkOffsets);
-                       root = null;
-               }
-
-               internal int Length
-               {
-                       get { return bb.Length; }
-               }
-
-               internal void Write(MetadataWriter mw, uint rva)
-               {
-                       foreach (int offset in linkOffsets)
-                       {
-                               bb.Position = offset;
-                               bb.Write(bb.GetInt32AtCurrentPosition() + (int)rva);
-                       }
-                       mw.Write(bb);
-               }
-       }
-
-       sealed class ResourceDirectoryEntry
-       {
-               internal readonly OrdinalOrName OrdinalOrName;
-               internal ByteBuffer Data;
-               private int namedEntries;
-               private readonly List<ResourceDirectoryEntry> entries = new List<ResourceDirectoryEntry>();
-
-               internal ResourceDirectoryEntry(OrdinalOrName id)
-               {
-                       this.OrdinalOrName = id;
-               }
-
-               internal ResourceDirectoryEntry this[OrdinalOrName id]
-               {
-                       get
-                       {
-                               foreach (ResourceDirectoryEntry entry in entries)
-                               {
-                                       if (entry.OrdinalOrName.IsEqual(id))
-                                       {
-                                               return entry;
-                                       }
-                               }
-                               // the entries must be sorted
-                               ResourceDirectoryEntry newEntry = new ResourceDirectoryEntry(id);
-                               if (id.Name == null)
-                               {
-                                       for (int i = namedEntries; i < entries.Count; i++)
-                                       {
-                                               if (entries[i].OrdinalOrName.IsGreaterThan(id))
-                                               {
-                                                       entries.Insert(i, newEntry);
-                                                       return newEntry;
-                                               }
-                                       }
-                                       entries.Add(newEntry);
-                                       return newEntry;
-                               }
-                               else
-                               {
-                                       for (int i = 0; i < namedEntries; i++)
-                                       {
-                                               if (entries[i].OrdinalOrName.IsGreaterThan(id))
-                                               {
-                                                       entries.Insert(i, newEntry);
-                                                       namedEntries++;
-                                                       return newEntry;
-                                               }
-                                       }
-                                       entries.Insert(namedEntries++, newEntry);
-                                       return newEntry;
-                               }
-                       }
-               }
-
-               private int DirectoryLength
-               {
-                       get
-                       {
-                               if (Data != null)
-                               {
-                                       return 16;
-                               }
-                               else
-                               {
-                                       int length = 16 + entries.Count * 8;
-                                       foreach (ResourceDirectoryEntry entry in entries)
-                                       {
-                                               length += entry.DirectoryLength;
-                                       }
-                                       return length;
-                               }
-                       }
-               }
-
-               internal void Write(ByteBuffer bb, List<int> linkOffsets)
-               {
-                       if (entries.Count != 0)
-                       {
-                               int stringTableOffset = this.DirectoryLength;
-                               Dictionary<string, int> strings = new Dictionary<string, int>();
-                               ByteBuffer stringTable = new ByteBuffer(16);
-                               int offset = 16 + entries.Count * 8;
-                               for (int pass = 0; pass < 3; pass++)
-                               {
-                                       Write(bb, pass, 0, ref offset, strings, ref stringTableOffset, stringTable);
-                               }
-                               // the pecoff spec says that the string table is between the directory entries and the data entries,
-                               // but the windows linker puts them after the data entries, so we do too.
-                               stringTable.Align(4);
-                               offset += stringTable.Length;
-                               WriteResourceDataEntries(bb, linkOffsets, ref offset);
-                               bb.Write(stringTable);
-                               WriteData(bb);
-                       }
-               }
-
-               private void WriteResourceDataEntries(ByteBuffer bb, List<int> linkOffsets, ref int offset)
-               {
-                       foreach (ResourceDirectoryEntry entry in entries)
-                       {
-                               if (entry.Data != null)
-                               {
-                                       linkOffsets.Add(bb.Position);
-                                       bb.Write(offset);
-                                       bb.Write(entry.Data.Length);
-                                       bb.Write(0);    // code page
-                                       bb.Write(0);    // reserved
-                                       offset += (entry.Data.Length + 3) & ~3;
-                               }
-                               else
-                               {
-                                       entry.WriteResourceDataEntries(bb, linkOffsets, ref offset);
-                               }
-                       }
-               }
-
-               private void WriteData(ByteBuffer bb)
-               {
-                       foreach (ResourceDirectoryEntry entry in entries)
-                       {
-                               if (entry.Data != null)
-                               {
-                                       bb.Write(entry.Data);
-                                       bb.Align(4);
-                               }
-                               else
-                               {
-                                       entry.WriteData(bb);
-                               }
-                       }
-               }
-
-               private void Write(ByteBuffer bb, int writeDepth, int currentDepth, ref int offset, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
-               {
-                       if (currentDepth == writeDepth)
-                       {
-                               // directory header
-                               bb.Write(0);    // Characteristics
-                               bb.Write(0);    // Time/Date Stamp
-                               bb.Write(0);    // Version (Major / Minor)
-                               bb.Write((ushort)namedEntries);
-                               bb.Write((ushort)(entries.Count - namedEntries));
-                       }
-                       foreach (ResourceDirectoryEntry entry in entries)
-                       {
-                               if (currentDepth == writeDepth)
-                               {
-                                       entry.WriteEntry(bb, ref offset, strings, ref stringTableOffset, stringTable);
-                               }
-                               else
-                               {
-                                       entry.Write(bb, writeDepth, currentDepth + 1, ref offset, strings, ref stringTableOffset, stringTable);
-                               }
-                       }
-               }
-
-               private void WriteEntry(ByteBuffer bb, ref int offset, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
-               {
-                       WriteNameOrOrdinal(bb, OrdinalOrName, strings, ref stringTableOffset, stringTable);
-                       if (Data == null)
-                       {
-                               bb.Write(0x80000000U | (uint)offset);
-                       }
-                       else
-                       {
-                               bb.Write(offset);
-                       }
-                       offset += 16 + entries.Count * 8;
-               }
-
-               private static void WriteNameOrOrdinal(ByteBuffer bb, OrdinalOrName id, Dictionary<string, int> strings, ref int stringTableOffset, ByteBuffer stringTable)
-               {
-                       if (id.Name == null)
-                       {
-                               bb.Write((int)id.Ordinal);
-                       }
-                       else
-                       {
-                               int stringOffset;
-                               if (!strings.TryGetValue(id.Name, out stringOffset))
-                               {
-                                       stringOffset = stringTableOffset;
-                                       strings.Add(id.Name, stringOffset);
-                                       stringTableOffset += id.Name.Length * 2 + 2;
-                                       stringTable.Write((ushort)id.Name.Length);
-                                       foreach (char c in id.Name)
-                                       {
-                                               stringTable.Write((short)c);
-                                       }
-                               }
-                               bb.Write(0x80000000U | (uint)stringOffset);
-                       }
-               }
-       }
-
-       struct OrdinalOrName
-       {
-               internal readonly ushort Ordinal;
-               internal readonly string Name;
-
-               internal OrdinalOrName(ushort value)
-               {
-                       Ordinal = value;
-                       Name = null;
-               }
-
-               internal OrdinalOrName(string value)
-               {
-                       Ordinal = 0xFFFF;
-                       Name = value;
-               }
-
-               internal bool IsGreaterThan(OrdinalOrName other)
-               {
-                       return this.Name == null
-                               ? this.Ordinal > other.Ordinal
-                               : String.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase) > 0;
-               }
-
-               internal bool IsEqual(OrdinalOrName other)
-               {
-                       return this.Name == null
-                               ? this.Ordinal == other.Ordinal
-                               : String.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase) == 0;
-               }
-       }
-
-       struct RESOURCEHEADER
-       {
-               internal int DataSize;
-               internal int HeaderSize;
-               internal OrdinalOrName TYPE;
-               internal OrdinalOrName NAME;
-               internal int DataVersion;
-               internal ushort MemoryFlags;
-               internal ushort LanguageId;
-               internal int Version;
-               internal int Characteristics;
-
-               internal RESOURCEHEADER(ByteReader br)
-               {
-                       DataSize = br.ReadInt32();
-                       HeaderSize = br.ReadInt32();
-                       TYPE = ReadOrdinalOrName(br);
-                       NAME = ReadOrdinalOrName(br);
-                       br.Align(4);
-                       DataVersion = br.ReadInt32();
-                       MemoryFlags = br.ReadUInt16();
-                       LanguageId = br.ReadUInt16();
-                       Version = br.ReadInt32();
-                       Characteristics = br.ReadInt32();
-               }
-
-               private static OrdinalOrName ReadOrdinalOrName(ByteReader br)
-               {
-                       char c = br.ReadChar();
-                       if (c == 0xFFFF)
-                       {
-                               return new OrdinalOrName(br.ReadUInt16());
-                       }
-                       else
-                       {
-                               StringBuilder sb = new StringBuilder();
-                               while (c != 0)
-                               {
-                                       sb.Append(c);
-                                       c = br.ReadChar();
-                               }
-                               return new OrdinalOrName(sb.ToString());
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/TextSection.cs b/mcs/class/IKVM.Reflection/Writer/TextSection.cs
deleted file mode 100644 (file)
index a8b4785..0000000
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
-  Copyright (C) 2008-2011 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using IKVM.Reflection.Emit;
-using IKVM.Reflection.Impl;
-using IKVM.Reflection.Metadata;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class TextSection
-       {
-               private readonly PEWriter peWriter;
-               private readonly CliHeader cliHeader;
-               private readonly ModuleBuilder moduleBuilder;
-               private readonly uint strongNameSignatureLength;
-               private readonly ExportTables exportTables;
-
-               internal TextSection(PEWriter peWriter, CliHeader cliHeader, ModuleBuilder moduleBuilder, int strongNameSignatureLength)
-               {
-                       this.peWriter = peWriter;
-                       this.cliHeader = cliHeader;
-                       this.moduleBuilder = moduleBuilder;
-                       this.strongNameSignatureLength = (uint)strongNameSignatureLength;
-                       if (moduleBuilder.unmanagedExports.Count != 0)
-                       {
-                               this.exportTables = new ExportTables(this);
-                       }
-               }
-
-               internal uint PointerToRawData
-               {
-                       get { return peWriter.ToFileAlignment(peWriter.HeaderSize); }
-               }
-
-               internal uint BaseRVA
-               {
-                       get { return 0x2000; }
-               }
-
-               internal uint ImportAddressTableRVA
-               {
-                       get { return BaseRVA; }
-               }
-
-               internal uint ImportAddressTableLength
-               {
-                       get
-                       {
-                               switch (peWriter.Headers.FileHeader.Machine)
-                               {
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                               return 8;
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
-                                               return 0;
-                                       default:
-                                               return 16;
-                               }
-                       }
-               }
-
-               internal uint ComDescriptorRVA
-               {
-                       get { return ImportAddressTableRVA + ImportAddressTableLength; }
-               }
-
-               internal uint ComDescriptorLength
-               {
-                       get { return cliHeader.Cb; }
-               }
-
-               internal uint MethodBodiesRVA
-               {
-                       get { return (ComDescriptorRVA + ComDescriptorLength + 7) & ~7U; }
-               }
-
-               private uint MethodBodiesLength
-               {
-                       get { return (uint)moduleBuilder.methodBodies.Length; }
-               }
-
-               private uint ResourcesRVA
-               {
-                       get
-                       {
-                               switch (peWriter.Headers.FileHeader.Machine)
-                               {
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
-                                               return (MethodBodiesRVA + MethodBodiesLength + 3) & ~3U;
-                                       default:
-                                               return (MethodBodiesRVA + MethodBodiesLength + 15) & ~15U;
-                               }
-                       }
-               }
-
-               private uint ResourcesLength
-               {
-                       get { return (uint)moduleBuilder.manifestResources.Length; }
-               }
-
-               internal uint StrongNameSignatureRVA
-               {
-                       get
-                       {
-                               return (ResourcesRVA + ResourcesLength + 3) & ~3U;
-                       }
-               }
-
-               internal uint StrongNameSignatureLength
-               {
-                       get
-                       {
-                               return strongNameSignatureLength;
-                       }
-               }
-
-               private uint MetadataRVA
-               {
-                       get
-                       {
-                               return (StrongNameSignatureRVA + StrongNameSignatureLength + 3) & ~3U;
-                       }
-               }
-
-               private uint MetadataLength
-               {
-                       get { return (uint)moduleBuilder.MetadataLength; }
-               }
-
-               private uint VTableFixupsRVA
-               {
-                       get { return (MetadataRVA + MetadataLength + 7) & ~7U; }
-               }
-
-               private uint VTableFixupsLength
-               {
-                       get { return (uint)moduleBuilder.vtablefixups.Count * 8; }
-               }
-
-               internal uint DebugDirectoryRVA
-               {
-                       get { return VTableFixupsRVA + VTableFixupsLength; }
-               }
-
-               internal uint DebugDirectoryLength
-               {
-                       get
-                       {
-                               if (DebugDirectoryContentsLength != 0)
-                               {
-                                       return 28;
-                               }
-                               return 0;
-                       }
-               }
-
-               private uint DebugDirectoryContentsLength
-               {
-                       get
-                       {
-                               if (moduleBuilder.symbolWriter != null)
-                               {
-                                       IMAGE_DEBUG_DIRECTORY idd = new IMAGE_DEBUG_DIRECTORY();
-                                       return (uint)SymbolSupport.GetDebugInfo(moduleBuilder.symbolWriter, ref idd).Length;
-                               }
-                               return 0;
-                       }
-               }
-
-               internal uint ExportDirectoryRVA
-               {
-                       get { return (DebugDirectoryRVA + DebugDirectoryLength + DebugDirectoryContentsLength + 15) & ~15U; }
-               }
-
-               internal uint ExportDirectoryLength
-               {
-                       get { return moduleBuilder.unmanagedExports.Count == 0 ? 0U : 40U; }
-               }
-
-               private uint ExportTablesRVA
-               {
-                       get { return ExportDirectoryRVA + ExportDirectoryLength; }
-               }
-
-               private uint ExportTablesLength
-               {
-                       get { return exportTables == null ? 0U : exportTables.Length; }
-               }
-
-               internal uint ImportDirectoryRVA
-               {
-                       // on AMD64 (and probably IA64) the import directory needs to be 16 byte aligned (on I386 4 byte alignment is sufficient)
-                       get { return (ExportTablesRVA + ExportTablesLength + 15) & ~15U; }
-               }
-
-               internal uint ImportDirectoryLength
-               {
-                       get
-                       {
-                               switch (peWriter.Headers.FileHeader.Machine)
-                               {
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
-                                               return 0;
-                                       default:
-                                               return (ImportHintNameTableRVA - ImportDirectoryRVA) + 27;
-                               }
-                       }
-               }
-
-               private uint ImportHintNameTableRVA
-               {
-                       get
-                       {
-                               if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
-                               {
-                                       return (ImportDirectoryRVA + 48 + 15) & ~15U;
-                               }
-                               else
-                               {
-                                       return (ImportDirectoryRVA + 48 + 4 + 15) & ~15U;
-                               }
-                       }
-               }
-
-               internal uint StartupStubRVA
-               {
-                       get
-                       {
-                               if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64)
-                               {
-                                       // note that the alignment is driven by the requirement that the two relocation fixups are in a single page
-                                       return (ImportDirectoryRVA + ImportDirectoryLength + 15U) & ~15U;
-                               }
-                               else
-                               {
-                                       // the additional 2 bytes padding are to align the address in the jump (which is a relocation fixup)
-                                       return 2 + ((ImportDirectoryRVA + ImportDirectoryLength + 3U) & ~3U);
-                               }
-                       }
-               }
-
-               internal uint StartupStubLength
-               {
-                       get
-                       {
-                               switch (peWriter.Headers.FileHeader.Machine)
-                               {
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                               return 6;
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
-                                               return 12;
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
-                                               return 48;
-                                       default:
-                                               return 0;
-                               }
-                       }
-               }
-
-               private void WriteRVA(MetadataWriter mw, uint rva)
-               {
-                       switch (peWriter.Headers.FileHeader.Machine)
-                       {
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_ARM:
-                                       mw.Write(rva);
-                                       break;
-                               default:
-                                       mw.Write((ulong)rva);
-                                       break;
-                       }
-               }
-
-               internal void Write(MetadataWriter mw, uint sdataRVA)
-               {
-                       // Now that we're ready to start writing, we need to do some fix ups
-                       moduleBuilder.TypeRef.Fixup(moduleBuilder);
-                       moduleBuilder.MethodDef.Fixup(this);
-                       moduleBuilder.MethodImpl.Fixup(moduleBuilder);
-                       moduleBuilder.MethodSemantics.Fixup(moduleBuilder);
-                       moduleBuilder.InterfaceImpl.Fixup();
-                       moduleBuilder.ResolveInterfaceImplPseudoTokens();
-                       moduleBuilder.MemberRef.Fixup(moduleBuilder);
-                       moduleBuilder.Constant.Fixup(moduleBuilder);
-                       moduleBuilder.FieldMarshal.Fixup(moduleBuilder);
-                       moduleBuilder.DeclSecurity.Fixup(moduleBuilder);
-                       moduleBuilder.GenericParam.Fixup(moduleBuilder);
-                       moduleBuilder.CustomAttribute.Fixup(moduleBuilder);
-                       moduleBuilder.FieldLayout.Fixup(moduleBuilder);
-                       moduleBuilder.FieldRVA.Fixup(moduleBuilder, (int)sdataRVA, (int)this.MethodBodiesRVA);
-                       moduleBuilder.ImplMap.Fixup(moduleBuilder);
-                       moduleBuilder.ExportedType.Fixup(moduleBuilder);
-                       moduleBuilder.ManifestResource.Fixup(moduleBuilder);
-                       moduleBuilder.MethodSpec.Fixup(moduleBuilder);
-                       moduleBuilder.GenericParamConstraint.Fixup(moduleBuilder);
-
-                       // Import Address Table
-                       AssertRVA(mw, ImportAddressTableRVA);
-                       if (ImportAddressTableLength != 0)
-                       {
-                               WriteRVA(mw, ImportHintNameTableRVA);
-                               WriteRVA(mw, 0);
-                       }
-
-                       // CLI Header
-                       AssertRVA(mw, ComDescriptorRVA);
-                       cliHeader.MetaData.VirtualAddress = MetadataRVA;
-                       cliHeader.MetaData.Size = MetadataLength;
-                       if (ResourcesLength != 0)
-                       {
-                               cliHeader.Resources.VirtualAddress = ResourcesRVA;
-                               cliHeader.Resources.Size = ResourcesLength;
-                       }
-                       if (StrongNameSignatureLength != 0)
-                       {
-                               cliHeader.StrongNameSignature.VirtualAddress = StrongNameSignatureRVA;
-                               cliHeader.StrongNameSignature.Size = StrongNameSignatureLength;
-                       }
-                       if (VTableFixupsLength != 0)
-                       {
-                               cliHeader.VTableFixups.VirtualAddress = VTableFixupsRVA;
-                               cliHeader.VTableFixups.Size = VTableFixupsLength;
-                       }
-                       cliHeader.Write(mw);
-
-                       // alignment padding
-                       for (int i = (int)(MethodBodiesRVA - (ComDescriptorRVA + ComDescriptorLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Method Bodies
-                       mw.Write(moduleBuilder.methodBodies);
-
-                       // alignment padding
-                       for (int i = (int)(ResourcesRVA - (MethodBodiesRVA + MethodBodiesLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Resources
-                       mw.Write(moduleBuilder.manifestResources);
-
-                       // The strong name signature live here (if it exists), but it will written later
-                       // and the following alignment padding will take care of reserving the space.
-
-                       // alignment padding
-                       for (int i = (int)(MetadataRVA - (ResourcesRVA + ResourcesLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Metadata
-                       AssertRVA(mw, MetadataRVA);
-                       moduleBuilder.WriteMetadata(mw);
-
-                       // alignment padding
-                       for (int i = (int)(VTableFixupsRVA - (MetadataRVA + MetadataLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // VTableFixups
-                       AssertRVA(mw, VTableFixupsRVA);
-                       WriteVTableFixups(mw, sdataRVA);
-
-                       // Debug Directory
-                       AssertRVA(mw, DebugDirectoryRVA);
-                       WriteDebugDirectory(mw);
-
-                       // alignment padding
-                       for (int i = (int)(ExportDirectoryRVA - (DebugDirectoryRVA + DebugDirectoryLength + DebugDirectoryContentsLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Export Directory
-                       AssertRVA(mw, ExportDirectoryRVA);
-                       WriteExportDirectory(mw);
-
-                       // Export Tables
-                       AssertRVA(mw, ExportTablesRVA);
-                       WriteExportTables(mw, sdataRVA);
-       
-                       // alignment padding
-                       for (int i = (int)(ImportDirectoryRVA - (ExportTablesRVA + ExportTablesLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Import Directory
-                       AssertRVA(mw, ImportDirectoryRVA);
-                       if (ImportDirectoryLength != 0)
-                       {
-                               WriteImportDirectory(mw);
-                       }
-
-                       // alignment padding
-                       for (int i = (int)(StartupStubRVA - (ImportDirectoryRVA + ImportDirectoryLength)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Startup Stub
-                       AssertRVA(mw, StartupStubRVA);
-                       if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64)
-                       {
-                               /*
-                                *   48 A1 00 20 40 00 00 00 00 00        mov         rax,qword ptr [0000000000402000h]
-                                *   FF E0                                jmp         rax
-                                */
-                               mw.Write((ushort)0xA148);
-                               mw.Write(peWriter.Headers.OptionalHeader.ImageBase + ImportAddressTableRVA);
-                               mw.Write((ushort)0xE0FF);
-                       }
-                       else if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64)
-                       {
-                               mw.Write(new byte[] {
-                                               0x0B, 0x48, 0x00, 0x02, 0x18, 0x10, 0xA0, 0x40, 0x24, 0x30, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00,
-                                               0x10, 0x08, 0x00, 0x12, 0x18, 0x10, 0x60, 0x50, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00
-                                       });
-                               mw.Write(peWriter.Headers.OptionalHeader.ImageBase + StartupStubRVA);
-                               mw.Write(peWriter.Headers.OptionalHeader.ImageBase + BaseRVA);
-                       }
-                       else if (peWriter.Headers.FileHeader.Machine == IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
-                       {
-                               mw.Write((ushort)0x25FF);
-                               mw.Write((uint)peWriter.Headers.OptionalHeader.ImageBase + ImportAddressTableRVA);
-                       }
-               }
-
-               [Conditional("DEBUG")]
-               private void AssertRVA(MetadataWriter mw, uint rva)
-               {
-                       Debug.Assert(mw.Position - PointerToRawData + BaseRVA == rva);
-               }
-
-               private void WriteVTableFixups(MetadataWriter mw, uint sdataRVA)
-               {
-                       foreach (ModuleBuilder.VTableFixups fixups in moduleBuilder.vtablefixups)
-                       {
-                               mw.Write(fixups.initializedDataOffset + sdataRVA);
-                               mw.Write(fixups.count);
-                               mw.Write(fixups.type);
-                       }
-               }
-
-               private void WriteDebugDirectory(MetadataWriter mw)
-               {
-                       if (DebugDirectoryLength != 0)
-                       {
-                               IMAGE_DEBUG_DIRECTORY idd = new IMAGE_DEBUG_DIRECTORY();
-                               idd.Characteristics = 0;
-                               idd.TimeDateStamp = peWriter.Headers.FileHeader.TimeDateStamp;
-                               byte[] buf = SymbolSupport.GetDebugInfo(moduleBuilder.symbolWriter, ref idd);
-                               idd.PointerToRawData = (DebugDirectoryRVA - BaseRVA) + DebugDirectoryLength + PointerToRawData;
-                               idd.AddressOfRawData = DebugDirectoryRVA + DebugDirectoryLength;
-                               mw.Write(idd.Characteristics);
-                               mw.Write(idd.TimeDateStamp);
-                               mw.Write(idd.MajorVersion);
-                               mw.Write(idd.MinorVersion);
-                               mw.Write(idd.Type);
-                               mw.Write(idd.SizeOfData);
-                               mw.Write(idd.AddressOfRawData);
-                               mw.Write(idd.PointerToRawData);
-                               mw.Write(buf);
-                       }
-               }
-
-               private sealed class ExportTables
-               {
-                       private readonly TextSection text;
-                       internal readonly uint entries;
-                       internal readonly uint ordinalBase;
-                       internal readonly uint nameCount;
-                       internal readonly uint namesLength;
-                       internal readonly uint exportAddressTableRVA;
-                       internal readonly uint exportNamePointerTableRVA;
-                       internal readonly uint exportOrdinalTableRVA;
-                       internal readonly uint namesRVA;
-                       internal readonly uint stubsRVA;
-                       private readonly uint stubLength;
-
-                       internal ExportTables(TextSection text)
-                       {
-                               this.text = text;
-                               ordinalBase = GetOrdinalBase(out entries);
-                               namesLength = GetExportNamesLength(out nameCount);
-                               exportAddressTableRVA = text.ExportTablesRVA;
-                               exportNamePointerTableRVA = exportAddressTableRVA + 4 * entries;
-                               exportOrdinalTableRVA = exportNamePointerTableRVA + 4 * nameCount;
-                               namesRVA = exportOrdinalTableRVA + 2 * nameCount;
-                               stubsRVA = (namesRVA + namesLength + 15) & ~15U;
-                               // note that we align the stubs to avoid having to deal with the relocation crossing a page boundary
-                               switch (text.peWriter.Headers.FileHeader.Machine)
-                               {
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                               stubLength = 8;
-                                               break;
-                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
-                                               stubLength = 16;
-                                               break;
-                                       default:
-                                               throw new NotImplementedException();
-                               }
-                       }
-
-                       internal uint Length
-                       {
-                               get { return (stubsRVA + stubLength * (uint)text.moduleBuilder.unmanagedExports.Count) - text.ExportTablesRVA; }
-                       }
-
-                       private uint GetOrdinalBase(out uint entries)
-                       {
-                               uint min = uint.MaxValue;
-                               uint max = uint.MinValue;
-                               foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
-                               {
-                                       uint ordinal = (uint)exp.ordinal;
-                                       min = Math.Min(min, ordinal);
-                                       max = Math.Max(max, ordinal);
-                               }
-                               entries = 1 + (max - min);
-                               return min;
-                       }
-
-                       private uint GetExportNamesLength(out uint nameCount)
-                       {
-                               nameCount = 0;
-                               // the first name in the names list is the module name (the Export Directory contains a name of the current module)
-                               uint length = (uint)text.moduleBuilder.fileName.Length + 1;
-                               foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
-                               {
-                                       if (exp.name != null)
-                                       {
-                                               nameCount++;
-                                               length += (uint)exp.name.Length + 1;
-                                       }
-                               }
-                               return length;
-                       }
-
-                       internal void Write(MetadataWriter mw, uint sdataRVA)
-                       {
-                               // sort the exports by ordinal
-                               text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportOrdinals);
-
-                               // Now write the Export Address Table
-                               text.AssertRVA(mw, exportAddressTableRVA);
-                               for (int i = 0, pos = 0; i < entries; i++)
-                               {
-                                       if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
-                                       {
-                                               mw.Write(stubsRVA + (uint)pos * stubLength);
-                                               pos++;
-                                       }
-                                       else
-                                       {
-                                               mw.Write(0);
-                                       }
-                               }
-
-                               // sort the exports by name
-                               text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportNames);
-
-                               // Now write the Export Name Pointer Table
-                               text.AssertRVA(mw, exportNamePointerTableRVA);
-                               uint nameOffset = (uint)text.moduleBuilder.fileName.Length + 1;
-                               foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
-                               {
-                                       if (exp.name != null)
-                                       {
-                                               mw.Write(namesRVA + nameOffset);
-                                               nameOffset += (uint)exp.name.Length + 1;
-                                       }
-                               }
-
-                               // Now write the Export Ordinal Table
-                               text.AssertRVA(mw, exportOrdinalTableRVA);
-                               foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
-                               {
-                                       if (exp.name != null)
-                                       {
-                                               mw.Write((ushort)(exp.ordinal - ordinalBase));
-                                       }
-                               }
-
-                               // Now write the actual names
-                               text.AssertRVA(mw, namesRVA);
-                               mw.Write(Encoding.ASCII.GetBytes(text.moduleBuilder.fileName));
-                               mw.Write((byte)0);
-                               foreach (UnmanagedExport exp in text.moduleBuilder.unmanagedExports)
-                               {
-                                       if (exp.name != null)
-                                       {
-                                               mw.Write(Encoding.ASCII.GetBytes(exp.name));
-                                               mw.Write((byte)0);
-                                       }
-                               }
-                               text.AssertRVA(mw, namesRVA + namesLength);
-
-                               // alignment padding
-                               for (int i = (int)(stubsRVA - (namesRVA + namesLength)); i > 0; i--)
-                               {
-                                       mw.Write((byte)0);
-                               }
-
-                               // sort the exports by ordinal
-                               text.moduleBuilder.unmanagedExports.Sort(CompareUnmanagedExportOrdinals);
-
-                               // Now write the stubs
-                               text.AssertRVA(mw, stubsRVA);
-
-                               for (int i = 0, pos = 0; i < entries; i++)
-                               {
-                                       if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
-                                       {
-                                               switch (text.peWriter.Headers.FileHeader.Machine)
-                                               {
-                                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                                               mw.Write((byte)0xFF);
-                                                               mw.Write((byte)0x25);
-                                                               mw.Write((uint)text.peWriter.Headers.OptionalHeader.ImageBase + text.moduleBuilder.unmanagedExports[pos].rva.initializedDataOffset + sdataRVA);
-                                                               mw.Write((short)0);     // alignment
-                                                               break;
-                                                       case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
-                                                               mw.Write((byte)0x48);
-                                                               mw.Write((byte)0xA1);
-                                                               mw.Write(text.peWriter.Headers.OptionalHeader.ImageBase + text.moduleBuilder.unmanagedExports[pos].rva.initializedDataOffset + sdataRVA);
-                                                               mw.Write((byte)0xFF);
-                                                               mw.Write((byte)0xE0);
-                                                               mw.Write(0); // alignment
-                                                               break;
-                                                       default:
-                                                               throw new NotImplementedException();
-                                               }
-                                               pos++;
-                                       }
-                               }
-                       }
-
-                       private static int CompareUnmanagedExportNames(UnmanagedExport x, UnmanagedExport y)
-                       {
-                               if (x.name == null)
-                               {
-                                       return y.name == null ? 0 : 1;
-                               }
-                               if (y.name == null)
-                               {
-                                       return -1;
-                               }
-                               return x.name.CompareTo(y.name);
-                       }
-
-                       private static int CompareUnmanagedExportOrdinals(UnmanagedExport x, UnmanagedExport y)
-                       {
-                               return x.ordinal.CompareTo(y.ordinal);
-                       }
-
-                       internal void WriteRelocations(MetadataWriter mw)
-                       {
-                               // we assume that unmanagedExports is still sorted by ordinal
-                               for (int i = 0, pos = 0; i < entries; i++)
-                               {
-                                       if (text.moduleBuilder.unmanagedExports[pos].ordinal == i + ordinalBase)
-                                       {
-                                               // both I386 and AMD64 have the address at offset 2
-                                               text.WriteRelocationBlock(mw, stubsRVA + 2 + (uint)pos * stubLength);
-                                               pos++;
-                                       }
-                               }
-                       }
-               }
-
-               private uint GetOrdinalBase(out uint entries)
-               {
-                       uint min = uint.MaxValue;
-                       uint max = uint.MinValue;
-                       foreach (UnmanagedExport exp in moduleBuilder.unmanagedExports)
-                       {
-                               uint ordinal = (uint)exp.ordinal;
-                               min = Math.Min(min, ordinal);
-                               max = Math.Max(max, ordinal);
-                       }
-                       entries = 1 + (max - min);
-                       return min;
-               }
-
-               private uint GetExportNamesLength(out uint nameCount)
-               {
-                       nameCount = 0;
-                       uint length = 0;
-                       foreach (UnmanagedExport exp in moduleBuilder.unmanagedExports)
-                       {
-                               if (exp.name != null)
-                               {
-                                       nameCount++;
-                                       length += (uint)exp.name.Length + 1;
-                               }
-                       }
-                       return length;
-               }
-
-               private void WriteExportDirectory(MetadataWriter mw)
-               {
-                       if (ExportDirectoryLength != 0)
-                       {
-                               // Flags
-                               mw.Write(0);
-                               // Date/Time Stamp
-                               mw.Write(peWriter.Headers.FileHeader.TimeDateStamp);
-                               // Major Version
-                               mw.Write((short)0);
-                               // Minor Version
-                               mw.Write((short)0);
-                               // Name RVA
-                               mw.Write(exportTables.namesRVA);
-                               // Ordinal Base
-                               mw.Write(exportTables.ordinalBase);
-                               // Address Table Entries
-                               mw.Write(exportTables.entries);
-                               // Number of Name Pointers
-                               mw.Write(exportTables.nameCount);
-                               // Export Address Table RVA
-                               mw.Write(exportTables.exportAddressTableRVA);
-                               // Name Pointer RVA
-                               mw.Write(exportTables.exportNamePointerTableRVA);
-                               // Ordinal Table RVA
-                               mw.Write(exportTables.exportOrdinalTableRVA);
-                       }
-               }
-
-               private void WriteExportTables(MetadataWriter mw, uint sdataRVA)
-               {
-                       if (exportTables != null)
-                       {
-                               exportTables.Write(mw, sdataRVA);
-                       }
-               }
-
-               private void WriteImportDirectory(MetadataWriter mw)
-               {
-                       mw.Write(ImportDirectoryRVA + 40);              // ImportLookupTable
-                       mw.Write(0);                                                    // DateTimeStamp
-                       mw.Write(0);                                                    // ForwarderChain
-                       mw.Write(ImportHintNameTableRVA + 14);  // Name
-                       mw.Write(ImportAddressTableRVA);
-                       mw.Write(new byte[20]);
-                       // Import Lookup Table
-                       mw.Write(ImportHintNameTableRVA);               // Hint/Name Table RVA
-                       int size = 48;
-                       if (peWriter.Headers.FileHeader.Machine != IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386)
-                       {
-                               size += 4;
-                               mw.Write(0);
-                       }
-                       mw.Write(0);
-
-                       // alignment padding
-                       for (int i = (int)(ImportHintNameTableRVA - (ImportDirectoryRVA + size)); i > 0; i--)
-                       {
-                               mw.Write((byte)0);
-                       }
-
-                       // Hint/Name Table
-                       AssertRVA(mw, ImportHintNameTableRVA);
-                       mw.Write((ushort)0);            // Hint
-                       if ((peWriter.Headers.FileHeader.Characteristics & IMAGE_FILE_HEADER.IMAGE_FILE_DLL) != 0)
-                       {
-                               mw.Write(System.Text.Encoding.ASCII.GetBytes("_CorDllMain"));
-                       }
-                       else
-                       {
-                               mw.Write(System.Text.Encoding.ASCII.GetBytes("_CorExeMain"));
-                       }
-                       mw.Write((byte)0);
-                       // Name
-                       mw.Write(System.Text.Encoding.ASCII.GetBytes("mscoree.dll"));
-                       mw.Write((ushort)0);
-               }
-
-               internal int Length
-               {
-                       get { return (int)(StartupStubRVA - BaseRVA + StartupStubLength); }
-               }
-
-               internal void WriteRelocations(MetadataWriter mw)
-               {
-                       uint relocAddress = this.StartupStubRVA;
-                       switch (peWriter.Headers.FileHeader.Machine)
-                       {
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
-                                       relocAddress += 2;
-                                       break;
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
-                                       relocAddress += 0x20;
-                                       break;
-                       }
-                       WriteRelocationBlock(mw, relocAddress);
-                       if (exportTables != null)
-                       {
-                               exportTables.WriteRelocations(mw);
-                       }
-               }
-
-               // note that we're lazy and write a new relocation block for every relocation
-               // even if they are in the same page (since there is typically only one anyway)
-               private void WriteRelocationBlock(MetadataWriter mw, uint relocAddress)
-               {
-                       uint pageRVA = relocAddress & ~0xFFFU;
-                       mw.Write(pageRVA);      // PageRVA
-                       mw.Write(0x000C);       // Block Size
-                       switch (peWriter.Headers.FileHeader.Machine)
-                       {
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_I386:
-                                       mw.Write(0x3000 + relocAddress - pageRVA);                              // Type / Offset
-                                       break;
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_AMD64:
-                                       mw.Write(0xA000 + relocAddress - pageRVA);                              // Type / Offset
-                                       break;
-                               case IMAGE_FILE_HEADER.IMAGE_FILE_MACHINE_IA64:
-                                       // on IA64 the StartupStubRVA is 16 byte aligned, so these two addresses won't cross a page boundary
-                                       mw.Write((short)(0xA000 + relocAddress - pageRVA));             // Type / Offset
-                                       mw.Write((short)(0xA000 + relocAddress - pageRVA + 8)); // Type / Offset
-                                       break;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/Writer/VersionInfo.cs b/mcs/class/IKVM.Reflection/Writer/VersionInfo.cs
deleted file mode 100644 (file)
index 4c76b49..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
-  Copyright (C) 2008 Jeroen Frijters
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jeroen Frijters
-  jeroen@frijters.net
-  
-*/
-using System;
-using System.Globalization;
-using IKVM.Reflection.Emit;
-
-namespace IKVM.Reflection.Writer
-{
-       sealed class VersionInfo
-       {
-               private AssemblyName name;
-               private string fileName;
-               internal string copyright;
-               internal string trademark;
-               internal string product;
-               internal string company;
-               private string description;
-               private string title;
-               internal string informationalVersion;
-               private string fileVersion;
-
-               internal void SetName(AssemblyName name)
-               {
-                       this.name = name;
-               }
-
-               internal void SetFileName(string assemblyFileName)
-               {
-                       this.fileName = assemblyFileName;
-               }
-
-               internal void SetAttribute(CustomAttributeBuilder cab)
-               {
-                       Universe u = cab.Constructor.Module.universe;
-                       Type type = cab.Constructor.DeclaringType;
-                       if (copyright == null && type == u.System_Reflection_AssemblyCopyrightAttribute)
-                       {
-                               copyright = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (trademark == null && type == u.System_Reflection_AssemblyTrademarkAttribute)
-                       {
-                               trademark = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (product == null && type == u.System_Reflection_AssemblyProductAttribute)
-                       {
-                               product = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (company == null && type == u.System_Reflection_AssemblyCompanyAttribute)
-                       {
-                               company = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (description == null && type == u.System_Reflection_AssemblyDescriptionAttribute)
-                       {
-                               description = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (title == null && type == u.System_Reflection_AssemblyTitleAttribute)
-                       {
-                               title = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (informationalVersion == null && type == u.System_Reflection_AssemblyInformationalVersionAttribute)
-                       {
-                               informationalVersion = (string)cab.GetConstructorArgument(0);
-                       }
-                       else if (fileVersion == null && type == u.System_Reflection_AssemblyFileVersionAttribute)
-                       {
-                               fileVersion = (string)cab.GetConstructorArgument(0);
-                       }
-               }
-
-               internal void Write(ByteBuffer bb)
-               {
-                       if (fileVersion == null)
-                       {
-                               if (name.Version != null)
-                               {
-                                       fileVersion = name.Version.ToString();
-                               }
-                               else
-                               {
-                                       fileVersion = "0.0.0.0";
-                               }
-                       }
-
-                       int codepage = 1200;    // Unicode codepage
-                       int lcid = 0x7f;
-                       try
-                       {
-                               if (name.CultureInfo != null)
-                               {
-                                       lcid = name.CultureInfo.LCID;
-                               }
-                       }
-                       catch (ArgumentException)
-                       {
-                               // AssemblyName.CultureInfo throws an ArgumentException if AssemblyBuilder.__SetAssemblyCulture() was used to specify a non-existing culture
-                       }
-
-                       Version filever = ParseVersionRobust(fileVersion);
-                       int fileVersionMajor = filever.Major;
-                       int fileVersionMinor = filever.Minor;
-                       int fileVersionBuild = filever.Build;
-                       int fileVersionRevision = filever.Revision;
-
-                       int productVersionMajor = fileVersionMajor;
-                       int productVersionMinor = fileVersionMinor;
-                       int productVersionBuild = fileVersionBuild;
-                       int productVersionRevision = fileVersionRevision;
-                       if (informationalVersion != null)
-                       {
-                               Version productver = ParseVersionRobust(informationalVersion);
-                               productVersionMajor = productver.Major;
-                               productVersionMinor = productver.Minor;
-                               productVersionBuild = productver.Build;
-                               productVersionRevision = productver.Revision;
-                       }
-
-                       ByteBuffer stringTable = new ByteBuffer(512);
-                       stringTable.Write((short)0);    // wLength (placeholder)
-                       stringTable.Write((short)0);    // wValueLength
-                       stringTable.Write((short)1);    // wType
-                       WriteUTF16Z(stringTable, string.Format("{0:x4}{1:x4}", lcid, codepage));
-                       stringTable.Align(4);
-
-                       WriteString(stringTable, "Comments", description);
-                       WriteString(stringTable, "CompanyName", company);
-                       WriteString(stringTable, "FileDescription", title);
-                       WriteString(stringTable, "FileVersion", fileVersion);
-                       WriteString(stringTable, "InternalName", name.Name);
-                       WriteString(stringTable, "LegalCopyright", copyright);
-                       WriteString(stringTable, "LegalTrademarks", trademark);
-                       WriteString(stringTable, "OriginalFilename", fileName);
-                       WriteString(stringTable, "ProductName", product);
-                       WriteString(stringTable, "ProductVersion", informationalVersion);
-
-                       stringTable.Position = 0;
-                       stringTable.Write((short)stringTable.Length);
-
-                       ByteBuffer stringFileInfo = new ByteBuffer(512);
-                       stringFileInfo.Write((short)0); // wLength (placeholder)
-                       stringFileInfo.Write((short)0); // wValueLength
-                       stringFileInfo.Write((short)1); // wType
-                       WriteUTF16Z(stringFileInfo, "StringFileInfo");
-                       stringFileInfo.Align(4);
-                       stringFileInfo.Write(stringTable);
-                       stringFileInfo.Position = 0;
-                       stringFileInfo.Write((short)stringFileInfo.Length);
-
-                       byte[] preamble1 = new byte[] {
-                         // VS_VERSIONINFO (platform SDK)
-                         0x34, 0x00,                           // wValueLength
-                         0x00, 0x00,                           // wType
-                         0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00,  // "VS_VERSION_INFO\0"
-                         0x00, 0x00,                           // Padding1 (32 bit alignment)
-                         // VS_FIXEDFILEINFO starts
-                         0xBD, 0x04, 0xEF, 0xFE,       // dwSignature (0xFEEF04BD)
-                         0x00, 0x00, 0x01, 0x00,       // dwStrucVersion
-                       };
-                       byte[] preamble2 = new byte[] {
-                         0x3F, 0x00, 0x00, 0x00,       // dwFileFlagsMask (??)
-                         0x00, 0x00, 0x00, 0x00,       // dwFileFlags (??)
-                         0x04, 0x00, 0x00, 0x00,       // dwFileOS
-                         0x02, 0x00, 0x00, 0x00,       // dwFileType
-                         0x00, 0x00, 0x00, 0x00,       // dwFileSubtype
-                         0x00, 0x00, 0x00, 0x00,       // dwFileDateMS
-                         0x00, 0x00, 0x00, 0x00,       // dwFileDateLS
-                                                                               // Padding2 (32 bit alignment)
-                         // VarFileInfo
-                         0x44, 0x00,                           // wLength
-                         0x00, 0x00,                           // wValueLength
-                         0x01, 0x00,                           // wType
-                         0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00,       // "VarFileInfo\0"
-                         0x00, 0x00,                           // Padding
-                         // Var
-                         0x24, 0x00,                           // wLength
-                         0x04, 0x00,                           // wValueLength
-                         0x00, 0x00,                           // wType
-                         0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00,       // "Translation\0"
-                         0x00, 0x00,                           // Padding (32 bit alignment)
-                       };
-                       bb.Write((short)(2 + preamble1.Length + 8 + 8 + preamble2.Length + 4 + stringFileInfo.Length));
-                       bb.Write(preamble1);
-                       bb.Write((short)fileVersionMinor);
-                       bb.Write((short)fileVersionMajor);
-                       bb.Write((short)fileVersionRevision);
-                       bb.Write((short)fileVersionBuild);
-                       bb.Write((short)productVersionMinor);
-                       bb.Write((short)productVersionMajor);
-                       bb.Write((short)productVersionRevision);
-                       bb.Write((short)productVersionBuild);
-                       bb.Write(preamble2);
-                       bb.Write((short)lcid);
-                       bb.Write((short)codepage);
-                       bb.Write(stringFileInfo);
-               }
-
-               private static void WriteUTF16Z(ByteBuffer bb, string str)
-               {
-                       foreach (char c in str)
-                       {
-                               bb.Write((short)c);
-                       }
-                       bb.Write((short)0);
-               }
-
-               private static void WriteString(ByteBuffer bb, string name, string value)
-               {
-                       value = value ?? " ";
-                       int pos = bb.Position;
-                       bb.Write((short)0);                                     // wLength (placeholder)
-                       bb.Write((short)(value.Length + 1));// wValueLength
-                       bb.Write((short)1);                                     // wType
-                       WriteUTF16Z(bb, name);
-                       bb.Align(4);
-                       WriteUTF16Z(bb, value);
-                       bb.Align(4);
-                       int savedPos = bb.Position;
-                       bb.Position = pos;
-                       bb.Write((short)(savedPos - pos));
-                       bb.Position = savedPos;
-               }
-
-               private static Version ParseVersionRobust(string ver)
-               {
-                       int index = 0;
-                       ushort major = ParseVersionPart(ver, ref index);
-                       ushort minor = ParseVersionPart(ver, ref index);
-                       ushort build = ParseVersionPart(ver, ref index);
-                       ushort revision = ParseVersionPart(ver, ref index);
-                       return new Version(major, minor, build, revision);
-               }
-
-               private static ushort ParseVersionPart(string str, ref int pos)
-               {
-                       ushort value = 0;
-                       while (pos < str.Length)
-                       {
-                               char c = str[pos];
-                               if (c == '.')
-                               {
-                                       pos++;
-                                       break;
-                               }
-                               else if (c >= '0' && c <= '9')
-                               {
-                                       value *= 10;
-                                       value += (ushort)(c - '0');
-                                       pos++;
-                               }
-                               else
-                               {
-                                       break;
-                               }
-                       }
-                       return value;
-               }
-       }
-}
diff --git a/mcs/class/IKVM.Reflection/reflect.build b/mcs/class/IKVM.Reflection/reflect.build
deleted file mode 100644 (file)
index f9c935b..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0"?>
-<project name="reflect" default="IKVM.Reflection">
-    <target name="IKVM.Reflection">
-        <property name="defs" value="TRACE" />
-        <if test="${framework::exists('mono-2.0')}">
-            <property name="defs" value="${defs};MONO" />
-        </if>
-        <if test="${property::exists('signed')}">
-            <property name="defs" value="${defs};${signed}" />
-        </if>
-        <if test="${version::get-major(framework::get-version(framework::get-target-framework() )) == 4}">
-            <property name="defs" value="${defs};NET_4_0" />
-        </if>
-        <!-- workaround for the fact that <include if="${framework::exists('mono-2.0')} ...> still insists on evaluating the name attribute -->
-        <property name="MonoSymbolWriter" value="dummy.dll" />
-        <if test="${framework::exists('mono-2.0')}">
-            <property name="MonoSymbolWriter" value="${path::combine(framework::get-assembly-directory('mono-2.0'), 'Mono.CompilerServices.SymbolWriter.dll')}" />
-        </if>
-        <csc target="library" output="../bin/IKVM.Reflection.dll" optimize="true" define="${defs}">
-            <sources>
-                <include name="../CommonAssemblyInfo.cs" />
-                <include name="AmbiguousMatchException.cs" />
-                <include name="Assembly.cs" />
-                <include name="AssemblyName.cs" />
-                <include name="BadImageFormatException.cs" />
-                <include name="Binder.cs" />
-                <include name="ConstructorInfo.cs" />
-                <include name="CustomAttributeData.cs" />
-                <include name="CustomAttributeNamedArgument.cs" />
-                <include name="CustomAttributeTypedArgument.cs" />
-                <include name="CustomModifiers.cs" />
-                <include name="Enums.cs" />
-                <include name="EventInfo.cs" />
-                <include name="ExceptionHandlingClause.cs" />
-                <include name="FieldInfo.cs" />
-                <include name="FieldSignature.cs" />
-                <include name="Fusion.cs" />
-                <include name="GenericWrappers.cs" />
-                <include name="InterfaceMapping.cs" />
-                <include name="LocalVariableInfo.cs" />
-                <include name="ManifestResourceInfo.cs" />
-                <include name="MarshalSpec.cs" />
-                <include name="MemberInfo.cs" />
-                <include name="MethodBase.cs" />
-                <include name="MethodBody.cs" />
-                <include name="MethodImplMap.cs" />
-                <include name="MethodInfo.cs" />
-                <include name="MethodSignature.cs" />
-                <include name="Missing.cs" />
-                <include name="Module.cs" />
-                <include name="ParameterInfo.cs" />
-                <include name="ParameterModifier.cs" />
-                <include name="PropertyInfo.cs" />
-                <include name="PropertySignature.cs" />
-                <include name="Signature.cs" />
-                <include name="StandAloneMethodSig.cs" />
-                <include name="StrongNameKeyPair.cs" />
-                <include name="Type.cs" />
-                <include name="TypeNameParser.cs" />
-                <include name="Universe.cs" />
-                <include name="Util.cs" />
-                <include name="Emit\AssemblyBuilder.cs" />
-                <include name="Emit\ConstructorBuilder.cs" />
-                <include name="Emit\CustomAttributeBuilder.cs" />
-                <include name="Emit\CustomModifiersBuilder.cs" />
-                <include name="Emit\EnumBuilder.cs" />
-                <include name="Emit\Enums.cs" />
-                <include name="Emit\EventBuilder.cs" />
-                <include name="Emit\FieldBuilder.cs" />
-                <include name="Emit\ILGenerator.cs" />
-                <include name="Emit\MethodBuilder.cs" />
-                <include name="Emit\ModuleBuilder.cs" />
-                <include name="Emit\OpCode.cs" />
-                <include name="Emit\OpCodes.cs" />
-                <include name="Emit\ParameterBuilder.cs" />
-                <include name="Emit\PropertyBuilder.cs" />
-                <include name="Emit\SignatureHelper.cs" />
-                <include name="Emit\Tokens.cs" />
-                <include name="Emit\TypeBuilder.cs" />
-                <include name="Impl\ITypeOwner.cs" />
-                <include name="Impl\MdbWriter.cs" />
-                <include name="Impl\PdbWriter.cs" />
-                <include name="Impl\SymbolSupport.cs" />
-                <include name="Metadata\CliHeader.cs" />
-                <include name="Metadata\MetadataRW.cs" />
-                <include name="Metadata\Tables.cs" />
-                <include name="Properties\AssemblyInfo.cs" />
-                <include name="Reader\AssemblyReader.cs" />
-                <include name="Reader\ByteReader.cs" />
-                <include name="Reader\EventInfoImpl.cs" />
-                <include name="Reader\Field.cs" />
-                <include name="Reader\GenericTypeParameter.cs" />
-                <include name="Reader\MetadataReader.cs" />
-                <include name="Reader\Method.cs" />
-                <include name="Reader\ModuleReader.cs" />
-                <include name="Reader\PEReader.cs" />
-                <include name="Reader\PropertyInfoImpl.cs" />
-                <include name="Reader\ResourceModule.cs" />
-                <include name="Reader\TypeDefImpl.cs" />
-                <include name="Writer\ByteBuffer.cs" />
-                <include name="Writer\Heaps.cs" />
-                <include name="Writer\MetadataWriter.cs" />
-                <include name="Writer\ModuleWriter.cs" />
-                <include name="Writer\PEWriter.cs" />
-                <include name="Writer\ResourceSection.cs" />
-                <include name="Writer\TextSection.cs" />
-                <include name="Writer\VersionInfo.cs" />
-            </sources>
-            <references>
-                <include if="${framework::exists('mono-2.0')}" name="${MonoSymbolWriter}" />
-            </references>
-        </csc>
-    </target>
-</project>
index 3a5a153bff2571199d874a9ad1f80fc1f1a91fe9..a7af39076b0e73e16aaf8e5b59eafbd222bc7129 100644 (file)
@@ -115,7 +115,8 @@ net_2_0_dirs := \
        System.Dynamic                  \
        Mono.CSharp                     \
        Moonlight.Build.Tasks           \
-       System.Net
+       System.Net                              \
+       System.Json
 
 net_2_0_only_dirs := \
        System.Web.Extensions_1.0       \
@@ -159,12 +160,19 @@ mobile_dirs := \
        Mono.Cairo      \
        Mono.Data.Sqlite        \
        System.Numerics \
-       System.Data.Services.Client
+       System.Data.Services.Client \
+       System.Reactive.Interfaces \
+       System.Reactive.Core \
+       System.Reactive.Linq \
+       System.Reactive.PlatformServices \
+       System.Reactive.Experimental \
+       System.Reactive.Debugger
 
 monodroid_dirs := \
        Mono.CompilerServices.SymbolWriter      \
        Mono.CSharp     \
-       Microsoft.CSharp
+       Microsoft.CSharp \
+       System.Reactive.Providers
 
 monotouch_runtime_dirs := \
        corlib \
@@ -208,6 +216,16 @@ net_4_0_dirs := \
        System.Windows.Forms.DataVisualization  \
        System.Xaml \
        WindowsBase \
+       System.Reactive.Interfaces \
+       System.Reactive.Core \
+       System.Reactive.Linq \
+       System.Reactive.PlatformServices \
+       System.Reactive.Providers \
+       System.Reactive.Runtime.Remoting \
+       System.Reactive.Windows.Forms \
+       System.Reactive.Windows.Threading \
+       System.Reactive.Experimental \
+       System.Reactive.Debugger \
        System.ServiceModel.Routing \
        System.ServiceModel.Discovery \
        System.Runtime.Caching \
@@ -216,8 +234,8 @@ net_4_0_dirs := \
        Microsoft.Web.Infrastructure \
        WebMatrix.Data \
        System.Data.Services.Client     \
-       System.Data.Services    \
-       System.Json
+       System.Data.Services \
+       System.Json.Microsoft
        
 net_4_0_only_dirs := \
        System.ComponentModel.Composition
@@ -252,7 +270,7 @@ include ../build/rules.make
 
 SUBDIRS = $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) $(net_3_5_only_dirs) $(moonlight_raw_dirs) $(mobile_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
 
-DIST_ONLY_SUBDIRS = dlr IKVM.Reflection aot-compiler
+DIST_ONLY_SUBDIRS = dlr aot-compiler
 
 # No new makefiles for: System.Messaging, System.Web.Mobile,
 # System.ServiceProcess
@@ -264,6 +282,7 @@ DISTFILES = \
        mono.pub                \
        msfinal.pub             \
        silverlight.pub         \
+       reactive.pub            \
        mono.snk                \
        LICENSE                 \
        README                  \
index 607ba4176a404306043fc6f618e59375b3c57615..b32fbfe9a06eab04db3866930988aed2ff5809fc 100644 (file)
       </AssemblyInfo>
       <Attributes>
         <Attribute>
-          <AttributeName>System.ComponentModel.DefaultValue(&#x0;)</AttributeName>
+          <AttributeName>System.ComponentModel.DefaultValue(&apos;\0&apos;)</AttributeName>
         </Attribute>
         <Attribute>
           <AttributeName>System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)</AttributeName>
index 1502e19cd01861f511d6aea9489fce9dfa8eac76..f705f03afdc130da4bb54dc0787e927fb4fc6831 100644 (file)
           <AttributeName>System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)</AttributeName>
         </Attribute>
         <Attribute>
-          <AttributeName>System.ComponentModel.DefaultValue(&#x0;)</AttributeName>
+          <AttributeName>System.ComponentModel.DefaultValue(&apos;\0&apos;)</AttributeName>
         </Attribute>
         <Attribute>
           <AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
index e9ca02ae741c3552f077f738e7aea67eec4df818..f8343abb9e555645a58ebb28bf5328212ac38b77 100644 (file)
@@ -557,7 +557,8 @@ namespace System.Windows.Forms {
                
                protected override void CreateHandle ()
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       if(!base.IsHandleCreated)
+                               base.CreateHandle();
                }
 
                protected virtual object CreateInstanceCore (Guid clsid)
@@ -573,7 +574,7 @@ namespace System.Windows.Forms {
                
                protected override void DestroyHandle ()
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.DestroyHandle();
                }
 
                [EditorBrowsable (EditorBrowsableState.Advanced)]
@@ -584,7 +585,7 @@ namespace System.Windows.Forms {
 
                protected override void Dispose (bool disposing)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       base.Dispose(disposing);
                }
 
                [EditorBrowsable (EditorBrowsableState.Never)]
@@ -722,7 +723,7 @@ namespace System.Windows.Forms {
                
                protected override void WndProc (ref Message m)
                {
-                       throw new NotImplementedException("COM/ActiveX support is not implemented");
+                       this.DefWndProc(ref m);
                }
                #endregion      // Protected Instance Methods
 
index 711fe5fd282c16d261aee0cdf395f09738699cbd..96bb476997296a38b5ce8c9f352d6d86a5f551ea 100644 (file)
@@ -70,7 +70,12 @@ namespace Microsoft.Build.Tasks {
                                                        String.Join (";", defines));
                        }
 
-                       commandLine.AppendSwitchIfNotNull ("/nowarn:", DisabledWarnings);
+                       if (!String.IsNullOrEmpty (DisabledWarnings)) {
+                               string [] defines = DisabledWarnings.Split (new char [] {';', ' ', ','},
+                                               StringSplitOptions.RemoveEmptyEntries);
+                               if (defines.Length > 0)
+                                   commandLine.AppendSwitchIfNotNull ("/nowarn:", defines, ";");
+                       }
 
                        commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
 
index f7505b294c4c9ad1223ccd644fa765c9aeae5cfa..e72978e064ff9553132be58934d416bfab142f56 100644 (file)
@@ -189,6 +189,18 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.AreEqual ("/nowarn:A", clbe.ToString (), "A1");
                }
 
+               [Test]
+               public void TestDisabledWarningsComma ()
+               {
+                       CscExtended csc = new CscExtended ();
+                       CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
+
+                       csc.DisabledWarnings = "A, B";
+                       csc.ARFC (clbe);
+
+                       Assert.AreEqual ("/nowarn:A;B", clbe.ToString (), "A1");
+               }
+
                [Test]
                public void TestDocumentationFile ()
                {
index 5816d7adf5ccb09c891470760f3a6fd01e05b3c1..67d386284a3de92da42db624c36a5c91c7f86c90 100644 (file)
@@ -69,7 +69,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");
                }
                
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_FancyStuff ()
                {
                        engine = new Engine (Consts.BinPath);
@@ -86,7 +86,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("SimpleWrite.dll")), "A5");
                }
                
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_SimpleWrite ()
                {
                        engine = new Engine (Consts.BinPath);
@@ -102,7 +102,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.AreEqual (0, big.Count, "A4");
                }
                
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_Testing ()
                {
                        engine = new Engine (Consts.BinPath);
@@ -118,7 +118,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.AreEqual (0, big.Count, "A4");
                }
                
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_XbuildReferenceBugTest ()
                {
                        engine = new Engine (Consts.BinPath);
@@ -137,7 +137,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("Testing.dll")), "A7");
                }
 
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_FancyStuffAndXbuild ()
                {
                        engine = new Engine (Consts.BinPath);
@@ -156,7 +156,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("Testing.dll")), "A6");
                }
 
-               [Test]
+               [Test, Category("NotWorking")]
                public void ResolveBinary_SameAssemblyTwice ()
                {
                        engine = new Engine (Consts.BinPath);
index 00589e5605f5d80a65e6a2158bb2e0d61cd12e61..82a40ed6c8a1efc6c0a95ab55b5e7884ca7e9b94 100644 (file)
@@ -49,10 +49,6 @@ namespace Mono.Data.Sqlite
     {\r
       if (bDisposing)\r
         Close();\r
-#if MONOTOUCH\r
-      if (gch.IsAllocated)\r
-        gch.Free ();\r
-#endif\r
     }\r
 \r
     // It isn't necessary to cleanup any functions we've registered.  If the connection\r
@@ -73,6 +69,10 @@ namespace Mono.Data.Sqlite
       }\r
 \r
       _sql = null;\r
+#if MONOTOUCH\r
+      if (gch.IsAllocated)\r
+        gch.Free ();\r
+#endif\r
     }\r
 \r
     internal override void Cancel()\r
index d1560c3103cfc9fb341389517bd8cf1155218b0b..961184bb0d7febfc94023cb7fd00418941927d9f 100644 (file)
@@ -304,6 +304,9 @@ namespace Mono.Data.Sqlite
     {\r
       base.Dispose(disposing);\r
 \r
+      if (_sql != null)\r
+        _sql.Dispose ();\r
+\r
       if (disposing)\r
         Close();\r
     }\r
index a5b663b1cd0aa74fd6f2c1b3f7bd51ab9aec0f3c..cdf7fc6097e79680b4fb11b2bd966621983d96b1 100644 (file)
@@ -219,6 +219,10 @@ public class Tests : TestsBase
                        unhandled_exception ();
                        return 0;
                }
+               if (args.Length >0 && args [0] == "unhandled-exception-user") {
+                       unhandled_exception_user ();
+                       return 0;
+               }
                breakpoints ();
                single_stepping ();
                arguments ();
@@ -423,7 +427,7 @@ public class Tests : TestsBase
 
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
        public static void objects () {
-               Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5) };
+               Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5), field_nullable = null };
                t.o1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
                o2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, (int[,])Array.CreateInstance (typeof (int), new int [] { 2, 2}, new int [] { 1, 3}), new int[] { 0 });
        }
@@ -801,6 +805,21 @@ public class Tests : TestsBase
                Thread.Sleep (10000);
        }
 
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void unhandled_exception_user () {
+#if NET_4_5
+               System.Threading.Tasks.Task.Factory.StartNew (() => {
+                               Throw ();
+                       });
+               Thread.Sleep (10000);
+#endif
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void Throw () {
+               throw new Exception ();
+       }
+
        internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
        {
                if (dlg == null)
index 9b15fbc2af788a56081a9be6bcf28affac660982..ead271375b165287671f02994238cced868b8315 100644 (file)
@@ -2175,8 +2175,6 @@ public class DebuggerTests
        void invoke_multiple_cb (IAsyncResult ar) {
                ObjectMirror this_obj = (ObjectMirror)ar.AsyncState;
 
-               Console.WriteLine ("CB!");
-
                var res = this_obj.EndInvokeMethod (ar);
                lock (invoke_results)
                        invoke_results.Add (res);
@@ -3083,6 +3081,29 @@ public class DebuggerTests
                vm.Exit (0);
                vm = null;
        }
+
+#if NET_4_5
+       [Test]
+       public void UnhandledExceptionUserCode () {
+               vm.Detach ();
+
+               // Exceptions caught in non-user code are treated as unhandled
+               Start (new string [] { "dtest-app.exe", "unhandled-exception-user" });
+
+               var req = vm.CreateExceptionRequest (null, false, true);
+               req.AssemblyFilter = new List<AssemblyMirror> () { entry_point.DeclaringType.Assembly };
+               req.Enable ();
+
+               var e = run_until ("unhandled_exception_user");
+               vm.Resume ();
+
+               var e2 = GetNextEvent ();
+               Assert.IsTrue (e2 is ExceptionEvent);
+
+               vm.Exit (0);
+               vm = null;
+       }
+#endif
 }
 
 }
\ No newline at end of file
index 661c9a51b79a09a9f667048fe88d461a519f556e..54923a89ad9aa04116607c173635709aedd07b59 100644 (file)
           </para>
           <para>
             This is equivalent to calling the 
-            <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+            <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32,System.Boolean)" />
             constructor as with <c>Option(<paramref name="prototype" />, 
-            <paramref name="description" />, 1)</c>.
+            <paramref name="description" />, 1,false)</c>.
           </para>
         </remarks>
         <exception cref="T:System.ArgumentException">
             new instance using <paramref name="prototype" />, the 
             <see cref="P:Mono.Options.Option.Description" /> property of the
             new instance using <paramref name="description" />. and
+            initializes the <see cref="P:Mono.Options.Option.MaxValueCount" />
+            property of the new instance to <c>1</c>.
+          </para>
+          <para>
+            This is equivalent to calling the
+            <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32,System.Boolean)" />
+            constructor as with <c>Option(<paramref name="prototype" />,
+            <paramref name="description" />, <paramref name="maxValueCount" />, false)</c>.
+          </para>
+        </remarks>
+        <exception cref="T:System.ArgumentException">
+          <para>
+            <paramref name="prototype" /> is the empty string <c>""</c>.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="prototype" /> contains an empty alias, such as
+            <c>a||b</c>.
+          </para>
+          <para>-or-</para>
+          <para>
+            Conflicting <see cref="T:Mono.Options.OptionValueType" /> values
+            were found within <paramref name="prototype" />.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="maxValueCount" /> is <c>0</c> and
+            <paramref name="prototype" /> specified an
+            <see cref="T:Mono.Options.OptionValueType" /> value of
+            <see cref="F:Mono.Options.OptionValueType.Optional" /> or
+            <see cref="F:Mono.Options.OptionValueType.Required" />.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="maxValueCount" /> is greater than <c>1</c> and
+            <paramref name="prototype" /> specified an
+            <see cref="T:Mono.Options.OptionValueType" /> value of
+            <see cref="F:Mono.Options.OptionValueType.None" />.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="prototype" /> contains a separator list and
+            <paramref name="maxValueCount" /> is <c>0</c> or <c>1</c>.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="prototype" /> contains a badly formatted
+            separator list, such as <c>{{</c>, <c>}}</c>, <c>{{}</c>, etc.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="prototype" /> only includes the default handler
+            <c>&lt;&gt;</c> and <paramref name="prototype" /> did not specify an
+            <see cref="T:Mono.Options.OptionValueType" /> value of
+            <see cref="F:Mono.Options.OptionValueType.None" />.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="prototype" /> includes the default handler
+            <c>&lt;&gt;</c>, and <paramref name="MaxValueCount" /> is greater
+            than <c>1</c>.
+          </para>
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="prototype" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="protected Option (string prototype, string description, int maxValueCount, bool hidden);" />
+      <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(string prototype, string description, int32 maxValueCount, bool hidden) cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="maxValueCount" Type="System.Int32" />
+        <Parameter Name="hidden" Type="System.Boolean" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing a <c>|</c>-separated
+          list of option names (aliases) and an optional value-type specifier.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing documentation for the
+          option.
+        </param>
+        <param name="maxValueCount">
+          A <see cref="T:System.Int32" /> containing the number of values this
+          option accepts.
+        </param>
+        <param name="hidden">
+          A <see cref="T:System.Boolean" /> specifying whether or not the
+          Option should be displayed in
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+        </param>
+        <summary>
+          Creates and initializes a new instance of the
+          <see cref="T:Mono.Options.Option" /> class.
+        </summary>
+        <remarks>
+          <para>
+            This constructor initializes the
+            <see cref="P:Mono.Options.Option.Prototype" /> property of the
+            new instance using <paramref name="prototype" />, the
+            <see cref="P:Mono.Options.Option.Description" /> property of the
+            new instance using <paramref name="description" />,
             initializes the <see cref="P:Mono.Options.Option.MaxValueCount" /> 
-            property of the new instance using <paramref name="maxValueCount" />.
+            property of the new instance using <paramref name="maxValueCount" />,
+            and initializes the <see cref="P:Mono.Options.Option.Hidden" />
+            property of the new instance using <paramref name="hidden" />.
           </para>
           <para>
             <paramref name="prototype" /> is a <c>|</c>-separated list of
         </remarks>
       </Docs>
     </Member>
+    <Member MemberName="Hidden">
+      <MemberSignature Language="C#" Value="public bool Hidden { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance bool Hidden" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Boolean</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Whether
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+          should write this option.
+        </summary>
+        <value>
+          If <see langword="true" />, then
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+          will not print this option; otherwise,
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />
+          will write this option.
+        </value>
+        <remarks>
+        </remarks>
+      </Docs>
+    </Member>
     <Member MemberName="Invoke">
       <MemberSignature Language="C#" Value="public void Invoke (Mono.Options.OptionContext c);" />
       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Invoke(class Mono.Options.OptionContext c) cil managed" />
index bddc27c5b671c5522da349cba25c75d93eaaf86d..67225ad77680005658a2e3e423e91d7120289bdc 100644 (file)
@@ -1402,6 +1402,136 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti
         </exception>
       </Docs>
     </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Mono.Options.OptionAction&lt;string,string&gt; action, bool hidden);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class Mono.Options.OptionAction`2&lt;string, string&gt; action, bool hidden) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.OptionSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
+        <Parameter Name="hidden" Type="System.Boolean" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <param name="hidden">
+          A <see cref="T:System.Boolean" /> specifying whether or not the
+          Option should be displayed in
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.OptionSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Action&lt;string&gt; action, bool hidden);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class System.Action`1&lt;string&gt; action, bool hidden) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.OptionSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
+        <Parameter Name="hidden" Type="System.Boolean" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <param name="hidden">
+          A <see cref="T:System.Boolean" /> specifying whether or not the
+          Option should be displayed in
+          <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.OptionSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
     <Member MemberName="Add&lt;T&gt;">
       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add&lt;T&gt; (string prototype, Action&lt;T&gt; action);" />
       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add&lt;T&gt;(string prototype, class System.Action`1&lt;!!T&gt; action) cil managed" />
@@ -2415,6 +2545,15 @@ class Test {
           <paramref name="o" />.
         </summary>
         <remarks>
+          <para>
+            Writes <see cref="T:Mono.Options.Option" /> documentation to
+            <paramref name="o" />.
+          </para>
+          <para>
+            If <see cref="P:Mono.Options.Option.Hidden" /> is
+            <see langword="true" />, then the Option will not be written to
+            <paramref name="o" />.
+          </para>
           <para>
             For each <see cref="T:Mono.Options.Option" /> previously added to
             the current instance, this method writes out a comma-separated
index 6f5dee2d6c7ab790a6658346b1f40e9dc768453d..5af7fe0f387f9b18f0e788d613eb3f29084c7a43 100644 (file)
@@ -4,9 +4,11 @@
 // Authors:
 //  Jonathan Pryor <jpryor@novell.com>
 //  Federico Di Gregorio <fog@initd.org>
+//  Rolf Bjarne Kvinge <rolf@xamarin.com>
 //
 // Copyright (C) 2008 Novell (http://www.novell.com)
 // Copyright (C) 2009 Federico Di Gregorio.
+// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -372,13 +374,19 @@ namespace Mono.Options
                OptionValueType type;
                int count;
                string[] separators;
+               bool hidden;
 
                protected Option (string prototype, string description)
-                       : this (prototype, description, 1)
+                       : this (prototype, description, 1, false)
                {
                }
 
                protected Option (string prototype, string description, int maxValueCount)
+                       : this (prototype, description, maxValueCount, false)
+               {
+               }
+
+               protected Option (string prototype, string description, int maxValueCount, bool hidden)
                {
                        if (prototype == null)
                                throw new ArgumentNullException ("prototype");
@@ -400,6 +408,7 @@ namespace Mono.Options
                                return;
 
                        this.type        = ParsePrototype ();
+                       this.hidden      = hidden;
 
                        if (this.count == 0 && type != OptionValueType.None)
                                throw new ArgumentException (
@@ -422,6 +431,7 @@ namespace Mono.Options
                public string           Description     {get {return description;}}
                public OptionValueType  OptionValueType {get {return type;}}
                public int              MaxValueCount   {get {return count;}}
+               public bool             Hidden          {get {return hidden;}}
 
                public string[] GetNames ()
                {
@@ -805,7 +815,12 @@ namespace Mono.Options
                        Action<OptionValueCollection> action;
 
                        public ActionOption (string prototype, string description, int count, Action<OptionValueCollection> action)
-                               : base (prototype, description, count)
+                               : this (prototype, description, count, action, false)
+                       {
+                       }
+
+                       public ActionOption (string prototype, string description, int count, Action<OptionValueCollection> action, bool hidden)
+                               : base (prototype, description, count, hidden)
                        {
                                if (action == null)
                                        throw new ArgumentNullException ("action");
@@ -824,11 +839,16 @@ namespace Mono.Options
                }
 
                public OptionSet Add (string prototype, string description, Action<string> action)
+               {
+                       return Add (prototype, description, action, false);
+               }
+
+               public OptionSet Add (string prototype, string description, Action<string> action, bool hidden)
                {
                        if (action == null)
                                throw new ArgumentNullException ("action");
                        Option p = new ActionOption (prototype, description, 1, 
-                                       delegate (OptionValueCollection v) { action (v [0]); });
+                                       delegate (OptionValueCollection v) { action (v [0]); }, hidden);
                        base.Add (p);
                        return this;
                }
@@ -840,10 +860,14 @@ namespace Mono.Options
 
                public OptionSet Add (string prototype, string description, OptionAction<string, string> action)
                {
+                       return Add (prototype, description, action, false);
+               }
+
+               public OptionSet Add (string prototype, string description, OptionAction<string, string> action, bool hidden)   {
                        if (action == null)
                                throw new ArgumentNullException ("action");
                        Option p = new ActionOption (prototype, description, 2, 
-                                       delegate (OptionValueCollection v) {action (v [0], v [1]);});
+                                       delegate (OptionValueCollection v) {action (v [0], v [1]);}, hidden);
                        base.Add (p);
                        return this;
                }
@@ -1150,6 +1174,9 @@ namespace Mono.Options
                        foreach (Option p in this) {
                                int written = 0;
 
+                               if (p.Hidden)
+                                       continue;
+
                                Category c = p as Category;
                                if (c != null) {
                                        WriteDescription (o, p.Description, "", 80, 80);
index 3992ee03fd54e8af6d9c10fe74f9498b4c66b62b..666bad54d5b8d90f021a32011c1b3c8f4eab3c0e 100644 (file)
@@ -386,6 +386,8 @@ namespace Tests.Mono.Options
                {
                        var p = new OptionSet () {
                                "\n:Category 1:",
+                               { "hidden",             "hidden option, invisible in help",     v => {}, true },
+                               { "hidden2=",           "hidden option, invisible in help",     (k, v) => {}, true },
                                { "p|indicator-style=", "append / indicator to directories",    v => {} },
                                { "color:",             "controls color info",                  v => {} },
                                { "color2:",            "set {color}",                          v => {} },
index ac0aa729e51a7c24e32c6cf4dbd330b2b7ace7be..e71898ffddec8b6c85d40eae4eb29e6009d32fda 100644 (file)
@@ -684,32 +684,6 @@ class Test
         <remarks>
           <para>This member is obsolete.  Please use
           <see cref="P:Mono.Unix.UnixEnvironment.MachineName" /> instead.</para>
-          <para>See also GetHostName()</para>
-        </remarks>
-        <altmember cref="P:Mono.Unix.UnixEnvironment.MachineName" />
-        <altmember cref="M:Mono.Unix.Native.Syscall.gethostname" />
-      </Docs>
-    </Member>
-    <Member MemberName="GetHostName">
-      <MemberSignature Language="C#" Value="public static string GetHostName ();" />
-      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetHostName() cil managed" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>Retrieves the hostname.</summary>
-        <returns>a <see cref="T:System.String" /></returns>
-        <remarks>
-          <para>This member is obsolete.  Please use
-          <see cref="P:Mono.Unix.UnixEnvironment.MachineName" /> instead.</para>
-          <para>Either GetHostName() should be removed, since gethostname() also exists, or the entire library should be CamelCased per .NET standard.</para>
         </remarks>
         <altmember cref="P:Mono.Unix.UnixEnvironment.MachineName" />
         <altmember cref="M:Mono.Unix.Native.Syscall.gethostname" />
diff --git a/mcs/class/Mono.Reactive.Testing/Makefile b/mcs/class/Mono.Reactive.Testing/Makefile
new file mode 100644 (file)
index 0000000..c02117a
--- /dev/null
@@ -0,0 +1,48 @@
+thisdir = class/Mono.Reactive.Testing
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Mono.Reactive.Testing.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll \
+               -r:System.Reactive.PlatformServices.dll \
+               -r:System.Reactive.Providers.dll \
+               -r:System.Reactive.Runtime.Remoting.dll \
+               -r:System.Reactive.Experimental.dll \
+               -r:System.Reactive.Windows.Forms.dll \
+               -r:System.Reactive.Windows.Threading.dll \
+               -r:System.Windows.Forms.dll \
+               -r:WindowsBase.dll \
+               -r:nunit.framework.dll \
+               -d:NUNIT -d:MONO -d:DESKTOPCLR
+               # NO_PERF is required to disable ObservableMultipleTest.Catch_TailRecursive2 which blocked test execution.
+               # disabled -d:HAS_WINFORMS
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.Mono.Reactive.Testing.dll
+NO_INSTALL = yes
+NO_TEST = yes
+endif
+
+NO_SIGN_ASSEMBLY = yes
+
+include ../../build/library.make
diff --git a/mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing.dll.sources b/mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing.dll.sources
new file mode 100644 (file)
index 0000000..964a9c5
--- /dev/null
@@ -0,0 +1,13 @@
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ColdObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/HotObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ITestObservable.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ITestObserver.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/MockObserver.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/NamespaceDoc.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ReactiveAssert.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/ReactiveTest.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Recorded.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/Subscription.cs
+../../../external/rx/Rx.NET/Microsoft.Reactive.Testing/TestScheduler.cs
diff --git a/mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing_test.dll.sources b/mcs/class/Mono.Reactive.Testing/Mono.Reactive.Testing_test.dll.sources
new file mode 100644 (file)
index 0000000..8971bf1
--- /dev/null
@@ -0,0 +1,83 @@
+../../../../external/rx/Rx.NET/Tests.System.Reactive/App.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/DispatcherHelpers.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Semaphore.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Composite.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/Serial.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/SingleAssignment.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Core/Disposables/RefCount.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/Delay.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/FromEvent.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Helpers.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Stress/Linq/Replay.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestBase.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestLongRunningScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AnonymousTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AsyncLockTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConcurrencyTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ConnectableObservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ControlSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableSafetyTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/QbservableExTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/RogueEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ScheduledItemTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/StopwatchTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SystemClockTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/EventPatternSourceBaseTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SynchronizationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DefaultSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/CurrentThreadSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/DisposableTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/EventLoopSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/HistoricalSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ImmediateSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/MySubject.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/NewThreadSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/NotificationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableEventsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableImperativeTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SynchronizationContextSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TaskObservableExtensionsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TaskPoolSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ThreadPoolSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/TimeTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/UnitTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/VirtualSchedulerTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyDisposable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyFunc.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyObserver.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Dummies/DummyScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Extensions.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/MockDisposable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/MockEnumerable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/NullErrorObservable.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Properties/AssemblyInfo.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/AsyncSubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/BehaviorSubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/SubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ListObservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAggregateTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAsyncTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableAwaiterTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableBindingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableBlockingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableConversionTests.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableCreationTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableExtensionsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableJoinsTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableMultipleTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableRemotingTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableSingleTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableStandardQueryOperatorTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableTimeTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObserverTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/PrivateTypesTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/QbservableTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/RegressionTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ReplaySubjectTest.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/TestTaskScheduler.cs
+../../../../external/rx/Rx.NET/Tests.System.Reactive/Utils.cs
diff --git a/mcs/class/Mono.Reactive.Testing/more_build_args b/mcs/class/Mono.Reactive.Testing/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD2.xml b/mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD2.xml
deleted file mode 100644 (file)
index f111ba1..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<Type Name="MD2" FullName="Mono.Security.Cryptography.MD2">
-  <TypeSignature Language="C#" Maintainer="auto" Value="public abstract class MD2 : System.Security.Cryptography.HashAlgorithm" />
-  <AssemblyInfo>
-    <AssemblyName>Mono.Security.Win32</AssemblyName>
-    <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF]</AssemblyPublicKey>
-    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-    <AssemblyVersion>2.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
-  <Base>
-    <BaseTypeName>System.Security.Cryptography.HashAlgorithm</BaseTypeName>
-  </Base>
-  <Interfaces>
-  </Interfaces>
-  <Docs>
-    <summary>Common base class for all derived MD2 implementations.</summary>
-    <remarks>This class isn't CryptoAPI related. It is included here so that Mono.Security.dll doesn't have any dependencies on assemblies other than mscorlib.dll.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="protected MD2 ();" />
-      <MemberType>Constructor</MemberType>
-      <ReturnValue />
-      <Parameters />
-      <Docs>
-        <summary>To be added</summary>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName="Create">
-      <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD2 Create ();" />
-      <MemberType>Method</MemberType>
-      <ReturnValue>
-        <ReturnType>Mono.Security.Cryptography.MD2</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>Creates the default derived class.</summary>
-        <returns>a <see cref="T:Mono.Security.Cryptography.MD2" /></returns>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName="Create">
-      <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD2 Create (string hashName);" />
-      <MemberType>Method</MemberType>
-      <ReturnValue>
-        <ReturnType>Mono.Security.Cryptography.MD2</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="hashName" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="hashName">Specifies which derived class to create.</param>
-        <summary>Creates a new derived class.</summary>
-        <returns>a <see cref="T:Mono.Security.Cryptography.MD2" /></returns>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-  </Members>
-</Type>
diff --git a/mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD4.xml b/mcs/class/Mono.Security.Win32/Documentation/en/Mono.Security.Cryptography/MD4.xml
deleted file mode 100644 (file)
index 73cb844..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<Type Name="MD4" FullName="Mono.Security.Cryptography.MD4">
-  <TypeSignature Language="C#" Maintainer="auto" Value="public abstract class MD4 : System.Security.Cryptography.HashAlgorithm" />
-  <AssemblyInfo>
-    <AssemblyName>Mono.Security.Win32</AssemblyName>
-    <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF]</AssemblyPublicKey>
-    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-    <AssemblyVersion>2.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
-  <Base>
-    <BaseTypeName>System.Security.Cryptography.HashAlgorithm</BaseTypeName>
-  </Base>
-  <Interfaces>
-  </Interfaces>
-  <Docs>
-    <summary>Common base class for all derived MD4 implementations. </summary>
-    <remarks>This class isn't CryptoAPI related. It is included here so that Mono.Security.dll doesn't have any dependencies on assemblies other than mscorlib.dll.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="protected MD4 ();" />
-      <MemberType>Constructor</MemberType>
-      <ReturnValue />
-      <Parameters />
-      <Docs>
-        <summary>To be added</summary>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName="Create">
-      <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD4 Create ();" />
-      <MemberType>Method</MemberType>
-      <ReturnValue>
-        <ReturnType>Mono.Security.Cryptography.MD4</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>Creates the default derived class.</summary>
-        <returns>a <see cref="T:Mono.Security.Cryptography.MD4" /></returns>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName="Create">
-      <MemberSignature Language="C#" Value="public static Mono.Security.Cryptography.MD4 Create (string hashName);" />
-      <MemberType>Method</MemberType>
-      <ReturnValue>
-        <ReturnType>Mono.Security.Cryptography.MD4</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="hashName" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="hashName">Specifies which derived class to create.</param>
-        <summary>Creates a new derived class.</summary>
-        <returns>a <see cref="T:Mono.Security.Cryptography.MD4" /></returns>
-        <remarks>To be added</remarks>
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-  </Members>
-</Type>
index e8a0b8a14822cb623ceeee7b84dc1e07144ef5cc..7a8456bb744e306f707480dc99f838de3be948de 100644 (file)
@@ -45,6 +45,7 @@ using Mono.Security.Cryptography;
 
 namespace Mono.Security.Protocol.Ntlm {
 
+       [Obsolete (Type3Message.LegacyAPIWarning)]
        public class ChallengeResponse : IDisposable {
 
                static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
new file mode 100644 (file)
index 0000000..5479520
--- /dev/null
@@ -0,0 +1,295 @@
+//
+// Mono.Security.Protocol.Ntlm.ChallengeResponse
+//     Implements Challenge Response for NTLM v1 and NTLM v2 Session
+//
+// Authors:
+//     Sebastien Pouliot <sebastien@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2004 Novell (http://www.novell.com)
+// (C) 2012 Xamarin, Inc. (http://www.xamarin.com)
+//
+// References
+// a.  NTLM Authentication Scheme for HTTP, Ronald Tschalär
+//     http://www.innovation.ch/java/ntlm.html
+// b.  The NTLM Authentication Protocol, Copyright © 2003 Eric Glass
+//     http://davenport.sourceforge.net/ntlm.html
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Net;
+using System.Globalization;
+using System.Security.Cryptography;
+using System.Text;
+
+using Mono.Security.Cryptography;
+
+namespace Mono.Security.Protocol.Ntlm {
+
+       public static class ChallengeResponse2 {
+
+               static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
+
+               // This is the pre-encrypted magic value with a null DES key (0xAAD3B435B51404EE)
+               // Ref: http://packetstormsecurity.nl/Crackers/NT/l0phtcrack/l0phtcrack2.5-readme.html
+               static private byte[] nullEncMagic = { 0xAA, 0xD3, 0xB4, 0x35, 0xB5, 0x14, 0x04, 0xEE };
+
+               static byte[] Compute_LM (string password, byte[] challenge)
+               {
+                       var buffer = new byte [21];
+
+                       // create Lan Manager password
+#if MOONLIGHT
+                       DESCryptoServiceProvider des = new DESCryptoServiceProvider ();
+#else
+                       DES des = DES.Create ();
+#endif
+                       des.Mode = CipherMode.ECB;
+                       ICryptoTransform ct = null;
+                               
+                       // Note: In .NET DES cannot accept a weak key
+                       // this can happen for a null password
+                       if ((password == null) || (password.Length < 1)) {
+                               Buffer.BlockCopy (nullEncMagic, 0, buffer, 0, 8);
+                       } else {
+                               des.Key = PasswordToKey (password, 0);
+                               ct = des.CreateEncryptor ();
+                               ct.TransformBlock (magic, 0, 8, buffer, 0);
+                       }
+                               
+                       // and if a password has less than 8 characters
+                       if ((password == null) || (password.Length < 8)) {
+                               Buffer.BlockCopy (nullEncMagic, 0, buffer, 8, 8);
+                       } else {
+                               des.Key = PasswordToKey (password, 7);
+                               ct = des.CreateEncryptor ();
+                               ct.TransformBlock (magic, 0, 8, buffer, 8);
+                       }
+                               
+                       des.Clear ();
+
+                       return GetResponse (challenge, buffer);
+               }
+
+               static byte[] Compute_NTLM_Password (string password)
+               {
+                       var buffer = new byte [21];
+
+                       // create NT password
+#if MOONLIGHT
+                       MD4Managed md4 = new MD4Managed ();
+#else
+                       MD4 md4 = MD4.Create ();
+#endif
+                       byte[] data = ((password == null) ? (new byte [0]) : (Encoding.Unicode.GetBytes (password)));
+                       byte[] hash = md4.ComputeHash (data);
+                       Buffer.BlockCopy (hash, 0, buffer, 0, 16);
+                       
+                       // clean up
+                       Array.Clear (data, 0, data.Length);
+                       Array.Clear (hash, 0, hash.Length);
+
+                       return buffer;
+               }
+
+               static byte[] Compute_NTLM (string password, byte[] challenge)
+               {
+                       var buffer = Compute_NTLM_Password (password);
+                       return GetResponse (challenge, buffer);
+               }
+
+               static void Compute_NTLMv2_Session (string password, byte[] challenge,
+                                                   out byte[] lm, out byte[] ntlm)
+               {
+                       var nonce = new byte [8];
+                       var rng = RandomNumberGenerator.Create ();
+                       rng.GetBytes (nonce);
+
+                       var sessionNonce = new byte [challenge.Length + 8];
+                       challenge.CopyTo (sessionNonce, 0);
+                       nonce.CopyTo (sessionNonce, challenge.Length);
+
+                       lm = new byte [24];
+                       nonce.CopyTo (lm, 0);
+
+#if MOONLIGHT
+                       MD5Managed md5 = new MD5Managed ();
+#else
+                       MD5 md5 = MD5.Create ();
+#endif
+                       
+                       var hash = md5.ComputeHash (sessionNonce);
+                       var newChallenge = new byte [8];
+                       Array.Copy (hash, newChallenge, 8);
+
+                       ntlm = Compute_NTLM (password, newChallenge);
+
+                       // clean up
+                       Array.Clear (nonce, 0, nonce.Length);
+                       Array.Clear (sessionNonce, 0, sessionNonce.Length);
+                       Array.Clear (newChallenge, 0, newChallenge.Length);
+                       Array.Clear (hash, 0, hash.Length);
+               }
+
+               static byte[] Compute_NTLMv2 (Type2Message type2, string username, string password)
+               {
+                       var ntlm_hash = Compute_NTLM_Password (password);
+
+                       var ubytes = Encoding.Unicode.GetBytes (username.ToUpperInvariant ());
+                       var tbytes = Encoding.Unicode.GetBytes (type2.TargetName.ToUpperInvariant ());
+
+                       var bytes = new byte [ubytes.Length + tbytes.Length];
+                       ubytes.CopyTo (bytes, 0);
+                       Array.Copy (tbytes, 0, bytes, ubytes.Length, tbytes.Length);
+
+                       var md5 = new HMACMD5 (ntlm_hash);
+                       var ntlm_v2_hash = md5.ComputeHash (bytes);
+
+                       Array.Clear (ntlm_hash, 0, ntlm_hash.Length);
+                       md5.Clear ();
+
+                       var ntlm_v2_md5 = new HMACMD5 (ntlm_v2_hash);
+
+                       var now = DateTime.Now;
+                       var timestamp = now.Ticks - 504911232000000000;
+                       
+                       var nonce = new byte [8];
+                       var rng = RandomNumberGenerator.Create ();
+                       rng.GetBytes (nonce);
+                       
+                       byte[] blob = new byte [28 + type2.TargetInfo.Length];
+                       blob[0] = 0x01;
+                       blob[1] = 0x01;
+
+                       Buffer.BlockCopy (BitConverterLE.GetBytes (timestamp), 0, blob, 8, 8);
+
+                       Buffer.BlockCopy (nonce, 0, blob, 16, 8);
+                       Buffer.BlockCopy (type2.TargetInfo, 0, blob, 28, type2.TargetInfo.Length);
+
+                       var challenge = type2.Nonce;
+
+                       var hashInput = new byte [challenge.Length + blob.Length];
+                       challenge.CopyTo (hashInput, 0);
+                       blob.CopyTo (hashInput, challenge.Length);
+
+                       var blobHash = ntlm_v2_md5.ComputeHash (hashInput);
+
+                       var response = new byte [blob.Length + blobHash.Length];
+                       blobHash.CopyTo (response, 0);
+                       blob.CopyTo (response, blobHash.Length);
+
+                       Array.Clear (ntlm_v2_hash, 0, ntlm_v2_hash.Length);
+                       ntlm_v2_md5.Clear ();
+                       Array.Clear (nonce, 0, nonce.Length);
+                       Array.Clear (blob, 0, blob.Length);
+                       Array.Clear (hashInput, 0, hashInput.Length);
+                       Array.Clear (blobHash, 0, blobHash.Length);
+
+                       return response;
+               }
+
+               public static void Compute (Type2Message type2, NtlmAuthLevel level,
+                                           string username, string password,
+                                           out byte[] lm, out byte[] ntlm)
+               {
+                       lm = null;
+
+                       switch (level) {
+                       case NtlmAuthLevel.LM_and_NTLM:
+                               lm = Compute_LM (password, type2.Nonce);
+                               ntlm = Compute_NTLM (password, type2.Nonce);
+                               break;
+
+                       case NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session:
+                               if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) == 0)
+                                       goto case NtlmAuthLevel.LM_and_NTLM;
+                               Compute_NTLMv2_Session (password, type2.Nonce, out lm, out ntlm);
+                               break;
+
+                       case NtlmAuthLevel.NTLM_only:
+                               if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) != 0)
+                                       Compute_NTLMv2_Session (password, type2.Nonce, out lm, out ntlm);
+                               else
+                                       ntlm = Compute_NTLM (password, type2.Nonce);
+                               break;
+
+                       case NtlmAuthLevel.NTLMv2_only:
+                               ntlm = Compute_NTLMv2 (type2, username, password);
+                               break;
+
+                       default:
+                               throw new InvalidOperationException ();
+                       }
+               }
+
+               static byte[] GetResponse (byte[] challenge, byte[] pwd) 
+               {
+                       byte[] response = new byte [24];
+#if MOONLIGHT
+                       DESCryptoServiceProvider des = new DESCryptoServiceProvider ();
+#else
+                       DES des = DES.Create ();
+#endif
+                       des.Mode = CipherMode.ECB;
+                       des.Key = PrepareDESKey (pwd, 0);
+                       ICryptoTransform ct = des.CreateEncryptor ();
+                       ct.TransformBlock (challenge, 0, 8, response, 0);
+                       des.Key = PrepareDESKey (pwd, 7);
+                       ct = des.CreateEncryptor ();
+                       ct.TransformBlock (challenge, 0, 8, response, 8);
+                       des.Key = PrepareDESKey (pwd, 14);
+                       ct = des.CreateEncryptor ();
+                       ct.TransformBlock (challenge, 0, 8, response, 16);
+                       return response;
+               }
+
+               static byte[] PrepareDESKey (byte[] key56bits, int position) 
+               {
+                       // convert to 8 bytes
+                       byte[] key = new byte [8];
+                       key [0] = key56bits [position];
+                       key [1] = (byte) ((key56bits [position] << 7)     | (key56bits [position + 1] >> 1));
+                       key [2] = (byte) ((key56bits [position + 1] << 6) | (key56bits [position + 2] >> 2));
+                       key [3] = (byte) ((key56bits [position + 2] << 5) | (key56bits [position + 3] >> 3));
+                       key [4] = (byte) ((key56bits [position + 3] << 4) | (key56bits [position + 4] >> 4));
+                       key [5] = (byte) ((key56bits [position + 4] << 3) | (key56bits [position + 5] >> 5));
+                       key [6] = (byte) ((key56bits [position + 5] << 2) | (key56bits [position + 6] >> 6));
+                       key [7] = (byte)  (key56bits [position + 6] << 1);
+                       return key;
+               }
+
+               static byte[] PasswordToKey (string password, int position) 
+               {
+                       byte[] key7 = new byte [7];
+                       int len = System.Math.Min (password.Length - position, 7);
+                       Encoding.ASCII.GetBytes (password.ToUpper (CultureInfo.CurrentCulture), position, len, key7, 0);
+                       byte[] key8 = PrepareDESKey (key7, 0);
+                       // cleanup intermediate key material
+                       Array.Clear (key7, 0, key7.Length);
+                       return key8;
+               }
+       }
+}
diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
new file mode 100644 (file)
index 0000000..e66d590
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// NtlmAuthLevel.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace Mono.Security.Protocol.Ntlm {
+       
+       /*
+        * On Windows, this is controlled by a registry setting
+        * (http://msdn.microsoft.com/en-us/library/ms814176.aspx)
+        *
+        * This can be configured by setting the static
+        * Type3Message.DefaultAuthLevel property, the default value
+        * is LM_and_NTLM_and_try_NTLMv2_Session.
+        */
+       
+       public enum NtlmAuthLevel {
+               /* Use LM and NTLM, never use NTLMv2 session security. */
+               LM_and_NTLM,
+               
+               /* Use NTLMv2 session security if the server supports it,
+                * otherwise fall back to LM and NTLM. */
+               LM_and_NTLM_and_try_NTLMv2_Session,
+               
+               /* Use NTLMv2 session security if the server supports it,
+                * otherwise fall back to NTLM.  Never use LM. */
+               NTLM_only,
+               
+               /* Use NTLMv2 only. */
+               NTLMv2_only,
+       }
+}
+
index 4db26d7913545b955ad72f012b6fe31362d0a450..a2f65e3e584b06fb618ae541beb01d8f4769db5e 100644 (file)
@@ -34,6 +34,7 @@
 //
 
 using System;
+using System.Text;
 using System.Security.Cryptography;
 
 namespace Mono.Security.Protocol.Ntlm {
@@ -41,6 +42,8 @@ namespace Mono.Security.Protocol.Ntlm {
        public class Type2Message : MessageBase {
 
                private byte[] _nonce;
+               private string _targetName;
+               private byte[] _targetInfo;
 
                public Type2Message () : base (2)
                {
@@ -78,15 +81,42 @@ namespace Mono.Security.Protocol.Ntlm {
                        }
                }
 
+               public string TargetName {
+                       get { return _targetName; }
+               }
+
+               public byte[] TargetInfo {
+                       get { return (byte[])_targetInfo.Clone (); }
+               }
+
                // methods
 
-               protected override void Decode (byte[] message) 
+               protected override void Decode (byte[] message)
                {
                        base.Decode (message);
 
-                       Flags = (NtlmFlags) BitConverterLE.ToUInt32 (message, 20);
+                       Flags = (NtlmFlags)BitConverterLE.ToUInt32 (message, 20);
 
                        Buffer.BlockCopy (message, 24, _nonce, 0, 8);
+
+                       var tname_len = BitConverterLE.ToUInt16 (message, 12);
+                       var tname_off = BitConverterLE.ToUInt16 (message, 16);
+                       if (tname_len > 0) {
+                               if ((Flags & NtlmFlags.NegotiateOem) != 0)
+                                       _targetName = Encoding.ASCII.GetString (message, tname_off, tname_len);
+                               else
+                                       _targetName = Encoding.Unicode.GetString (message, tname_off, tname_len);
+                       }
+                       
+                       // The Target Info block is optional.
+                       if (message.Length >= 48) {
+                               var tinfo_len = BitConverterLE.ToUInt16 (message, 40);
+                               var tinfo_off = BitConverterLE.ToUInt16 (message, 44);
+                               if (tinfo_len > 0) {
+                                       _targetInfo = new byte [tinfo_len];
+                                       Buffer.BlockCopy (message, tinfo_off, _targetInfo, 0, tinfo_len);
+                               }
+                       }
                }
 
                public override byte[] GetBytes ()
index 4662ae92b3fddbc51983d40fbb74672e09084bac..59e948fdfd9b5e0d77f14eb86a61dca34d345709 100644 (file)
@@ -41,20 +41,38 @@ namespace Mono.Security.Protocol.Ntlm {
 
        public class Type3Message : MessageBase {
 
+               private NtlmAuthLevel _level;
                private byte[] _challenge;
                private string _host;
                private string _domain;
                private string _username;
                private string _password;
+               private Type2Message _type2;
                private byte[] _lm;
                private byte[] _nt;
-
+               
+               internal const string LegacyAPIWarning = 
+                       "Use of this API is highly discouraged, " +
+                       "it selects legacy-mode LM/NTLM authentication, which sends " +
+                       "your password in very weak encryption over the wire even if " +
+                       "the server supports the more secure NTLMv2 / NTLMv2 Session. " +
+                       "You need to use the new `Type3Message (Type2Message)' constructor " +
+                       "to use the more secure NTLMv2 / NTLMv2 Session authentication modes. " +
+                       "These require the Type 2 message from the server to compute the response.";
+               
+               [Obsolete (LegacyAPIWarning)]
                public Type3Message () : base (3)
                {
+                       if (DefaultAuthLevel != NtlmAuthLevel.LM_and_NTLM)
+                               throw new InvalidOperationException (
+                                       "Refusing to use legacy-mode LM/NTLM authentication " +
+                                       "unless explicitly enabled using DefaultAuthLevel.");
+
                        // default values
                        _domain = Environment.UserDomainName;
                        _host = Environment.MachineName;
                        _username = Environment.UserName;
+                       _level = NtlmAuthLevel.LM_and_NTLM;
                        Flags = (NtlmFlags) 0x8201;
                }
 
@@ -63,6 +81,26 @@ namespace Mono.Security.Protocol.Ntlm {
                        Decode (message);
                }
 
+               public Type3Message (Type2Message type2) : base (3)
+               {
+                       _type2 = type2;
+                       _level = DefaultAuthLevel;
+                       _challenge = (byte[]) type2.Nonce.Clone ();
+
+                       _domain = type2.TargetName;
+                       _host = Environment.MachineName;
+                       _username = Environment.UserName;
+
+                       Flags = (NtlmFlags) 0x8200;
+                       if ((type2.Flags & NtlmFlags.NegotiateUnicode) != 0)
+                               Flags |= NtlmFlags.NegotiateUnicode;
+                       else
+                               Flags |= NtlmFlags.NegotiateOem;
+
+                       if ((type2.Flags & NtlmFlags.NegotiateNtlm2Key) != 0)
+                               Flags |= NtlmFlags.NegotiateNtlm2Key;
+               }
+
                ~Type3Message () 
                {
                        if (_challenge != null)
@@ -73,14 +111,34 @@ namespace Mono.Security.Protocol.Ntlm {
                                Array.Clear (_nt, 0, _nt.Length);
                }
 
+               // Default auth level
+
+               static NtlmAuthLevel _default = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
+
+               public static NtlmAuthLevel DefaultAuthLevel {
+                       get { return _default; }
+                       set { _default = value; }
+               }
+
+               public NtlmAuthLevel Level {
+                       get { return _level; }
+                       set { _level = value; }
+               }
+               
                // properties
 
+               [Obsolete (LegacyAPIWarning)]
                public byte[] Challenge {
                        get { 
                                if (_challenge == null)
                                        return null;
                                return (byte[]) _challenge.Clone (); }
                        set { 
+                               if ((_type2 != null) || (_level != NtlmAuthLevel.LM_and_NTLM))
+                                       throw new InvalidOperationException (
+                                               "Refusing to use legacy-mode LM/NTLM authentication " +
+                                                       "unless explicitly enabled using DefaultAuthLevel.");
+                               
                                if (value == null)
                                        throw new ArgumentNullException ("Challenge");
                                if (value.Length != 8) {
@@ -94,6 +152,9 @@ namespace Mono.Security.Protocol.Ntlm {
                public string Domain {
                        get { return _domain; }
                        set {
+                               if (_type2 != null)
+                                       throw new InvalidOperationException (
+                                               "Domain is set automatically from Type2Message.TargetName");
                                if (value == null)
                                        value = "";
                                if (value == "")
@@ -135,11 +196,12 @@ namespace Mono.Security.Protocol.Ntlm {
 
                public byte[] NT {
                        get { return _nt; }
+                       set { _nt = value; }
                }
 
                // methods
 
-               protected override void Decode (byte[] message) 
+               protected override void Decode (byte[] message)
                {
                        base.Decode (message);
 
@@ -150,105 +212,154 @@ namespace Mono.Security.Protocol.Ntlm {
 
                        _password = null;
 
-                       int dom_len = BitConverterLE.ToUInt16 (message, 28);
-                       int dom_off = 64;
-                       _domain = Encoding.Unicode.GetString (message, dom_off, dom_len);
+                       if (message.Length >= 64)
+                               Flags = (NtlmFlags)BitConverterLE.ToUInt32 (message, 60);
+                       else
+                               Flags = (NtlmFlags)0x8201;
+                       
+                       int lm_len = BitConverterLE.ToUInt16 (message, 12);
+                       int lm_off = BitConverterLE.ToUInt16 (message, 16);
+                       _lm = new byte [lm_len];
+                       Buffer.BlockCopy (message, lm_off, _lm, 0, lm_len);
 
-                       int host_len = BitConverterLE.ToUInt16 (message, 44);
-                       int host_off = BitConverterLE.ToUInt16 (message, 48);
-                       _host = Encoding.Unicode.GetString (message, host_off, host_len);
+                       int nt_len = BitConverterLE.ToUInt16 (message, 20);
+                       int nt_off = BitConverterLE.ToUInt16 (message, 24);
+                       _nt = new byte [nt_len];
+                       Buffer.BlockCopy (message, nt_off, _nt, 0, nt_len);
+                       
+                       int dom_len = BitConverterLE.ToUInt16 (message, 28);
+                       int dom_off = BitConverterLE.ToUInt16 (message, 32);
+                       _domain = DecodeString (message, dom_off, dom_len);
 
                        int user_len = BitConverterLE.ToUInt16 (message, 36);
                        int user_off = BitConverterLE.ToUInt16 (message, 40);
-                       _username = Encoding.Unicode.GetString (message, user_off, user_len);
-
-                       _lm = new byte [24];
-                       int lm_off = BitConverterLE.ToUInt16 (message, 16);
-                       Buffer.BlockCopy (message, lm_off, _lm, 0, 24);
+                       _username = DecodeString (message, user_off, user_len);
                        
-                       _nt = new byte [24];
-                       int nt_off = BitConverterLE.ToUInt16 (message, 24);
-                       Buffer.BlockCopy (message, nt_off, _nt, 0, 24);
+                       int host_len = BitConverterLE.ToUInt16 (message, 44);
+                       int host_off = BitConverterLE.ToUInt16 (message, 48);
+                       _host = DecodeString (message, host_off, host_len);
+                       
+                       // Session key.  We don't use it yet.
+                       // int skey_len = BitConverterLE.ToUInt16 (message, 52);
+                       // int skey_off = BitConverterLE.ToUInt16 (message, 56);
+               }
 
-                       if (message.Length >= 64)
-                               Flags = (NtlmFlags) BitConverterLE.ToUInt32 (message, 60);
+               string DecodeString (byte[] buffer, int offset, int len)
+               {
+                       if ((Flags & NtlmFlags.NegotiateUnicode) != 0)
+                               return Encoding.Unicode.GetString (buffer, offset, len);
+                       else
+                               return Encoding.ASCII.GetString (buffer, offset, len);
+               }
+
+               byte[] EncodeString (string text)
+               {
+                       if (text == null)
+                               return new byte [0];
+                       if ((Flags & NtlmFlags.NegotiateUnicode) != 0)
+                               return Encoding.Unicode.GetBytes (text);
+                       else
+                               return Encoding.ASCII.GetBytes (text);
                }
 
-               public override byte[] GetBytes () 
+               public override byte[] GetBytes ()
                {
-                       byte[] domain = Encoding.Unicode.GetBytes (_domain.ToUpper (CultureInfo.InvariantCulture));
-                       byte[] user = Encoding.Unicode.GetBytes (_username);
-                       byte[] host = Encoding.Unicode.GetBytes (_host.ToUpper (CultureInfo.InvariantCulture));
+                       byte[] target = EncodeString (_domain);
+                       byte[] user = EncodeString (_username);
+                       byte[] host = EncodeString (_host);
+
+                       byte[] lm, ntlm;
+                       if (_type2 == null) {
+                               if (_level != NtlmAuthLevel.LM_and_NTLM)
+                                       throw new InvalidOperationException (
+                                               "Refusing to use legacy-mode LM/NTLM authentication " +
+                                                       "unless explicitly enabled using DefaultAuthLevel.");
+                               
+                               using (var legacy = new ChallengeResponse (_password, _challenge)) {
+                                       lm = legacy.LM;
+                                       ntlm = legacy.NT;
+                               }
+                       } else {
+                               ChallengeResponse2.Compute (_type2, _level, _username, _password, out lm, out ntlm);
+                       }
+
+                       var lmresp_len = lm != null ? lm.Length : 0;
+                       var ntresp_len = ntlm != null ? ntlm.Length : 0;
 
-                       byte[] data = PrepareMessage (64 + domain.Length + user.Length + host.Length + 24 + 24);
+                       byte[] data = PrepareMessage (64 + target.Length + user.Length + host.Length + lmresp_len + ntresp_len);
 
                        // LM response
-                       short lmresp_off = (short)(64 + domain.Length + user.Length + host.Length);
-                       data [12] = (byte) 0x18;
-                       data [13] = (byte) 0x00;
-                       data [14] = (byte) 0x18;
-                       data [15] = (byte) 0x00;
-                       data [16] = (byte) lmresp_off;
+                       short lmresp_off = (short)(64 + target.Length + user.Length + host.Length);
+                       data [12] = (byte)lmresp_len;
+                       data [13] = (byte)0x00;
+                       data [14] = (byte)lmresp_len;
+                       data [15] = (byte)0x00;
+                       data [16] = (byte)lmresp_off;
                        data [17] = (byte)(lmresp_off >> 8);
 
                        // NT response
-                       short ntresp_off = (short)(lmresp_off + 24);
-                       data [20] = (byte) 0x18;
-                       data [21] = (byte) 0x00;
-                       data [22] = (byte) 0x18;
-                       data [23] = (byte) 0x00;
-                       data [24] = (byte) ntresp_off;
+                       short ntresp_off = (short)(lmresp_off + lmresp_len);
+                       data [20] = (byte)ntresp_len;
+                       data [21] = (byte)(ntresp_len >> 8);
+                       data [22] = (byte)ntresp_len;
+                       data [23] = (byte)(ntresp_len >> 8);
+                       data [24] = (byte)ntresp_off;
                        data [25] = (byte)(ntresp_off >> 8);
 
-                       // domain
-                       short dom_len = (short)domain.Length;
+                       // target
+                       short dom_len = (short)target.Length;
                        short dom_off = 64;
-                       data [28] = (byte) dom_len;
+                       data [28] = (byte)dom_len;
                        data [29] = (byte)(dom_len >> 8);
                        data [30] = data [28];
                        data [31] = data [29];
-                       data [32] = (byte) dom_off;
+                       data [32] = (byte)dom_off;
                        data [33] = (byte)(dom_off >> 8);
 
                        // username
                        short uname_len = (short)user.Length;
                        short uname_off = (short)(dom_off + dom_len);
-                       data [36] = (byte) uname_len;
+                       data [36] = (byte)uname_len;
                        data [37] = (byte)(uname_len >> 8);
                        data [38] = data [36];
                        data [39] = data [37];
-                       data [40] = (byte) uname_off;
+                       data [40] = (byte)uname_off;
                        data [41] = (byte)(uname_off >> 8);
 
                        // host
                        short host_len = (short)host.Length;
                        short host_off = (short)(uname_off + uname_len);
-                       data [44] = (byte) host_len;
+                       data [44] = (byte)host_len;
                        data [45] = (byte)(host_len >> 8);
                        data [46] = data [44];
                        data [47] = data [45];
-                       data [48] = (byte) host_off;
+                       data [48] = (byte)host_off;
                        data [49] = (byte)(host_off >> 8);
 
                        // message length
                        short msg_len = (short)data.Length;
-                       data [56] = (byte) msg_len;
+                       data [56] = (byte)msg_len;
                        data [57] = (byte)(msg_len >> 8);
 
+                       int flags = (int)Flags;
+
                        // options flags
-                       data [60] = (byte) Flags;
-                       data [61] = (byte)((uint)Flags >> 8);
-                       data [62] = (byte)((uint)Flags >> 16);
-                       data [63] = (byte)((uint)Flags >> 24);
+                       data [60] = (byte)flags;
+                       data [61] = (byte)((uint)flags >> 8);
+                       data [62] = (byte)((uint)flags >> 16);
+                       data [63] = (byte)((uint)flags >> 24);
 
-                       Buffer.BlockCopy (domain, 0, data, dom_off, domain.Length);
+                       Buffer.BlockCopy (target, 0, data, dom_off, target.Length);
                        Buffer.BlockCopy (user, 0, data, uname_off, user.Length);
                        Buffer.BlockCopy (host, 0, data, host_off, host.Length);
 
-                       using (ChallengeResponse ntlm = new ChallengeResponse (_password, _challenge)) {
-                               Buffer.BlockCopy (ntlm.LM, 0, data, lmresp_off, 24);
-                               Buffer.BlockCopy (ntlm.NT, 0, data, ntresp_off, 24);
+                       if (lm != null) {
+                               Buffer.BlockCopy (lm, 0, data, lmresp_off, lm.Length);
+                               Array.Clear (lm, 0, lm.Length);
                        }
+                       Buffer.BlockCopy (ntlm, 0, data, ntresp_off, ntlm.Length);
+                       Array.Clear (ntlm, 0, ntlm.Length);
+
                        return data;
                }
        }
index 2bb1d7bb8ef203974d79242059f2f5b2251ffd61..42ca34523a44e8215bb767e030d0b2cb1581a327 100644 (file)
@@ -23,6 +23,7 @@
 //
 
 using System;
+using System.Net;
 using System.Security.Cryptography;
 
 namespace Mono.Security.Protocol.Tls.Handshake.Client
@@ -63,15 +64,10 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
                #region Protected Methods
 
                protected override void ProcessAsSsl3()
-               {
-                       this.ProcessAsTls1();
-               }
-
-               protected override void ProcessAsTls1()
                {
                        // Client Version
                        this.Write(this.Context.Protocol);
-                                                               
+
                        // Random bytes - Unix time + Radom bytes [28]
                        TlsStream clientRandom = new TlsStream();
                        clientRandom.Write(this.Context.GetUnixTime());
@@ -111,10 +107,23 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
                        
                        // Compression methods ( 0 = none )
                        this.Write((byte)this.Context.CompressionMethod);
+               }
 
+               protected override void ProcessAsTls1()
+               {
+                       ProcessAsSsl3 ();
+
+                       // If applicable add the "server_name" extension to the hello message
                        // http://www.ietf.org/rfc/rfc3546.txt
+                       string host = Context.ClientSettings.TargetHost;
+                       // Our TargetHost might be an address (not a host *name*) - see bug #8553
+                       // RFC3546 -> Literal IPv4 and IPv6 addresses are not permitted in "HostName".
+                       IPAddress addr;
+                       if (IPAddress.TryParse (host, out addr))
+                               return;
+
                        TlsStream extensions = new TlsStream ();
-                       byte[] server_name = System.Text.Encoding.UTF8.GetBytes (Context.ClientSettings.TargetHost);
+                       byte[] server_name = System.Text.Encoding.UTF8.GetBytes (host);
                        extensions.Write ((short) 0x0000);                      // ExtensionType: server_name (0)
                        extensions.Write ((short) (server_name.Length + 5));    // ServerNameList (length)
                        extensions.Write ((short) (server_name.Length + 3));    // ServerName (length)
index fd1e2c5e206fd8ff86d952d33e621f520213f298..0d4a4497200b008f15646c7bef888bce18d537a6 100644 (file)
@@ -291,10 +291,10 @@ namespace Mono.Security.Protocol.Tls
                        }
                }
 
-               private void SafeReceiveRecord (Stream s)
+               private void SafeReceiveRecord (Stream s, bool ignoreEmpty = false)
                {
                        byte[] record = this.protocol.ReceiveRecord (s);
-                       if ((record == null) || (record.Length == 0)) {
+                       if (!ignoreEmpty && ((record == null) || (record.Length == 0))) {
                                throw new TlsException (
                                        AlertDescription.HandshakeFailiure,
                                        "The server stopped the handshake.");
@@ -308,8 +308,8 @@ namespace Mono.Security.Protocol.Tls
                        // Read server response
                        while (this.context.LastHandshakeMsg != HandshakeType.ServerHelloDone) 
                        {
-                               // Read next record
-                               SafeReceiveRecord (this.innerStream);
+                               // Read next record (skip empty, e.g. warnings alerts)
+                               SafeReceiveRecord (this.innerStream, true);
 
                                // special case for abbreviated handshake where no ServerHelloDone is sent from the server
                                if (this.context.AbbreviatedHandshake && (this.context.LastHandshakeMsg == HandshakeType.ServerHello))
index f38e35e06aba5223770483a2a9ab2304b37a5a84..e6a36298cdf6777f7cbf1ca1fa6441d30ebc3918 100644 (file)
@@ -66,7 +66,9 @@
 ./Mono.Security.Cryptography/TlsHMAC.cs
 ./Mono.Security.Cryptography/MD5SHA1.cs
 ./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
+./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
 ./Mono.Security.Protocol.Ntlm/MessageBase.cs
+./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
 ./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
 ./Mono.Security.Protocol.Ntlm/Type1Message.cs
 ./Mono.Security.Protocol.Ntlm/Type2Message.cs
index 2421612e4b87208d1c20a442e97e8195fc93162f..7164640be9b3d900fa1ac0ef05005fa76a8d4e9b 100644 (file)
@@ -23,7 +23,7 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                [ExpectedException (typeof (ArgumentNullException))]
                public void Decode_Null () 
                {
-                       Type3Message msg = new Type3Message (null);
+                       Type3Message msg = new Type3Message ((byte[])null);
                }
 
                [Test]
index 79bc2d9ca281c83f923810ab907c27c1bdef7382..05ad02f25f3655cc81fb9ebee2b5ce57edd06ccf 100644 (file)
@@ -23,6 +23,12 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
                static byte[] data1 = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x72, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x54, 0x00, 0x00, 0x00, 0x12, 0x00, 0x12, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x01, 0x82, 0x00, 0x00, 0x55, 0x00, 0x52, 0x00, 0x53, 0x00, 0x41, 0x00, 0x2d, 0x00, 0x4d, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x52, 0x00, 0x5a, 0x00, 0x61, 0x00, 0x70, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x4c, 0x00, 0x49, 0x00, 0x47, 0x00, 0x48, 0x00, 0x54, 0x00, 0x43, 0x00, 0x49, 0x00, 0x54, 0x00, 0x59, 0x00, 0xad, 0x87, 0xca, 0x6d, 0xef, 0xe3, 0x46, 0x85, 0xb9, 0xc4, 0x3c, 0x47, 0x7a, 0x8c, 0x42, 0xd6, 0x00, 0x66, 0x7d, 0x68, 0x92, 0xe7, 0xe8, 0x97, 0xe0, 0xe0, 0x0d, 0xe3, 0x10, 0x4a, 0x1b, 0xf2, 0x05, 0x3f, 0x07, 0xc7, 0xdd, 0xa8, 0x2d, 0x3c, 0x48, 0x9a, 0xe9, 0x89, 0xe1, 0xb0, 0x00, 0xd3 };
                static byte[] data2 = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x16, 0x00, 0x16, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x57, 0x00, 0x4f, 0x00, 0x52, 0x00, 0x4b, 0x00, 0x53, 0x00, 0x54, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4f, 0x00, 0x4e, 0x00, 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97, 0x82, 0xa6, 0x67, 0xaf, 0x6d, 0x42, 0x7c, 0x6d, 0xe6, 0x7c, 0x20, 0xc2, 0xd3, 0xe7, 0x7c, 0x56, 0x25, 0xa9, 0x8c, 0x1c, 0x31, 0xe8, 0x18, 0x47, 0x46, 0x6b, 0x29, 0xb2, 0xdf, 0x46, 0x80, 0xf3, 0x99, 0x58, 0xfb, 0x8c, 0x21, 0x3a, 0x9c, 0xc6 };
+               
+               static Type3MessageTest ()
+               {
+                       // Explicitly select legacy-mode.
+                       Type3Message.DefaultAuthLevel = NtlmAuthLevel.LM_and_NTLM;
+               }
 
                [Test]
                // Example for a password smaller than 8 characters - which implies a weak DES key
@@ -44,8 +50,9 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        Type3Message msg = new Type3Message ();
                        msg.Challenge = nonce;
-                       msg.Domain = "Ursa-Minor";
-                       msg.Host = "LightCity";
+                       // Type3Message now encodes domain and host case-sensitive.
+                       msg.Domain = "URSA-MINOR";
+                       msg.Host = "LIGHTCITY";
                        msg.Password = "Beeblebrox";
                        msg.Username = "Zaphod";
                        AssertEquals ("Type", 3, msg.Type);
index e205619f7db8b8f580cbbfc08c7570081b424255..fe250f48295710a7d17cf75c047f7f0bb12d454f 100644 (file)
@@ -463,7 +463,7 @@ namespace Novell.Directory.Ldap.Rfc2251
 
 //                                                             utf8Bytes = new System.String(ca).getBytes("UTF-8");
                                                                // copy utf8 encoded character into octets
-                                                               Array.Copy((System.Array) SupportClass.ToByteArray(utf8Bytes), 0, (System.Array)SupportClass.ToByteArray( octets), iOctets, utf8Bytes.Length);
+                                                               Array.Copy((System.Array) (utf8Bytes), 0, (System.Array) octets, iOctets, utf8Bytes.Length);
                                                                iOctets = iOctets + utf8Bytes.Length;
                                                        }
                                                        escape = false;
index fa2c360863ae12151c3c0219173796f17c214da4..b2bc01dbd606b888ae23d0e394284717b93d2193 100644 (file)
@@ -55,6 +55,7 @@ namespace PEAPI {
                PublicSealed = 0x101, SpecialName = 0x400, RTSpecialName = 0x800, 
                Import = 0x1000, Serializable = 0x2000, UnicodeClass = 0x10000,
                AutoClass = 0x20000, HasSecurity = 0x40000, BeforeFieldInit = 0x100000,
+               Forwarder = 0x200000,
                VisibilityMask = 0x07 }
 
        /// <summary>
@@ -2090,9 +2091,9 @@ namespace PEAPI {
                ExternClass externClass;
 
                internal ExternClassRef(TypeAttr attrs, string nsName, string name,
-                               FileRef declFile, MetaData md) : base(nsName,name,md) 
+                               MetaDataElement declRef, MetaData md) : base(nsName,name,md) 
                {
-                       externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declFile);
+                       externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declRef);
                        metaData.AddToTable(MDTable.ExportedType,externClass);
                }
 
index 0cb718cee345b6fb092e5893aa0084c41667cdfa..ce259c0739bc97e5e8dea133a3a97be6aba199b8 100644 (file)
@@ -753,6 +753,11 @@ namespace PEAPI {
                        return modRef;
                }
 
+               public ClassRef AddExternClass(string name, TypeAttr attrs, MetaDataElement declRef) 
+               {
+                       return new ExternClassRef (attrs, null, name, declRef, metaData);
+               }
+               
                /// <summary>
                /// Add a "global" method to this module
                /// </summary>
index f21ffa26a3d9812ff939b80a2256e2de4ab21de1..a3f8dc924f43c9c479e4b3fd578cc0e5025d0ddd 100644 (file)
@@ -356,6 +356,7 @@ namespace System.Configuration {
                        section.ConfigHost = system.Host;
                        group.AddChild (section);
                        elementData [section] = sec;
+                       sec.Configuration = this;
                }
                
                internal void CreateSectionGroup (SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec)
index 704bb4a88ecb9d9ef92f6630be3db6a76de61258..0fe992c6d4a7dbdc609b64f12bdc7f1bd7cab38b 100644 (file)
@@ -94,12 +94,12 @@ namespace System.Configuration
                        }
                }
 
-               [MonoTODO]
                protected ContextInformation EvaluationContext {
                        get {
                                if (Configuration != null)
                                        return Configuration.EvaluationContext;
-                               throw new NotImplementedException ();
+                               throw new ConfigurationErrorsException (
+                                       "This element is not currently associated with any context.");
                        }
                }
 
index 7b02a1a13aaf5c07e562a10b5cd52c92e4db25e7..84723f85aa5e8ae7698f977578ee6ca21c7e28cd 100644 (file)
@@ -134,6 +134,7 @@ namespace System.Configuration
                {
                        ConfigurationElement elem = (ConfigurationElement) Activator.CreateInstance (t);
                        elem.Init ();
+                       elem.Configuration = Configuration;
                        if (IsReadOnly ())
                                elem.SetReadOnly ();
                        return elem;
index 1219fcd99926776e632072f7c24381043c4b4d3a..07ce1da61d55649f9c86a86ee8a146fd99e5b974 100644 (file)
@@ -207,7 +207,7 @@ namespace System.Configuration
                public virtual Stream OpenStreamForWrite (string streamName, string templateStreamName, ref object writeContext)
                {
                        string dir = Path.GetDirectoryName (streamName);
-                       if (!Directory.Exists (dir))
+                       if (!String.IsNullOrEmpty (dir) && !Directory.Exists (dir))
                                Directory.CreateDirectory (dir);
                        return new FileStream (streamName, FileMode.Create, FileAccess.Write);
                }
index d6e06cd3e8996f07e821ad7d0cb652be47d3daee..d47ce4de9121f749ace9c910567c1106a418a204 100644 (file)
@@ -61,6 +61,18 @@ namespace MonoTests.System.Configuration {
                        if (Directory.Exists (tempFolder))
                                Directory.Delete (tempFolder, true);
                }
+               
+               static string DotNetVersion {
+                       get {
+#if NET_4_5
+                               return "net_4_5";
+#elif NET_4_0
+                               return "net_4_0";
+#else
+                               return "net_2_0";
+#endif
+                       }
+               }
 
                [Test] // OpenExeConfiguration (ConfigurationUserLevel)
                [Category ("NotWorking")] // bug #323622
@@ -145,12 +157,8 @@ namespace MonoTests.System.Configuration {
                        FileInfo fi = new FileInfo (config.FilePath);
 #if TARGET_JVM
                        Assert.AreEqual ("nunit-console.jar.config", fi.Name);
-#elif NET_4_5
-                       Assert.AreEqual ("System.Configuration_test_net_4_5.dll.config", fi.Name);
-#elif NET_4_0
-                       Assert.AreEqual ("System.Configuration_test_net_4_0.dll.config", fi.Name);
 #else
-                       Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+                       Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
 #endif
                }
 
@@ -263,8 +271,9 @@ namespace MonoTests.System.Configuration {
                public void exePath_UserLevelNone ()
                {
                        string basedir = AppDomain.CurrentDomain.BaseDirectory;
-                       SysConfig config = ConfigurationManager.OpenExeConfiguration("System.Configuration_test_net_2_0.dll.mdb");
-                       Assert.AreEqual (Path.Combine (basedir, "System.Configuration_test_net_2_0.dll.mdb.config"), config.FilePath);
+                       string name = "System.Configuration_test_" + DotNetVersion + ".dll";
+                       SysConfig config = ConfigurationManager.OpenExeConfiguration (name);
+                       Assert.AreEqual (Path.Combine (basedir, name + ".config"), config.FilePath);
                }
 
                [Test]
@@ -396,7 +405,7 @@ namespace MonoTests.System.Configuration {
                        Console.WriteLine("null exe application config path: {0}", config.FilePath);    
 
                        FileInfo fi = new FileInfo (config.FilePath);
-                       Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+                       Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
 #endif
                }
 
@@ -411,7 +420,7 @@ namespace MonoTests.System.Configuration {
 #if TARGET_JVM
                        Assert.AreEqual("System.Configuration.Test20.jar.config", fi.Name);
 #else
-                       Assert.AreEqual ("System.Configuration_test_net_2_0.dll.config", fi.Name);
+                       Assert.AreEqual ("System.Configuration_test_" + DotNetVersion + ".dll.config", fi.Name);
 #endif
                }
 
@@ -486,6 +495,86 @@ namespace MonoTests.System.Configuration {
                        Assert.IsNotNull(section as TestSection);
                        config.Sections.Remove(name);
                }
+               
+               [Test]
+               public void TestFileMap ()
+               {
+                       var name = Path.GetRandomFileName () + ".config";
+                       Assert.IsFalse (File.Exists (name));
+
+                       try {
+                               var map = new ExeConfigurationFileMap ();
+                               map.ExeConfigFilename = name;
+                       
+                               var config = ConfigurationManager.OpenMappedExeConfiguration (
+                                       map, ConfigurationUserLevel.None);
+                               
+                               config.Sections.Add ("testsection", new TestSection ());
+                       
+                               config.Save ();
+                       
+                               Assert.IsTrue (File.Exists (name), "#1");
+                               Assert.IsTrue (File.Exists (Path.GetFullPath (name)), "#2");
+                       } finally {
+                               File.Delete (name);
+                       }
+               }
+               
+               [Test]
+               public void TestContext ()
+               {
+                       var config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.None);
+                       const string name = "testsection";
+
+                       // ensure not present
+                       if (config.GetSection (name) != null)
+                               config.Sections.Remove (name);
+
+                       var section = new TestContextSection ();
+
+                       // Can't access EvaluationContext ....
+                       try {
+                               section.TestContext (null);
+                               Assert.Fail ("#1");
+                       } catch (ConfigurationException) {
+                               ;
+                       }
+
+                       // ... until it's been added to a section.
+                       config.Sections.Add (name, section);
+                       section.TestContext ("#2");
+
+                       // Remove ...
+                       config.Sections.Remove (name);
+
+                       // ... and it doesn't lose its context
+                       section.TestContext (null);
+               }
+
+               [Test]
+               public void TestContext2 ()
+               {
+                       var name = Path.GetRandomFileName () + ".config";
+                       Assert.IsFalse (File.Exists (name));
+                       
+                       try {
+                               var map = new ExeConfigurationFileMap ();
+                               map.ExeConfigFilename = name;
+                               
+                               var config = ConfigurationManager.OpenMappedExeConfiguration (
+                                       map, ConfigurationUserLevel.None);
+                               
+                               config.Sections.Add ("testsection", new TestSection ());
+                               config.Sections.Add ("testcontext", new TestContextSection ());
+                               
+                               config.Save ();
+                               
+                               Assert.IsTrue (File.Exists (name), "#1");
+                       } finally {
+                               File.Delete (name);
+                       }
+               }
+
                        
                class TestSection : ConfigurationSection  {}
 
@@ -533,5 +622,12 @@ namespace MonoTests.System.Configuration {
                                return ConfigurationManager.AppSettings [key];
                        }
                }
+               
+               class TestContextSection : ConfigurationSection {
+                       public void TestContext (string label)
+                       {
+                               Assert.That (EvaluationContext != null, label);
+                       }
+               }
        }
 }
index 9baf52c37057c92be842a63f277153182599ae9b..c4f9a6624d67e6c90033b83d82a748c2d78fa9f0 100644 (file)
@@ -199,7 +199,7 @@ namespace System.IO.MemoryMappedFiles
                }
 
 
-               [DllImport("kernel32.dll", SetLastError = true)]
+               [DllImport("kernel32", SetLastError = true)]
                static extern bool SetHandleInformation (IntPtr hObject, int dwMask, int dwFlags);
                static void ConfigureWindowsFD (IntPtr handle, HandleInheritability h)
                {
index 569299e8fbdcb2277abe5241e23d55e7e2538735..143f57513f47f7ba7c38307bf8729162d48b5d95 100644 (file)
@@ -97,6 +97,7 @@ namespace System.Linq.Expressions {
                        this.is_lifted = is_lifted;
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitArrayAccess (EmitContext ec)
                {
                        left.Emit (ec);
@@ -768,5 +769,6 @@ namespace System.Linq.Expressions {
                                throw new NotSupportedException (this.NodeType.ToString ());
                        }
                }
+#endif
        }
 }
index b9286535bc188321b0130002444229b39a6835d5..6d6d5dd60eca27dfa7da896d430566048555c914 100644 (file)
@@ -57,6 +57,7 @@ namespace System.Linq.Expressions {
                        this.if_false = if_false;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        var ig = ec.ig;
@@ -74,5 +75,6 @@ namespace System.Linq.Expressions {
 
                        ig.MarkLabel (end_target);
                }
+#endif
        }
 }
index dd45bdc967c6f7a82073b4e3e792a66fb915b7ba..38a7b3cab66116f54649681a2016c64a5b4de9af 100644 (file)
@@ -50,6 +50,7 @@ namespace System.Linq.Expressions {
                        this.value = value;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        if (Type.IsNullable ()) {
@@ -190,5 +191,6 @@ namespace System.Linq.Expressions {
 
                        emit (ec);
                }
+#endif
        }
 }
index 0880f12f770d76b78eea402595488dfc37b38623..2069927b3066aed4119802c8272b32e1ee243406 100644 (file)
@@ -57,6 +57,7 @@ namespace System.Linq.Expressions {
                        return ExpressionPrinter.ToString (this);
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitPopIfNeeded (EmitContext ec)
                {
                        if (add_method.ReturnType == typeof (void))
@@ -70,5 +71,6 @@ namespace System.Linq.Expressions {
                        ec.EmitCall (local, arguments, add_method);
                        EmitPopIfNeeded (ec);
                }
+#endif
        }
 }
index dd9934218b2565857f8caf113d7e2697e8dadd84..a43b87f728bf0f2ad672b30c2e2b2edea1a2b808 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Collections.ObjectModel;
 using System.Collections.Generic;
@@ -606,3 +607,4 @@ namespace System.Linq.Expressions {
                }
        }
 }
+#endif
index ebc27e0545776a5ae3546bfbfbed58a7de58c004..bfe939a5cb0901bb47395d82de7a18de15840b68 100644 (file)
@@ -2268,9 +2268,11 @@ namespace System.Linq.Expressions {
                // This method must be overwritten by derived classes to
                // compile the expression
                //
+#if !FULL_AOT_RUNTIME
                internal virtual void Emit (EmitContext ec)
                {
                        throw new NotImplementedException (String.Format ("Emit method is not implemented in expression type {0}", GetType ()));
                }
+#endif
        }
 }
index 13994a13202c076824b8c274e15757a0edddb1a9..ad12dc38460dc405f4d5b5fdbf7ef4915e74f275 100644 (file)
@@ -53,9 +53,11 @@ namespace System.Linq.Expressions {
                        this.arguments = arguments;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        ec.EmitCall (expression, arguments, expression.Type.GetInvokeMethod ());
                }
+#endif
        }
 }
index 96d3ed817115e39b11fff83603eb8c172822556f..92a40c6d4b7f220bf1591ba48ff3b976b833fd00 100644 (file)
@@ -55,6 +55,7 @@ namespace System.Linq.Expressions {
                        this.parameters = parameters;
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitPopIfNeeded (EmitContext ec)
                {
                        if (GetReturnType () == typeof (void) && body.Type != typeof (void))
@@ -72,6 +73,7 @@ namespace System.Linq.Expressions {
                        EmitPopIfNeeded (ec);
                        ec.ig.Emit (OpCodes.Ret);
                }
+#endif
 
                internal Type GetReturnType ()
                {
index 30915a89dc3b28933cae728236ef027a61509023..517ad39a72d2f15f6e81de091fae72dc90588070 100644 (file)
@@ -53,11 +53,13 @@ namespace System.Linq.Expressions {
                        this.initializers = initializers;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        var local = ec.EmitStored (new_expression);
                        ec.EmitCollection (initializers, local);
                        ec.EmitLoad (local);
                }
+#endif
        }
 }
index f62acfb2ff55e69befc750f62fde12ea1b1a51ef..cf58105456810d348056be60d01d7f53ee5c1221 100644 (file)
@@ -47,6 +47,7 @@ namespace System.Linq.Expressions {
                        this.expression = expression;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec, LocalBuilder local)
                {
                        this.Member.OnFieldOrProperty (
@@ -71,5 +72,6 @@ namespace System.Linq.Expressions {
                        expression.Emit (ec);
                        ec.EmitCall (setter);
                }
+#endif
        }
 }
index 5187fa551f194f320bab8d3d68855c8be880ce68..bf0c6835c3fb9c351301af610b557d0881cbb1eb 100644 (file)
@@ -56,6 +56,7 @@ namespace System.Linq.Expressions {
                        return ExpressionPrinter.ToString (this);
                }
 
+#if !FULL_AOT_RUNTIME
                internal abstract void Emit (EmitContext ec, LocalBuilder local);
 
                internal LocalBuilder EmitLoadMember (EmitContext ec, LocalBuilder local)
@@ -86,5 +87,6 @@ namespace System.Linq.Expressions {
                        ec.ig.Emit (OpCodes.Stloc, store);
                        return store;
                }
+#endif
        }
 }
index 91a6aa0c1a89ad75063005ef90d80a580be4bdaa..1a0255f4ea776b9f1fc36d7fc4d2a95919a1cab6 100644 (file)
@@ -52,6 +52,7 @@ namespace System.Linq.Expressions {
                        this.member = member;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        member.OnFieldOrProperty (
@@ -76,5 +77,6 @@ namespace System.Linq.Expressions {
                        } else
                                ec.ig.Emit (OpCodes.Ldsfld, field);
                }
+#endif
        }
 }
index 59b71baeef3ae4e953a6a2955cc8ca7e5d10d8d6..ed30e9c2fb93a9d2287b7d2e8ca87689cf6b9f18 100644 (file)
@@ -52,11 +52,13 @@ namespace System.Linq.Expressions {
                        this.bindings = bindings;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        var local = ec.EmitStored (new_expression);
                        ec.EmitCollection (bindings, local);
                        ec.EmitLoad (local);
                }
+#endif
        }
 }
index 03b7e67da63bd8ae166778ec2f57abc564a77317..3c320e63e30a2c4e375287fb3b633507d40caebc 100644 (file)
@@ -47,6 +47,7 @@ namespace System.Linq.Expressions {
                        this.initializers = initializers;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec, LocalBuilder local)
                {
                        var member = EmitLoadMember (ec, local);
@@ -54,5 +55,6 @@ namespace System.Linq.Expressions {
                        foreach (var initializer in initializers)
                                initializer.Emit (ec, member);
                }
+#endif
        }
 }
index 9eb0c515d9dbc3644d47613dfe0bbaa59aa57aab..ec10de5c5266d8fb05bb1d76e9ac076f85b0a61e 100644 (file)
@@ -47,6 +47,7 @@ namespace System.Linq.Expressions {
                        this.bindings = bindings;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec, LocalBuilder local)
                {
                        var member = EmitLoadMember (ec, local);
@@ -54,5 +55,6 @@ namespace System.Linq.Expressions {
                        foreach (var binding in bindings)
                                binding.Emit (ec, member);
                }
+#endif
        }
 }
index 02718ffa055d354d3ec44bdbd20edee520ca2293..7f898689c0a796adb10d6fd09d2bab77d2683f2c 100644 (file)
@@ -66,9 +66,11 @@ namespace System.Linq.Expressions {
                        this.arguments = arguments;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        ec.EmitCall (obj, arguments, method);
                }
+#endif
        }
 }
index b952b8c0057c48c5a46966bb927f78090dfceab6..c30bec70537a335bae16f82adc8511281d05fd10 100644 (file)
@@ -48,6 +48,7 @@ namespace System.Linq.Expressions {
                        this.expressions = expressions;
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitNewArrayInit (EmitContext ec, Type type)
                {
                        var size = expressions.Count;
@@ -107,5 +108,6 @@ namespace System.Linq.Expressions {
                                throw new NotSupportedException ();
                        }
                }
+#endif
        }
 }
index 8e6673c616c8b7714708969cfe65d909cee858df..005d17569ec8d9c4943cd897e927b59b4bb0973d 100644 (file)
@@ -65,6 +65,7 @@ namespace System.Linq.Expressions {
                        this.members = members;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        var ig = ec.ig;
@@ -90,6 +91,7 @@ namespace System.Linq.Expressions {
                        } else
                                ig.Emit (OpCodes.Newobj, constructor ?? GetDefaultConstructor (type));
                }
+#endif
 
                static ConstructorInfo GetDefaultConstructor (Type type)
                {
index 651f9a90b94c71532848e5db6b2e75cd070b5b62..94bd0ea4475dd02c125aa06473877b73481f9300 100644 (file)
@@ -46,6 +46,7 @@ namespace System.Linq.Expressions {
                        this.name = name;
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitLocalParameter (EmitContext ec, int position)
                {
                        ec.ig.Emit (OpCodes.Ldarg, position);
@@ -82,5 +83,6 @@ namespace System.Linq.Expressions {
 
                        throw new InvalidOperationException ("Parameter out of scope");
                }
+#endif
        }
 }
index 4463e4e8b29a754f90933b0e66db17edd3e3bacb..2629c96c4f20e9c94d7198cfd29edbf4434f81a9 100644 (file)
@@ -51,6 +51,7 @@ namespace System.Linq.Expressions {
                        this.type_operand = type_operand;
                }
 
+#if !FULL_AOT_RUNTIME
                internal override void Emit (EmitContext ec)
                {
                        if (expression.Type == typeof (void)) {
@@ -63,5 +64,6 @@ namespace System.Linq.Expressions {
                        ec.ig.Emit (OpCodes.Ldnull);
                        ec.ig.Emit (OpCodes.Cgt_Un);
                }
+#endif
        }
 }
index 11e6240afca4b70ded4a82ad505686b9327ad32d..4f6f9cb890d679651918e0c48e23a76d984df4d8 100644 (file)
@@ -68,6 +68,7 @@ namespace System.Linq.Expressions {
                        this.is_lifted = is_lifted;
                }
 
+#if !FULL_AOT_RUNTIME
                void EmitArrayLength (EmitContext ec)
                {
                        operand.Emit (ec);
@@ -431,5 +432,6 @@ namespace System.Linq.Expressions {
                                throw new NotImplementedException (this.NodeType.ToString ());
                        }
                }
+#endif
        }
 }
index 37cc578c3168c35e032dede542fc1d42fc752c6e..99879ac443197ebedf95df7e23b7577f78edd8d0 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Threading.Tasks;
index 4dbb49b23b43f776ca7cfdc1ee647ce91c7056ed..1fa3f407e38e51af0dac7510d4ce6fb3149b883d 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Threading.Tasks;
index 646d7e76715c5dcac09b6c163e4d9c00131c0987..ab5043a5cc3b140a32b4e489e4fdeaf4ea1eb949 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 
 namespace System.Linq.Parallel.QueryNodes
index e09dfbf9543e143e154145ba89f3cfad81328d24..2942b5162b88974cd2669fed61c4a9900e7cb961 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index c3b766eaa2a5121f9c1b947bbd249f6fd5ca669f..7d86b63f9e4290773e34239688a325f74cc4a9f6 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 87d870b4debd974d7fdb3760977c7d22bf9a3f39..69dbbb1bd18987f15b40820364fb4aeea4041a34 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
@@ -69,7 +69,7 @@ namespace System.Linq.Parallel.QueryNodes
 
                internal IEnumerable<IGrouping<TKey, TElement>> GetGroupedElements ()
                {
-                       return GetStore ().Select (e => (IGrouping<TKey,TElement>)new ConcurrentGrouping<TKey, TElement> (e.Key, e.Value));
+                       return (IEnumerable<System.Linq.IGrouping<TKey,TElement>>)GetStore ().Select (e => (IGrouping<TKey,TElement>)new ConcurrentGrouping<TKey, TElement> (e.Key, e.Value));
                }
 
                internal ConcurrentDictionary<TKey, ConcurrentQueue<TElement>> GetStore ()
index 223783fa5fccbb3db6af7e25106e95c0425dcc3b..6918086e5b85716020a23158b42e9c279592b15a 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 79ed83eb11cc5400c7cac2c21eb452a7a3469194..61b9162e1f32d4b122f5b0b42c488bcf7dcf3789 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 4a320c78935eed7e7be979c04ef372f8e58effb3..6ca3ab0dd96a6bb2b6d37709cfe388b1b42d43c9 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections.Generic;
index a6c713e26b8b9ba59fd2d77ae68c38e2b29d697a..1a3eb63628c1a379607b85d63c6b15a1a375c7a2 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections.Generic;
index d3b7caeeb9be0938344f0d6cb07e8e9af6db505a..1dba782eff6a964bd8dd37d97d0d55acb9972fd8 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 4b4b75daf3f67236ca3aaa7ca33dbaeaf4e2b11d..047fd9ac227022bd3662c3ff0602ce7542d703ad 100644 (file)
@@ -23,7 +23,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections.Generic;
 
index 388ae95251779beff491ee8adf7d50f5113bdd3f..266b68035807245b6c30e30b819be6b5bf1c2cc2 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 
 namespace System.Linq.Parallel.QueryNodes
index c7128658a430a3621df2781cde7b09688330230e..982abd3cc5382f57b8a6146d68e4431a6da08fbc 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Threading;
index 815cb5fc9f630ee47af3f3d92d0dae330c17f07c..2d7d0d1115c4cc81ba98b77dd1284248e493f04a 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 78ffd83af200065b894cc93828549d74da5930cb..50daf099ae6f4ad5b6056df53fbb7a74c292f069 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections.Generic;
index 7e3d18be23284badef30c686438d264e53cf4e57..68a531a3ae2cdc0b5f8fe3d4f2f47cedf01d68b0 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections.Generic;
index f1fd930ee05c0dc1d5e77297efd8509e62756dfb..8bffdfad7058f970a81aaf6dee6aca8d82b8088d 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections;
 using System.Collections.Generic;
index cd1700f33e05b4fdaf54fb9e7324756a75fc955f..8dab7cfe87065a48d7d4f6e2c261e9e304dec176 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Threading.Tasks;
index 8d9c9ad7f5fe383781fa113b9455d5777b61e1d3..fe9ca8a90edfa3c3cd003e19cc5a61cfbec87ff1 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Threading;
index 9b9b475ac6807aa71047e8b93ff111d998d485d8..124027b6b04216ffcef9e97c7495c67cea7abb8e 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Linq;
index 8baf43450bc0cd41148035d36e6102dee4cf2ffc..63f043d2f1e7a3b7cc0903b9ab6d5aabcb7b17f6 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections.Generic;
index b3239e4165fd4ea3c2dc806199774ea640f769c0..4d51db0a76558a8a47625582ab4a306c1d4af43d 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections;
index 0d403ed3a4c8688a1468012e94ad08b0e90769fc..225fcac9a9c04cd8b38212cb2c0acbc91ba21aab 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections;
 using System.Collections.Generic;
index 3864b48a5310e6ce18cc7d468f26aff7c3cff97b..7e6668429223af2ad0ea7250b9f533a7ee27c3e5 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 0cf258e51faedc90f6a17a611c567ec7f53ade53..c355d955e1b227ce1aad059a5287c62640fc8d45 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
@@ -109,7 +109,7 @@ namespace System.Linq.Parallel
 
                IEnumerator<IGrouping<TKey, TElement>> GetEnumeratorInternal ()
                {
-                       return dictionary.Select ((pair) => new ConcurrentGrouping<TKey, TElement> (pair.Key, pair.Value)).GetEnumerator ();
+                       return (IEnumerator<System.Linq.IGrouping<TKey,TElement>>) dictionary.Select ((pair) => new ConcurrentGrouping<TKey, TElement> (pair.Key, pair.Value)).GetEnumerator ();
                }
        }
 }
index 5b68a4425a5919342c4995a2f84b924e94a47f7a..90bbee4f174edfee90d0ac8bde72609e79e2e9a9 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq.Parallel.QueryNodes;
 
index 013dc53598a27f71103203b7b63e39b01c9d44a0..9be102c0c03307f564fbdcf4cfbdcec5d0c0f250 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 
 namespace System.Linq.Parallel
index 6012f7904937ae426aeb08f2035a959fe89673a1..40023031dccdf704700f4958b4756b3ed3d0f4b6 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 96a5fe1f8e3f7d10c24b84cda5d57a66d17c14d6..5f78b5165d275389a2c9eb86730f8c24892bb243 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Threading.Tasks;
index e9bf2f8b4e2b3c127dd38d3670d47d3336a80b96..e9a61cf9110516666661ce062ff1e44a01e417fc 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Collections.Generic;
index a3d17520c621a196870207279f454957e72c2565..c30266abd18056050cd96c078bf2a54c21ad70fd 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index cb46dcc86aed7a10eba8370528dcb89a34cf89e9..29f357e5a6fed5112ce45b279d2e2d7e5b60c96e 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Linq;
 using System.Collections;
index 1bf8f6b3cc671ca4b6bdba9ebb215c73b54ccc1f..c0ce24e0f1cdfdd109569563964bc0f61bf4cfe7 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Linq.Parallel.QueryNodes;
index 01cab21f68eddda7c890fa44c29cccae4900daff..debc0d8af155219e6d9ceed1daa8c72d36f9f650 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Linq.Parallel.QueryNodes;
index 7ca9a8586d3edca94fcf833e8ff9e133ef6f2c60..9ec67ef6d4ab537fb828ddd97ead2c74d6fc6a8e 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 
index 5a8985bbe69395ea482688710c969184c949f289..cd58ed8bacc18d668e0f008af8e7c2436f2d0901 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections;
 using System.Collections.Generic;
index e2c99d2ed57e249dc417efd9a004de38fcc0fb87..b506897b37593fccc3e59a81219d25dfcb167b71 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections;
 using System.Collections.Generic;
index 909de501bda294746b1f09c93f8f4a58086051c7..628d925917f0d9d78b412835ef1fc967eb44c5ac 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System.Linq;
 using System.Threading;
 using System.Collections;
index 8b4c41210c96d6f819e020e4f869127b25113cc6..62be137a81c5643a8aa6c610234f4531314ac673 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections.Generic;
index b8be6abc055c541ce38e60a69ed1a5a4853f7482..6ebc18e97322a3ae5d3e1dbecf8c0f73723a3456 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 0f9b717b4af71fb1ebd043426132fb0490269ea9..73e5006211b44eb6c66a4d350773408b9ede15d4 100644 (file)
@@ -45,9 +45,11 @@ namespace System.Linq
                        Throw
                }
 
+#if !FULL_AOT_RUNTIME
                static class PredicateOf<T> {
                        public static readonly Func<T, bool> Always = (t) => true;
                }
+#endif
 
                static class Function<T> {
                        public static readonly Func<T, T> Identity = (t) => t;
@@ -71,7 +73,7 @@ namespace System.Linq
                        // if zero elements and treat the first element differently
                        using (var enumerator = source.GetEnumerator ()) {
                                if (!enumerator.MoveNext ())
-                                       throw new InvalidOperationException ("No elements in source list");
+                                       throw EmptySequence ();
 
                                TSource folded = enumerator.Current;
                                while (enumerator.MoveNext ())
@@ -171,7 +173,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / (double) count;
                }
 
@@ -186,7 +188,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / (double) count;
                }
 
@@ -201,7 +203,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
                }
 
@@ -216,7 +218,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
                }
 
@@ -231,7 +233,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
                }
 
@@ -379,7 +381,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / (double) count;
                }
 
@@ -416,7 +418,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / (double) count;
 
                }
@@ -454,7 +456,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
 
                }
@@ -493,7 +495,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
                }
 
@@ -530,7 +532,7 @@ namespace System.Linq
                                count++;
                        }
                        if (count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return total / count;
                }
 
@@ -811,7 +813,7 @@ namespace System.Linq
                                        return element;
 
                        if (fallback == Fallback.Throw)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
 
                        return default (TSource);
                }
@@ -831,7 +833,7 @@ namespace System.Linq
                                }
                        }
 
-                       throw new InvalidOperationException ("The source sequence is empty");
+                       throw EmptySequence ();
                }
 
                public static TSource First<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
@@ -849,7 +851,15 @@ namespace System.Linq
                {
                        Check.Source (source);
 
+#if !FULL_AOT_RUNTIME
                        return source.First (PredicateOf<TSource>.Always, Fallback.Default);
+#else
+                       // inline the code to reduce dependency o generic causing AOT errors on device (e.g. bug #3285)
+                       foreach (var element in source)
+                               return element;
+
+                       return default (TSource);
+#endif
                }
 
                public static TSource FirstOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
@@ -1191,7 +1201,7 @@ namespace System.Linq
                                return item;
 
                        if (fallback == Fallback.Throw)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
 
                        return item;
                }
@@ -1202,14 +1212,29 @@ namespace System.Linq
 
                        var collection = source as ICollection<TSource>;
                        if (collection != null && collection.Count == 0)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
 
                        var list = source as IList<TSource>;
                        if (list != null)
                                return list [list.Count - 1];
 
+#if !FULL_AOT_RUNTIME
                        return source.Last (PredicateOf<TSource>.Always, Fallback.Throw);
-               }
+#else
+                       var empty = true;
+                       var item = default (TSource);
+
+                       foreach (var element in source) {
+                               item = element;
+                               empty = false;
+                       }
+
+                       if (!empty)
+                               return item;
+
+                       throw EmptySequence ();
+#endif
+        }
 
                public static TSource Last<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
                {
@@ -1230,7 +1255,22 @@ namespace System.Linq
                        if (list != null)
                                return list.Count > 0 ? list [list.Count - 1] : default (TSource);
 
+#if !FULL_AOT_RUNTIME
                        return source.Last (PredicateOf<TSource>.Always, Fallback.Default);
+#else
+                       var empty = true;
+                       var item = default (TSource);
+
+                       foreach (var element in source) {
+                               item = element;
+                               empty = false;
+                       }
+
+                       if (!empty)
+                               return item;
+
+                       return item;
+#endif
                }
 
                public static TSource LastOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
@@ -1289,7 +1329,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence();
                        return max;
                }
 
@@ -1304,7 +1344,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return max;
                }
 
@@ -1319,7 +1359,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return max;
                }
 
@@ -1334,7 +1374,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return max;
                }
 
@@ -1349,7 +1389,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return max;
                }
 
@@ -1487,7 +1527,7 @@ namespace System.Linq
                                                max = element;
                                }
                                if (empty)
-                                       throw new InvalidOperationException ();
+                                       throw EmptySequence ();
                        }
                        return max;
                }
@@ -1503,7 +1543,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return max;
                }
 
@@ -1518,7 +1558,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return max;
                }
 
@@ -1533,7 +1573,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return max;
                }
 
@@ -1548,7 +1588,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return max;
                }
 
@@ -1563,7 +1603,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return max;
                }
 
@@ -1576,7 +1616,7 @@ namespace System.Linq
                        }
 
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
 
                        return initValue;
                }
@@ -1709,7 +1749,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return min;
                }
 
@@ -1724,7 +1764,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return min;
                }
 
@@ -1739,7 +1779,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return min;
                }
 
@@ -1754,7 +1794,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return min;
                }
 
@@ -1769,7 +1809,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw EmptySequence ();
                        return min;
                }
 
@@ -1906,7 +1946,7 @@ namespace System.Linq
                                                min = element;
                                }
                                if (empty)
-                                       throw new InvalidOperationException ();
+                                       throw EmptySequence ();
                        }
                        return min;
                }
@@ -1922,7 +1962,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return min;
                }
 
@@ -1937,7 +1977,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return min;
                }
 
@@ -1952,7 +1992,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return min;
                }
 
@@ -1967,7 +2007,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return min;
                }
 
@@ -1982,7 +2022,7 @@ namespace System.Linq
                                empty = false;
                        }
                        if (empty)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
                        return min;
                }
 
@@ -2327,14 +2367,14 @@ namespace System.Linq
                                        continue;
 
                                if (found)
-                                       throw new InvalidOperationException ();
+                                       throw MoreThanOneMatchingElement ();
 
                                found = true;
                                item = element;
                        }
 
                        if (!found && fallback == Fallback.Throw)
-                               throw new InvalidOperationException ();
+                               throw NoMatchingElement ();
 
                        return item;
                }
@@ -2343,8 +2383,26 @@ namespace System.Linq
                {
                        Check.Source (source);
 
+#if !FULL_AOT_RUNTIME
                        return source.Single (PredicateOf<TSource>.Always, Fallback.Throw);
-               }
+#else
+                       var found = false;
+                       var item = default (TSource);
+
+                       foreach (var element in source) {
+                               if (found)
+                                       throw MoreThanOneElement ();
+
+                               found = true;
+                               item = element;
+                       }
+
+                       if (!found)
+                               throw NoMatchingElement ();
+
+                       return item;
+#endif
+        }
 
                public static TSource Single<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
                {
@@ -2361,8 +2419,23 @@ namespace System.Linq
                {
                        Check.Source (source);
 
+#if !FULL_AOT_RUNTIME
                        return source.Single (PredicateOf<TSource>.Always, Fallback.Default);
-               }
+#else
+                       var found = false;
+                       var item = default (TSource);
+
+                       foreach (var element in source) {
+                               if (found)
+                                       throw MoreThanOneMatchingElement ();
+
+                               found = true;
+                               item = element;
+                       }
+
+                       return item;
+#endif
+        }
 
                public static TSource SingleOrDefault<TSource> (this IEnumerable<TSource> source, Func<TSource, bool> predicate)
                {
@@ -2762,6 +2835,12 @@ namespace System.Linq
                {
                        Check.SourceAndKeySelector (source, keySelector);
 
+#if FULL_AOT_RUNTIME
+                       var oe = source as OrderedEnumerable <TSource>;
+                       if (oe != null)
+                               return oe.CreateOrderedEnumerable (keySelector, comparer, false);
+#endif
+
                        return source.CreateOrderedEnumerable (keySelector, comparer, false);
                }
 
@@ -2780,6 +2859,11 @@ namespace System.Linq
                {
                        Check.SourceAndKeySelector (source, keySelector);
 
+#if FULL_AOT_RUNTIME
+                       var oe = source as OrderedEnumerable <TSource>;
+                       if (oe != null)
+                               return oe.CreateOrderedEnumerable (keySelector, comparer, true);
+#endif
                        return source.CreateOrderedEnumerable (keySelector, comparer, true);
                }
 
@@ -2878,7 +2962,7 @@ namespace System.Linq
                public static ILookup<TKey, TSource> ToLookup<TSource, TKey> (this IEnumerable<TSource> source,
                        Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
                {
-                       return ToLookup<TSource, TKey, TSource> (source, keySelector, element => element, comparer);
+                       return ToLookup<TSource, TKey, TSource> (source, keySelector, Function<TSource>.Identity, comparer);
                }
 
                public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement> (this IEnumerable<TSource> source,
@@ -3061,5 +3145,26 @@ namespace System.Linq
 
                        return new ReadOnlyCollection<TSource> (source.ToArray<TSource> ());
                }
+
+               #region Exception helpers
+
+               static Exception EmptySequence ()
+               {
+                       return new InvalidOperationException (Locale.GetText ("Sequence contains no elements"));
+               }
+               static Exception NoMatchingElement ()
+               {
+                       return new InvalidOperationException (Locale.GetText ("Sequence contains no matching element"));
+               }
+               static Exception MoreThanOneElement ()
+               {
+                       return new InvalidOperationException (Locale.GetText ("Sequence contains more than one element"));
+               }
+               static Exception MoreThanOneMatchingElement ()
+               {
+                       return new InvalidOperationException (Locale.GetText ("Sequence contains more than one matching element"));
+               }
+
+               #endregion
        }
 }
index 842555c4c4b77ce44bd69bc969ee80bf19bd7420..1bd7949c8c92ae596864b713df2730d7181a9532 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 44b45c35820b330db69ccb304de3651155699521..9d093826f153764aba356a019b8a501bbfaa9c22 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Threading;
 using System.Collections;
index 7b6687cfd749c90878d9b1cf6de81f45dab86af9..888824959b5b265c781ebe052c9d7f125262a1a1 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 
 namespace System.Linq
index f40defc99f0bc7f513cdcf2c12b6cbab772f7c7f..6073516aa698a3dbcf5476dde52ef5324d3d2989 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 
 namespace System.Linq
index c5ea95e41b04eee69cc640a60da115bb4dd74402..4bf5922d83fbc85663d0aa655a977b88ce4c25f5 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Threading;
index bfc4b34f4e427ad7c1c0ee797c6d522e7808c96a..e9b98cca9e1e536efeaa264195820cc503e3654f 100644 (file)
@@ -1603,7 +1603,7 @@ namespace System.Linq {
 
                #endregion
 
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
                #region Zip
 
                public static IQueryable<TResult> Zip<TFirst, TSecond, TResult> (this IQueryable<TFirst> source1, IEnumerable<TSecond> source2, Expression<Func<TFirst, TSecond, TResult>> resultSelector)
index 553b94b452c745ebfd1a84c3889b070412a38333..729c080c639447ba50ff0a17a0f97152907dcda0 100644 (file)
@@ -65,7 +65,7 @@ namespace System.Linq {
 
                        // Then sorts the elements according to the collected
                        // key values and the selected ordering
-                       Array.Sort<int, TElement> (indexes, elements, context);
+                       Array.Sort<int> (indexes, context);
                }
 
                public static IEnumerable<TElement> Sort (IEnumerable<TElement> source, SortContext<TElement> context)
@@ -75,7 +75,7 @@ namespace System.Linq {
                        sorter.PerformSort ();
 
                        for (int i = 0; i < sorter.elements.Length; i++)
-                               yield return sorter.elements [i];
+                               yield return sorter.elements [sorter.indexes [i]];
                }
        }
 }
index ef063be4974a686f8bed9f2f8aba0eb623924d8f..b64fd4e55ae881487a412ebb24536b23021cb3ae 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Linq.Expressions;
 
@@ -96,3 +97,4 @@ namespace System.Runtime.CompilerServices {
                }
        }
 }
+#endif
index 7f2272fdd2e0f332866541cbea95d85de4c9c5d1..cb2ddbc93fab41b52784ebb551f562efa1c2856b 100644 (file)
@@ -56,7 +56,17 @@ namespace System.Security.Cryptography {
 
                public static new Aes Create () \r
                {\r
+#if FULL_AOT_RUNTIME\r
+                       // The Aes base class was moved from System.Core to mscorlib - so we can't just return a new AesCryptoServiceProvider instance\r
+                       // note: the linker is aware of this condition\r
+                       return (Aes) Activator.CreateInstance (Type.GetType ("System.Security.Cryptography.AesCryptoServiceProvider, " + Consts.AssemblySystem_Core));\r
+#elif MOBILE\r
+                       // there was a mixup in the MOBILE profile, to be compatible with Silverlight it's\r
+                       // AesManaged that should have been provided, not AesCryptoServiceProvider\r
+                       return Create ("System.Security.Cryptography.AesCryptoServiceProvider, " + Consts.AssemblySystem_Core);\r
+#else\r
                        return Create ("System.Security.Cryptography.AesManaged, " + Consts.AssemblySystem_Core);\r
+#endif\r
                }\r
 \r
                public static new Aes Create (string algorithmName) \r
@@ -68,7 +78,7 @@ namespace System.Security.Cryptography {
                {\r
                        KeySizeValue = 256;\r
                        BlockSizeValue = 128;
-#if !NET_2_1
+#if !MOONLIGHT
                        // Silverlight 2.0 only supports CBC mode (i.e. no feedback)\r
                        FeedbackSizeValue = 128;
 #endif\r
index f3a2a643b28be4c54d1234d44be18356b48a5bbc..af52741bf8dcf8e3901ad7479b0053784e5478ee 100644 (file)
@@ -382,7 +382,10 @@ namespace System
                        }
 #endif
 #if MONODROID
-                       return ZoneInfoDB.GetTimeZone (id);
+                       var timeZoneInfo = ZoneInfoDB.GetTimeZone (id);
+                       if (timeZoneInfo == null)
+                               throw new TimeZoneNotFoundException ();
+                       return timeZoneInfo;
 #else
                        // Local requires special logic that already exists in the Local property (bug #326)
                        if (id == "Local")
index d2c2a348d5f3770b90ef44d5f66cb20bf4e0fe0c..979c4e162e4f743b995473dedd405618466bf632 100644 (file)
@@ -3,6 +3,7 @@
 ../../build/common/MonoTODOAttribute.cs
 ../corlib/Mono.Security.Cryptography/CryptoTools.cs
 ../corlib/Mono.Security.Cryptography/SymmetricTransform.cs
+../corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
 Assembly/AssemblyInfo.cs
 System/Actions.cs
 System/Funcs.cs
@@ -86,6 +87,7 @@ System.Linq.Parallel/RangeList.cs
 System.Linq.Parallel/RepeatList.cs
 System.Linq.Parallel/ReverseList.cs
 System.Linq.Parallel/StripPartitioner.cs
+System.Linq.Parallel/TemporaryArea.cs
 System.Linq/EnumerableExecutor.cs
 System.Linq/EnumerableExecutor_T.cs
 System.Linq/EnumerableQuery.cs
index 5ad9459d88a2c1a21c93891ab1fec23f77267393..37dc2990c8d1d24845da0ddfc69531c220374a84 100644 (file)
@@ -1,2 +1 @@
-#include System.Data.Services.Client.dll.sources
-./Client/AssemblyAttributes.cs
+#include net_4_5_System.Data.Services.Client.dll.sources
diff --git a/mcs/class/System.Json.Microsoft/Assembly/AssemblyInfo.cs b/mcs/class/System.Json.Microsoft/Assembly/AssemblyInfo.cs
new file mode 100755 (executable)
index 0000000..702394f
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// AssemblyInfo.cs
+//
+// Authors:
+//     Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.Json assembly
+
+[assembly: AssemblyDefaultAlias ("System.Json.Microsoft.dll")]
+
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
diff --git a/mcs/class/System.Json.Microsoft/Assembly/ChangeLog b/mcs/class/System.Json.Microsoft/Assembly/ChangeLog
new file mode 100755 (executable)
index 0000000..1fcfb76
--- /dev/null
@@ -0,0 +1,16 @@
+2010-03-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * AssemblyInfo.cs : use the same pub key in 2.0 (dummy), to ease
+         testing locally.
+
+2008-05-07  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * AssemblyInfo.cs: Remove AssemblyDelaySign(true) since it's
+       not always needed and can be controlled from the Makefile.
+       Adjust public key for System.Windows (InternalsVisibleTo)
+
+2008-04-13  Jb Evain  <jbevain@novell.com>
+
+       * AssemblyInfo.cs: agmono is renamed to Mono.Moonlight.
+       Merged from the Moonlight 2 branch.
+
diff --git a/mcs/class/System.Json.Microsoft/ChangeLog b/mcs/class/System.Json.Microsoft/ChangeLog
new file mode 100644 (file)
index 0000000..3782149
--- /dev/null
@@ -0,0 +1,29 @@
+2010-04-01  Miguel de Icaza  <miguel@novell.com>
+
+       * JsonValue.cs: We need to use Convert.ToXXXX for numbers as we
+       always end up reporting the value JsonType.Number regardless of
+       the underlying storage (int, long or decimal).   The parser
+       picks the best storage suitable for the data, and can end up using
+       "ints" for values that sometimes use longs. 
+
+       This causes problems when derefercing the data for example, if you
+       have an int and try to get it out as a long you end up with an
+       invalid cast exception.
+
+2010-03-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * System.Json.dll.sources : remove JsonReader.cs.
+
+2010-03-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Makefile : reference System.Xml and System.ServiceModel.Web (for
+         moonlight compatibility).
+
+2009-08-13  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Makefile : update profile check.
+
+2008-06-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * System.Json.dll.sources, Makefile : initial checkin.
+
diff --git a/mcs/class/System.Json.Microsoft/Makefile b/mcs/class/System.Json.Microsoft/Makefile
new file mode 100644 (file)
index 0000000..5124d3f
--- /dev/null
@@ -0,0 +1,30 @@
+thisdir = class/System.Json.Microsoft
+SUBDIRS = 
+include ../../build/rules.make
+
+System.Json.Properties.Resources.resources: System.Json/Properties/Resources.resx
+       $(RESGEN) "$<" "$@"
+
+LIBRARY = System.Json.Microsoft.dll
+LIB_MCS_FLAGS = /d:ASPNETMVC -keyfile:../winfx.pub -delaysign \
+               /r:System.dll \
+               /r:System.Xml.dll \
+               /r:System.Core.dll \
+               /r:System.Runtime.Serialization.dll \
+               /resource:System.Json.Properties.Resources.resources
+
+EXTRA_DISTFILES = System.Json/Properties/Resources.resx
+
+ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
+LIB_MCS_FLAGS += /r:Microsoft.CSharp.dll -d:FEATURE_DYNAMIC
+endif
+
+ifeq (monodroid, $(PROFILE))
+LIB_MCS_FLAGS += -d:FEATURE_DYNAMIC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+include ../../build/library.make
+
+$(the_lib): System.Json.Properties.Resources.resources
diff --git a/mcs/class/System.Json.Microsoft/System.Json.Microsoft.dll.sources b/mcs/class/System.Json.Microsoft/System.Json.Microsoft.dll.sources
new file mode 100644 (file)
index 0000000..4d2f589
--- /dev/null
@@ -0,0 +1,22 @@
+../../build/common/Consts.cs
+Assembly/AssemblyInfo.cs
+
+../../../external/aspnetwebstack/src/RS.cs
+../../../external/aspnetwebstack/src/CommonAssemblyInfo.cs
+../../../external/aspnetwebstack/src/TransparentCommonAssemblyInfo.cs
+
+System.Json/Properties/AssemblyInfo.cs
+System.Json/Extensions/JsonValueExtensions.cs
+System.Json/GlobalSuppressions.cs
+System.Json/JXmlToJsonValueConverter.cs
+System.Json/JsonArray.cs
+System.Json/JsonObject.cs
+System.Json/JsonPrimitive.cs
+System.Json/JsonType.cs
+System.Json/JsonValue.cs
+System.Json/JsonValueChange.cs
+System.Json/JsonValueChangeEventArgs.cs
+System.Json/JsonValueDynamicMetaObject.cs
+System.Json/JsonValueLinqExtensions.cs
+System.Json/NGenWrapper.cs
+System.Json/Properties/Resources.Designer.cs
diff --git a/mcs/class/System.Json.Microsoft/System.Json.Microsoft_test.dll.sources b/mcs/class/System.Json.Microsoft/System.Json.Microsoft_test.dll.sources
new file mode 100644 (file)
index 0000000..8d6ae22
--- /dev/null
@@ -0,0 +1 @@
+System.Json/JsonValueTest.cs
\ No newline at end of file
diff --git a/mcs/class/System.Json.Microsoft/System.Json/Extensions/JsonValueExtensions.cs b/mcs/class/System.Json.Microsoft/System.Json/Extensions/JsonValueExtensions.cs
new file mode 100644 (file)
index 0000000..2ea0c14
--- /dev/null
@@ -0,0 +1,383 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+#if FEATURE_DYNAMIC
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+using System.Dynamic;
+using System.IO;
+using System.Json;
+using System.Linq.Expressions;
+
+namespace System.Runtime.Serialization.Json
+{
+    /// <summary>
+    /// This class extends the functionality of the <see cref="JsonValue"/> type. 
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public static class JsonValueExtensions
+    {
+        /// <summary>
+        /// Creates a <see cref="System.Json.JsonValue"/> object based on an arbitrary CLR object.
+        /// </summary>
+        /// <param name="value">The object to be converted to <see cref="System.Json.JsonValue"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> which represents the given object.</returns>
+        /// <remarks>The conversion is done through the <see cref="System.Runtime.Serialization.Json.DataContractJsonSerializer"/>;
+        /// the object is first serialized into JSON using the serializer, then parsed into a <see cref="System.Json.JsonValue"/>
+        /// object.</remarks>
+        public static JsonValue CreateFrom(object value)
+        {
+            JsonValue jsonValue = null;
+
+            if (value != null)
+            {
+                jsonValue = value as JsonValue;
+
+                if (jsonValue == null)
+                {
+                    jsonValue = JsonValueExtensions.CreatePrimitive(value);
+
+                    if (jsonValue == null)
+                    {
+                        jsonValue = JsonValueExtensions.CreateFromDynamic(value);
+
+                        if (jsonValue == null)
+                        {
+                            jsonValue = JsonValueExtensions.CreateFromComplex(value);
+                        }
+                    }
+                }
+            }
+
+            return jsonValue;
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+        /// <param name="valueOfT">An instance of T initialized with this instance, or the default
+        /// value of T, if the conversion cannot be performed.</param>
+        /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as type T; otherwise, false.</returns>
+        public static bool TryReadAsType<T>(this JsonValue jsonValue, out T valueOfT)
+        {
+            if (jsonValue == null)
+            {
+                throw new ArgumentNullException("jsonValue");
+            }
+
+            object value;
+            if (JsonValueExtensions.TryReadAsType(jsonValue, typeof(T), out value))
+            {
+                valueOfT = (T)value;
+                return true;
+            }
+
+            valueOfT = default(T);
+            return false;
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+        /// <returns>An instance of T initialized with the <see cref="System.Json.JsonValue"/> value
+        /// specified if the conversion.</returns>
+        /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be
+        /// converted into the type T.</exception>
+        [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+            Justification = "The generic parameter is used to specify the output type")]
+        public static T ReadAsType<T>(this JsonValue jsonValue)
+        {
+            if (jsonValue == null)
+            {
+                throw new ArgumentNullException("jsonValue");
+            }
+
+            return (T)JsonValueExtensions.ReadAsType(jsonValue, typeof(T));
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T, returning a fallback value
+        /// if the conversion fails.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+        /// <param name="fallback">A fallback value to be retuned in case the conversion cannot be performed.</param>
+        /// <returns>An instance of T initialized with the <see cref="System.Json.JsonValue"/> value
+        /// specified if the conversion succeeds or the specified fallback value if it fails.</returns>
+        public static T ReadAsType<T>(this JsonValue jsonValue, T fallback)
+        {
+            if (jsonValue == null)
+            {
+                throw new ArgumentNullException("jsonValue");
+            }
+
+            T outVal;
+            if (JsonValueExtensions.TryReadAsType<T>(jsonValue, out outVal))
+            {
+                return outVal;
+            }
+
+            return fallback;
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <returns>An object instance initialized with the <see cref="System.Json.JsonValue"/> value
+        /// specified if the conversion.</returns>
+        /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be
+        /// converted into the type T.</exception>
+        public static object ReadAsType(this JsonValue jsonValue, Type type)
+        {
+            if (jsonValue == null)
+            {
+                throw new ArgumentNullException("jsonValue");
+            }
+
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            object result;
+            if (JsonValueExtensions.TryReadAsType(jsonValue, type, out result))
+            {
+                return result;
+            }
+
+            throw new NotSupportedException(RS.Format(System.Json.Properties.Resources.CannotReadAsType, jsonValue.GetType().FullName, type.FullName));
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <param name="value">An object to be initialized with this instance or null if the conversion cannot be performed.</param>
+        /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as the specified type; otherwise, false.</returns>
+        [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate",
+            Justification = "This is the non-generic version of the method.")]
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exception translates to fail.")]
+        public static bool TryReadAsType(this JsonValue jsonValue, Type type, out object value)
+        {
+            if (jsonValue == null)
+            {
+                throw new ArgumentNullException("jsonValue");
+            }
+
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            if (type == typeof(JsonValue) || type == typeof(object))
+            {
+                value = jsonValue;
+                return true;
+            }
+
+            if (type == typeof(object[]) || type == typeof(Dictionary<string, object>))
+            {
+                if (!JsonValueExtensions.CanConvertToClrCollection(jsonValue, type))
+                {
+                    value = null;
+                    return false;
+                }
+            }
+
+            if (jsonValue.TryReadAs(type, out value))
+            {
+                return true;
+            }
+
+            try
+            {
+                using (MemoryStream ms = new MemoryStream())
+                {
+                    jsonValue.Save(ms);
+                    ms.Position = 0;
+                    DataContractJsonSerializer dcjs = new DataContractJsonSerializer(type);
+                    value = dcjs.ReadObject(ms);
+                }
+
+                return true;
+            }
+            catch (Exception)
+            {
+                value = null;
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Determines whether the specified <see cref="JsonValue"/> instance can be converted to the specified collection <see cref="Type"/>.
+        /// </summary>
+        /// <param name="jsonValue">The instance to be converted.</param>
+        /// <param name="collectionType">The collection type to convert the instance to.</param>
+        /// <returns>true if the instance can be converted, false otherwise</returns>
+        private static bool CanConvertToClrCollection(JsonValue jsonValue, Type collectionType)
+        {
+            if (jsonValue != null)
+            {
+                return (jsonValue.JsonType == JsonType.Object && collectionType == typeof(Dictionary<string, object>)) ||
+                       (jsonValue.JsonType == JsonType.Array && collectionType == typeof(object[]));
+            }
+
+            return false;
+        }
+
+        private static JsonValue CreatePrimitive(object value)
+        {
+            JsonPrimitive jsonPrimitive;
+
+            if (JsonPrimitive.TryCreate(value, out jsonPrimitive))
+            {
+                return jsonPrimitive;
+            }
+
+            return null;
+        }
+
+        private static JsonValue CreateFromComplex(object value)
+        {
+            DataContractJsonSerializer dcjs = new DataContractJsonSerializer(value.GetType());
+            using (MemoryStream ms = new MemoryStream())
+            {
+                dcjs.WriteObject(ms, value);
+                ms.Position = 0;
+                return JsonValue.Load(ms);
+            }
+        }
+
+        [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "value is not the same")]
+        private static JsonValue CreateFromDynamic(object value)
+        {
+            JsonObject parent = null;
+            DynamicObject dynObj = value as DynamicObject;
+
+            if (dynObj != null)
+            {
+                parent = new JsonObject();
+                Stack<CreateFromTypeStackInfo> infoStack = new Stack<CreateFromTypeStackInfo>();
+                IEnumerator<string> keys = null;
+
+                do
+                {
+                    if (keys == null)
+                    {
+                        keys = dynObj.GetDynamicMemberNames().GetEnumerator();
+                    }
+
+                    while (keys.MoveNext())
+                    {
+                        JsonValue child = null;
+                        string key = keys.Current;
+                        SimpleGetMemberBinder binder = new SimpleGetMemberBinder(key);
+
+                        if (dynObj.TryGetMember(binder, out value))
+                        {
+                            DynamicObject childDynObj = value as DynamicObject;
+
+                            if (childDynObj != null)
+                            {
+                                child = new JsonObject();
+                                parent.Add(key, child);
+
+                                infoStack.Push(new CreateFromTypeStackInfo(parent, dynObj, keys));
+
+                                parent = child as JsonObject;
+                                dynObj = childDynObj;
+                                keys = null;
+
+                                break;
+                            }
+                            else
+                            {
+                                if (value != null)
+                                {
+                                    child = value as JsonValue;
+
+                                    if (child == null)
+                                    {
+                                        child = JsonValueExtensions.CreatePrimitive(value);
+
+                                        if (child == null)
+                                        {
+                                            child = JsonValueExtensions.CreateFromComplex(value);
+                                        }
+                                    }
+                                }
+
+                                parent.Add(key, child);
+                            }
+                        }
+                    }
+
+                    if (infoStack.Count > 0 && keys != null)
+                    {
+                        CreateFromTypeStackInfo info = infoStack.Pop();
+
+                        parent = info.JsonObject;
+                        dynObj = info.DynamicObject;
+                        keys = info.Keys;
+                    }
+                }
+                while (infoStack.Count > 0);
+            }
+
+            return parent;
+        }
+
+        private class CreateFromTypeStackInfo
+        {
+            public CreateFromTypeStackInfo(JsonObject jsonObject, DynamicObject dynamicObject, IEnumerator<string> keyEnumerator)
+            {
+                JsonObject = jsonObject;
+                DynamicObject = dynamicObject;
+                Keys = keyEnumerator;
+            }
+
+            /// <summary>
+            /// Gets of sets
+            /// </summary>
+            public JsonObject JsonObject { get; set; }
+
+            /// <summary>
+            /// Gets of sets
+            /// </summary>
+            public DynamicObject DynamicObject { get; set; }
+
+            /// <summary>
+            /// Gets of sets
+            /// </summary>
+            public IEnumerator<string> Keys { get; set; }
+        }
+
+        private class SimpleGetMemberBinder : GetMemberBinder
+        {
+            public SimpleGetMemberBinder(string name)
+                : base(name, false)
+            {
+            }
+
+            public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
+            {
+                if (target != null && errorSuggestion == null)
+                {
+                    string exceptionMessage = RS.Format(System.Json.Properties.Resources.DynamicPropertyNotDefined, target.LimitType, Name);
+                    Expression throwExpression = Expression.Throw(Expression.Constant(new InvalidOperationException(exceptionMessage)), typeof(object));
+
+                    errorSuggestion = new DynamicMetaObject(throwExpression, target.Restrictions);
+                }
+
+                return errorSuggestion;
+            }
+        }
+    }
+}
+#endif
diff --git a/mcs/class/System.Json.Microsoft/System.Json/GlobalSuppressions.cs b/mcs/class/System.Json.Microsoft/System.Json/GlobalSuppressions.cs
new file mode 100644 (file)
index 0000000..5d3e557
--- /dev/null
@@ -0,0 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "These assemblies are delay-signed.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Classes are grouped logically for user clarity.", Scope = "namespace", Target = "System.Runtime.Serialization.Json")]
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JXmlToJsonValueConverter.cs b/mcs/class/System.Json.Microsoft/System.Json/JXmlToJsonValueConverter.cs
new file mode 100644 (file)
index 0000000..f495264
--- /dev/null
@@ -0,0 +1,304 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+    internal static class JXmlToJsonValueConverter
+    {
+        internal const string RootElementName = "root";
+        internal const string ItemElementName = "item";
+        internal const string TypeAttributeName = "type";
+        internal const string ArrayAttributeValue = "array";
+        internal const string BooleanAttributeValue = "boolean";
+        internal const string NullAttributeValue = "null";
+        internal const string NumberAttributeValue = "number";
+        internal const string ObjectAttributeValue = "object";
+        internal const string StringAttributeValue = "string";
+        private const string TypeHintAttributeName = "__type";
+
+        private static readonly char[] _floatingPointChars = new char[] { '.', 'e', 'E' };
+
+        public static JsonValue JXMLToJsonValue(Stream jsonStream)
+        {
+            if (jsonStream == null)
+            {
+                throw new ArgumentNullException("jsonStream");
+            }
+
+            return JXMLToJsonValue(jsonStream, null);
+        }
+
+        public static JsonValue JXMLToJsonValue(string jsonString)
+        {
+            if (jsonString == null)
+            {
+                throw new ArgumentNullException("jsonString");
+            }
+
+            if (jsonString.Length == 0)
+            {
+                throw new ArgumentException(Properties.Resources.JsonStringCannotBeEmpty, "jsonString");
+            }
+
+            byte[] jsonBytes = Encoding.UTF8.GetBytes(jsonString);
+
+            return JXMLToJsonValue(null, jsonBytes);
+        }
+
+        public static JsonValue JXMLToJsonValue(XmlDictionaryReader jsonReader)
+        {
+            if (jsonReader == null)
+            {
+                throw new ArgumentNullException("jsonReader");
+            }
+
+            const string RootObjectName = "RootObject";
+            Stack<JsonValue> jsonStack = new Stack<JsonValue>();
+            string nodeType = null;
+            bool isEmptyElement = false;
+
+            JsonValue parent = new JsonObject();
+            jsonStack.Push(parent);
+            string currentName = RootObjectName;
+
+            try
+            {
+                MoveToRootNode(jsonReader);
+
+                while (jsonStack.Count > 0 && jsonReader.NodeType != XmlNodeType.None)
+                {
+                    if (parent is JsonObject && currentName == null)
+                    {
+                        currentName = GetMemberName(jsonReader);
+                    }
+
+                    nodeType = jsonReader.GetAttribute(TypeAttributeName) ?? StringAttributeValue;
+
+                    if (parent is JsonArray)
+                    {
+                        // For arrays, the element name has to be "item"
+                        if (jsonReader.Name != ItemElementName)
+                        {
+                            throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+                        }
+                    }
+
+                    switch (nodeType)
+                    {
+                        case NullAttributeValue:
+                        case BooleanAttributeValue:
+                        case StringAttributeValue:
+                        case NumberAttributeValue:
+                            JsonPrimitive jsonPrimitive = ReadPrimitive(nodeType, jsonReader);
+                            InsertJsonValue(jsonStack, ref parent, ref currentName, jsonPrimitive, true);
+                            break;
+                        case ArrayAttributeValue:
+                            JsonArray jsonArray = CreateJsonArray(jsonReader, ref isEmptyElement);
+                            InsertJsonValue(jsonStack, ref parent, ref currentName, jsonArray, isEmptyElement);
+                            break;
+                        case ObjectAttributeValue:
+                            JsonObject jsonObject = CreateObjectWithTypeHint(jsonReader, ref isEmptyElement);
+                            InsertJsonValue(jsonStack, ref parent, ref currentName, jsonObject, isEmptyElement);
+                            break;
+                        default:
+                            throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+                    }
+
+                    while (jsonReader.NodeType == XmlNodeType.EndElement && jsonStack.Count > 0)
+                    {
+                        jsonReader.Read();
+                        SkipWhitespace(jsonReader);
+                        jsonStack.Pop();
+                        if (jsonStack.Count > 0)
+                        {
+                            parent = jsonStack.Peek();
+                        }
+                    }
+                }
+            }
+            catch (XmlException xmlException)
+            {
+                throw new FormatException(Properties.Resources.IncorrectJsonFormat, xmlException);
+            }
+
+            if (jsonStack.Count != 1)
+            {
+                throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+            }
+
+            return parent[RootObjectName];
+        }
+
+        private static JsonValue JXMLToJsonValue(Stream jsonStream, byte[] jsonBytes)
+        {
+            try
+            {
+                using (XmlDictionaryReader jsonReader =
+                    jsonStream != null
+                        ? JsonReaderWriterFactory.CreateJsonReader(jsonStream, XmlDictionaryReaderQuotas.Max)
+                        : JsonReaderWriterFactory.CreateJsonReader(jsonBytes, XmlDictionaryReaderQuotas.Max))
+                {
+                    return JXMLToJsonValue(jsonReader);
+                }
+            }
+            catch (XmlException)
+            {
+                throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+            }
+        }
+
+        private static void InsertJsonValue(Stack<JsonValue> jsonStack, ref JsonValue parent, ref string currentName, JsonValue jsonValue, bool isEmptyElement)
+        {
+            if (parent is JsonArray)
+            {
+                ((JsonArray)parent).Add(jsonValue);
+            }
+            else
+            {
+                if (currentName != null)
+                {
+                    ((JsonObject)parent)[currentName] = jsonValue;
+                    currentName = null;
+                }
+            }
+
+            if (!isEmptyElement)
+            {
+                jsonStack.Push(jsonValue);
+                parent = jsonValue;
+            }
+        }
+
+        private static string GetMemberName(XmlDictionaryReader jsonReader)
+        {
+            string name;
+            if (jsonReader.NamespaceURI == ItemElementName && jsonReader.LocalName == ItemElementName)
+            {
+                // JXML special case for names which aren't valid XML names
+                name = jsonReader.GetAttribute(ItemElementName);
+
+                if (name == null)
+                {
+                    throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+                }
+            }
+            else
+            {
+                name = jsonReader.Name;
+            }
+
+            return name;
+        }
+
+        private static JsonObject CreateObjectWithTypeHint(XmlDictionaryReader jsonReader, ref bool isEmptyElement)
+        {
+            JsonObject jsonObject = new JsonObject();
+            string typeHintAttribute = jsonReader.GetAttribute(TypeHintAttributeName);
+            isEmptyElement = jsonReader.IsEmptyElement;
+            jsonReader.ReadStartElement();
+            SkipWhitespace(jsonReader);
+
+            if (typeHintAttribute != null)
+            {
+                jsonObject.Add(TypeHintAttributeName, typeHintAttribute);
+            }
+
+            return jsonObject;
+        }
+
+        private static JsonArray CreateJsonArray(XmlDictionaryReader jsonReader, ref bool isEmptyElement)
+        {
+            JsonArray jsonArray = new JsonArray();
+            isEmptyElement = jsonReader.IsEmptyElement;
+            jsonReader.ReadStartElement();
+            SkipWhitespace(jsonReader);
+            return jsonArray;
+        }
+
+        private static void MoveToRootNode(XmlDictionaryReader jsonReader)
+        {
+            while (!jsonReader.EOF && (jsonReader.NodeType == XmlNodeType.None || jsonReader.NodeType == XmlNodeType.XmlDeclaration))
+            {
+                // read into <root> node
+                jsonReader.Read();
+                SkipWhitespace(jsonReader);
+            }
+
+            if (jsonReader.NodeType != XmlNodeType.Element || !String.IsNullOrEmpty(jsonReader.NamespaceURI) || jsonReader.Name != RootElementName)
+            {
+                throw new FormatException(Properties.Resources.IncorrectJsonFormat);
+            }
+        }
+
+        private static JsonPrimitive ReadPrimitive(string type, XmlDictionaryReader jsonReader)
+        {
+            JsonValue result = null;
+            switch (type)
+            {
+                case NullAttributeValue:
+                    jsonReader.Skip();
+                    result = null;
+                    break;
+                case BooleanAttributeValue:
+                    result = jsonReader.ReadElementContentAsBoolean();
+                    break;
+                case StringAttributeValue:
+                    result = jsonReader.ReadElementContentAsString();
+                    break;
+                case NumberAttributeValue:
+                    string temp = jsonReader.ReadElementContentAsString();
+                    result = ConvertStringToJsonNumber(temp);
+                    break;
+            }
+
+            SkipWhitespace(jsonReader);
+            return (JsonPrimitive)result;
+        }
+
+        private static void SkipWhitespace(XmlDictionaryReader reader)
+        {
+            while (!reader.EOF && (reader.NodeType == XmlNodeType.Whitespace || reader.NodeType == XmlNodeType.SignificantWhitespace))
+            {
+                reader.Read();
+            }
+        }
+
+        private static JsonValue ConvertStringToJsonNumber(string value)
+        {
+            if (value.IndexOfAny(_floatingPointChars) < 0)
+            {
+                int intVal;
+                if (Int32.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out intVal))
+                {
+                    return intVal;
+                }
+
+                long longVal;
+                if (Int64.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out longVal))
+                {
+                    return longVal;
+                }
+            }
+
+            decimal decValue;
+            if (Decimal.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out decValue) && decValue != 0)
+            {
+                return decValue;
+            }
+
+            double dblValue;
+            if (Double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out dblValue))
+            {
+                return dblValue;
+            }
+
+            throw new ArgumentException(RS.Format(Properties.Resources.InvalidJsonPrimitive, value.ToString()), "value");
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonArray.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonArray.cs
new file mode 100644 (file)
index 0000000..21d0d03
--- /dev/null
@@ -0,0 +1,389 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Xml;
+
+namespace System.Json
+{
+    /// <summary>
+    /// A JsonArray is an ordered sequence of zero or more <see cref="System.Json.JsonValue"/> objects.
+    /// </summary>
+    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+        Justification = "Array already conveys the meaning of collection")]
+    [DataContract]
+    public sealed class JsonArray : JsonValue, IList<JsonValue>
+    {
+        [DataMember]
+        private List<JsonValue> values = new List<JsonValue>();
+
+        /// <summary>
+        /// Creates an instance of the <see cref="System.Json.JsonArray"/> class initialized by
+        /// an <see cref="System.Collections.Generic.IEnumerable{T}"/> enumeration of
+        /// objects of type <see cref="System.Json.JsonValue"/>.
+        /// </summary>
+        /// <param name="items">The <see cref="System.Collections.Generic.IEnumerable{T}"/> enumeration
+        /// of objects of type <see cref="System.Json.JsonValue"/> used to initialize the JavaScript Object Notation (JSON)
+        /// array.</param>
+        /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+        /// <exception cref="System.ArgumentException">If any of the items in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public JsonArray(IEnumerable<JsonValue> items)
+        {
+            AddRange(items);
+        }
+
+        /// <summary>
+        /// Creates an instance of the <see cref="System.Json.JsonArray"/> class, initialized by an array of type <see cref="System.Json.JsonValue"/>.
+        /// </summary>
+        /// <param name="items">The array of type <see cref="System.Json.JsonValue"/> used to initialize the
+        /// JavaScript Object Notation (JSON) array.</param>
+        /// <exception cref="System.ArgumentException">If any of the items in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public JsonArray(params JsonValue[] items)
+        {
+            if (items != null)
+            {
+                AddRange(items);
+            }
+        }
+
+        /// <summary>
+        /// Gets the JSON type of this <see cref="System.Json.JsonArray"/>. The return value
+        /// is always <see cref="F:System.Json.JsonType.Array"/>.
+        /// </summary>
+        public override JsonType JsonType
+        {
+            get { return JsonType.Array; }
+        }
+
+        /// <summary>
+        /// Gets a value indicating whether the <see cref="System.Json.JsonArray"/> is read-only.
+        /// </summary>
+        public bool IsReadOnly
+        {
+            get { return ((IList)values).IsReadOnly; }
+        }
+
+        /// <summary>
+        /// Returns the number of <see cref="System.Json.JsonValue"/> elements in the array.
+        /// </summary>
+        public override int Count
+        {
+            get { return values.Count; }
+        }
+
+        /// <summary>
+        /// Gets or sets the JSON value at a specified index.
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to get or set.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> element at the specified index.</returns>
+        /// <exception cref="System.ArgumentOutOfRangeException">If index is not a valid index for this array.</exception>
+        /// <exception cref="System.ArgumentException">The property is set and the value is a
+        /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+        /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public override JsonValue this[int index]
+        {
+            get { return values[index]; }
+
+            set
+            {
+                if (value != null && value.JsonType == JsonType.Default)
+                {
+                    throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+                }
+
+                JsonValue oldValue = values[index];
+                RaiseItemChanging(value, JsonValueChange.Replace, index);
+                values[index] = value;
+                RaiseItemChanged(oldValue, JsonValueChange.Replace, index);
+            }
+        }
+
+        /// <summary>
+        /// Adds the elements from a collection of type <see cref="System.Json.JsonValue"/> to this instance.
+        /// </summary>
+        /// <param name="items">Collection of items to add.</param>
+        /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+        /// <exception cref="System.ArgumentException">If any of the items in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void AddRange(IEnumerable<JsonValue> items)
+        {
+            if (items == null)
+            {
+                throw new ArgumentNullException("items");
+            }
+
+            if (ChangingListenersCount > 0)
+            {
+                int index = Count;
+                foreach (JsonValue toBeAdded in items)
+                {
+                    RaiseItemChanging(toBeAdded, JsonValueChange.Add, index++);
+                }
+            }
+
+            foreach (JsonValue item in items)
+            {
+                if (item != null && item.JsonType == JsonType.Default)
+                {
+                    throw new ArgumentNullException("items", Properties.Resources.UseOfDefaultNotAllowed);
+                }
+
+                values.Add(item);
+                RaiseItemChanged(item, JsonValueChange.Add, values.Count - 1);
+            }
+        }
+
+        /// <summary>
+        /// Adds the elements from an array of type <see cref="System.Json.JsonValue"/> to this instance.
+        /// </summary>
+        /// <param name="items">The array of type JsonValue to be added to this instance.</param>
+        /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+        /// <exception cref="System.ArgumentException">If any of the items in the array
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void AddRange(params JsonValue[] items)
+        {
+            AddRange(items as IEnumerable<JsonValue>);
+        }
+
+        /// <summary>
+        /// Searches for a specified object and returns the zero-based index of its first
+        /// occurrence within this <see cref="System.Json.JsonArray"/>.
+        /// </summary>
+        /// <param name="item">The <see cref="System.Json.JsonValue"/> object to look up.</param>
+        /// <returns>The zero-based index of the first occurrence of item within the
+        /// <see cref="System.Json.JsonArray"/>, if found; otherwise, -1.</returns>
+        public int IndexOf(JsonValue item)
+        {
+            return values.IndexOf(item);
+        }
+
+        /// <summary>
+        /// Insert a JSON CLR type into the array at a specified index.
+        /// </summary>
+        /// <param name="index">The zero-based index at which the item should be inserted.</param>
+        /// <param name="item">The <see cref="System.Json.JsonValue"/> object to insert.</param>
+        /// <exception cref="System.ArgumentOutOfRangeException">If index is less than zero or larger than
+        /// the size of the array.</exception>
+        /// <exception cref="System.ArgumentException">If the object to insert has a
+        /// <see cref="System.Json.JsonValue.JsonType"/> property of value
+        /// <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void Insert(int index, JsonValue item)
+        {
+            if (item != null && item.JsonType == JsonType.Default)
+            {
+                throw new ArgumentNullException("item", Properties.Resources.UseOfDefaultNotAllowed);
+            }
+
+            RaiseItemChanging(item, JsonValueChange.Add, index);
+            values.Insert(index, item);
+            RaiseItemChanged(item, JsonValueChange.Add, index);
+        }
+
+        /// <summary>
+        /// Remove the JSON value at a specified index of <see cref="System.Json.JsonArray"/>.
+        /// </summary>
+        /// <param name="index">The zero-based index at which to remove the <see cref="System.Json.JsonValue"/>.</param>
+        /// <exception cref="System.ArgumentOutOfRangeException">If index is less than zero or index
+        /// is equal or larger than the size of the array.</exception>
+        public void RemoveAt(int index)
+        {
+            JsonValue item = values[index];
+            RaiseItemChanging(item, JsonValueChange.Remove, index);
+            values.RemoveAt(index);
+            RaiseItemChanged(item, JsonValueChange.Remove, index);
+        }
+
+        /// <summary>
+        /// Adds a <see cref="System.Json.JsonValue"/> object to the end of the array.
+        /// </summary>
+        /// <param name="item">The <see cref="System.Json.JsonValue"/> object to add.</param>
+        /// <exception cref="System.ArgumentException">If the object to add has a
+        /// <see cref="System.Json.JsonValue.JsonType"/> property of value
+        /// <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void Add(JsonValue item)
+        {
+            if (item != null && item.JsonType == JsonType.Default)
+            {
+                throw new ArgumentNullException("item", Properties.Resources.UseOfDefaultNotAllowed);
+            }
+
+            int index = Count;
+            RaiseItemChanging(item, JsonValueChange.Add, index);
+            values.Add(item);
+            RaiseItemChanged(item, JsonValueChange.Add, index);
+        }
+
+        /// <summary>
+        /// Removes all JSON CLR types from the <see cref="System.Json.JsonArray"/>.
+        /// </summary>
+        public void Clear()
+        {
+            RaiseItemChanging(null, JsonValueChange.Clear, 0);
+            values.Clear();
+            RaiseItemChanged(null, JsonValueChange.Clear, 0);
+        }
+
+        /// <summary>
+        /// Checks whether a specified JSON CLR type is in the <see cref="System.Json.JsonArray"/>.
+        /// </summary>
+        /// <param name="item">The <see cref="System.Json.JsonValue"/> to check for in the array.</param>
+        /// <returns>true if item is found in the <see cref="System.Json.JsonArray"/>; otherwise, false.</returns>
+        public bool Contains(JsonValue item)
+        {
+            return values.Contains(item);
+        }
+
+        /// <summary>
+        /// Copies the contents of the current JSON CLR array instance into a specified
+        /// destination array beginning at the specified index.
+        /// </summary>
+        /// <param name="array">The destination array to which the elements of the current
+        /// <see cref="System.Json.JsonArray"/> object are copied.</param>
+        /// <param name="arrayIndex">The zero-based index in the destination array at which the
+        /// copying of the elements of the JSON CLR array begins.</param>
+        public void CopyTo(JsonValue[] array, int arrayIndex)
+        {
+            values.CopyTo(array, arrayIndex);
+        }
+
+        /// <summary>
+        /// Removes the first occurrence of the specified JSON value from the array.
+        /// </summary>
+        /// <param name="item">The <see cref="System.Json.JsonValue"/> to remove from the <see cref="System.Json.JsonArray"/>.</param>
+        /// <returns>true if item is successfully removed; otherwise, false. This method
+        /// also returns false if item was not found in the <see cref="System.Json.JsonArray"/>.</returns>
+        public bool Remove(JsonValue item)
+        {
+            int index = -1;
+            if (ChangingListenersCount > 0 || ChangedListenersCount > 0)
+            {
+                index = IndexOf(item);
+            }
+
+            if (index >= 0)
+            {
+                RaiseItemChanging(item, JsonValueChange.Remove, index);
+            }
+
+            bool result = values.Remove(item);
+            if (index >= 0)
+            {
+                RaiseItemChanged(item, JsonValueChange.Remove, index);
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// Returns an enumerator that iterates through the <see cref="System.Json.JsonValue"/> objects in the array.
+        /// </summary>
+        /// <returns>Returns an <see cref="System.Collections.IEnumerator"/> object that
+        /// iterates through the <see cref="System.Json.JsonValue"/> elements in this <see cref="System.Json.JsonArray"/>.</returns>
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return values.GetEnumerator();
+        }
+
+        /// <summary>
+        /// Safe indexer for the <see cref="System.Json.JsonValue"/> type. 
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to get.</param>
+        /// <returns>If the index is within the array bounds and the value corresponding to the
+        /// index is not null, then it will return that value. Otherwise it will return a
+        /// <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        public override JsonValue ValueOrDefault(int index)
+        {
+            if (index >= 0 && index < Count && this[index] != null)
+            {
+                return this[index];
+            }
+
+            return base.ValueOrDefault(index);
+        }
+
+        /// <summary>
+        /// Returns an enumerator that iterates through the <see cref="System.Json.JsonValue"/> objects in the array.
+        /// </summary>
+        /// <returns>Returns an <see cref="System.Collections.Generic.IEnumerator{T}"/> object that
+        /// iterates through the <see cref="System.Json.JsonValue"/> elements in this <see cref="System.Json.JsonArray"/>.</returns>
+        public new IEnumerator<JsonValue> GetEnumerator()
+        {
+            return values.GetEnumerator();
+        }
+
+        /// <summary>
+        /// Returns an enumerator which iterates through the values in this object.
+        /// </summary>
+        /// <returns>An <see cref="System.Collections.Generic.IEnumerator{T}"/> which iterates through the values in this object.</returns>
+        /// <remarks>The enumerator returned by this class contains one pair for each element
+        /// in this array, whose key is the element index (as a string), and the value is the
+        /// element itself.</remarks>
+        protected override IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+        {
+            for (int i = 0; i < values.Count; i++)
+            {
+                yield return new KeyValuePair<string, JsonValue>(i.ToString(CultureInfo.InvariantCulture), values[i]);
+            }
+        }
+
+        /// <summary>
+        /// Callback method called to let an instance write the proper JXML attribute when saving this
+        /// instance.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        internal override void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+        {
+            if (jsonWriter == null)
+            {
+                throw new ArgumentNullException("jsonWriter");
+            }
+
+            jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.ArrayAttributeValue);
+        }
+
+        /// <summary>
+        /// Callback method called during Save operations to let the instance write the start element
+        /// and return the next element in the collection.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        /// <param name="currentIndex">The index within this collection.</param>
+        /// <returns>The next item in the collection, or null of there are no more items.</returns>
+        internal override JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int currentIndex)
+        {
+            if (jsonWriter == null)
+            {
+                throw new ArgumentNullException("jsonWriter");
+            }
+
+            jsonWriter.WriteStartElement(JXmlToJsonValueConverter.ItemElementName);
+            JsonValue nextValue = this[currentIndex];
+            return nextValue;
+        }
+
+        private void RaiseItemChanging(JsonValue child, JsonValueChange change, int index)
+        {
+            if (ChangingListenersCount > 0)
+            {
+                RaiseChangingEvent(this, new JsonValueChangeEventArgs(child, change, index));
+            }
+        }
+
+        private void RaiseItemChanged(JsonValue child, JsonValueChange change, int index)
+        {
+            if (ChangedListenersCount > 0)
+            {
+                RaiseChangedEvent(this, new JsonValueChangeEventArgs(child, change, index));
+            }
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonObject.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonObject.cs
new file mode 100644 (file)
index 0000000..a8831c6
--- /dev/null
@@ -0,0 +1,474 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Serialization;
+using System.Xml;
+using WrappedPair = System.Json.NGenWrapper<System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>>;
+
+namespace System.Json
+{
+    /// <summary>
+    /// A JsonObject is an unordered collection of zero or more key/value pairs.
+    /// </summary>
+    /// <remarks>A JsonObject is an unordered collection of zero or more key/value pairs,
+    /// where each key is a String and each value is a <see cref="System.Json.JsonValue"/>, which can be a
+    /// <see cref="System.Json.JsonPrimitive"/>, a <see cref="System.Json.JsonArray"/>, or a JsonObject.</remarks>
+    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+        Justification = "Object in the context of JSON already conveys the meaning of dictionary")]
+    [DataContract]
+    public sealed class JsonObject : JsonValue, IDictionary<string, JsonValue>
+    {
+        [DataMember]
+        private Dictionary<string, JsonValue> values = new Dictionary<string, JsonValue>(StringComparer.Ordinal);
+
+        private List<WrappedPair> indexedPairs;
+        private int instanceSaveCount;
+        private object saveLock = new object();
+
+        /// <summary>
+        /// Creates an instance of the <see cref="System.Json.JsonObject"/> class initialized with an
+        /// <see cref="System.Collections.Generic.IEnumerable{T}"/> collection of key/value pairs.
+        /// </summary>
+        /// <param name="items">The <see cref="System.Collections.Generic.IEnumerable{T}"/> collection of
+        /// <see cref="System.Collections.Generic.KeyValuePair{K, V}"/> used to initialize the
+        /// key/value pairs</param>
+        /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+        /// <exception cref="System.ArgumentException">If any of the values in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+            Justification = "There's no complexity using this design because nested generic type is atomic type not another collection")]
+        public JsonObject(IEnumerable<KeyValuePair<string, JsonValue>> items)
+        {
+            AddRange(items);
+        }
+
+        /// <summary>
+        /// Creates an instance of the <see cref="System.Json.JsonObject"/> class initialized with a collection of key/value pairs.
+        /// </summary>
+        /// <param name="items">The <see cref="System.Collections.Generic.KeyValuePair{K, V}"/> objects used to initialize the key/value pairs.</param>
+        /// <exception cref="System.ArgumentException">If any of the values in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public JsonObject(params KeyValuePair<string, JsonValue>[] items)
+        {
+            if (items != null)
+            {
+                AddRange(items);
+            }
+        }
+
+        /// <summary>
+        /// Gets the JSON type of this <see cref="System.Json.JsonObject"/>. The return value
+        /// is always <see cref="F:System.Json.JsonType.Object"/>.
+        /// </summary>
+        public override JsonType JsonType
+        {
+            get { return JsonType.Object; }
+        }
+
+        /// <summary>
+        /// Gets a collection that contains the keys in this <see cref="System.Json.JsonObject"/>.
+        /// </summary>
+        public ICollection<string> Keys
+        {
+            get { return values.Keys; }
+        }
+
+        /// <summary>
+        /// Gets a collection that contains the values in this <see cref="System.Json.JsonObject"/>.
+        /// </summary>
+        public ICollection<JsonValue> Values
+        {
+            get { return values.Values; }
+        }
+
+        /// <summary>
+        /// Returns the number of key/value pairs in this <see cref="System.Json.JsonObject"/>.
+        /// </summary>
+        public override int Count
+        {
+            get { return values.Count; }
+        }
+
+        /// <summary>
+        /// Gets a value indicating whether this JSON CLR object is read-only.
+        /// </summary>
+        bool ICollection<KeyValuePair<string, JsonValue>>.IsReadOnly
+        {
+            get { return ((ICollection<KeyValuePair<string, JsonValue>>)values).IsReadOnly; }
+        }
+
+        /// <summary>
+        /// Gets or sets the value associated with the specified key.
+        /// </summary>
+        /// <param name="key">The key of the value to get or set.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> associated to the specified key.</returns>
+        /// <exception cref="System.ArgumentNullException">If key is null.</exception>
+        /// <exception cref="System.ArgumentException">The property is set and the value is a
+        /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+        /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public override JsonValue this[string key]
+        {
+            get
+            {
+                if (key == null)
+                {
+                    throw new ArgumentNullException("key");
+                }
+
+                return values[key];
+            }
+
+            set
+            {
+                if (value != null && value.JsonType == JsonType.Default)
+                {
+                    throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+                }
+
+                if (key == null)
+                {
+                    throw new ArgumentNullException("key");
+                }
+
+                bool replacement = values.ContainsKey(key);
+                JsonValue oldValue = null;
+                if (replacement)
+                {
+                    oldValue = values[key];
+                    RaiseItemChanging(value, JsonValueChange.Replace, key);
+                }
+                else
+                {
+                    RaiseItemChanging(value, JsonValueChange.Add, key);
+                }
+
+                values[key] = value;
+                if (replacement)
+                {
+                    RaiseItemChanged(oldValue, JsonValueChange.Replace, key);
+                }
+                else
+                {
+                    RaiseItemChanged(value, JsonValueChange.Add, key);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Safe string indexer for the <see cref="System.Json.JsonValue"/> type. 
+        /// </summary>
+        /// <param name="key">The key of the element to get.</param>
+        /// <returns>If this instance contains the given key and the value corresponding to
+        /// the key is not null, then it will return that value. Otherwise it will return a
+        /// <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        public override JsonValue ValueOrDefault(string key)
+        {
+            if (key != null && ContainsKey(key) && this[key] != null)
+            {
+                return this[key];
+            }
+
+            return base.ValueOrDefault(key);
+        }
+
+        /// <summary>
+        /// Adds a specified collection of key/value pairs to this instance.
+        /// </summary>
+        /// <param name="items">The collection of key/value pairs to add.</param>
+        /// <exception cref="System.ArgumentNullException">If items is null.</exception>
+        /// <exception cref="System.ArgumentException">If the value of any of the items in the collection
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+            Justification = "There's no complexity using this design because nested generic type is atomic type not another collection")]
+        public void AddRange(IEnumerable<KeyValuePair<string, JsonValue>> items)
+        {
+            if (items == null)
+            {
+                throw new ArgumentNullException("items");
+            }
+
+            if (ChangingListenersCount > 0)
+            {
+                foreach (KeyValuePair<string, JsonValue> item in items)
+                {
+                    RaiseItemChanging(item.Value, JsonValueChange.Add, item.Key);
+                }
+            }
+
+            foreach (KeyValuePair<string, JsonValue> item in items)
+            {
+                if (item.Value != null && item.Value.JsonType == JsonType.Default)
+                {
+                    throw new ArgumentNullException("items", Properties.Resources.UseOfDefaultNotAllowed);
+                }
+
+                values.Add(item.Key, item.Value);
+                RaiseItemChanged(item.Value, JsonValueChange.Add, item.Key);
+            }
+        }
+
+        /// <summary>
+        /// Adds the elements from an array of type <see cref="System.Json.JsonValue"/> to this instance.
+        /// </summary>
+        /// <param name="items">The array of key/value paris to be added to this instance.</param>
+        /// <exception cref="System.ArgumentException">If the value of any of the items in the array
+        /// is a <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void AddRange(params KeyValuePair<string, JsonValue>[] items)
+        {
+            AddRange(items as IEnumerable<KeyValuePair<string, JsonValue>>);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return ((IEnumerable)values).GetEnumerator();
+        }
+
+        /// <summary>
+        /// Adds a key/value pair to this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        /// <param name="key">The key for the element added.</param>
+        /// <param name="value">The <see cref="System.Json.JsonValue"/> for the element added.</param>
+        /// <exception cref="System.ArgumentException">If the value is a <see cref="System.Json.JsonValue"/>
+        /// with <see cref="System.Json.JsonValue.JsonType"/> property of
+        /// value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void Add(string key, JsonValue value)
+        {
+            if (value != null && value.JsonType == JsonType.Default)
+            {
+                throw new ArgumentNullException("value", Properties.Resources.UseOfDefaultNotAllowed);
+            }
+
+            RaiseItemChanging(value, JsonValueChange.Add, key);
+            values.Add(key, value);
+            RaiseItemChanged(value, JsonValueChange.Add, key);
+        }
+
+        /// <summary>
+        /// Adds a key/value pair to this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        /// <param name="item">The key/value pair to be added.</param>
+        /// <exception cref="System.ArgumentException">If the value of the pair is a
+        /// <see cref="System.Json.JsonValue"/> with <see cref="System.Json.JsonValue.JsonType"/>
+        /// property of value <see cref="F:System.Json.JsonType.Default"/>.</exception>
+        public void Add(KeyValuePair<string, JsonValue> item)
+        {
+            Add(item.Key, item.Value);
+        }
+
+        /// <summary>
+        /// Checks whether a key/value pair with a specified key exists in this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        /// <param name="key">The key to check for.</param>
+        /// <returns>true if this instance contains the key; otherwise, false.</returns>
+        public override bool ContainsKey(string key)
+        {
+            return values.ContainsKey(key);
+        }
+
+        /// <summary>
+        /// Removes the key/value pair with a specified key from this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        /// <param name="key">The key of the item to remove.</param>
+        /// <returns>true if the element is successfully found and removed; otherwise, false.
+        /// This method returns false if key is not found in this <see cref="System.Json.JsonObject"/> instance.</returns>
+        public bool Remove(string key)
+        {
+            JsonValue original = null;
+            bool containsKey = false;
+            if (ChangingListenersCount > 0 || ChangedListenersCount > 0)
+            {
+                containsKey = TryGetValue(key, out original);
+            }
+
+            if (containsKey && ChangingListenersCount > 0)
+            {
+                RaiseItemChanging(original, JsonValueChange.Remove, key);
+            }
+
+            bool result = values.Remove(key);
+
+            if (containsKey && ChangedListenersCount > 0)
+            {
+                RaiseItemChanged(original, JsonValueChange.Remove, key);
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// Attempts to get the value that corresponds to the specified key.
+        /// </summary>
+        /// <param name="key">The key of the value to retrieve.</param>
+        /// <param name="value">The primitive or structured <see cref="System.Json.JsonValue"/> object that has the key
+        /// specified. If this object does not contain a key/value pair with the given key,
+        /// this parameter is set to null.</param>
+        /// <returns>true if the instance of the <see cref="System.Json.JsonObject"/> contains an element with the
+        /// specified key; otherwise, false.</returns>
+        public bool TryGetValue(string key, out JsonValue value)
+        {
+            return values.TryGetValue(key, out value);
+        }
+
+        /// <summary>
+        /// Removes all key/value pairs from this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        public void Clear()
+        {
+            RaiseItemChanging(null, JsonValueChange.Clear, null);
+            values.Clear();
+            RaiseItemChanged(null, JsonValueChange.Clear, null);
+        }
+
+        bool ICollection<KeyValuePair<string, JsonValue>>.Contains(KeyValuePair<string, JsonValue> item)
+        {
+            return ((ICollection<KeyValuePair<string, JsonValue>>)values).Contains(item);
+        }
+
+        /// <summary>
+        /// Copies the contents of this <see cref="System.Json.JsonObject"/> instance into a specified
+        /// key/value destination array beginning at a specified index.
+        /// </summary>
+        /// <param name="array">The destination array of type <see cref="System.Collections.Generic.KeyValuePair{K, V}"/>
+        /// to which the elements of this <see cref="System.Json.JsonObject"/> are copied.</param>
+        /// <param name="arrayIndex">The zero-based index at which to begin the insertion of the
+        /// contents from this <see cref="System.Json.JsonObject"/> instance.</param>
+        public void CopyTo(KeyValuePair<string, JsonValue>[] array, int arrayIndex)
+        {
+            ((ICollection<KeyValuePair<string, JsonValue>>)values).CopyTo(array, arrayIndex);
+        }
+
+        bool ICollection<KeyValuePair<string, JsonValue>>.Remove(KeyValuePair<string, JsonValue> item)
+        {
+            if (ChangingListenersCount > 0)
+            {
+                if (ContainsKey(item.Key) && EqualityComparer<JsonValue>.Default.Equals(item.Value, values[item.Key]))
+                {
+                    RaiseItemChanging(item.Value, JsonValueChange.Remove, item.Key);
+                }
+            }
+
+            bool result = ((ICollection<KeyValuePair<string, JsonValue>>)values).Remove(item);
+            if (result)
+            {
+                RaiseItemChanged(item.Value, JsonValueChange.Remove, item.Key);
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// Returns an enumerator over the key/value pairs contained in this <see cref="System.Json.JsonObject"/> instance.
+        /// </summary>
+        /// <returns>An <see cref="System.Collections.Generic.IEnumerator{T}"/> which iterates
+        /// through the members of this instance.</returns>
+        protected override IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+        {
+            return values.GetEnumerator();
+        }
+
+        /// <summary>
+        /// Callback method called when a Save operation is starting for this instance.
+        /// </summary>
+        protected override void OnSaveStarted()
+        {
+            lock (saveLock)
+            {
+                instanceSaveCount++;
+                if (indexedPairs == null)
+                {
+                    indexedPairs = new List<WrappedPair>();
+
+                    foreach (KeyValuePair<string, JsonValue> item in values)
+                    {
+                        indexedPairs.Add(new WrappedPair(item));
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Callback method called when a Save operation is finished for this instance.
+        /// </summary>
+        protected override void OnSaveEnded()
+        {
+            lock (saveLock)
+            {
+                instanceSaveCount--;
+                if (instanceSaveCount == 0)
+                {
+                    indexedPairs = null;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Callback method called to let an instance write the proper JXML attribute when saving this
+        /// instance.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        internal override void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+        {
+            jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.ObjectAttributeValue);
+        }
+
+        /// <summary>
+        /// Callback method called during Save operations to let the instance write the start element
+        /// and return the next element in the collection.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        /// <param name="currentIndex">The index within this collection.</param>
+        /// <returns>The next item in the collection, or null of there are no more items.</returns>
+        internal override JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int currentIndex)
+        {
+            KeyValuePair<string, JsonValue> currentPair = indexedPairs[currentIndex];
+            string currentKey = currentPair.Key;
+
+            if (currentKey.Length == 0)
+            {
+                // special case in JXML world
+                jsonWriter.WriteStartElement(JXmlToJsonValueConverter.ItemElementName, JXmlToJsonValueConverter.ItemElementName);
+                jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.ItemElementName, String.Empty);
+            }
+            else
+            {
+                jsonWriter.WriteStartElement(currentKey);
+            }
+
+            return currentPair.Value;
+        }
+
+        [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "Context is required by CLR for this to work.")]
+        [OnDeserialized]
+        private void OnDeserialized(StreamingContext context)
+        {
+            saveLock = new object();
+        }
+
+        private void RaiseItemChanging(JsonValue child, JsonValueChange change, string key)
+        {
+            if (ChangingListenersCount > 0)
+            {
+                RaiseChangingEvent(this, new JsonValueChangeEventArgs(child, change, key));
+            }
+        }
+
+        private void RaiseItemChanged(JsonValue child, JsonValueChange change, string key)
+        {
+            if (ChangedListenersCount > 0)
+            {
+                RaiseChangedEvent(this, new JsonValueChangeEventArgs(child, change, key));
+            }
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonPrimitive.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonPrimitive.cs
new file mode 100644 (file)
index 0000000..6d5cc7c
--- /dev/null
@@ -0,0 +1,1151 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+    /// <summary>
+    /// Represents a JavaScript Object Notation (JSON) primitive type in the common language runtime (CLR).
+    /// </summary>
+    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+        Justification = "JsonPrimitive does not represent a collection.")]
+    [DataContract]
+    public sealed class JsonPrimitive : JsonValue
+    {
+        internal const string DateTimeIsoFormat = "yyyy-MM-ddTHH:mm:ss.fffK";
+        private const string UtcString = "UTC";
+        private const string GmtString = "GMT";
+        private static readonly long UnixEpochTicks = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
+        private static readonly char[] FloatingPointChars = new char[] { '.', 'e', 'E' };
+        private static readonly Type jsonPrimitiveType = typeof(JsonPrimitive);
+        private static readonly Type uriType = typeof(Uri);
+
+        private static readonly Dictionary<Type, Func<string, ConvertResult>> stringConverters = new Dictionary<Type, Func<string, ConvertResult>>
+        {
+            { typeof(bool), new Func<string, ConvertResult>(StringToBool) },
+            { typeof(byte), new Func<string, ConvertResult>(StringToByte) },
+            { typeof(char), new Func<string, ConvertResult>(StringToChar) },
+            { typeof(sbyte), new Func<string, ConvertResult>(StringToSByte) },
+            { typeof(short), new Func<string, ConvertResult>(StringToShort) },
+            { typeof(int), new Func<string, ConvertResult>(StringToInt) },
+            { typeof(long), new Func<string, ConvertResult>(StringToLong) },
+            { typeof(ushort), new Func<string, ConvertResult>(StringToUShort) },
+            { typeof(uint), new Func<string, ConvertResult>(StringToUInt) },
+            { typeof(ulong), new Func<string, ConvertResult>(StringToULong) },
+            { typeof(float), new Func<string, ConvertResult>(StringToFloat) },
+            { typeof(double), new Func<string, ConvertResult>(StringToDouble) },
+            { typeof(decimal), new Func<string, ConvertResult>(StringToDecimal) },
+            { typeof(DateTime), new Func<string, ConvertResult>(StringToDateTime) },
+            { typeof(DateTimeOffset), new Func<string, ConvertResult>(StringToDateTimeOffset) },
+            { typeof(Guid), new Func<string, ConvertResult>(StringToGuid) },
+            { typeof(Uri), new Func<string, ConvertResult>(StringToUri) },
+        };
+
+        [DataMember]
+        private object value;
+
+        [DataMember]
+        private JsonType jsonType;
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Boolean"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Boolean"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Boolean"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Boolean"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Boolean"/>.</remarks>
+        public JsonPrimitive(bool value)
+        {
+            jsonType = JsonType.Boolean;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Byte"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Byte"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Byte"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Byte"/>.</remarks>
+        public JsonPrimitive(byte value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.SByte"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.SByte"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.SByte"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.SByte"/>.</remarks>
+        [CLSCompliant(false)]
+        public JsonPrimitive(sbyte value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Decimal"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Decimal"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Decimal"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Decimal"/>.</remarks>
+        public JsonPrimitive(decimal value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int16"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int16"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Int16"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int16"/>.</remarks>
+        public JsonPrimitive(short value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt16"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt16"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.UInt16"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt16"/>.</remarks>
+        [CLSCompliant(false)]
+        public JsonPrimitive(ushort value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int32"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int32"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Int32"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int32"/>.</remarks>
+        public JsonPrimitive(int value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt32"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt32"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.UInt32"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt32"/>.</remarks>
+        [CLSCompliant(false)]
+        public JsonPrimitive(uint value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Int64"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int64"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Int64"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Int64"/>.</remarks>
+        public JsonPrimitive(long value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.UInt64"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt64"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.UInt64"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.UInt64"/>.</remarks>
+        [CLSCompliant(false)]
+        public JsonPrimitive(ulong value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Single"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Single"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Single"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Single"/>.</remarks>
+        public JsonPrimitive(float value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Double"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Double"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Double"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.Number"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Double"/>.</remarks>
+        public JsonPrimitive(double value)
+        {
+            jsonType = JsonType.Number;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.String"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.String"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.String"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.String"/>.</remarks>
+        /// <exception cref="System.ArgumentNullException">value is null.</exception>
+        [SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads",
+            Justification = "This operator does not intend to represent a Uri overload.")]
+        public JsonPrimitive(string value)
+        {
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Char"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Char"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Char"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Char"/>.</remarks>
+        public JsonPrimitive(char value)
+        {
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.DateTime"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.DateTime"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.DateTime"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.DateTime"/>.</remarks>
+        public JsonPrimitive(DateTime value)
+        {
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.DateTimeOffset"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.DateTimeOffset"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.DateTimeOffset"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.DateTimeOffset"/>.</remarks>
+        public JsonPrimitive(DateTimeOffset value)
+        {
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Uri"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Uri"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Uri"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Uri"/>.</remarks>
+        /// <exception cref="System.ArgumentNullException">value is null.</exception>
+        public JsonPrimitive(Uri value)
+        {
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of a <see cref="System.Json.JsonPrimitive"/> type with a <see cref="System.Guid"/> type.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Guid"/> object that initializes the new instance.</param>
+        /// <remarks>A <see cref="System.Json.JsonPrimitive"/> object stores a <see cref="System.Json.JsonType"/> and the value used to initialize it.
+        /// When initialized with a <see cref="System.Guid"/> object, the <see cref="System.Json.JsonType"/> is a <see cref="F:System.Json.JsonType.String"/>, which can be
+        /// recovered using the <see cref="System.Json.JsonPrimitive.JsonType"/> property. The value used to initialize the <see cref="System.Json.JsonPrimitive"/>
+        /// object can be recovered by casting the <see cref="System.Json.JsonPrimitive"/> to <see cref="System.Guid"/>.</remarks>
+        public JsonPrimitive(Guid value)
+        {
+            jsonType = JsonType.String;
+            this.value = value;
+        }
+
+        private JsonPrimitive(object value, JsonType type)
+        {
+            jsonType = type;
+            this.value = value;
+        }
+
+        private enum ReadAsFailureKind
+        {
+            NoFailure,
+            InvalidCast,
+            InvalidDateFormat,
+            InvalidFormat,
+            InvalidUriFormat,
+            Overflow,
+        }
+
+        /// <summary>
+        /// Gets the JsonType that is associated with this <see cref="System.Json.JsonPrimitive"/> object.
+        /// </summary>
+        public override JsonType JsonType
+        {
+            get { return jsonType; }
+        }
+
+        /// <summary>
+        /// Gets the value represented by this instance.
+        /// </summary>
+        [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
+            Justification = "Value in this context clearly refers to the underlying CLR value")]
+        public object Value
+        {
+            get { return value; }
+        }
+
+        /// <summary>
+        /// Attempts to create a <see cref="JsonPrimitive"/> instance from the specified <see cref="object"/> value.
+        /// </summary>
+        /// <param name="value">The <see cref="object"/> value to create the <see cref="JsonPrimitive"/> instance.</param>
+        /// <param name="result">The resulting <see cref="JsonPrimitive"/> instance on success, null otherwise.</param>
+        /// <returns>true if the operation is successful, false otherwise.</returns>
+        public static bool TryCreate(object value, out JsonPrimitive result)
+        {
+            bool allowedType = true;
+            JsonType jsonType = default(JsonType);
+
+            if (value != null)
+            {
+                Type type = value.GetType();
+                switch (Type.GetTypeCode(type))
+                {
+                    case TypeCode.Boolean:
+                        jsonType = JsonType.Boolean;
+                        break;
+                    case TypeCode.Byte:
+                    case TypeCode.SByte:
+                    case TypeCode.Decimal:
+                    case TypeCode.Double:
+                    case TypeCode.Int16:
+                    case TypeCode.Int32:
+                    case TypeCode.Int64:
+                    case TypeCode.UInt16:
+                    case TypeCode.UInt32:
+                    case TypeCode.UInt64:
+                    case TypeCode.Single:
+                        jsonType = JsonType.Number;
+                        break;
+                    case TypeCode.String:
+                    case TypeCode.Char:
+                    case TypeCode.DateTime:
+                        jsonType = JsonType.String;
+                        break;
+                    default:
+                        if (type == typeof(Uri) || type == typeof(Guid) || type == typeof(DateTimeOffset))
+                        {
+                            jsonType = JsonType.String;
+                        }
+                        else
+                        {
+                            allowedType = false;
+                        }
+
+                        break;
+                }
+            }
+            else
+            {
+                allowedType = false;
+            }
+
+            if (allowedType)
+            {
+                result = new JsonPrimitive(value, jsonType);
+                return true;
+            }
+            else
+            {
+                result = null;
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonPrimitive"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <returns>An object instance initialized with the <see cref="System.Json.JsonValue"/> value
+        /// specified if the conversion.</returns>
+        /// <exception cref="System.UriFormatException">If T is <see cref="System.Uri"/> and this value does
+        /// not represent a valid Uri.</exception>
+        /// <exception cref="OverflowException">If T is a numeric type, and a narrowing conversion would result
+        /// in a loss of data. For example, if this instance holds an <see cref="System.Int32"/> value of 10000,
+        /// and T is <see cref="System.Byte"/>, this operation would throw an <see cref="System.OverflowException"/>
+        /// because 10000 is outside the range of the <see cref="System.Byte"/> data type.</exception>
+        /// <exception cref="System.FormatException">If the conversion from the string representation of this
+        /// value into another fails because the string is not in the proper format.</exception>
+        /// <exception cref="System.InvalidCastException">If this instance cannot be read as type T.</exception>
+        public override object ReadAs(Type type)
+        {
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            object result;
+            ReadAsFailureKind failure = TryReadAsInternal(type, out result);
+            if (failure == ReadAsFailureKind.NoFailure)
+            {
+                return result;
+            }
+            else
+            {
+                string valueStr = value.ToString();
+                string typeOfTName = type.Name;
+                switch (failure)
+                {
+                    case ReadAsFailureKind.InvalidFormat:
+                        throw new FormatException(RS.Format(Properties.Resources.CannotReadPrimitiveAsType, valueStr, typeOfTName));
+                    case ReadAsFailureKind.InvalidDateFormat:
+                        throw new FormatException(RS.Format(Properties.Resources.InvalidDateFormat, valueStr, typeOfTName));
+                    case ReadAsFailureKind.InvalidUriFormat:
+                        throw new UriFormatException(RS.Format(Properties.Resources.InvalidUriFormat, jsonPrimitiveType.Name, valueStr, typeOfTName, uriType.Name));
+                    case ReadAsFailureKind.Overflow:
+                        throw new OverflowException(RS.Format(Properties.Resources.OverflowReadAs, valueStr, typeOfTName));
+                    case ReadAsFailureKind.InvalidCast:
+                    default:
+                        throw new InvalidCastException(RS.Format(Properties.Resources.CannotReadPrimitiveAsType, valueStr, typeOfTName));
+                }
+            }
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonPrimitive"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <param name="value">An object instance to be initialized with this instance or null if the conversion cannot be performed.</param>
+        /// <returns>true if this <see cref="System.Json.JsonPrimitive"/> instance can be read as the specified type; otherwise, false.</returns>
+        [SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
+            Justification = "field is used with 'this' and arg is out param which makes it harder to be misused.")]
+        public override bool TryReadAs(Type type, out object value)
+        {
+            return TryReadAsInternal(type, out value) == ReadAsFailureKind.NoFailure;
+        }
+
+        /// <summary>
+        /// Returns the value this object wraps (if any).
+        /// </summary>
+        /// <returns>The value wrapped by this instance or null if none.</returns>
+        internal override object Read()
+        {
+            return value;
+        }
+
+        internal override void Save(XmlDictionaryWriter jsonWriter)
+        {
+            if (value == null)
+            {
+                throw new ArgumentNullException("jsonWriter");
+            }
+
+            switch (jsonType)
+            {
+                case JsonType.Boolean:
+                    jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.BooleanAttributeValue);
+                    break;
+                case JsonType.Number:
+                    jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.NumberAttributeValue);
+                    break;
+                default:
+                    jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.StringAttributeValue);
+                    break;
+            }
+
+            WriteValue(jsonWriter);
+        }
+
+        private static ConvertResult StringToBool(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            bool tempBool;
+            result.ReadAsFailureKind = Boolean.TryParse(valueString, out tempBool) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+            result.Value = tempBool;
+            return result;
+        }
+
+        private static ConvertResult StringToByte(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            byte tempByte;
+            result.ReadAsFailureKind = Byte.TryParse(valueString, out tempByte) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<byte>(valueString, out tempByte);
+            }
+
+            result.Value = tempByte;
+            return result;
+        }
+
+        private static ConvertResult StringToChar(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            char tempChar;
+            result.ReadAsFailureKind = Char.TryParse(valueString, out tempChar) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+            result.Value = tempChar;
+            return result;
+        }
+
+        private static ConvertResult StringToDecimal(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            decimal tempDecimal;
+            result.ReadAsFailureKind = Decimal.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempDecimal) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<decimal>(valueString, out tempDecimal);
+            }
+
+            result.Value = tempDecimal;
+            return result;
+        }
+
+        private static ConvertResult StringToDateTime(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            DateTime tempDateTime;
+            result.ReadAsFailureKind = TryParseDateTime(valueString, out tempDateTime) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidDateFormat;
+            result.Value = tempDateTime;
+            return result;
+        }
+
+        private static ConvertResult StringToDateTimeOffset(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            DateTimeOffset tempDateTimeOffset;
+            result.ReadAsFailureKind = TryParseDateTimeOffset(valueString, out tempDateTimeOffset) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidDateFormat;
+            result.Value = tempDateTimeOffset;
+            return result;
+        }
+
+        private static ConvertResult StringToDouble(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            double tempDouble;
+            result.ReadAsFailureKind = Double.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempDouble) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<double>(valueString, out tempDouble);
+            }
+
+            result.Value = tempDouble;
+            return result;
+        }
+
+       private static bool TryGuidParse (string value, out Guid guid)
+       {
+#if NET_4_0
+               return Guid.TryParse (value, out guid);
+#else
+               try {
+                       guid = new Guid (value);
+                       return true;
+               } catch (Exception) {
+                       guid = Guid.Empty;
+                       return false;
+               }
+#endif
+       }
+
+        private static ConvertResult StringToGuid(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            Guid tempGuid;
+            result.ReadAsFailureKind = TryGuidParse(valueString, out tempGuid) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidFormat;
+            result.Value = tempGuid;
+            return result;
+        }
+
+        private static ConvertResult StringToShort(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            short tempShort;
+            result.ReadAsFailureKind = Int16.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempShort) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<short>(valueString, out tempShort);
+            }
+
+            result.Value = tempShort;
+            return result;
+        }
+
+        private static ConvertResult StringToInt(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            int tempInt;
+            result.ReadAsFailureKind = Int32.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempInt) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<int>(valueString, out tempInt);
+            }
+
+            result.Value = tempInt;
+            return result;
+        }
+
+        private static ConvertResult StringToLong(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            long tempLong;
+            result.ReadAsFailureKind = Int64.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempLong) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<long>(valueString, out tempLong);
+            }
+
+            result.Value = tempLong;
+            return result;
+        }
+
+        private static ConvertResult StringToSByte(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            sbyte tempSByte;
+            result.ReadAsFailureKind = SByte.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempSByte) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<sbyte>(valueString, out tempSByte);
+            }
+
+            result.Value = tempSByte;
+            return result;
+        }
+
+        private static ConvertResult StringToFloat(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            float tempFloat;
+            result.ReadAsFailureKind = Single.TryParse(valueString, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out tempFloat) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<float>(valueString, out tempFloat);
+            }
+
+            result.Value = tempFloat;
+            return result;
+        }
+
+        private static ConvertResult StringToUShort(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            ushort tempUShort;
+            result.ReadAsFailureKind = UInt16.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempUShort) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<ushort>(valueString, out tempUShort);
+            }
+
+            result.Value = tempUShort;
+            return result;
+        }
+
+        private static ConvertResult StringToUInt(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            uint tempUInt;
+            result.ReadAsFailureKind = UInt32.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempUInt) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<uint>(valueString, out tempUInt);
+            }
+
+            result.Value = tempUInt;
+            return result;
+        }
+
+        private static ConvertResult StringToULong(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            ulong tempULong;
+            result.ReadAsFailureKind = UInt64.TryParse(valueString, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out tempULong) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidCast;
+            if (result.ReadAsFailureKind != ReadAsFailureKind.NoFailure)
+            {
+                result.ReadAsFailureKind = StringToNumberConverter<ulong>(valueString, out tempULong);
+            }
+
+            result.Value = tempULong;
+            return result;
+        }
+
+        private static ConvertResult StringToUri(string valueString)
+        {
+            ConvertResult result = new ConvertResult();
+            Uri tempUri;
+            result.ReadAsFailureKind = Uri.TryCreate(valueString, UriKind.RelativeOrAbsolute, out tempUri) ? ReadAsFailureKind.NoFailure : ReadAsFailureKind.InvalidUriFormat;
+            result.Value = tempUri;
+            return result;
+        }
+
+        private static ReadAsFailureKind StringToNumberConverter<T>(string valueString, out T valueNumber)
+        {
+            string str = valueString.Trim();
+
+            if (str.IndexOfAny(FloatingPointChars) < 0)
+            {
+                long longVal;
+                if (Int64.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out longVal))
+                {
+                    return NumberToNumberConverter<T>(longVal, out valueNumber);
+                }
+            }
+
+            decimal decValue;
+            if (Decimal.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out decValue) && decValue != 0)
+            {
+                return NumberToNumberConverter<T>(decValue, out valueNumber);
+            }
+
+            double dblValue;
+            if (Double.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dblValue))
+            {
+                return NumberToNumberConverter<T>(dblValue, out valueNumber);
+            }
+
+            valueNumber = default(T);
+            return ReadAsFailureKind.InvalidFormat;
+        }
+
+        private static ReadAsFailureKind NumberToNumberConverter<T>(object valueObject, out T valueNumber)
+        {
+            object value;
+            ReadAsFailureKind failureKind = NumberToNumberConverter(typeof(T), valueObject, out value);
+            if (failureKind == ReadAsFailureKind.NoFailure)
+            {
+                valueNumber = (T)value;
+            }
+            else
+            {
+                valueNumber = default(T);
+            }
+
+            return failureKind;
+        }
+
+        private static ReadAsFailureKind NumberToNumberConverter(Type type, object valueObject, out object valueNumber)
+        {
+            try
+            {
+                valueNumber = System.Convert.ChangeType(valueObject, type, CultureInfo.InvariantCulture);
+                return ReadAsFailureKind.NoFailure;
+            }
+            catch (OverflowException)
+            {
+                valueNumber = null;
+                return ReadAsFailureKind.Overflow;
+            }
+        }
+
+        private static bool TryParseDateTime(string valueString, out DateTime dateTime)
+        {
+            string filteredValue = valueString.EndsWith(UtcString, StringComparison.Ordinal) ? valueString.Replace(UtcString, GmtString) : valueString;
+
+            if (DateTime.TryParse(filteredValue, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTime))
+            {
+                return true;
+            }
+
+            if (TryParseAspNetDateTimeFormat(valueString, out dateTime))
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        private static bool TryParseDateTimeOffset(string valueString, out DateTimeOffset dateTimeOffset)
+        {
+            string filteredValue = valueString.EndsWith(UtcString, StringComparison.Ordinal) ? valueString.Replace(UtcString, GmtString) : valueString;
+
+            if (DateTimeOffset.TryParse(filteredValue, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTimeOffset))
+            {
+                return true;
+            }
+
+            if (TryParseAspNetDateTimeFormat(valueString, out dateTimeOffset))
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        private static bool TryParseAspNetDateTimeFormat(string valueString, out DateTime dateTime)
+        {
+            // Reference to the format is available at these sources:
+            // http://msdn.microsoft.com/en-us/library/bb299886.aspx#intro_to_json_sidebarb
+            // http://msdn.microsoft.com/en-us/library/bb412170.aspx
+
+            // The format for the value is given by the following regex:
+            // \/Date\((?<milliseconds>\-?\d+)(?<offset>[\+\-]?\d{4})\)\/
+            // where milliseconds is the number of milliseconds since 1970/01/01:00:00:00.000 UTC (the "unix baseline")
+            // and offset is an optional which indicates whether the value is local or UTC.
+            // The actual value of the offset is ignored, since the ticks represent the UTC offset. The value is converted to local time based on that info.
+            const string DateTimePrefix = "/Date(";
+            const int DateTimePrefixLength = 6;
+            const string DateTimeSuffix = ")/";
+            const int DateTimeSuffixLength = 2;
+
+            if (valueString.StartsWith(DateTimePrefix, StringComparison.Ordinal) && valueString.EndsWith(DateTimeSuffix, StringComparison.Ordinal))
+            {
+                string ticksValue = valueString.Substring(DateTimePrefixLength, valueString.Length - DateTimePrefixLength - DateTimeSuffixLength);
+                DateTimeKind dateTimeKind = DateTimeKind.Utc;
+
+                int indexOfTimeZoneOffset = ticksValue.IndexOf('+', 1);
+
+                if (indexOfTimeZoneOffset < 0)
+                {
+                    indexOfTimeZoneOffset = ticksValue.IndexOf('-', 1);
+                }
+
+                // If an offset is present, verify it is properly formatted. Actual value is ignored (see spec).
+                if (indexOfTimeZoneOffset != -1)
+                {
+                    if (indexOfTimeZoneOffset + 5 == ticksValue.Length
+                        && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 1])
+                        && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 2])
+                        && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 3])
+                        && IsLatinDigit(ticksValue[indexOfTimeZoneOffset + 4]))
+                    {
+                        ticksValue = ticksValue.Substring(0, indexOfTimeZoneOffset);
+                        dateTimeKind = DateTimeKind.Local;
+                    }
+                    else
+                    {
+                        dateTime = new DateTime();
+                        return false;
+                    }
+                }
+
+                long millisecondsSinceUnixEpoch;
+                if (Int64.TryParse(ticksValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out millisecondsSinceUnixEpoch))
+                {
+                    long ticks = (millisecondsSinceUnixEpoch * 10000) + UnixEpochTicks;
+                    if (ticks < DateTime.MaxValue.Ticks)
+                    {
+                        dateTime = new DateTime(ticks, DateTimeKind.Utc);
+                        if (dateTimeKind == DateTimeKind.Local)
+                        {
+                            dateTime = dateTime.ToLocalTime();
+                        }
+
+                        return true;
+                    }
+                }
+            }
+
+            dateTime = new DateTime();
+            return false;
+        }
+
+        private static bool TryParseAspNetDateTimeFormat(string valueString, out DateTimeOffset dateTimeOffset)
+        {
+            DateTime dateTime;
+            if (TryParseAspNetDateTimeFormat(valueString, out dateTime))
+            {
+                dateTimeOffset = new DateTimeOffset(dateTime);
+                return true;
+            }
+
+            dateTimeOffset = new DateTimeOffset();
+            return false;
+        }
+
+        private static bool IsLatinDigit(char c)
+        {
+            return (c >= '0') && (c <= '9');
+        }
+
+        private static string UnescapeJsonString(string val)
+        {
+            if (val == null)
+            {
+                return null;
+            }
+
+            StringBuilder sb = null;
+            int startIndex = 0, count = 0;
+            for (int i = 0; i < val.Length; i++)
+            {
+                if (val[i] == '\\')
+                {
+                    i++;
+                    if (sb == null)
+                    {
+                        sb = new StringBuilder();
+                    }
+
+                    sb.Append(val, startIndex, count);
+#if NET_4_0
+                    Contract.Assert(i < val.Length, "Found that a '\' was the last character in a string, which is invalid JSON. Verify the calling method uses a valid JSON string as the input parameter of this method.");
+#endif
+                    switch (val[i])
+                    {
+                        case '"':
+                        case '\'':
+                        case '/':
+                        case '\\':
+                            sb.Append(val[i]);
+                            break;
+                        case 'b':
+                            sb.Append('\b');
+                            break;
+                        case 'f':
+                            sb.Append('\f');
+                            break;
+                        case 'n':
+                            sb.Append('\n');
+                            break;
+                        case 'r':
+                            sb.Append('\r');
+                            break;
+                        case 't':
+                            sb.Append('\t');
+                            break;
+                        case 'u':
+#if NET_4_0
+                            Contract.Assert((i + 3) < val.Length, String.Format(CultureInfo.CurrentCulture, "Unexpected char {0} at position {1}. The unicode escape sequence should be followed by 4 digits.", val[i], i));
+#endif
+                            sb.Append(ParseChar(val.Substring(i + 1, 4), NumberStyles.HexNumber));
+                            i += 4;
+                            break;
+                    }
+
+                    startIndex = i + 1;
+                    count = 0;
+                }
+                else
+                {
+                    count++;
+                }
+            }
+
+            if (sb == null)
+            {
+                return val;
+            }
+
+            if (count > 0)
+            {
+                sb.Append(val, startIndex, count);
+            }
+
+            return sb.ToString();
+        }
+
+        private static char ParseChar(string value, NumberStyles style)
+        {
+            try
+            {
+                int intValue = Int32.Parse(value, style, NumberFormatInfo.InvariantInfo);
+                return System.Convert.ToChar(intValue);
+            }
+            catch (ArgumentException exception)
+            {
+                throw new InvalidCastException(exception.Message, exception);
+            }
+            catch (FormatException exception)
+            {
+                throw new InvalidCastException(exception.Message, exception);
+            }
+            catch (OverflowException exception)
+            {
+                throw new InvalidCastException(exception.Message, exception);
+            }
+        }
+
+        [SuppressMessage("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames", MessageId = "value",
+            Justification = "field is used with 'this' and arg is out param which makes it harder to be misused.")]
+        private ReadAsFailureKind TryReadAsInternal(Type type, out object value)
+        {
+            if (base.TryReadAs(type, out value))
+            {
+                return ReadAsFailureKind.NoFailure;
+            }
+
+            if (type == this.value.GetType())
+            {
+                value = this.value;
+                return ReadAsFailureKind.NoFailure;
+            }
+
+            if (jsonType == JsonType.Number)
+            {
+                switch (Type.GetTypeCode(type))
+                {
+                    case TypeCode.Byte:
+                    case TypeCode.SByte:
+                    case TypeCode.Int16:
+                    case TypeCode.Int32:
+                    case TypeCode.Int64:
+                    case TypeCode.UInt16:
+                    case TypeCode.UInt32:
+                    case TypeCode.UInt64:
+                    case TypeCode.Single:
+                    case TypeCode.Double:
+                    case TypeCode.Decimal:
+                        return NumberToNumberConverter(type, this.value, out value);
+                    case TypeCode.String:
+                        value = ToString();
+                        return ReadAsFailureKind.NoFailure;
+                }
+            }
+
+            if (jsonType == JsonType.Boolean)
+            {
+                if (type == typeof(string))
+                {
+                    value = ToString();
+                    return ReadAsFailureKind.NoFailure;
+                }
+            }
+
+            if (jsonType == JsonType.String)
+            {
+                string str = UnescapeJsonString(ToString());
+#if NET_4_0
+                Contract.Assert(str.Length >= 2 && str.StartsWith("\"", StringComparison.Ordinal) && str.EndsWith("\"", StringComparison.Ordinal), "The unescaped string must begin and end with quotes.");
+#endif
+                str = str.Substring(1, str.Length - 2);
+
+                if (stringConverters.ContainsKey(type))
+                {
+                    ConvertResult result = stringConverters[type].Invoke(str);
+                    value = result.Value;
+                    return result.ReadAsFailureKind;
+                }
+
+                if (type == typeof(string))
+                {
+                    value = str;
+                    return ReadAsFailureKind.NoFailure;
+                }
+            }
+
+            value = null;
+            return ReadAsFailureKind.InvalidCast;
+        }
+
+        private void WriteValue(XmlDictionaryWriter jsonWriter)
+        {
+            Type valueType = value.GetType();
+            switch (Type.GetTypeCode(valueType))
+            {
+                case TypeCode.Boolean:
+                    jsonWriter.WriteValue((bool)value);
+                    break;
+                case TypeCode.Byte:
+                case TypeCode.Int16:
+                case TypeCode.Int32:
+                case TypeCode.Int64:
+                case TypeCode.SByte:
+                case TypeCode.UInt16:
+                case TypeCode.UInt32:
+                case TypeCode.UInt64:
+                case TypeCode.Decimal:
+                    jsonWriter.WriteValue(String.Format(CultureInfo.InvariantCulture, "{0}", value));
+                    break;
+                case TypeCode.Single:
+                case TypeCode.Double:
+                    jsonWriter.WriteValue(String.Format(CultureInfo.InvariantCulture, "{0:R}", value));
+                    break;
+                case TypeCode.Char:
+                    jsonWriter.WriteValue(new string((char)value, 1));
+                    break;
+                case TypeCode.String:
+                    jsonWriter.WriteValue((string)value);
+                    break;
+                case TypeCode.DateTime:
+                    jsonWriter.WriteValue(((DateTime)value).ToString(DateTimeIsoFormat, CultureInfo.InvariantCulture));
+                    break;
+                default:
+                    if (valueType == typeof(Uri))
+                    {
+                        Uri uri = (Uri)value;
+                        jsonWriter.WriteValue(uri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped));
+                    }
+                    else if (valueType == typeof(DateTimeOffset))
+                    {
+                        jsonWriter.WriteValue(((DateTimeOffset)value).ToString(DateTimeIsoFormat, CultureInfo.InvariantCulture));
+                    }
+                    else
+                    {
+                        jsonWriter.WriteValue(value);
+                    }
+
+                    break;
+            }
+        }
+
+        private class ConvertResult
+        {
+            public ReadAsFailureKind ReadAsFailureKind { get; set; }
+
+            public object Value { get; set; }
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonType.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonType.cs
new file mode 100644 (file)
index 0000000..785026c
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+    /// <summary>
+    /// An enumeration that specifies primitive and structured JavaScript Object 
+    /// Notation (JSON) common language runtime (CLR) types.
+    /// </summary>
+    public enum JsonType
+    {
+        /// <summary>
+        /// Specifies the JSON string CLR type.
+        /// </summary>
+        String,
+
+        /// <summary>
+        /// Specifies the JSON number CLR type.
+        /// </summary>
+        Number,
+
+        /// <summary>
+        /// Specifies the JSON object CLR type that consists of an unordered collection
+        /// of key/value pairs, where the key is of type String and the value is of
+        /// type <see cref="System.Json.JsonValue"/>, which can, in turn, be either a
+        /// primitive or a structured JSON type.
+        /// </summary>
+        Object,
+
+        /// <summary>
+        /// Specifies the JSON array CLR type that consists of an ordered collection of
+        /// <see cref="System.Json.JsonValue"/>types, which can, in turn, be either
+        /// primitive or structured JSON types.
+        /// </summary>
+        Array,
+
+        /// <summary>
+        /// Specifies the JSON Boolean CLR type.
+        /// </summary>
+        Boolean,
+
+        /// <summary>
+        /// Specifies the type returned by calls to <see cref="System.Json.JsonValue.ValueOrDefault(string)"/>
+        /// or <see cref="System.Json.JsonValue.ValueOrDefault(int)"/>
+        /// when the element searches doesn't exist in the JSON collection. This is a special
+        /// value which does not represent any JSON element, and cannot be added to any
+        /// JSON collections.
+        /// </summary>
+        Default
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonValue.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonValue.cs
new file mode 100644 (file)
index 0000000..97dbae5
--- /dev/null
@@ -0,0 +1,1249 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+#if FEATURE_DYNAMIC
+using System.Dynamic;
+#endif
+using System.Globalization;
+using System.IO;
+using System.Linq.Expressions;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Xml;
+
+namespace System.Json
+{
+    /// <summary>
+    /// This is the base class for JavaScript Object Notation (JSON) common language runtime (CLR) types. 
+    /// </summary>
+    [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
+        Justification = "JsonValue is by definition either a collection or a single object.")]
+    [DataContract]
+#if FEATURE_DYNAMIC
+    public class JsonValue : IEnumerable<KeyValuePair<string, JsonValue>>, IDynamicMetaObjectProvider
+#else
+    public class JsonValue : IEnumerable<KeyValuePair<string, JsonValue>>
+#endif
+    {
+        private static JsonValue defaultInstance = new JsonValue();
+        private int changingListenersCount;
+        private int changedListenersCount;
+
+        internal JsonValue()
+        {
+        }
+
+        /// <summary>
+        /// Raised when this <see cref="System.Json.JsonValue"/> or any of its members have changed.
+        /// </summary>
+        /// <remarks><p>Events are raised when elements are added or removed to <see cref="System.Json.JsonValue"/>
+        /// instances. It applies to both complex descendants of <see cref="System.Json.JsonValue"/>: <see cref="System.Json.JsonArray"/>
+        /// and <see cref="System.Json.JsonObject"/>.</p>
+        /// <p>You should be careful when modifying a <see cref="System.Json.JsonValue"/> tree within one of these events,
+        /// because doing this might lead to unexpected results. For example, if you receive a Changing event, and while
+        /// the event is being processed you remove the node from the tree, you might not receive the Changed event. When
+        /// an event is being processed, it is valid to modify a tree other than the one that contains the node that is
+        /// receiving the event; it is even valid to modify the same tree provided the modifications do not affect the
+        /// specific nodes on which the event was raised. However, if you modify the area of the tree that contains the
+        /// node receiving the event, the events that you receive and the impact to the tree are undefined.</p></remarks>
+        public event EventHandler<JsonValueChangeEventArgs> Changed
+        {
+            add
+            {
+                changedListenersCount++;
+                OnChanged += value;
+            }
+
+            remove
+            {
+                changedListenersCount--;
+                OnChanged -= value;
+            }
+        }
+
+        /// <summary>
+        /// Raised when this <see cref="System.Json.JsonValue"/> or any of its members are about to be changed.
+        /// </summary>
+        /// <remarks><p>Events are raised when elements are added or removed to <see cref="System.Json.JsonValue"/>
+        /// instances. It applies to both complex descendants of <see cref="System.Json.JsonValue"/>: <see cref="System.Json.JsonArray"/>
+        /// and <see cref="System.Json.JsonObject"/>.</p>
+        /// <p>You should be careful when modifying a <see cref="System.Json.JsonValue"/> tree within one of these events,
+        /// because doing this might lead to unexpected results. For example, if you receive a Changing event, and while
+        /// the event is being processed you remove the node from the tree, you might not receive the Changed event. When
+        /// an event is being processed, it is valid to modify a tree other than the one that contains the node that is
+        /// receiving the event; it is even valid to modify the same tree provided the modifications do not affect the
+        /// specific nodes on which the event was raised. However, if you modify the area of the tree that contains the
+        /// node receiving the event, the events that you receive and the impact to the tree are undefined.</p></remarks>
+        public event EventHandler<JsonValueChangeEventArgs> Changing
+        {
+            add
+            {
+                changingListenersCount++;
+                OnChanging += value;
+            }
+
+            remove
+            {
+                changingListenersCount--;
+                OnChanging -= value;
+            }
+        }
+
+        private event EventHandler<JsonValueChangeEventArgs> OnChanged;
+        private event EventHandler<JsonValueChangeEventArgs> OnChanging;
+
+        /// <summary>
+        /// Gets the JSON CLR type represented by this instance.
+        /// </summary>
+        public virtual JsonType JsonType
+        {
+            get { return JsonType.Default; }
+        }
+
+        /// <summary>
+        /// Gets the number of items in this object.
+        /// </summary>
+        public virtual int Count
+        {
+            get { return 0; }
+        }
+
+        /// <summary>
+        /// Gets the number of listeners to the <see cref="Changing"/> event for this instance.
+        /// </summary>
+        protected int ChangingListenersCount
+        {
+            get { return changingListenersCount; }
+        }
+
+        /// <summary>
+        /// Gets the number of listeners to the <see cref="Changed"/> event for this instance.
+        /// </summary>
+        protected int ChangedListenersCount
+        {
+            get { return changedListenersCount; }
+        }
+
+        /// <summary>
+        /// Gets the default JsonValue instance.  
+        /// This instance enables safe-chaining of JsonValue operations and resolves to 'null'
+        /// when this instance is used as dynamic, mapping to the JavaScript 'null' value.
+        /// </summary>
+        private static JsonValue DefaultInstance
+        {
+            get { return defaultInstance; }
+        }
+
+        /// <summary>
+        /// This indexer is not supported for this base class and throws an exception.
+        /// </summary>
+        /// <param name="key">The key of the element to get or set.</param>
+        /// <returns><see cref="System.Json.JsonValue"/>.</returns>
+        /// <remarks>The exception thrown is the <see cref="System.InvalidOperationException"/>.
+        /// This method is overloaded in the implementation of the <see cref="System.Json.JsonObject"/>
+        /// class, which inherits from this class.</remarks>
+        public virtual JsonValue this[string key]
+        {
+            get { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(string), JsonType)); }
+
+            set { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(string), JsonType)); }
+        }
+
+        /// <summary>
+        /// This indexer is not supported for this base class and throws an exception.
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to get or set.</param>
+        /// <returns><see cref="System.Json.JsonValue"/>.</returns>
+        /// <remarks>The exception thrown is the <see cref="System.InvalidOperationException"/>.
+        /// This method is overloaded in the implementation of the <see cref="System.Json.JsonArray"/>
+        /// class, which inherits from this class.</remarks>
+        public virtual JsonValue this[int index]
+        {
+            get { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(int), JsonType)); }
+
+            set { throw new InvalidOperationException(RS.Format(Properties.Resources.IndexerNotSupportedOnJsonType, typeof(int), JsonType)); }
+        }
+
+        /// <summary>
+        /// Deserializes text-based JSON into a JSON CLR type.
+        /// </summary>
+        /// <param name="json">The text-based JSON to be parsed into a JSON CLR type.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+        /// text-based JSON as a CLR type.</returns>
+        /// <exception cref="System.ArgumentException">The length of jsonString is zero.</exception>
+        /// <exception cref="System.ArgumentNullException">jsonString is null.</exception>
+        /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+        /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+        /// depending on the text-based JSON supplied to the method.</remarks>
+        public static JsonValue Parse(string json)
+        {
+            return JXmlToJsonValueConverter.JXMLToJsonValue(json);
+        }
+
+        /// <summary>
+        /// Deserializes text-based JSON from a text reader into a JSON CLR type.
+        /// </summary>
+        /// <param name="textReader">A <see cref="System.IO.TextReader"/> over text-based JSON content.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+        /// text-based JSON as a CLR type.</returns>
+        /// <exception cref="System.ArgumentNullException">textReader is null.</exception>
+        /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+        /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+        /// depending on the text-based JSON supplied to the method.</remarks>
+        public static JsonValue Load(TextReader textReader)
+        {
+            if (textReader == null)
+            {
+                throw new ArgumentNullException("textReader");
+            }
+
+            return JsonValue.Parse(textReader.ReadToEnd());
+        }
+
+        /// <summary>
+        /// Deserializes text-based JSON from a stream into a JSON CLR type.
+        /// </summary>
+        /// <param name="stream">A <see cref="System.IO.Stream"/> that contains text-based JSON content.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> object that represents the parsed
+        /// text-based JSON as a CLR type.</returns>
+        /// <exception cref="System.ArgumentNullException">stream is null.</exception>
+        /// <remarks>The result will be an instance of either <see cref="System.Json.JsonArray"/>,
+        /// <see cref="System.Json.JsonObject"/> or <see cref="System.Json.JsonPrimitive"/>,
+        /// depending on the text-based JSON supplied to the method.</remarks>
+        public static JsonValue Load(Stream stream)
+        {
+            return JXmlToJsonValueConverter.JXMLToJsonValue(stream);
+        }
+
+        /// <summary>
+        /// Performs a cast operation from a <see cref="JsonValue"/> instance into the specified type parameter./>
+        /// </summary>
+        /// <typeparam name="T">The type to cast the instance to.</typeparam>
+        /// <param name="value">The <see cref="System.Json.JsonValue"/> instance.</param>
+        /// <returns>An object of type T initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        /// <remarks>This method is to support the framework and is not intended to be used externally, use explicit type cast instead.</remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+            Justification = "The generic parameter is used to specify the output type")]
+        public static T CastValue<T>(JsonValue value)
+        {
+            Type typeofT = typeof(T);
+
+            if ((value != null && typeofT.IsAssignableFrom(value.GetType())) || typeofT == typeof(object))
+            {
+                return (T)(object)value;
+            }
+
+            if (value == null || value.JsonType == JsonType.Default)
+            {
+                if (typeofT.IsValueType)
+                {
+                    throw new InvalidCastException(RS.Format(Properties.Resources.InvalidCastNonNullable, typeofT.FullName));
+                }
+                else
+                {
+                    return default(T);
+                }
+            }
+
+            try
+            {
+                return value.ReadAs<T>();
+            }
+            catch (Exception ex)
+            {
+                if (ex is FormatException || ex is NotSupportedException || ex is InvalidCastException)
+                {
+                    throw new InvalidCastException(RS.Format(Properties.Resources.CannotCastJsonValue, value.GetType().FullName, typeofT.FullName), ex);
+                }
+
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// Returns an enumerator which iterates through the values in this object.
+        /// </summary>
+        /// <returns>An enumerator which which iterates through the values in this object.</returns>
+        /// <remarks>The enumerator returned by this class is empty; subclasses will override this method to return appropriate enumerators for themselves.</remarks>
+        public IEnumerator<KeyValuePair<string, JsonValue>> GetEnumerator()
+        {
+            return GetKeyValuePairEnumerator();
+        }
+
+        /// <summary>
+        /// Returns an enumerator which iterates through the values in this object.
+        /// </summary>
+        /// <returns>An <see cref="System.Collections.IEnumerator"/> which iterates through the values in this object.</returns>
+        /// <remarks>The enumerator returned by this class is empty; subclasses will override this method to return appropriate enumerators for themselves.</remarks>
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetKeyValuePairEnumerator();
+        }
+
+#if FEATURE_DYNAMIC
+        /// <summary>
+        /// Gets this instance as a <code>dynamic</code> object.
+        /// </summary>
+        /// <returns>This instance as <code>dynamic</code>.</returns>
+        public dynamic AsDynamic()
+        {
+            return this;
+        }
+#endif
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <param name="valueOfT">An instance of T initialized with this instance, or the default value of T if the conversion cannot be performed.</param>
+        /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as type T; otherwise, false.</returns>
+        public bool TryReadAs<T>(out T valueOfT)
+        {
+            object value;
+            if (TryReadAs(typeof(T), out value))
+            {
+                valueOfT = (T)value;
+                return true;
+            }
+
+            valueOfT = default(T);
+            return false;
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <returns>An instance of T initialized with the value from the conversion of this instance.</returns>
+        /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be converted into the type T.</exception>
+        [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
+            Justification = "The generic parameter is used to specify the output type")]
+        public T ReadAs<T>()
+        {
+            return (T)ReadAs(typeof(T));
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into the type T.
+        /// </summary>
+        /// <typeparam name="T">The type to which the conversion is being performed.</typeparam>
+        /// <param name="fallback">The fallback value to be returned if the conversion cannot be made.</param>
+        /// <returns>An instance of T initialized with the value from the conversion of this instance, or the specified fallback value if the conversion cannot be made.</returns>
+        public T ReadAs<T>(T fallback)
+        {
+            return (T)ReadAs(typeof(T), fallback);
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance to an instance of the specified type.
+        /// </summary>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <param name="fallback">The fallback value to be returned if the conversion cannot be made.</param>
+        /// <returns>An instance of the specified type initialized with the value from the conversion of this instance, or the specified fallback value if the conversion cannot be made.</returns>
+        public object ReadAs(Type type, object fallback)
+        {
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            object result;
+            if (JsonType != JsonType.Default && TryReadAs(type, out result))
+            {
+                return result;
+            }
+            else
+            {
+                return fallback;
+            }
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <returns>An instance of the specified type initialized with the value from the conversion of this instance.</returns>
+        /// <exception cref="System.NotSupportedException">If this <see cref="System.Json.JsonValue"/> value cannot be converted into the type T.</exception>
+        public virtual object ReadAs(Type type)
+        {
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            object result;
+            if (TryReadAs(type, out result))
+            {
+                return result;
+            }
+
+            throw new NotSupportedException(RS.Format(Properties.Resources.CannotReadAsType, GetType().FullName, type.FullName));
+        }
+
+        /// <summary>
+        /// Attempts to convert this <see cref="System.Json.JsonValue"/> instance into an instance of the specified type.
+        /// </summary>
+        /// <param name="type">The type to which the conversion is being performed.</param>
+        /// <param name="value">An object to be initialized with this instance or null if the conversion cannot be performed.</param>
+        /// <returns>true if this <see cref="System.Json.JsonValue"/> instance can be read as the specified type; otherwise, false.</returns>
+        [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate",
+            Justification = "This is the non-generic version of the method.")]
+        public virtual bool TryReadAs(Type type, out object value)
+        {
+            if (type == null)
+            {
+                throw new ArgumentNullException("type");
+            }
+
+            if (type.IsAssignableFrom(GetType()) || type == typeof(object))
+            {
+                value = this;
+                return true;
+            }
+
+            value = null;
+            return false;
+        }
+
+        /// <summary>
+        /// Writes this <see cref="System.Json.JsonValue"/> instance to a <see cref="System.IO.Stream"/>.
+        /// </summary>
+        /// <param name="stream">Stream to which to write text-based JSON.</param>
+        public void Save(Stream stream)
+        {
+            if (JsonType == JsonType.Default)
+            {
+                throw new InvalidOperationException(Properties.Resources.UseOfDefaultNotAllowed);
+            }
+
+            if (stream == null)
+            {
+                throw new ArgumentNullException("stream");
+            }
+
+            using (XmlDictionaryWriter jsonWriter = JsonReaderWriterFactory.CreateJsonWriter(stream, Encoding.UTF8, false))
+            {
+                jsonWriter.WriteStartElement(JXmlToJsonValueConverter.RootElementName);
+                Save(jsonWriter);
+                jsonWriter.WriteEndElement();
+            }
+        }
+
+        /// <summary>
+        /// Writes <see cref="System.Json.JsonValue"/> instance to a <see cref="TextWriter"/>.
+        /// </summary>
+        /// <param name="textWriter">The <see cref="System.IO.TextWriter"/> used to write text-based JSON.</param>
+        public void Save(TextWriter textWriter)
+        {
+            if (JsonType == JsonType.Default)
+            {
+                throw new InvalidOperationException(Properties.Resources.UseOfDefaultNotAllowed);
+            }
+
+            if (textWriter == null)
+            {
+                throw new ArgumentNullException("textWriter");
+            }
+
+            using (MemoryStream ms = new MemoryStream())
+            {
+                Save(ms);
+                ms.Position = 0;
+                textWriter.Write(new StreamReader(ms).ReadToEnd());
+            }
+        }
+
+        /// <summary>
+        /// Provides a textual representation of this <see cref="System.Json.JsonValue"/> instance.
+        /// </summary>
+        /// <returns>A <see cref="System.String"/> containing text-based JSON.</returns>
+        public override string ToString()
+        {
+            if (JsonType == JsonType.Default)
+            {
+                return "Default";
+            }
+
+            using (MemoryStream ms = new MemoryStream())
+            {
+                Save(ms);
+                ms.Position = 0;
+                return new StreamReader(ms).ReadToEnd();
+            }
+        }
+
+        /// <summary>
+        /// Checks whether a key/value pair with a specified key exists in the JSON CLR object type.
+        /// </summary>
+        /// <param name="key">The key to check for.</param>
+        /// <returns>false in this class; subclasses may override this method to return other values.</returns>
+        /// <remarks>This method is overloaded in the implementation of the <see cref="System.Json.JsonObject"/>
+        /// class, which inherits from this class.</remarks>
+        public virtual bool ContainsKey(string key)
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// Returns the value returned by the safe string indexer for this instance.
+        /// </summary>
+        /// <param name="key">The key of the element to get.</param>
+        /// <returns>If this is an instance of <see cref="System.Json.JsonObject"/>, it contains
+        /// the given key and the value corresponding to the key is not null, then it will return that value.
+        /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public virtual JsonValue GetValue(string key)
+        {
+            return ValueOrDefault(key);
+        }
+
+        /// <summary>
+        /// Returns the value returned by the safe int indexer for this instance.
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to get.</param>
+        /// <returns>If this is an instance of <see cref="System.Json.JsonArray"/>, the index is within the array
+        /// bounds, and the value corresponding to the index is not null, then it will return that value.
+        /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public virtual JsonValue GetValue(int index)
+        {
+            return ValueOrDefault(index);
+        }
+
+        /// <summary>
+        /// Sets the value and returns it.
+        /// </summary>
+        /// <param name="key">The key of the element to set.</param>
+        /// <param name="value">The value to be set.</param>
+        /// <returns>The value, converted into a JsonValue, set in this collection.</returns>
+        /// <exception cref="System.ArgumentException">If the value cannot be converted into a JsonValue.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public virtual JsonValue SetValue(string key, object value)
+        {
+            this[key] = ResolveObject(value);
+            return this[key];
+        }
+
+        /// <summary>
+        /// Sets the value and returns it.
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to set.</param>
+        /// <param name="value">The value to be set.</param>
+        /// <returns>The value, converted into a JsonValue, set in this collection.</returns>
+        /// <exception cref="System.ArgumentException">If the value cannot be converted into a JsonValue.</exception>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public virtual JsonValue SetValue(int index, object value)
+        {
+            this[index] = ResolveObject(value);
+            return this[index];
+        }
+
+        /// <summary>
+        /// Safe string indexer for the <see cref="System.Json.JsonValue"/> type. 
+        /// </summary>
+        /// <param name="key">The key of the element to get.</param>
+        /// <returns>If this is an instance of <see cref="System.Json.JsonObject"/>, it contains
+        /// the given key and the value corresponding to the key is not null, then it will return that value.
+        /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        public virtual JsonValue ValueOrDefault(string key)
+        {
+            return JsonValue.DefaultInstance;
+        }
+
+        /// <summary>
+        /// Safe indexer for the <see cref="System.Json.JsonValue"/> type. 
+        /// </summary>
+        /// <param name="index">The zero-based index of the element to get.</param>
+        /// <returns>If this is an instance of <see cref="System.Json.JsonArray"/>, the index is within the array
+        /// bounds, and the value corresponding to the index is not null, then it will return that value.
+        /// Otherwise it will return a <see cref="System.Json.JsonValue"/> instance with <see cref="System.Json.JsonValue.JsonType"/>
+        /// equals to <see cref="F:System.Json.JsonType.Default"/>.</returns>
+        public virtual JsonValue ValueOrDefault(int index)
+        {
+            return JsonValue.DefaultInstance;
+        }
+
+        /// <summary>
+        /// Safe deep indexer for the <see cref="JsonValue"/> type.
+        /// </summary>
+        /// <param name="indexes">The indices to index this type. The indices can be
+        /// of type <see cref="System.Int32"/> or <see cref="System.String"/>.</param>
+        /// <returns>A <see cref="JsonValue"/> which is equivalent to calling<see cref="ValueOrDefault(int)"/> or
+        /// <see cref="ValueOrDefault(string)"/> on the first index, then calling it again on the result
+        /// for the second index and so on.</returns>
+        /// <exception cref="System.ArgumentException">If any of the indices is not of type
+        /// <see cref="System.Int32"/> or <see cref="System.String"/>.</exception>
+        public JsonValue ValueOrDefault(params object[] indexes)
+        {
+            if (indexes == null)
+            {
+                return JsonValue.DefaultInstance;
+            }
+
+            if (indexes.Length == 0)
+            {
+                return this;
+            }
+
+            JsonValue result = this;
+            for (int i = 0; i < indexes.Length; i++)
+            {
+                object index = indexes[i];
+                if (index == null)
+                {
+                    result = JsonValue.DefaultInstance;
+                    continue;
+                }
+
+                Type indexType = index.GetType();
+
+                switch (Type.GetTypeCode(indexType))
+                {
+                    case TypeCode.Char:
+                    case TypeCode.Int16:
+                    case TypeCode.UInt16:
+                    case TypeCode.Byte:
+                    case TypeCode.SByte:
+                        index = System.Convert.ChangeType(index, typeof(int), CultureInfo.InvariantCulture);
+                        goto case TypeCode.Int32;
+
+                    case TypeCode.Int32:
+                        result = result.ValueOrDefault((int)index);
+                        break;
+
+                    case TypeCode.String:
+                        result = result.ValueOrDefault((string)index);
+                        break;
+
+                    default:
+                        throw new ArgumentException(RS.Format(Properties.Resources.InvalidIndexType, index.GetType()), "indexes");
+                }
+            }
+
+            return result;
+        }
+
+#if FEATURE_DYNAMIC
+        [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes",
+            Justification = "Cannot make this class sealed, it needs to have subclasses. But its subclasses are sealed themselves.")]
+        DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter)
+        {
+            if (parameter == null)
+            {
+                throw new ArgumentNullException("parameter");
+            }
+
+            return new JsonValueDynamicMetaObject(parameter, this);
+        }
+#endif
+
+        /// <summary>
+        /// Resolves the specified object to an appropriate JsonValue instance.
+        /// </summary>
+        /// <param name="value">The object to resolve.</param>
+        /// <returns>A <see cref="JsonValue"/> instance resolved from the specified object.</returns>
+        internal static JsonValue ResolveObject(object value)
+        {
+            JsonPrimitive primitive;
+
+            if (value == null)
+            {
+                return null;
+            }
+
+            JsonValue jsonValue = value as JsonValue;
+
+            if (jsonValue != null)
+            {
+                return jsonValue;
+            }
+
+            if (JsonPrimitive.TryCreate(value, out primitive))
+            {
+                return primitive;
+            }
+
+            throw new ArgumentException(Properties.Resources.TypeNotSupported, "value");
+        }
+
+        /// <summary>
+        /// Determines whether an explicit cast to JsonValue is provided from the specified type.
+        /// </summary>
+        /// <param name="type">The type to check.</param>
+        /// <returns>true if an explicit cast exists for the specified type, false otherwise.</returns>
+        internal static bool IsSupportedExplicitCastType(Type type)
+        {
+            TypeCode typeCode = Type.GetTypeCode(type);
+
+            switch (typeCode)
+            {
+                case TypeCode.Boolean:
+                case TypeCode.Byte:
+                case TypeCode.Char:
+                case TypeCode.DateTime:
+                case TypeCode.Decimal:
+                case TypeCode.Double:
+                case TypeCode.Int16:
+                case TypeCode.Int32:
+                case TypeCode.Int64:
+                case TypeCode.SByte:
+                case TypeCode.Single:
+                case TypeCode.String:
+                case TypeCode.UInt16:
+                case TypeCode.UInt32:
+                case TypeCode.UInt64:
+                    return true;
+
+                default:
+                    return type == typeof(DateTimeOffset) || type == typeof(Guid) || type == typeof(Uri) ||
+                           type == typeof(List<object>) || type == typeof(Array) || type == typeof(object[]) ||
+                           type == typeof(Dictionary<string, object>);
+            }
+        }
+
+        /// <summary>
+        /// Returns the value this object wraps (if any).
+        /// </summary>
+        /// <returns>The value wrapped by this instance or null if none.</returns>
+        internal virtual object Read()
+        {
+            return null;
+        }
+
+        /// <summary>
+        /// Serializes this object into the specified <see cref="XmlDictionaryWriter"/> instance.
+        /// </summary>
+        /// <param name="jsonWriter">An <see cref="XmlDictionaryWriter"/> instance to serialize this instance into.</param>
+        internal virtual void Save(XmlDictionaryWriter jsonWriter)
+        {
+            if (jsonWriter == null)
+            {
+                throw new ArgumentNullException("jsonWriter");
+            }
+
+            Stack<JsonValue> objectStack = new Stack<JsonValue>();
+            Stack<int> indexStack = new Stack<int>();
+            int currentIndex = 0;
+            JsonValue currentValue = this;
+
+            OnSaveStarted();
+
+            WriteAttributeString(jsonWriter);
+
+            while (currentIndex < currentValue.Count || objectStack.Count > 0)
+            {
+                if (currentValue.Count > currentIndex)
+                {
+                    JsonValue nextValue = currentValue.WriteStartElementAndGetNext(jsonWriter, currentIndex);
+
+                    if (JsonValue.IsJsonCollection(nextValue))
+                    {
+                        nextValue.OnSaveStarted();
+                        nextValue.WriteAttributeString(jsonWriter);
+
+                        objectStack.Push(currentValue);
+                        indexStack.Push(currentIndex);
+                        currentValue = nextValue;
+                        currentIndex = 0;
+                    }
+                    else
+                    {
+                        if (nextValue == null)
+                        {
+                            jsonWriter.WriteAttributeString(JXmlToJsonValueConverter.TypeAttributeName, JXmlToJsonValueConverter.NullAttributeValue);
+                        }
+                        else
+                        {
+                            nextValue.Save(jsonWriter);
+                        }
+
+                        currentIndex++;
+                        jsonWriter.WriteEndElement();
+                    }
+                }
+                else
+                {
+                    if (objectStack.Count > 0)
+                    {
+                        currentValue.OnSaveEnded();
+                        jsonWriter.WriteEndElement();
+
+                        currentValue = objectStack.Pop();
+                        currentIndex = indexStack.Pop() + 1;
+                    }
+                }
+            }
+
+            OnSaveEnded();
+        }
+
+        /// <summary>
+        /// Returns an enumerator which iterates through the values in this object.
+        /// </summary>
+        /// <returns>An <see cref="System.Collections.IEnumerator"/> which iterates through the values in this object.</returns>
+        /// <remarks>This method is the virtual version of the IEnumerator.GetEnumerator method and is provided to allow derived classes to implement the 
+        /// appropriate version of the generic interface (enumerator of values or key/value pairs).</remarks>
+        [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+            Justification = "This method is a virtual version of the IEnumerable.GetEnumerator method.")]
+        [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
+            Justification = "This class is a collection that is properly represented by the nested generic type.")]
+        protected virtual IEnumerator<KeyValuePair<string, JsonValue>> GetKeyValuePairEnumerator()
+        {
+            yield break;
+        }
+
+        /// <summary>
+        /// Callback method called during Save operations to let the instance write the start element
+        /// and return the next element in the collection.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        /// <param name="index">The index within this collection.</param>
+        /// <returns>The next item in the collection, or null of there are no more items.</returns>
+        internal virtual JsonValue WriteStartElementAndGetNext(XmlDictionaryWriter jsonWriter, int index)
+        {
+            return null;
+        }
+
+        /// <summary>
+        /// Callback method called to let an instance write the proper JXML attribute when saving this
+        /// instance.
+        /// </summary>
+        /// <param name="jsonWriter">The JXML writer used to write JSON.</param>
+        internal virtual void WriteAttributeString(XmlDictionaryWriter jsonWriter)
+        {
+        }
+
+        /// <summary>
+        /// Callback method called when a Save operation is starting for this instance.
+        /// </summary>
+        protected virtual void OnSaveStarted()
+        {
+        }
+
+        /// <summary>
+        /// Callback method called when a Save operation is finished for this instance.
+        /// </summary>
+        protected virtual void OnSaveEnded()
+        {
+        }
+
+        /// <summary>
+        /// Called internally to raise the <see cref="Changing"/> event.
+        /// </summary>
+        /// <param name="sender">The object which caused the event to be raised.</param>
+        /// <param name="eventArgs">The arguments to the event.</param>
+        [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate",
+            Justification = "This is a helper function used to raise the event.")]
+        [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers",
+            Justification = "This is not externally visible, since the constructor for this class is internal (cannot be directly derived) and all its subclasses are sealed.")]
+        protected void RaiseChangingEvent(object sender, JsonValueChangeEventArgs eventArgs)
+        {
+            EventHandler<JsonValueChangeEventArgs> changing = OnChanging;
+            if (changing != null)
+            {
+                changing(sender, eventArgs);
+            }
+        }
+
+        /// <summary>
+        /// Called internally to raise the <see cref="Changed"/> event.
+        /// </summary>
+        /// <param name="sender">The object which caused the event to be raised.</param>
+        /// <param name="eventArgs">The arguments to the event.</param>
+        [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate",
+            Justification = "This is a helper function used to raise the event.")]
+        [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers",
+            Justification = "This is not externally visible, since the constructor for this class is internal (cannot be directly derived) and all its subclasses are sealed.")]
+        protected void RaiseChangedEvent(object sender, JsonValueChangeEventArgs eventArgs)
+        {
+            EventHandler<JsonValueChangeEventArgs> changed = OnChanged;
+            if (changed != null)
+            {
+                changed(sender, eventArgs);
+            }
+        }
+
+        private static bool IsJsonCollection(JsonValue value)
+        {
+            return value != null && (value.JsonType == JsonType.Array || value.JsonType == JsonType.Object);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.String"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.String"/> object.</param>
+        /// <returns>The <see cref="System.String"/> initialized with the <see cref="System.Json.JsonValue"/> value specified or null if value is null.</returns>
+        public static explicit operator string(JsonValue value)
+        {
+            return CastValue<string>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Double"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Double"/> object.</param>
+        /// <returns>The <see cref="System.Double"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator double(JsonValue value)
+        {
+            return CastValue<double>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Single"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Single"/> object.</param>
+        /// <returns>The <see cref="System.Single"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator float(JsonValue value)
+        {
+            return CastValue<float>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Decimal"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Decimal"/> object.</param>
+        /// <returns>The <see cref="System.Decimal"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator decimal(JsonValue value)
+        {
+            return CastValue<decimal>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int64"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int64"/> object.</param>
+        /// <returns>The <see cref="System.Int64"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator long(JsonValue value)
+        {
+            return CastValue<long>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt64"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt64"/> object.</param>
+        /// <returns>The <see cref="System.UInt64"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        [CLSCompliant(false)]
+        public static explicit operator ulong(JsonValue value)
+        {
+            return CastValue<ulong>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int32"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int32"/> object.</param>
+        /// <returns>The <see cref="System.Int32"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator int(JsonValue value)
+        {
+            return CastValue<int>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt32"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt32"/> object.</param>
+        /// <returns>The <see cref="System.UInt32"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        [CLSCompliant(false)]
+        public static explicit operator uint(JsonValue value)
+        {
+            return CastValue<uint>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Int16"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Int16"/> object.</param>
+        /// <returns>The <see cref="System.Int16"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator short(JsonValue value)
+        {
+            return CastValue<short>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.UInt16"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.UInt16"/> object.</param>
+        /// <returns>The <see cref="System.UInt16"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        [CLSCompliant(false)]
+        public static explicit operator ushort(JsonValue value)
+        {
+            return CastValue<ushort>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.SByte"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.SByte"/> object.</param>
+        /// <returns>The <see cref="System.SByte"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        [CLSCompliant(false)]
+        public static explicit operator sbyte(JsonValue value)
+        {
+            return CastValue<sbyte>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Byte"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Byte"/> object.</param>
+        /// <returns>The <see cref="System.Byte"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator byte(JsonValue value)
+        {
+            return CastValue<byte>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Uri"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Uri"/> object.</param>
+        /// <returns>The <see cref="System.Uri"/> initialized with the <see cref="System.Json.JsonValue"/> value specified or null if value is null.</returns>
+        public static explicit operator Uri(JsonValue value)
+        {
+            return CastValue<Uri>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Guid"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Guid"/> object.</param>
+        /// <returns>The <see cref="System.Guid"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator Guid(JsonValue value)
+        {
+            return CastValue<Guid>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.DateTime"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.DateTime"/> object.</param>
+        /// <returns>The <see cref="System.DateTime"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator DateTime(JsonValue value)
+        {
+            return CastValue<DateTime>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Char"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Char"/> object.</param>
+        /// <returns>The <see cref="System.Char"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator char(JsonValue value)
+        {
+            return CastValue<char>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.Boolean"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.Boolean"/> object.</param>
+        /// <returns>The <see cref="System.Boolean"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator bool(JsonValue value)
+        {
+            return CastValue<bool>(value);
+        }
+
+        /// <summary>
+        /// Enables explicit casts from an instance of type <see cref="System.Json.JsonValue"/> to a <see cref="System.DateTimeOffset"/> object.
+        /// </summary>
+        /// <param name="value">The instance of <see cref="System.Json.JsonValue"/> used to initialize the <see cref="System.DateTimeOffset"/> object.</param>
+        /// <returns>The <see cref="System.DateTimeOffset"/> initialized with the <see cref="System.Json.JsonValue"/> value specified.</returns>
+        public static explicit operator DateTimeOffset(JsonValue value)
+        {
+            return CastValue<DateTimeOffset>(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Boolean"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Boolean"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Boolean"/> specified.</returns>
+        public static implicit operator JsonValue(bool value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Byte"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Byte"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Byte"/> specified.</returns>
+        public static implicit operator JsonValue(byte value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Decimal"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Decimal"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Decimal"/> specified.</returns>
+        public static implicit operator JsonValue(decimal value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Double"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Double"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Double"/> specified.</returns>
+        public static implicit operator JsonValue(double value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Int16"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int16"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int16"/> specified.</returns>
+        public static implicit operator JsonValue(short value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Int32"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int32"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int32"/> specified.</returns>
+        public static implicit operator JsonValue(int value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Int64"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Int64"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Int64"/> specified.</returns>
+        public static implicit operator JsonValue(long value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Single"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Single"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Single"/> specified.</returns>
+        public static implicit operator JsonValue(float value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.String"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.String"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.String"/> specified, or null if the value is null.</returns>
+        [SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads",
+            Justification = "This operator does not intend to represent a Uri overload.")]
+        public static implicit operator JsonValue(string value)
+        {
+            return value == null ? null : new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Char"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Char"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Char"/> specified.</returns>
+        public static implicit operator JsonValue(char value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.DateTime"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.DateTime"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.DateTime"/> specified.</returns>
+        public static implicit operator JsonValue(DateTime value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Guid"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Guid"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Guid"/> specified.</returns>
+        public static implicit operator JsonValue(Guid value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.Uri"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.Uri"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.Uri"/> specified, or null if the value is null.</returns>
+        public static implicit operator JsonValue(Uri value)
+        {
+            return value == null ? null : new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.SByte"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.SByte"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.SByte"/> specified.</returns>
+        [CLSCompliant(false)]
+        public static implicit operator JsonValue(sbyte value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.UInt16"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt16"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt16"/> specified.</returns>
+        [CLSCompliant(false)]
+        public static implicit operator JsonValue(ushort value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.UInt32"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt32"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt32"/> specified.</returns>
+        [CLSCompliant(false)]
+        public static implicit operator JsonValue(uint value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.UInt64"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.UInt64"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.UInt64"/> specified.</returns>
+        [CLSCompliant(false)]
+        public static implicit operator JsonValue(ulong value)
+        {
+            return new JsonPrimitive(value);
+        }
+
+        /// <summary>
+        /// Enables implicit casts from type <see cref="System.DateTimeOffset"/> to a <see cref="System.Json.JsonPrimitive"/>.
+        /// </summary>
+        /// <param name="value">The <see cref="System.DateTimeOffset"/> instance used to initialize the <see cref="System.Json.JsonPrimitive"/>.</param>
+        /// <returns>The <see cref="System.Json.JsonValue"/> initialized with the <see cref="System.DateTimeOffset"/> specified.</returns>
+        public static implicit operator JsonValue(DateTimeOffset value)
+        {
+            return new JsonPrimitive(value);
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonValueChange.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonValueChange.cs
new file mode 100644 (file)
index 0000000..2182e62
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+    /// <summary>
+    /// Specifies the event type when an event is raised for a <see cref="System.Json.JsonValue"/>.
+    /// </summary>
+    public enum JsonValueChange
+    {
+        /// <summary>
+        /// An element has been or will be added to the collection.
+        /// </summary>
+        Add,
+
+        /// <summary>
+        /// An element has been or will be removed from the collection.
+        /// </summary>
+        Remove,
+
+        /// <summary>
+        /// An element has been or will be replaced in the collection. Used on indexers.
+        /// </summary>
+        Replace,
+
+        /// <summary>
+        /// All elements of the collection have been or will be removed.
+        /// </summary>
+        Clear,
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonValueChangeEventArgs.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonValueChangeEventArgs.cs
new file mode 100644 (file)
index 0000000..cf7097b
--- /dev/null
@@ -0,0 +1,98 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+    /// <summary>
+    /// Provide data for the <see cref="System.Json.JsonValue.Changing"/> and <see cref="System.Json.JsonValue.Changed"/> events.
+    /// </summary>
+    public class JsonValueChangeEventArgs : EventArgs
+    {
+        private JsonValue child;
+        private JsonValueChange change;
+        private int index;
+        private string key;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="System.Json.JsonValueChangeEventArgs"/> class for
+        /// changes in a <see cref="System.Json.JsonArray"/>.
+        /// </summary>
+        /// <param name="child">The <see cref="System.Json.JsonValue"/> instance which will be or has been modified.</param>
+        /// <param name="change">The type of change of the <see cref="System.Json.JsonValue"/> event.</param>
+        /// <param name="index">The index of the element being changed in a <see cref="System.Json.JsonArray"/>.</param>
+        public JsonValueChangeEventArgs(JsonValue child, JsonValueChange change, int index)
+        {
+            if (index < 0)
+            {
+                throw new ArgumentOutOfRangeException("index", RS.Format(Properties.Resources.ArgumentMustBeGreaterThanOrEqualTo, index, 0));
+            }
+
+            this.child = child;
+            this.change = change;
+            this.index = index;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="System.Json.JsonValueChangeEventArgs"/> class for
+        /// changes in a <see cref="System.Json.JsonObject"/>.
+        /// </summary>
+        /// <param name="child">The <see cref="System.Json.JsonValue"/> instance which will be or has been modified.</param>
+        /// <param name="change">The type of change of the <see cref="System.Json.JsonValue"/> event.</param>
+        /// <param name="key">The key of the element being changed in a <see cref="System.Json.JsonObject"/>.</param>
+        public JsonValueChangeEventArgs(JsonValue child, JsonValueChange change, string key)
+        {
+            if (change != JsonValueChange.Clear)
+            {
+                if (key == null)
+                {
+                    throw new ArgumentNullException("key");
+                }
+            }
+
+            this.child = child;
+            this.change = change;
+            index = -1;
+            this.key = key;
+        }
+
+        /// <summary>
+        /// Gets the child which will be or has been modified.
+        /// </summary>
+        /// <remarks><p>This property is <code>null</code> for <see cref="System.Json.JsonValueChange.Clear"/> event types
+        /// raised by <see cref="System.Json.JsonValue"/> instances.</p>
+        /// <p>For <see cref="System.Json.JsonValueChange">Replace</see> events, this property contains the new value in
+        /// the <see cref="System.Json.JsonValue.Changing"/> event, and the old value (the one being replaced) in the
+        /// <see cref="System.Json.JsonValue.Changed"/> event.</p></remarks>
+        public JsonValue Child
+        {
+            get { return child; }
+        }
+
+        /// <summary>
+        /// Gets the type of change.
+        /// </summary>
+        public JsonValueChange Change
+        {
+            get { return change; }
+        }
+
+        /// <summary>
+        /// Gets the index in the <see cref="System.Json.JsonArray"/> where the change happened, or
+        /// <code>-1</code> if the change happened in a <see cref="System.Json.JsonValue"/> of a different type.
+        /// </summary>
+        public int Index
+        {
+            get { return index; }
+        }
+
+        /// <summary>
+        /// Gets the key in the <see cref="System.Json.JsonObject"/> where the change happened, or
+        /// <code>null</code> if the change happened in a <see cref="System.Json.JsonValue"/> of a different type.
+        /// </summary>
+        /// <remarks>This property can also be <code>null</code> if the event type is
+        /// <see cref="System.Json.JsonValueChange">Clear</see>.</remarks>
+        public string Key
+        {
+            get { return key; }
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonValueDynamicMetaObject.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonValueDynamicMetaObject.cs
new file mode 100644 (file)
index 0000000..f38f98f
--- /dev/null
@@ -0,0 +1,384 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+#if FEATURE_DYNAMIC
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.Serialization.Json;
+
+namespace System.Json
+{
+    /// <summary>
+    /// This class provides dynamic behavior support for the JsonValue types.
+    /// </summary>
+    internal class JsonValueDynamicMetaObject : DynamicMetaObject
+    {
+        private static readonly MethodInfo _getValueByIndexMethodInfo = typeof(JsonValue).GetMethod("GetValue", new Type[] { typeof(int) });
+        private static readonly MethodInfo _getValueByKeyMethodInfo = typeof(JsonValue).GetMethod("GetValue", new Type[] { typeof(string) });
+        private static readonly MethodInfo _setValueByIndexMethodInfo = typeof(JsonValue).GetMethod("SetValue", new Type[] { typeof(int), typeof(object) });
+        private static readonly MethodInfo _setValueByKeyMethodInfo = typeof(JsonValue).GetMethod("SetValue", new Type[] { typeof(string), typeof(object) });
+        private static readonly MethodInfo _castValueMethodInfo = typeof(JsonValue).GetMethod("CastValue", new Type[] { typeof(JsonValue) });
+        private static readonly MethodInfo _changeTypeMethodInfo = typeof(Convert).GetMethod("ChangeType", new Type[] { typeof(object), typeof(Type) });
+
+        /// <summary>
+        /// Class constructor.
+        /// </summary>
+        /// <param name="parameter">The expression representing this <see cref="DynamicMetaObject"/> during the dynamic binding process.</param>
+        /// <param name="value">The runtime value represented by the <see cref="DynamicMetaObject"/>.</param>
+        internal JsonValueDynamicMetaObject(Expression parameter, JsonValue value)
+            : base(parameter, BindingRestrictions.Empty, value)
+        {
+        }
+
+        /// <summary>
+        /// Gets the default binding restrictions for this type.
+        /// </summary>
+        private BindingRestrictions DefaultRestrictions
+        {
+            get { return BindingRestrictions.GetTypeRestriction(Expression, LimitType); }
+        }
+
+        /// <summary>
+        /// Implements dynamic cast for JsonValue types.
+        /// </summary>
+        /// <param name="binder">An instance of the <see cref="ConvertBinder"/> that represents the details of the dynamic operation.</param>
+        /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+        public override DynamicMetaObject BindConvert(ConvertBinder binder)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            Expression expression = Expression;
+
+            bool implicitCastSupported =
+                binder.Type.IsAssignableFrom(LimitType) ||
+                binder.Type == typeof(IEnumerable<KeyValuePair<string, JsonValue>>) ||
+                binder.Type == typeof(IDynamicMetaObjectProvider) ||
+                binder.Type == typeof(object);
+
+            if (!implicitCastSupported)
+            {
+                if (JsonValue.IsSupportedExplicitCastType(binder.Type))
+                {
+                    Expression instance = Expression.Convert(Expression, LimitType);
+                    expression = Expression.Call(_castValueMethodInfo.MakeGenericMethod(binder.Type), new Expression[] { instance });
+                }
+                else
+                {
+                    string exceptionMessage = RS.Format(Properties.Resources.CannotCastJsonValue, LimitType.FullName, binder.Type.FullName);
+                    expression = Expression.Throw(Expression.Constant(new InvalidCastException(exceptionMessage)), typeof(object));
+                }
+            }
+
+            expression = Expression.Convert(expression, binder.Type);
+
+            return new DynamicMetaObject(expression, DefaultRestrictions);
+        }
+
+        /// <summary>
+        /// Implements setter for dynamic indexer by index (JsonArray)
+        /// </summary>
+        /// <param name="binder">An instance of the <see cref="GetIndexBinder"/> that represents the details of the dynamic operation.</param>
+        /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the get index operation.</param>
+        /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+        public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            if (indexes == null)
+            {
+                throw new ArgumentNullException("indexes");
+            }
+
+            Expression indexExpression;
+            if (!JsonValueDynamicMetaObject.TryGetIndexExpression(indexes, out indexExpression))
+            {
+                return new DynamicMetaObject(indexExpression, DefaultRestrictions);
+            }
+
+            MethodInfo methodInfo = indexExpression.Type == typeof(string) ? _getValueByKeyMethodInfo : _getValueByIndexMethodInfo;
+            Expression[] args = new Expression[] { indexExpression };
+
+            return GetMethodMetaObject(methodInfo, args);
+        }
+
+        /// <summary>
+        /// Implements getter for dynamic indexer by index (JsonArray).
+        /// </summary>
+        /// <param name="binder">An instance of the <see cref="SetIndexBinder"/> that represents the details of the dynamic operation.</param>
+        /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the set index operation.</param>
+        /// <param name="value">The <see cref="DynamicMetaObject"/> representing the value for the set index operation.</param>
+        /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+        public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            if (indexes == null)
+            {
+                throw new ArgumentNullException("indexes");
+            }
+
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            Expression indexExpression;
+            if (!JsonValueDynamicMetaObject.TryGetIndexExpression(indexes, out indexExpression))
+            {
+                return new DynamicMetaObject(indexExpression, DefaultRestrictions);
+            }
+
+            MethodInfo methodInfo = indexExpression.Type == typeof(string) ? _setValueByKeyMethodInfo : _setValueByIndexMethodInfo;
+            Expression[] args = new Expression[] { indexExpression, Expression.Convert(value.Expression, typeof(object)) };
+
+            return GetMethodMetaObject(methodInfo, args);
+        }
+
+        /// <summary>
+        /// Implements getter for dynamic indexer by key (JsonObject).
+        /// </summary>
+        /// <param name="binder">An instance of the <see cref="GetMemberBinder"/> that represents the details of the dynamic operation.</param>
+        /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+        public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            PropertyInfo propInfo = LimitType.GetProperty(binder.Name, BindingFlags.Instance | BindingFlags.Public);
+
+            if (propInfo != null)
+            {
+                return base.BindGetMember(binder);
+            }
+
+            Expression[] args = new Expression[] { Expression.Constant(binder.Name) };
+
+            return GetMethodMetaObject(_getValueByKeyMethodInfo, args);
+        }
+
+        /// <summary>
+        /// Implements setter for dynamic indexer by key (JsonObject).
+        /// </summary>
+        /// <param name="binder">An instance of the <see cref="SetMemberBinder"/> that represents the details of the dynamic operation.</param>
+        /// <param name="value">The <see cref="DynamicMetaObject"/> representing the value for the set member operation.</param>
+        /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
+        public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            Expression[] args = new Expression[] { Expression.Constant(binder.Name), Expression.Convert(value.Expression, typeof(object)) };
+
+            return GetMethodMetaObject(_setValueByKeyMethodInfo, args);
+        }
+
+        /// <summary>
+        /// Performs the binding of the dynamic invoke member operation.
+        /// Implemented to support extension methods defined in <see cref="JsonValueExtensions"/> type.
+        /// </summary>
+        /// <param name="binder">An instance of the InvokeMemberBinder that represents the details of the dynamic operation.</param>
+        /// <param name="args">An array of DynamicMetaObject instances - arguments to the invoke member operation.</param>
+        /// <returns>The new DynamicMetaObject representing the result of the binding.</returns>
+        public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
+        {
+            if (binder == null)
+            {
+                throw new ArgumentNullException("binder");
+            }
+
+            if (args == null)
+            {
+                throw new ArgumentNullException("args");
+            }
+
+            List<Type> argTypeList = new List<Type>();
+
+            for (int idx = 0; idx < args.Length; idx++)
+            {
+                argTypeList.Add(args[idx].LimitType);
+            }
+
+            MethodInfo methodInfo = Value.GetType().GetMethod(binder.Name, argTypeList.ToArray());
+
+            if (methodInfo == null)
+            {
+                argTypeList.Insert(0, typeof(JsonValue));
+
+                Type[] argTypes = argTypeList.ToArray();
+
+                methodInfo = JsonValueDynamicMetaObject.GetExtensionMethod(typeof(JsonValueExtensions), binder.Name, argTypes);
+
+                if (methodInfo != null)
+                {
+                    Expression thisInstance = Expression.Convert(Expression, LimitType);
+                    Expression[] argsExpression = new Expression[argTypes.Length];
+
+                    argsExpression[0] = thisInstance;
+                    for (int i = 0; i < args.Length; i++)
+                    {
+                        argsExpression[i + 1] = args[i].Expression;
+                    }
+
+                    Expression callExpression = Expression.Call(methodInfo, argsExpression);
+
+                    if (methodInfo.ReturnType == typeof(void))
+                    {
+                        callExpression = Expression.Block(callExpression, Expression.Default(binder.ReturnType));
+                    }
+                    else
+                    {
+                        callExpression = Expression.Convert(Expression.Call(methodInfo, argsExpression), binder.ReturnType);
+                    }
+
+                    return new DynamicMetaObject(callExpression, DefaultRestrictions);
+                }
+            }
+
+            return base.BindInvokeMember(binder, args);
+        }
+
+        /// <summary>
+        /// Returns the enumeration of all dynamic member names.
+        /// </summary>
+        /// <returns>An <see cref="IEnumerable{T}"/> of string reprenseting the dynamic member names.</returns>
+        public override IEnumerable<string> GetDynamicMemberNames()
+        {
+            JsonValue jsonValue = Value as JsonValue;
+
+            if (jsonValue != null)
+            {
+                List<string> names = new List<string>();
+
+                foreach (KeyValuePair<string, JsonValue> pair in jsonValue)
+                {
+                    names.Add(pair.Key);
+                }
+
+                return names;
+            }
+
+            return base.GetDynamicMemberNames();
+        }
+
+        /// <summary>
+        /// Gets a <see cref="MethodInfo"/> instance for the specified method name in the specified type.
+        /// </summary>
+        /// <param name="extensionProviderType">The extension provider type.</param>
+        /// <param name="methodName">The name of the method to get the info for.</param>
+        /// <param name="argTypes">The types of the method arguments.</param>
+        /// <returns>A <see cref="MethodInfo"/>instance or null if the method cannot be resolved.</returns>
+        private static MethodInfo GetExtensionMethod(Type extensionProviderType, string methodName, Type[] argTypes)
+        {
+            MethodInfo methodInfo = null;
+            MethodInfo[] methods = extensionProviderType.GetMethods();
+
+            foreach (MethodInfo info in methods)
+            {
+                if (info.Name == methodName)
+                {
+                    methodInfo = info;
+
+                    if (!info.IsGenericMethodDefinition)
+                    {
+                        bool paramsMatch = true;
+                        ParameterInfo[] args = methodInfo.GetParameters();
+
+                        if (args.Length == argTypes.Length)
+                        {
+                            for (int idx = 0; idx < args.Length; idx++)
+                            {
+                                if (!args[idx].ParameterType.IsAssignableFrom(argTypes[idx]))
+                                {
+                                    paramsMatch = false;
+                                    break;
+                                }
+                            }
+
+                            if (paramsMatch)
+                            {
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+
+            return methodInfo;
+        }
+
+        /// <summary>
+        /// Attempts to get an expression for an index parameter.
+        /// </summary>
+        /// <param name="indexes">The operation indexes parameter.</param>
+        /// <param name="expression">A <see cref="Expression"/> to be initialized to the index expression if the operation is successful, otherwise an error expression.</param>
+        /// <returns>true the operation is successful, false otherwise.</returns>
+        private static bool TryGetIndexExpression(DynamicMetaObject[] indexes, out Expression expression)
+        {
+            if (indexes.Length == 1 && indexes[0] != null && indexes[0].Value != null)
+            {
+                DynamicMetaObject index = indexes[0];
+                Type indexType = indexes[0].Value.GetType();
+
+                switch (Type.GetTypeCode(indexType))
+                {
+                    case TypeCode.Char:
+                    case TypeCode.Int16:
+                    case TypeCode.UInt16:
+                    case TypeCode.Byte:
+                    case TypeCode.SByte:
+                        Expression argExp = Expression.Convert(index.Expression, typeof(object));
+                        Expression typeExp = Expression.Constant(typeof(int));
+                        expression = Expression.Convert(Expression.Call(_changeTypeMethodInfo, new Expression[] { argExp, typeExp }), typeof(int));
+                        return true;
+
+                    case TypeCode.Int32:
+                    case TypeCode.String:
+                        expression = index.Expression;
+                        return true;
+                }
+
+                expression = Expression.Throw(Expression.Constant(new ArgumentException(RS.Format(Properties.Resources.InvalidIndexType, indexType))), typeof(object));
+                return false;
+            }
+
+            expression = Expression.Throw(Expression.Constant(new ArgumentException(Properties.Resources.NonSingleNonNullIndexNotSupported)), typeof(object));
+            return false;
+        }
+
+        /// <summary>
+        /// Gets a <see cref="DynamicMetaObject"/> for a method call.
+        /// </summary>
+        /// <param name="methodInfo">Info for the method to be performed.</param>
+        /// <param name="args">expression array representing the method arguments</param>
+        /// <returns>A meta object for the method call.</returns>
+        private DynamicMetaObject GetMethodMetaObject(MethodInfo methodInfo, Expression[] args)
+        {
+            Expression instance = Expression.Convert(Expression, LimitType);
+            Expression methodCall = Expression.Call(instance, methodInfo, args);
+            BindingRestrictions restrictions = DefaultRestrictions;
+
+            DynamicMetaObject metaObj = new DynamicMetaObject(methodCall, restrictions);
+
+            return metaObj;
+        }
+    }
+}
+#endif
diff --git a/mcs/class/System.Json.Microsoft/System.Json/JsonValueLinqExtensions.cs b/mcs/class/System.Json.Microsoft/System.Json/JsonValueLinqExtensions.cs
new file mode 100644 (file)
index 0000000..5516a03
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.Json
+{
+    /// <summary>
+    /// This class extends the funcionality of the <see cref="JsonValue"/> type for better Linq support . 
+    /// </summary>
+    [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "Linq is a technical name.")]
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public static class JsonValueLinqExtensions
+    {
+        /// <summary>
+        /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="JsonValue"/> types.
+        /// </summary>
+        /// <param name="items">The enumerable instance.</param>
+        /// <returns>A <see cref="JsonArray"/> created from the specified items.</returns>
+        public static JsonArray ToJsonArray(this IEnumerable<JsonValue> items)
+        {
+            return new JsonArray(items);
+        }
+
+        /// <summary>
+        /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="KeyValuePair{K,V}"/> of <see cref="String"/> and <see cref="JsonValue"/> types.
+        /// </summary>
+        /// <param name="items">The enumerable instance.</param>
+        /// <returns>A <see cref="JsonValue"/> created from the specified items.</returns>
+        [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "JsonValue implements the nested type in param.")]
+        public static JsonObject ToJsonObject(this IEnumerable<KeyValuePair<string, JsonValue>> items)
+        {
+            return new JsonObject(items);
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/NGenWrapper.cs b/mcs/class/System.Json.Microsoft/System.Json/NGenWrapper.cs
new file mode 100644 (file)
index 0000000..4a9e7b5
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Json
+{
+    /// <summary>
+    /// Struct that wraps values which cause JIT compilation at runtime.
+    /// This Struct is added to solve the FxCop warning CA908 in JsonObject.cs.
+    /// </summary>
+    /// <typeparam name="T">Wrapped type.</typeparam>
+    internal struct NGenWrapper<T>
+    {
+        /// <summary>
+        /// Value of type T which represents the actual data which is currently in hold.
+        /// </summary>
+        public T Value;
+
+        /// <summary>
+        /// Creates an instance of the <see cref="System.Json.NGenWrapper{T}"/> class
+        /// </summary>
+        /// <param name="value">The wrapped object of T</param>
+        public NGenWrapper(T value)
+        {
+            Value = value;
+        }
+
+        /// <summary>
+        /// Cast operator from <see cref="System.Json.NGenWrapper{T}"/> to <typeparamref name="T"/>
+        /// </summary>
+        /// <param name="value">Object in type <see cref="System.Json.NGenWrapper{T}"/></param>
+        /// <returns>Object in type <typeparamref name="T">The wrapped element type</typeparamref></returns>
+        /// <typeparamref name="T">The wrapped element type</typeparamref>
+        public static implicit operator T(NGenWrapper<T> value)
+        {
+            return value.Value;
+        }
+
+        /// <summary>
+        /// Cast operator from <typeparamref name="T"/> to <see cref="System.Json.NGenWrapper{T}"/>
+        /// </summary>
+        /// <param name="value">Object in type <typeparamref name="T"/></param>
+        /// <returns>Object in type <see cref="System.Json.NGenWrapper{T}"/></returns>
+        /// <typeparamref name="T">The wrapped element type</typeparamref>
+        public static implicit operator NGenWrapper<T>(T value)
+        {
+            return new NGenWrapper<T>(value);
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/Properties/AssemblyInfo.cs b/mcs/class/System.Json.Microsoft/System.Json/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..f413e07
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
+
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+[assembly: AssemblyTitle("System.Json")]
+[assembly: AssemblyDescription("")]
+[assembly: Guid("6fd72360-ebfc-4097-96fa-2ee418c04f7b")]
diff --git a/mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.Designer.cs b/mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.Designer.cs
new file mode 100644 (file)
index 0000000..5a0e120
--- /dev/null
@@ -0,0 +1,216 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.239
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace System.Json.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // class via a tool like ResGen or Visual Studio.
+    // To add or remove a member, edit your .ResX file then rerun ResGen
+    // with the /str option, or rebuild your VS project.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Json.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The argument &apos;{0}&apos; must be greater than or equal to {1}..
+        /// </summary>
+        internal static string ArgumentMustBeGreaterThanOrEqualTo {
+            get {
+                return ResourceManager.GetString("ArgumentMustBeGreaterThanOrEqualTo", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Unable to cast object of type &apos;{0}&apos; to type &apos;{1}&apos;..
+        /// </summary>
+        internal static string CannotCastJsonValue {
+            get {
+                return ResourceManager.GetString("CannotCastJsonValue", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to CannotReadAsType=Cannot read &apos;{0}&apos; as &apos;{1}&apos; type..
+        /// </summary>
+        internal static string CannotReadAsType {
+            get {
+                return ResourceManager.GetString("CannotReadAsType", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Cannot read JsonPrimitive value &apos;{0}&apos; as &apos;{1}&apos;..
+        /// </summary>
+        internal static string CannotReadPrimitiveAsType {
+            get {
+                return ResourceManager.GetString("CannotReadPrimitiveAsType", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to &apos;{0}&apos; does not contain a definition for property &apos;{1}&apos;..
+        /// </summary>
+        internal static string DynamicPropertyNotDefined {
+            get {
+                return ResourceManager.GetString("DynamicPropertyNotDefined", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to The input source is not correctly formatted..
+        /// </summary>
+        internal static string IncorrectJsonFormat {
+            get {
+                return ResourceManager.GetString("IncorrectJsonFormat", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to &apos;{0}&apos; type indexer is not supported on JsonValue of &apos;JsonType.{1}&apos; type..
+        /// </summary>
+        internal static string IndexerNotSupportedOnJsonType {
+            get {
+                return ResourceManager.GetString("IndexerNotSupportedOnJsonType", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Cannot convert null to &apos;{0}&apos; because it is a non-nullable value type..
+        /// </summary>
+        internal static string InvalidCastNonNullable {
+            get {
+                return ResourceManager.GetString("InvalidCastNonNullable", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Cannot cast JsonPrimitive value &apos;{0}&apos; as &apos;{1}&apos;. It is not in a valid date format..
+        /// </summary>
+        internal static string InvalidDateFormat {
+            get {
+                return ResourceManager.GetString("InvalidDateFormat", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Invalid &apos;{0}&apos; index type; only &apos;System.String&apos; and non-negative &apos;System.Int32&apos; types are supported..
+        /// </summary>
+        internal static string InvalidIndexType {
+            get {
+                return ResourceManager.GetString("InvalidIndexType", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Invalid JSON primitive: {0}..
+        /// </summary>
+        internal static string InvalidJsonPrimitive {
+            get {
+                return ResourceManager.GetString("InvalidJsonPrimitive", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Cannot cast &apos;{0}&apos; value &apos;{1}.{2}&apos; as a type of &apos;{3}&apos;. The provided string is not a valid relative or absolute &apos;{3}&apos;..
+        /// </summary>
+        internal static string InvalidUriFormat {
+            get {
+                return ResourceManager.GetString("InvalidUriFormat", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to An empty string cannot be parsed as JSON..
+        /// </summary>
+        internal static string JsonStringCannotBeEmpty {
+            get {
+                return ResourceManager.GetString("JsonStringCannotBeEmpty", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Null index or multidimensional indexing is not supported by this indexer; use &apos;System.Int32&apos; or &apos;System.String&apos; for array and object indexing respectively..
+        /// </summary>
+        internal static string NonSingleNonNullIndexNotSupported {
+            get {
+                return ResourceManager.GetString("NonSingleNonNullIndexNotSupported", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Cannot cast JsonPrimitive value &apos;{0}&apos; as &apos;{1}&apos;. The value is either too large or too small for the specified CLR type..
+        /// </summary>
+        internal static string OverflowReadAs {
+            get {
+                return ResourceManager.GetString("OverflowReadAs", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Object type not supported..
+        /// </summary>
+        internal static string TypeNotSupported {
+            get {
+                return ResourceManager.GetString("TypeNotSupported", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Operation not supported on JsonValue instances of &apos;JsonType.Default&apos; type..
+        /// </summary>
+        internal static string UseOfDefaultNotAllowed {
+            get {
+                return ResourceManager.GetString("UseOfDefaultNotAllowed", resourceCulture);
+            }
+        }
+    }
+}
diff --git a/mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.resx b/mcs/class/System.Json.Microsoft/System.Json/Properties/Resources.resx
new file mode 100644 (file)
index 0000000..02fd621
--- /dev/null
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="ArgumentMustBeGreaterThanOrEqualTo" xml:space="preserve">
+    <value>The argument '{0}' must be greater than or equal to {1}.</value>
+  </data>
+  <data name="CannotCastJsonValue" xml:space="preserve">
+    <value>Unable to cast object of type '{0}' to type '{1}'.</value>
+  </data>
+  <data name="CannotReadAsType" xml:space="preserve">
+    <value>CannotReadAsType=Cannot read '{0}' as '{1}' type.</value>
+  </data>
+  <data name="CannotReadPrimitiveAsType" xml:space="preserve">
+    <value>Cannot read JsonPrimitive value '{0}' as '{1}'.</value>
+  </data>
+  <data name="DynamicPropertyNotDefined" xml:space="preserve">
+    <value>'{0}' does not contain a definition for property '{1}'.</value>
+  </data>
+  <data name="IncorrectJsonFormat" xml:space="preserve">
+    <value>The input source is not correctly formatted.</value>
+  </data>
+  <data name="IndexerNotSupportedOnJsonType" xml:space="preserve">
+    <value>'{0}' type indexer is not supported on JsonValue of 'JsonType.{1}' type.</value>
+  </data>
+  <data name="InvalidCastNonNullable" xml:space="preserve">
+    <value>Cannot convert null to '{0}' because it is a non-nullable value type.</value>
+  </data>
+  <data name="InvalidDateFormat" xml:space="preserve">
+    <value>Cannot cast JsonPrimitive value '{0}' as '{1}'. It is not in a valid date format.</value>
+  </data>
+  <data name="InvalidIndexType" xml:space="preserve">
+    <value>Invalid '{0}' index type; only 'System.String' and non-negative 'System.Int32' types are supported.</value>
+  </data>
+  <data name="InvalidJsonPrimitive" xml:space="preserve">
+    <value>Invalid JSON primitive: {0}.</value>
+  </data>
+  <data name="InvalidUriFormat" xml:space="preserve">
+    <value>Cannot cast '{0}' value '{1}.{2}' as a type of '{3}'. The provided string is not a valid relative or absolute '{3}'.</value>
+  </data>
+  <data name="JsonStringCannotBeEmpty" xml:space="preserve">
+    <value>An empty string cannot be parsed as JSON.</value>
+  </data>
+  <data name="NonSingleNonNullIndexNotSupported" xml:space="preserve">
+    <value>Null index or multidimensional indexing is not supported by this indexer; use 'System.Int32' or 'System.String' for array and object indexing respectively.</value>
+  </data>
+  <data name="OverflowReadAs" xml:space="preserve">
+    <value>Cannot cast JsonPrimitive value '{0}' as '{1}'. The value is either too large or too small for the specified CLR type.</value>
+  </data>
+  <data name="TypeNotSupported" xml:space="preserve">
+    <value>Object type not supported.</value>
+  </data>
+  <data name="UseOfDefaultNotAllowed" xml:space="preserve">
+    <value>Operation not supported on JsonValue instances of 'JsonType.Default' type.</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Json.Microsoft/Test/System.Json/JsonValueTest.cs b/mcs/class/System.Json.Microsoft/Test/System.Json/JsonValueTest.cs
new file mode 100644 (file)
index 0000000..c302a51
--- /dev/null
@@ -0,0 +1,30 @@
+//
+// JsonValueTest.cs: Tests for JSonValue
+//
+// Copyright 2011 Xamarin, Inc.
+//
+// Authors:
+//   Miguel de Icaza
+//
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+using System.Json;
+
+namespace MonoTests.System
+{
+       [TestFixture]
+       public class JsonValueTests {
+               // Tests that a trailing comma is allowed in dictionary definitions
+               // Test that we correctly serialize JsonArray with null elements.
+               [Test]
+               public void ToStringOnJsonArrayWithNulls () {
+                       var j = JsonValue.Load (new StringReader ("[1,2,3,null]"));
+                       Assert.AreEqual (4, j.Count, "itemcount");
+                       Assert.AreEqual (JsonType.Array, j.JsonType, "type");
+                       var str = j.ToString ();
+                       Assert.AreEqual ("[1,2,3,null]", str);
+               }
+       }
+}
index a550ea9caa15684f460fbd452d9e502c8f3ab66e..b8c49cd952bd53eac4e7967132dddbb9b7d678c5 100755 (executable)
@@ -37,6 +37,22 @@ using System.Runtime.InteropServices;
 
 // General Information about the System.Json assembly
 
+[assembly: AssemblyTitle ("System.Json.dll")]
+[assembly: AssemblyDescription ("System.Json.dll")]
 [assembly: AssemblyDefaultAlias ("System.Json.dll")]
 
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
 [assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../winfx.pub")]
+
+[assembly: ComVisible (false)]
+
+[assembly: SecurityCritical]
index f83e3ed6a98e4a0f91039d278c8d9721538c4290..906b0bf48f178ac8324ae1a357d887ee160d6007 100644 (file)
@@ -2,24 +2,24 @@ thisdir = class/System.Json
 SUBDIRS = 
 include ../../build/rules.make
 
-System.Json.Properties.Resources.resources: ../../../external/aspnetwebstack/src/System.Json/Properties/Resources.resx
-       $(RESGEN) "$<" "$@"
-
 LIBRARY = System.Json.dll
-LIB_MCS_FLAGS = /d:ASPNETMVC -keyfile:../winfx.pub -delaysign \
+LIB_MCS_FLAGS = \
                /r:System.dll \
                /r:System.Xml.dll \
                /r:System.Core.dll \
-               /r:System.Runtime.Serialization.dll \
-               /r:System.ServiceModel.Web.dll \
-               /resource:System.Json.Properties.Resources.resources
-
-ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
-LIB_MCS_FLAGS += /r:Microsoft.CSharp.dll
-endif
+               /r:System.ServiceModel.Web.dll
 
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
-include ../../build/library.make
+EXTRA_DISTFILES =
 
-$(the_lib): System.Json.Properties.Resources.resources
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.Json.dll
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+endif
+
+include ../../build/library.make
index c772ac2c523ec59000e83c2caf152d1b5c70f049..2611515e0030c02a8c5190e8e086831a607b8086 100644 (file)
     <AssemblyName>System.Json</AssemblyName>\r
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
     <FileAlignment>512</FileAlignment>\r
-    <!-- Filter out System.Core added by: Microsoft.NETFramework.props  -->\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>  \r
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
   <ItemGroup>\r
    <Compile Include="..\..\build\common\Consts.cs" />
    <Compile Include="Assembly\AssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\RS.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\CommonAssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\TransparentCommonAssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\AssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Extensions\JsonValueExtensions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\GlobalSuppressions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JXmlToJsonValueConverter.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonArray.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonObject.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonPrimitive.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonType.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValue.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChange.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChangeEventArgs.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueDynamicMetaObject.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueLinqExtensions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\NGenWrapper.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\Resources.Designer.cs" />
+   <Compile Include="System.Json\JsonArray.cs" />
+   <Compile Include="System.Json\JsonObject.cs" />
+   <Compile Include="System.Json\JsonPrimitive.cs" />
+   <Compile Include="System.Json\JsonType.cs" />
+   <Compile Include="System.Json\JsonValue.cs" />
+   <Compile Include="..\System.ServiceModel.Web\System.Runtime.Serialization.Json\JavaScriptReader.cs" />
 \r
   </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
@@ -75,7 +59,7 @@
     <PreBuildEvent></PreBuildEvent>\r
   </PropertyGroup>\r
   <ItemGroup>\r
-    <Reference Include="mscorlib.dll">
+        <Reference Include="mscorlib.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>mscorlib.dll</HintPath>
     </Reference>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.Core.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.Serialization.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>System.Runtime.Serialization.dll</HintPath>
-    </Reference>
     <Reference Include="System.ServiceModel.Web.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.ServiceModel.Web.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.CSharp.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Microsoft.CSharp.dll</HintPath>
-    </Reference>
 \r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
   </ItemGroup>\r
-    <ItemGroup>
-    <EmbeddedResource Include="System.Json.Properties.Resources.resources">
-       <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-\r
+  \r
 </Project>\r
 
index 5b6ff710cef45208d3d924adccbf2bf3f5863f2d..3a0996f6c174566765d7222563d029e3333de366 100644 (file)
     <AssemblyName>System.Json</AssemblyName>\r
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
     <FileAlignment>512</FileAlignment>\r
-    <!-- Filter out System.Core added by: Microsoft.NETFramework.props  -->\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>  \r
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
   <ItemGroup>\r
    <Compile Include="..\..\build\common\Consts.cs" />
    <Compile Include="Assembly\AssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\RS.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\CommonAssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\TransparentCommonAssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\AssemblyInfo.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Extensions\JsonValueExtensions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\GlobalSuppressions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JXmlToJsonValueConverter.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonArray.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonObject.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonPrimitive.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonType.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValue.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChange.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueChangeEventArgs.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueDynamicMetaObject.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\JsonValueLinqExtensions.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\NGenWrapper.cs" />
-   <Compile Include="..\..\..\external\aspnetwebstack\src\System.Json\Properties\Resources.Designer.cs" />
+   <Compile Include="System.Json\JsonArray.cs" />
+   <Compile Include="System.Json\JsonObject.cs" />
+   <Compile Include="System.Json\JsonPrimitive.cs" />
+   <Compile Include="System.Json\JsonType.cs" />
+   <Compile Include="System.Json\JsonValue.cs" />
+   <Compile Include="..\System.ServiceModel.Web\System.Runtime.Serialization.Json\JavaScriptReader.cs" />
 \r
   </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
@@ -75,7 +59,7 @@
     <PreBuildEvent></PreBuildEvent>\r
   </PropertyGroup>\r
   <ItemGroup>\r
-    <Reference Include="mscorlib.dll">
+        <Reference Include="mscorlib.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>mscorlib.dll</HintPath>
     </Reference>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.Core.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.Serialization.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>System.Runtime.Serialization.dll</HintPath>
-    </Reference>
     <Reference Include="System.ServiceModel.Web.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.ServiceModel.Web.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.CSharp.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Microsoft.CSharp.dll</HintPath>
-    </Reference>
 \r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
   </ItemGroup>\r
-    <ItemGroup>
-    <EmbeddedResource Include="System.Json.Properties.Resources.resources">
-       <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-\r
+  \r
 </Project>\r
 
index b542bdc296043f718910d1c277d34185a11c914f..903d919e9767ca36e9f3c67e2c86ca5f366d56c0 100644 (file)
     <AssemblyName>System.Json_test_net_4_0</AssemblyName>\r
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
     <FileAlignment>512</FileAlignment>\r
-    <!-- Filter out System.Core added by: Microsoft.NETFramework.props  -->\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>  \r
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_0</AdditionalLibPaths>\r
@@ -56,7 +52,7 @@
     <PreBuildEvent></PreBuildEvent>\r
   </PropertyGroup>\r
   <ItemGroup>\r
-    <Reference Include="mscorlib.dll">
+        <Reference Include="mscorlib.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>mscorlib.dll</HintPath>
     </Reference>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.Core.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.Serialization.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>System.Runtime.Serialization.dll</HintPath>
-    </Reference>
     <Reference Include="System.ServiceModel.Web.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.ServiceModel.Web.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.CSharp.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Microsoft.CSharp.dll</HintPath>
-    </Reference>
     <Reference Include="nunit.framework" />
 \r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
   </ItemGroup>\r
-    <ItemGroup>
-    <EmbeddedResource Include="System.Json.Properties.Resources.resources">
-       <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-\r
+  \r
 </Project>\r
 
index 052de28c25726be4bcc060b561687c4dc40aaec1..b35e9b3a428ea66fe7cc81a7bee85621305a41c4 100644 (file)
     <AssemblyName>System.Json_test_net_4_5</AssemblyName>\r
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
     <FileAlignment>512</FileAlignment>\r
-    <!-- Filter out System.Core added by: Microsoft.NETFramework.props  -->\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <PlatformTarget>AnyCPU</PlatformTarget>  \r
     <DebugType>pdbonly</DebugType>\r
     <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
-    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;ASPNETMVC</DefineConstants>\r
+    <DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <AdditionalLibPaths>./../../class/lib/net_4_5</AdditionalLibPaths>\r
@@ -56,7 +52,7 @@
     <PreBuildEvent></PreBuildEvent>\r
   </PropertyGroup>\r
   <ItemGroup>\r
-    <Reference Include="mscorlib.dll">
+        <Reference Include="mscorlib.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>mscorlib.dll</HintPath>
     </Reference>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.Core.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.Serialization.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>System.Runtime.Serialization.dll</HintPath>
-    </Reference>
     <Reference Include="System.ServiceModel.Web.dll">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>System.ServiceModel.Web.dll</HintPath>
     </Reference>
-    <Reference Include="Microsoft.CSharp.dll">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Microsoft.CSharp.dll</HintPath>
-    </Reference>
     <Reference Include="nunit.framework" />
 \r
   </ItemGroup>\r
   <ItemGroup>\r
     <Folder Include="Properties\" />\r
   </ItemGroup>\r
-    <ItemGroup>
-    <EmbeddedResource Include="System.Json.Properties.Resources.resources">
-       <LogicalName>System.Json.Properties.Resources.resources</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-\r
+  \r
 </Project>\r
 
index f829400c4a53cfa861c13d0f4da4d4cb898ce065..47a9ceed63acc60eeff70671bb6a16c17d727b69 100644 (file)
@@ -1,23 +1,8 @@
 ../../build/common/Consts.cs
 Assembly/AssemblyInfo.cs
-
-../../../external/aspnetwebstack/src/RS.cs
-../../../external/aspnetwebstack/src/CommonAssemblyInfo.cs
-../../../external/aspnetwebstack/src/TransparentCommonAssemblyInfo.cs
-
-../../../external/aspnetwebstack/src/System.Json/Properties/AssemblyInfo.cs
-../../../external/aspnetwebstack/src/System.Json/Extensions/JsonValueExtensions.cs
-../../../external/aspnetwebstack/src/System.Json/GlobalSuppressions.cs
-../../../external/aspnetwebstack/src/System.Json/JXmlToJsonValueConverter.cs
-../../../external/aspnetwebstack/src/System.Json/JsonArray.cs
-../../../external/aspnetwebstack/src/System.Json/JsonObject.cs
-../../../external/aspnetwebstack/src/System.Json/JsonPrimitive.cs
-../../../external/aspnetwebstack/src/System.Json/JsonType.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValue.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueChange.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueChangeEventArgs.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueDynamicMetaObject.cs
-../../../external/aspnetwebstack/src/System.Json/JsonValueLinqExtensions.cs
-../../../external/aspnetwebstack/src/System.Json/NGenWrapper.cs
-../../../external/aspnetwebstack/src/System.Json/Properties/Resources.Designer.cs
-
+System.Json/JsonArray.cs
+System.Json/JsonObject.cs
+System.Json/JsonPrimitive.cs
+System.Json/JsonType.cs
+System.Json/JsonValue.cs
+../System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
\ No newline at end of file
diff --git a/mcs/class/System.Json/System.Json/ChangeLog b/mcs/class/System.Json/System.Json/ChangeLog
new file mode 100644 (file)
index 0000000..2c56ec1
--- /dev/null
@@ -0,0 +1,70 @@
+2010-03-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : moved to Sys.SM.Web/Sys.R.S.Json.
+
+2010-03-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonValue.cs : use Sys.SM.Web.dll's JavaScriptObjectDeserializer
+         for silverlight sdk / moonlight compatibility.
+       * JsonReader.cs : renamed to JavaScriptReader (for disambiguation in
+         Sys.SM.Web.dll). Now it is native-type based and used by the above
+         deserializer.
+
+2010-02-18  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonValue.cs : fix string escaping, it was giving wrong output
+         after \" and \\.
+
+2010-02-18  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : line endings after a value should not result in
+         a parse error.
+       * JsonObject.cs : duplicate object key "SHOULD" not be used, but
+         they are not rejected. So, make it a bit sloppy.
+
+2010-01-27  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : oops, added previous change to wrong position.
+
+2010-01-27  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : It seems it can either return int, long or decimal
+         depending on the value. Users cannot really predict what type of
+         the primitive value can be returned and casts to specific types
+         very likely fail. doh.
+
+2010-01-27  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : use decimal instead of int to parse decimal part
+         of numeric value. It can parse bigger value than int now (like
+         tweet id).
+
+2009-10-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : \uXXXX parser was totally wrong, giving wrong #.
+
+2009-09-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonValue.cs, JsonReader.cs, JsonPrimitive.cs :
+         Handle "null" values, as string, so far (haven't tried what .NET
+         actually does).
+         Fix array ToString() that missed commas (while Save() worked fine -
+         it has different serialization logic).
+
+2009-01-15  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : consume ',' between items in an array.
+
+2008-09-15  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonObject.cs, JsonValue.cs : SL2b2 updates.
+
+2008-08-28  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonReader.cs : a ReadChar() is missing in number parsing.
+
+2008-06-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * JsonArray.cs, JsonObject.cs, JsonPrimitive.cs, JsonReader.cs,
+         JsonType.cs, JsonValue.cs, MergedEnumerator.cs : initial checkin.
+
diff --git a/mcs/class/System.Json/System.Json/JsonArray.cs b/mcs/class/System.Json/System.Json/JsonArray.cs
new file mode 100644 (file)
index 0000000..c630044
--- /dev/null
@@ -0,0 +1,139 @@
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace System.Json
+{
+       public class JsonArray : JsonValue, IList<JsonValue>
+       {
+               List<JsonValue> list;
+
+               public JsonArray (params JsonValue [] items)
+               {
+                       list = new List<JsonValue> ();
+                       AddRange (items);
+               }
+
+               public JsonArray (IEnumerable<JsonValue> items)
+               {
+                       if (items == null)
+                               throw new ArgumentNullException ("items");
+
+                       list = new List<JsonValue> (items);
+               }
+
+               public override int Count {
+                       get { return list.Count; }
+               }
+
+               public bool IsReadOnly {
+                       get { return false; }
+               }
+
+               public override sealed JsonValue this [int index] {
+                       get { return list [index]; }
+                       set { list [index] = value; }
+               }
+
+               public override JsonType JsonType {
+                       get { return JsonType.Array; }
+               }
+
+               public void Add (JsonValue item)
+               {
+                       if (item == null)
+                               throw new ArgumentNullException ("item");
+
+                       list.Add (item);
+               }
+
+               public void AddRange (IEnumerable<JsonValue> items)
+               {
+                       if (items == null)
+                               throw new ArgumentNullException ("items");
+
+                       list.AddRange (items);
+               }
+
+               public void AddRange (params JsonValue [] items)
+               {
+                       if (items == null)
+                               return;
+
+                       list.AddRange (items);
+               }
+
+               public void Clear ()
+               {
+                       list.Clear ();
+               }
+
+               public bool Contains (JsonValue item)
+               {
+                       return list.Contains (item);
+               }
+
+               public void CopyTo (JsonValue [] array, int arrayIndex)
+               {
+                       list.CopyTo (array, arrayIndex);
+               }
+
+               public int IndexOf (JsonValue item)
+               {
+                       return list.IndexOf (item);
+               }
+
+               public void Insert (int index, JsonValue item)
+               {
+                       list.Insert (index, item);
+               }
+
+               public bool Remove (JsonValue item)
+               {
+                       return list.Remove (item);
+               }
+
+               public void RemoveAt (int index)
+               {
+                       list.RemoveAt (index);
+               }
+
+               public override void Save (Stream stream)
+               {
+                       if (stream == null)
+                               throw new ArgumentNullException ("stream");
+                       stream.WriteByte ((byte) '[');
+                       for (int i = 0; i < list.Count; i++) {
+                               JsonValue v = list [i];
+                               if (v != null)
+                                       v.Save (stream);
+                               else {
+                                       stream.WriteByte ((byte) 'n');
+                                       stream.WriteByte ((byte) 'u');
+                                       stream.WriteByte ((byte) 'l');
+                                       stream.WriteByte ((byte) 'l');
+                               }
+
+                               if (i < Count - 1) {
+                                       stream.WriteByte ((byte) ',');
+                                       stream.WriteByte ((byte) ' ');
+                               }
+                       }
+                       stream.WriteByte ((byte) ']');
+               }
+
+               IEnumerator<JsonValue> IEnumerable<JsonValue>.GetEnumerator ()
+               {
+                       return list.GetEnumerator ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return list.GetEnumerator ();
+               }
+       }
+}
diff --git a/mcs/class/System.Json/System.Json/JsonObject.cs b/mcs/class/System.Json/System.Json/JsonObject.cs
new file mode 100644 (file)
index 0000000..33177b1
--- /dev/null
@@ -0,0 +1,160 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+using JsonPair = System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>;
+using JsonPairEnumerable = System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>>;
+
+namespace System.Json
+{
+       public class JsonObject : JsonValue, IDictionary<string, JsonValue>, ICollection<JsonPair>
+       {
+               Dictionary<string, JsonValue> map;
+
+               public JsonObject (params JsonPair [] items)
+               {
+                       map = new Dictionary<string, JsonValue> ();
+
+                       if (items != null)
+                               AddRange (items);
+               }
+
+               public JsonObject (JsonPairEnumerable items)
+               {
+                       if (items == null)
+                               throw new ArgumentNullException ("items");
+
+                       map = new Dictionary<string, JsonValue> ();
+                       AddRange (items);
+               }
+
+               public override int Count {
+                       get { return map.Count; }
+               }
+
+               public IEnumerator<JsonPair> GetEnumerator ()
+               {
+                       return map.GetEnumerator ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return map.GetEnumerator ();
+               }
+
+               public override sealed JsonValue this [string key] {
+                       get { return map [key]; }
+                       set { map [key] = value; }
+               }
+
+               public override JsonType JsonType {
+                       get { return JsonType.Object; }
+               }
+
+               public ICollection<string> Keys {
+                       get { return map.Keys; }
+               }
+
+               public ICollection<JsonValue> Values {
+                       get { return map.Values; }
+               }
+
+               public void Add (string key, JsonValue value)
+               {
+                       if (key == null)
+                               throw new ArgumentNullException ("key");
+
+                       map.Add (key, value);
+               }
+
+               public void Add (JsonPair pair)
+               {
+                       Add (pair.Key, pair.Value);
+               }
+
+               public void AddRange (JsonPairEnumerable items)
+               {
+                       if (items == null)
+                               throw new ArgumentNullException ("items");
+
+                       foreach (var pair in items)
+                               map.Add (pair.Key, pair.Value);
+               }
+
+               public void AddRange (params JsonPair [] items)
+               {
+                       AddRange ((JsonPairEnumerable) items);
+               }
+
+               public void Clear ()
+               {
+                       map.Clear ();
+               }
+
+               bool ICollection<JsonPair>.Contains (JsonPair item)
+               {
+                       return (map as ICollection<JsonPair>).Contains (item);
+               }
+
+               bool ICollection<JsonPair>.Remove (JsonPair item)
+               {
+                       return (map as ICollection<JsonPair>).Remove (item);
+               }
+
+               public override bool ContainsKey (string key)
+               {
+                       if (key == null)
+                               throw new ArgumentNullException ("key");
+
+                       return map.ContainsKey (key);
+               }
+
+               public void CopyTo (JsonPair [] array, int arrayIndex)
+               {
+                       (map as ICollection<JsonPair>).CopyTo (array, arrayIndex);
+               }
+
+               public bool Remove (string key)
+               {
+                       if (key == null)
+                               throw new ArgumentNullException ("key");
+
+                       return map.Remove (key);
+               }
+
+               bool ICollection<JsonPair>.IsReadOnly {
+                       get { return false; }
+               }
+
+               public override void Save (Stream stream)
+               {
+                       if (stream == null)
+                               throw new ArgumentNullException ("stream");
+                       stream.WriteByte ((byte) '{');
+                       foreach (JsonPair pair in map) {
+                               stream.WriteByte ((byte) '"');
+                               byte [] bytes = Encoding.UTF8.GetBytes (EscapeString (pair.Key));
+                               stream.Write (bytes, 0, bytes.Length);
+                               stream.WriteByte ((byte) '"');
+                               stream.WriteByte ((byte) ',');
+                               stream.WriteByte ((byte) ' ');
+                               if (pair.Value == null) {
+                                       stream.WriteByte ((byte) 'n');
+                                       stream.WriteByte ((byte) 'u');
+                                       stream.WriteByte ((byte) 'l');
+                                       stream.WriteByte ((byte) 'l');
+                               } else
+                                       pair.Value.Save (stream);
+                       }
+                       stream.WriteByte ((byte) '}');
+               }
+
+               public bool TryGetValue (string key, out JsonValue value)
+               {
+                       return map.TryGetValue (key, out value);
+               }
+       }
+}
diff --git a/mcs/class/System.Json/System.Json/JsonPrimitive.cs b/mcs/class/System.Json/System.Json/JsonPrimitive.cs
new file mode 100644 (file)
index 0000000..6451878
--- /dev/null
@@ -0,0 +1,172 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace System.Json
+{
+       public class JsonPrimitive : JsonValue
+       {
+               object value;
+
+               public JsonPrimitive (bool value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (byte value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (char value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (decimal value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (double value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (float value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (int value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (long value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (sbyte value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (short value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (string value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (DateTime value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (uint value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (ulong value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (ushort value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (DateTimeOffset value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (Guid value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (TimeSpan value)
+               {
+                       this.value = value;
+               }
+
+               public JsonPrimitive (Uri value)
+               {
+                       this.value = value;
+               }
+
+               internal object Value {
+                       get { return value; }
+               }
+
+               public override JsonType JsonType {
+                       get {
+                               // FIXME: what should we do for null? Handle it as null so far.
+                               if (value == null)
+                                       return JsonType.String;
+
+                               switch (Type.GetTypeCode (value.GetType ())) {
+                               case TypeCode.Boolean:
+                                       return JsonType.Boolean;
+                               case TypeCode.Char:
+                               case TypeCode.String:
+                               case TypeCode.DateTime:
+                               case TypeCode.Object: // DateTimeOffset || Guid || TimeSpan || Uri
+                                       return JsonType.String;
+                               default:
+                                       return JsonType.Number;
+                               }
+                       }
+               }
+
+               static readonly byte [] true_bytes = Encoding.UTF8.GetBytes ("true");
+               static readonly byte [] false_bytes = Encoding.UTF8.GetBytes ("false");
+
+               public override void Save (Stream stream)
+               {
+                       switch (JsonType) {
+                       case JsonType.Boolean:
+                               if ((bool) value)
+                                       stream.Write (true_bytes, 0, 4);
+                               else
+                                       stream.Write (false_bytes, 0, 5);
+                               break;
+                       case JsonType.String:
+                               stream.WriteByte ((byte) '\"');
+                               byte [] bytes = Encoding.UTF8.GetBytes (EscapeString (value.ToString ()));
+                               stream.Write (bytes, 0, bytes.Length);
+                               stream.WriteByte ((byte) '\"');
+                               break;
+                       default:
+                               bytes = Encoding.UTF8.GetBytes (GetFormattedString ());
+                               stream.Write (bytes, 0, bytes.Length);
+                               break;
+                       }
+               }
+
+               internal string GetFormattedString ()
+               {
+                       switch (JsonType) {
+                       case JsonType.String:
+                               if (value is string || value == null)
+                                       return (string) value;
+                               throw new NotImplementedException ("GetFormattedString from value type " + value.GetType ());
+                       case JsonType.Number:
+                               return ((IFormattable) value).ToString ("G", NumberFormatInfo.InvariantInfo);
+                       default:
+                               throw new InvalidOperationException ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Json/System.Json/JsonType.cs b/mcs/class/System.Json/System.Json/JsonType.cs
new file mode 100644 (file)
index 0000000..c04f574
--- /dev/null
@@ -0,0 +1,11 @@
+namespace System.Json
+{
+       public enum JsonType
+       {
+               String,
+               Number,
+               Object,
+               Array,
+               Boolean,
+       }
+}
diff --git a/mcs/class/System.Json/System.Json/JsonValue.cs b/mcs/class/System.Json/System.Json/JsonValue.cs
new file mode 100644 (file)
index 0000000..1d16b88
--- /dev/null
@@ -0,0 +1,460 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.Serialization.Json;
+using System.Text;
+
+using JsonPair = System.Collections.Generic.KeyValuePair<string, System.Json.JsonValue>;
+
+
+namespace System.Json
+{
+       public abstract class JsonValue : IEnumerable
+       {
+               public static JsonValue Load (Stream stream)
+               {
+                       if (stream == null)
+                               throw new ArgumentNullException ("stream");
+                       return Load (new StreamReader (stream, true));
+               }
+
+               public static JsonValue Load (TextReader textReader)
+               {
+                       if (textReader == null)
+                               throw new ArgumentNullException ("textReader");
+
+                       var ret = new JavaScriptReader (textReader, true).Read ();
+
+                       return ToJsonValue (ret);
+               }
+
+               static IEnumerable<KeyValuePair<string,JsonValue>> ToJsonPairEnumerable (IEnumerable<KeyValuePair<string,object>> kvpc)
+               {
+                       foreach (var kvp in kvpc)
+                               yield return new KeyValuePair<string,JsonValue> (kvp.Key, ToJsonValue (kvp.Value));
+               }
+
+               static IEnumerable<JsonValue> ToJsonValueEnumerable (IEnumerable<object> arr)
+               {
+                       foreach (var obj in arr)
+                               yield return ToJsonValue (obj);
+               }
+
+               static JsonValue ToJsonValue (object ret)
+               {
+                       if (ret == null)
+                               return null;
+                       var kvpc = ret as IEnumerable<KeyValuePair<string,object>>;
+                       if (kvpc != null)
+                               return new JsonObject (ToJsonPairEnumerable (kvpc));
+                       var arr = ret as IEnumerable<object>;
+                       if (arr != null)
+                               return new JsonArray (ToJsonValueEnumerable (arr));
+
+                       if (ret is bool)
+                               return new JsonPrimitive ((bool) ret);
+                       if (ret is byte)
+                               return new JsonPrimitive ((byte) ret);
+                       if (ret is char)
+                               return new JsonPrimitive ((char) ret);
+                       if (ret is decimal)
+                               return new JsonPrimitive ((decimal) ret);
+                       if (ret is double)
+                               return new JsonPrimitive ((double) ret);
+                       if (ret is float)
+                               return new JsonPrimitive ((float) ret);
+                       if (ret is int)
+                               return new JsonPrimitive ((int) ret);
+                       if (ret is long)
+                               return new JsonPrimitive ((long) ret);
+                       if (ret is sbyte)
+                               return new JsonPrimitive ((sbyte) ret);
+                       if (ret is short)
+                               return new JsonPrimitive ((short) ret);
+                       if (ret is string)
+                               return new JsonPrimitive ((string) ret);
+                       if (ret is uint)
+                               return new JsonPrimitive ((uint) ret);
+                       if (ret is ulong)
+                               return new JsonPrimitive ((ulong) ret);
+                       if (ret is ushort)
+                               return new JsonPrimitive ((ushort) ret);
+                       if (ret is DateTime)
+                               return new JsonPrimitive ((DateTime) ret);
+                       if (ret is DateTimeOffset)
+                               return new JsonPrimitive ((DateTimeOffset) ret);
+                       if (ret is Guid)
+                               return new JsonPrimitive ((Guid) ret);
+                       if (ret is TimeSpan)
+                               return new JsonPrimitive ((TimeSpan) ret);
+                       if (ret is Uri)
+                               return new JsonPrimitive ((Uri) ret);
+                       throw new NotSupportedException (String.Format ("Unexpected parser return type: {0}", ret.GetType ()));
+               }
+
+               public static JsonValue Parse (string jsonString)
+               {
+                       if (jsonString == null)
+                               throw new ArgumentNullException ("jsonString");
+                       return Load (new StringReader (jsonString));
+               }
+
+               public virtual int Count {
+                       get { throw new InvalidOperationException (); }
+               }
+
+               public abstract JsonType JsonType { get; }
+
+               public virtual JsonValue this [int index] {
+                       get { throw new InvalidOperationException (); }
+                       set { throw new InvalidOperationException (); }
+               }
+
+               public virtual JsonValue this [string key] {
+                       get { throw new InvalidOperationException (); }
+                       set { throw new InvalidOperationException (); }
+               }
+
+               public virtual bool ContainsKey (string key)
+               {
+                       throw new InvalidOperationException ();
+               }
+
+               public virtual void Save (Stream stream)
+               {
+                       if (stream == null)
+                               throw new ArgumentNullException ("stream");
+                       Save (new StreamWriter (stream));
+               }
+
+               public virtual void Save (TextWriter textWriter)
+               {
+                       if (textWriter == null)
+                               throw new ArgumentNullException ("textWriter");
+                       SaveInternal (textWriter);
+               }
+               
+               void SaveInternal (TextWriter w)
+               {
+                       switch (JsonType) {
+                       case JsonType.Object:
+                               w.Write ('{');
+                               bool following = false;
+                               foreach (JsonPair pair in ((JsonObject) this)) {
+                                       if (following)
+                                               w.Write (", ");
+                                       w.Write ('\"');
+                                       w.Write (EscapeString (pair.Key));
+                                       w.Write ("\": ");
+                                       if (pair.Value == null)
+                                               w.Write ("null");
+                                       else
+                                               pair.Value.SaveInternal (w);
+                                       following = true;
+                               }
+                               w.Write ('}');
+                               break;
+                       case JsonType.Array:
+                               w.Write ('[');
+                               following = false;
+                               foreach (JsonValue v in ((JsonArray) this)) {
+                                       if (following)
+                                               w.Write (", ");
+                                       if (v != null) 
+                                               v.SaveInternal (w);
+                                       else
+                                               w.Write ("null");
+                                       following = true;
+                               }
+                               w.Write (']');
+                               break;
+                       case JsonType.Boolean:
+                               w.Write ((bool) this ? "true" : "false");
+                               break;
+                       case JsonType.String:
+                               w.Write ('"');
+                               w.Write (EscapeString (((JsonPrimitive) this).GetFormattedString ()));
+                               w.Write ('"');
+                               break;
+                       default:
+                               w.Write (((JsonPrimitive) this).GetFormattedString ());
+                               break;
+                       }
+               }
+
+               public override string ToString ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       Save (sw);
+                       return sw.ToString ();
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       throw new InvalidOperationException ();
+               }
+
+               internal string EscapeString (string src)
+               {
+                       if (src == null)
+                               return null;
+
+                       for (int i = 0; i < src.Length; i++)
+                               if (src [i] == '"' || src [i] == '\\') {
+                                       var sb = new StringBuilder ();
+                                       if (i > 0)
+                                               sb.Append (src, 0, i);
+                                       return DoEscapeString (sb, src, i);
+                               }
+                       return src;
+               }
+
+               string DoEscapeString (StringBuilder sb, string src, int cur)
+               {
+                       int start = cur;
+                       for (int i = cur; i < src.Length; i++)
+                               if (src [i] == '"' || src [i] == '\\') {
+                                       sb.Append (src, start, i - start);
+                                       sb.Append ('\\');
+                                       sb.Append (src [i++]);
+                                       start = i;
+                               }
+                       sb.Append (src, start, src.Length - start);
+                       return sb.ToString ();
+               }
+
+               // CLI -> JsonValue
+
+               public static implicit operator JsonValue (bool value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (byte value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (char value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (decimal value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (double value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (float value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (int value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (long value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (sbyte value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (short value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (string value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (uint value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (ulong value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (ushort value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (DateTime value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (DateTimeOffset value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (Guid value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (TimeSpan value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               public static implicit operator JsonValue (Uri value)
+               {
+                       return new JsonPrimitive (value);
+               }
+
+               // JsonValue -> CLI
+
+               public static implicit operator bool (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToBoolean (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator byte (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToByte (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator char (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToChar (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator decimal (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToDecimal (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator double (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToDouble (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator float (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToSingle (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator int (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToInt32 (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator long (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToInt64 (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator sbyte (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToSByte (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator short (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToInt16 (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator string (JsonValue value)
+               {
+                       if (value == null)
+                               return null;
+                       return (string) ((JsonPrimitive) value).Value;
+               }
+
+               public static implicit operator uint (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToUInt16 (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator ulong (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToUInt64(((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator ushort (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return Convert.ToUInt16 (((JsonPrimitive) value).Value);
+               }
+
+               public static implicit operator DateTime (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return (DateTime) ((JsonPrimitive) value).Value;
+               }
+
+               public static implicit operator DateTimeOffset (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return (DateTimeOffset) ((JsonPrimitive) value).Value;
+               }
+
+               public static implicit operator TimeSpan (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return (TimeSpan) ((JsonPrimitive) value).Value;
+               }
+
+               public static implicit operator Guid (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return (Guid) ((JsonPrimitive) value).Value;
+               }
+
+               public static implicit operator Uri (JsonValue value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+                       return (Uri) ((JsonPrimitive) value).Value;
+               }
+       }
+}
index c302a5150733befb88c44d70e01f5b2b16d2d876..2459c1fc3ad0f27478d902ffaccc6f2ec3f0d371 100644 (file)
@@ -17,6 +17,15 @@ namespace MonoTests.System
        [TestFixture]
        public class JsonValueTests {
                // Tests that a trailing comma is allowed in dictionary definitions
+               [Test]
+               public void LoadWithTrailingComma ()
+               {
+                       var j = JsonValue.Load (new StringReader ("{ \"a\": \"b\",}"));
+                       Assert.AreEqual (1, j.Count, "itemcount");
+                       Assert.AreEqual (JsonType.String, j ["a"].JsonType, "type");
+                       Assert.AreEqual ("b", (string) j ["a"], "value");
+               }
+
                // Test that we correctly serialize JsonArray with null elements.
                [Test]
                public void ToStringOnJsonArrayWithNulls () {
@@ -24,7 +33,7 @@ namespace MonoTests.System
                        Assert.AreEqual (4, j.Count, "itemcount");
                        Assert.AreEqual (JsonType.Array, j.JsonType, "type");
                        var str = j.ToString ();
-                       Assert.AreEqual ("[1,2,3,null]", str);
+                       Assert.AreEqual (str, "[1, 2, 3, null]");
                }
        }
 }
diff --git a/mcs/class/System.Reactive.Core/Makefile b/mcs/class/System.Reactive.Core/Makefile
new file mode 100644 (file)
index 0000000..1a09fb5
--- /dev/null
@@ -0,0 +1,58 @@
+thisdir = class/System.Reactive.Core
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Core.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+       Strings_Core.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Core.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+       $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+       cp $* $@
+
+dist-default: $(PREBUILT)
+
diff --git a/mcs/class/System.Reactive.Core/Strings_Core.resources.prebuilt b/mcs/class/System.Reactive.Core/Strings_Core.resources.prebuilt
new file mode 100644 (file)
index 0000000..1bde584
Binary files /dev/null and b/mcs/class/System.Reactive.Core/Strings_Core.resources.prebuilt differ
diff --git a/mcs/class/System.Reactive.Core/Strings_Core.resx b/mcs/class/System.Reactive.Core/Strings_Core.resx
new file mode 100644 (file)
index 0000000..253ca99
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="CANT_OBTAIN_SCHEDULER" xml:space="preserve">
+    <value>Using the Scheduler.{0} property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please include System.Reactive.PlatformServices for your target platform and use the {0}Scheduler type instead. If you're building a Windows Store app, notice some schedulers are no longer supported. Consider using Scheduler.Default instead.</value>
+  </data>
+  <data name="COMPLETED_NO_VALUE" xml:space="preserve">
+    <value>OnCompleted notification doesn't have a value.</value>
+  </data>
+  <data name="DISPOSABLE_ALREADY_ASSIGNED" xml:space="preserve">
+    <value>Disposable has already been assigned.</value>
+  </data>
+  <data name="FAILED_CLOCK_MONITORING" xml:space="preserve">
+    <value>Failed to start monitoring system clock changes.</value>
+  </data>
+  <data name="HEAP_EMPTY" xml:space="preserve">
+    <value>Heap is empty.</value>
+  </data>
+  <data name="OBSERVER_TERMINATED" xml:space="preserve">
+    <value>Observer has already terminated.</value>
+  </data>
+  <data name="REENTRANCY_DETECTED" xml:space="preserve">
+    <value>Reentrancy has been detected.</value>
+  </data>
+  <data name="SCHEDULER_OPERATION_ALREADY_AWAITED" xml:space="preserve">
+    <value>This scheduler operation has already been awaited.</value>
+    <comment>Only on .NET 4.5 and above.</comment>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Reactive.Core/System.Reactive.Core.dll.sources b/mcs/class/System.Reactive.Core/System.Reactive.Core.dll.sources
new file mode 100644 (file)
index 0000000..257e51f
--- /dev/null
@@ -0,0 +1,78 @@
+../../../external/rx/Rx.NET/System.Reactive.Core/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Observable.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Observer.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/AnonymousSafeObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CatchScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ConcurrencyAbstractionLayer.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Wrappers.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DisableOptimizationsScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.Emulation.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.TimerQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Services.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/CurrentThreadScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ImmediateScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/LocalScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/ScheduledItem.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Recursive.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Scheduler.Simple.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerDefaults.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerOperation.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SchedulerWrapper.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Stopwatch.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.ObserveOn.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/Synchronization.Synchronize.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/SynchronizationContextScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/DefaultScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/AsyncLockObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/CheckedObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentDictionary.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ConcurrentQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/AnonymousDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/BooleanDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/CancellationDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/CompositeDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/ContextDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/DefaultDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/Disposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/MultipleAssignmentDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/RefCountDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/ScheduledDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/SerialDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Disposables/SingleAssignmentDisposable.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/AutoDetachObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ExceptionServices.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/HostLifecycleService.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ImmutableList.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Lazy.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Observers.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/PlatformEnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/PriorityQueue.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Producer.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SafeObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/ScheduledObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Silverlight.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Semaphore.Xna.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Sink.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/Stubs.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizationContextExtensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SynchronizedObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Internal/SystemClock.Default.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Notification.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/ObservableBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/ObserverBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Reactive/Unit.cs
+../../../external/rx/Rx.NET/System.Reactive.Core/Strings_Core.Generated.cs
diff --git a/mcs/class/System.Reactive.Core/more_build_args b/mcs/class/System.Reactive.Core/more_build_args
new file mode 100644 (file)
index 0000000..f832406
--- /dev/null
@@ -0,0 +1,4 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Core.resources,System.Reactive.Strings_Core.resources
diff --git a/mcs/class/System.Reactive.Debugger/Makefile b/mcs/class/System.Reactive.Debugger/Makefile
new file mode 100644 (file)
index 0000000..24d6fa7
--- /dev/null
@@ -0,0 +1,36 @@
+thisdir = class/System.Reactive.Debugger
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Debugger.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Debugger.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reactive.Debugger/System.Reactive.Debugger.dll.sources b/mcs/class/System.Reactive.Debugger/System.Reactive.Debugger.dll.sources
new file mode 100644 (file)
index 0000000..711f341
--- /dev/null
@@ -0,0 +1,2 @@
+../../../external/rx/Rx.NET/System.Reactive.Debugger/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Debugger/Reactive/Linq/QueryDebugger.cs
diff --git a/mcs/class/System.Reactive.Debugger/more_build_args b/mcs/class/System.Reactive.Debugger/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/System.Reactive.Experimental/Makefile b/mcs/class/System.Reactive.Experimental/Makefile
new file mode 100644 (file)
index 0000000..effbc88
--- /dev/null
@@ -0,0 +1,36 @@
+thisdir = class/System.Reactive.Experimental
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Experimental.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Experimental.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reactive.Experimental/System.Reactive.Experimental.dll.sources b/mcs/class/System.Reactive.Experimental/System.Reactive.Experimental.dll.sources
new file mode 100644 (file)
index 0000000..014a9c9
--- /dev/null
@@ -0,0 +1,10 @@
+../../../external/rx/Rx.NET/System.Reactive.Experimental/ExperimentalAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/IQueryLanguageEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/ObservableEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QbservableEx.Generated.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/Linq/QueryLanguageEx.cs
+../../../external/rx/Rx.NET/System.Reactive.Experimental/Reactive/ListObservable.cs
diff --git a/mcs/class/System.Reactive.Experimental/more_build_args b/mcs/class/System.Reactive.Experimental/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/System.Reactive.Interfaces/Makefile b/mcs/class/System.Reactive.Interfaces/Makefile
new file mode 100644 (file)
index 0000000..79ccee2
--- /dev/null
@@ -0,0 +1,33 @@
+thisdir = class/System.Reactive.Interfaces
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Interfaces.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Interfaces.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reactive.Interfaces/System.Reactive.Interfaces.dll.sources b/mcs/class/System.Reactive.Interfaces/System.Reactive.Interfaces.dll.sources
new file mode 100644 (file)
index 0000000..2ce2955
--- /dev/null
@@ -0,0 +1,24 @@
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/AssemblyFileVersionAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/DateTimeOffset.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/IObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/IObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerPeriodic.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatchProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduledItem.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/ISchedulerLongRunning.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Concurrency/IStopwatch.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Disposables/ICancelable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventPatternSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IEventSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/IObserver.Result.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IGroupedObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Linq/IQbservableProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/IConnectableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Interfaces/Reactive/Subjects/ISubject.Multi.cs
diff --git a/mcs/class/System.Reactive.Interfaces/more_build_args b/mcs/class/System.Reactive.Interfaces/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/System.Reactive.Linq/Makefile b/mcs/class/System.Reactive.Linq/Makefile
new file mode 100644 (file)
index 0000000..853d222
--- /dev/null
@@ -0,0 +1,59 @@
+thisdir = class/System.Reactive.Linq
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Linq.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+       Strings_Linq.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Linq.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+       $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+       cp $* $@
+
+dist-default: $(PREBUILT)
+
diff --git a/mcs/class/System.Reactive.Linq/Strings_Linq.resources.prebuilt b/mcs/class/System.Reactive.Linq/Strings_Linq.resources.prebuilt
new file mode 100644 (file)
index 0000000..f46874b
Binary files /dev/null and b/mcs/class/System.Reactive.Linq/Strings_Linq.resources.prebuilt differ
diff --git a/mcs/class/System.Reactive.Linq/Strings_Linq.resx b/mcs/class/System.Reactive.Linq/Strings_Linq.resx
new file mode 100644 (file)
index 0000000..8965ebb
--- /dev/null
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="CANT_ADVANCE_WHILE_RUNNING" xml:space="preserve">
+    <value>{0} cannot be called when the scheduler is already running. Try using Sleep instead.</value>
+  </data>
+  <data name="COULD_NOT_FIND_INSTANCE_EVENT" xml:space="preserve">
+    <value>Could not find event '{0}' on object of type '{1}'.</value>
+  </data>
+  <data name="COULD_NOT_FIND_STATIC_EVENT" xml:space="preserve">
+    <value>Could not find event '{0}' on type '{1}'.</value>
+  </data>
+  <data name="EVENT_ADD_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
+    <value>Add method should take 1 parameter.</value>
+  </data>
+  <data name="EVENT_ARGS_NOT_ASSIGNABLE" xml:space="preserve">
+    <value>The second parameter of the event delegate must be assignable to '{0}'.</value>
+  </data>
+  <data name="EVENT_MISSING_ADD_METHOD" xml:space="preserve">
+    <value>Event is missing the add method.</value>
+  </data>
+  <data name="EVENT_MISSING_REMOVE_METHOD" xml:space="preserve">
+    <value>Event is missing the remove method.</value>
+  </data>
+  <data name="EVENT_MUST_RETURN_VOID" xml:space="preserve">
+    <value>The event delegate must have a void return type.</value>
+  </data>
+  <data name="EVENT_PATTERN_REQUIRES_TWO_PARAMETERS" xml:space="preserve">
+    <value>The event delegate must have exactly two parameters.</value>
+  </data>
+  <data name="EVENT_REMOVE_METHOD_SHOULD_TAKE_ONE_PARAMETER" xml:space="preserve">
+    <value>Remove method should take 1 parameter.</value>
+  </data>
+  <data name="EVENT_SENDER_NOT_ASSIGNABLE" xml:space="preserve">
+    <value>The first parameter of the event delegate must be assignable to '{0}'.</value>
+  </data>
+  <data name="EVENT_WINRT_REMOVE_METHOD_SHOULD_TAKE_ERT" xml:space="preserve">
+    <value>Remove method of a WinRT event should take an EventRegistrationToken.</value>
+    <comment>Only onn platforms supporting WinRT.</comment>
+  </data>
+  <data name="MORE_THAN_ONE_ELEMENT" xml:space="preserve">
+    <value>Sequence contains more than one element.</value>
+  </data>
+  <data name="MORE_THAN_ONE_MATCHING_ELEMENT" xml:space="preserve">
+    <value>Sequence contains more than one matching element.</value>
+  </data>
+  <data name="NO_ELEMENTS" xml:space="preserve">
+    <value>Sequence contains no elements.</value>
+  </data>
+  <data name="NO_MATCHING_ELEMENTS" xml:space="preserve">
+    <value>Sequence contains no matching element.</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Reactive.Linq/System.Reactive.Linq.dll.sources b/mcs/class/System.Reactive.Linq/System.Reactive.Linq.dll.sources
new file mode 100644 (file)
index 0000000..8963575
--- /dev/null
@@ -0,0 +1,171 @@
+../../../external/rx/Rx.NET/System.Reactive.Linq/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/NamespaceDocs.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/ConcatSink.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Helpers.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/IConcatenatable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/IEvaluatableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/QueryServices.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/ReflectionUtils.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/HashSet.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Lookup.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/LocalQueryMethodImplementationTypeAttribute.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Case.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Collect.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/If.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/For.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DoWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/While.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLastBuffer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Next.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MostRecent.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Latest.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/PushToPullAdapter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/RefCount.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Multicast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Multiple.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Single.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.StandardSequenceOperators.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Time.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Awaiter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Binding.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Blocking.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Concurrency.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Conversions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Creation.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Events.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Aggregates.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/QueryLanguage.Imperative.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/IQueryLanguage.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Imperative.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSourceBase.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventPatternSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/EventSource.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/InternalsVisibleTo.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Async.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Events.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/HistoricalScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Concurrency/VirtualTimeScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/AnonymousEnumerable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/BinaryObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AddRef.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Aggregate.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/All.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Amb.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Any.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/AsObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Average.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Buffer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Catch.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Concat.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Contains.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Cast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/CombineLatest.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GetEnumerator.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupJoin.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Join.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SelectMany.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Zip.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OfType.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Count.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DefaultIfEmpty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Defer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Delay.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DelaySubscription.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Dematerialize.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Distinct.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/DistinctUntilChanged.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Do.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ElementAt.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Empty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Finally.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FirstAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ForEach.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEvent.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/FromEventPattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Generate.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/GroupByUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IgnoreElements.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/IsEmpty.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LastAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/LongCount.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Materialize.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Max.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MaxBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Merge.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Min.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/MinBy.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Never.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/OnErrorResumeNext.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Range.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Repeat.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Return.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sample.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Scan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Select.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SequenceEqual.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SingleAsync.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Skip.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipLast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/SkipWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Sum.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Switch.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Take.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeLast.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeUntil.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TakeWhile.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throttle.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Throw.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/TimeInterval.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timeout.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timer.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Timestamp.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToArray.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToDictionary.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToList.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToLookup.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/ToObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Using.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Where.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/Window.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observαble/_.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ConnectableObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.Extensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/Either.Generic.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/AsyncSubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/BehaviorSubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/Subject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/GroupedObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/ActivePlan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/JoinObserver.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/Pattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Joins/Plan.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Aggregates.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Awaiter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Binding.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Blocking.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Concurrency.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Conversions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Creation.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Multiple.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Single.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.StandardSequenceOperators.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Linq/Observable.Time.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/PushPullAdapter.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Subjects/ReplaySubject.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/NamespaceDoc.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Threading/Tasks/TaskObservableExtensions.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/TimeInterval.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Reactive/Timestamped.cs
+../../../external/rx/Rx.NET/System.Reactive.Linq/Strings_Linq.Generated.cs
diff --git a/mcs/class/System.Reactive.Linq/more_build_args b/mcs/class/System.Reactive.Linq/more_build_args
new file mode 100644 (file)
index 0000000..d2c11c8
--- /dev/null
@@ -0,0 +1,4 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Linq.resources,System.Reactive.Strings_Linq.resources
diff --git a/mcs/class/System.Reactive.PlatformServices/Makefile b/mcs/class/System.Reactive.PlatformServices/Makefile
new file mode 100644 (file)
index 0000000..05f493f
--- /dev/null
@@ -0,0 +1,65 @@
+thisdir = class/System.Reactive.PlatformServices
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.PlatformServices.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+       Strings_PlatformServices.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+NO_TASK_DELAY := $(filter 4.5 2.1, $(FRAMEWORK_VERSION))
+ifndef NO_TASK_DELAY
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:Mono.Reactive.Tests.dll
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.PlatformServices.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+       $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+       cp $* $@
+
+dist-default: $(PREBUILT)
+
diff --git a/mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resources.prebuilt b/mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resources.prebuilt
new file mode 100644 (file)
index 0000000..1612fc5
Binary files /dev/null and b/mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resources.prebuilt differ
diff --git a/mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resx b/mcs/class/System.Reactive.PlatformServices/Strings_PlatformServices.resx
new file mode 100644 (file)
index 0000000..f796d0a
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="WINRT_NO_SUB1MS_TIMERS" xml:space="preserve">
+    <value>The WinRT thread pool doesn't support creating periodic timers with a period below 1 millisecond.</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Reactive.PlatformServices/System.Reactive.PlatformServices.dll.sources b/mcs/class/System.Reactive.PlatformServices/System.Reactive.PlatformServices.dll.sources
new file mode 100644 (file)
index 0000000..9950bee
--- /dev/null
@@ -0,0 +1,18 @@
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/EventLoopScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/NewThreadScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/Thread.Stub.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/EnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.WindowsPhone.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/HostLifecycleNotifications.Windows.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PhoneShellThunks.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/StopwatchImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/TaskPoolScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Concurrency/ThreadPoolScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/ExceptionServicesImpl.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Reactive/Internal/PlatformEnlightenmentProvider.cs
+../../../external/rx/Rx.NET/System.Reactive.PlatformServices/Strings_PlatformServices.Generated.cs
diff --git a/mcs/class/System.Reactive.PlatformServices/more_build_args b/mcs/class/System.Reactive.PlatformServices/more_build_args
new file mode 100644 (file)
index 0000000..630b370
--- /dev/null
@@ -0,0 +1,4 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_PlatformServices.resources,System.Reactive.Strings_PlatformServices.resources
diff --git a/mcs/class/System.Reactive.Providers/Makefile b/mcs/class/System.Reactive.Providers/Makefile
new file mode 100644 (file)
index 0000000..7ce54a2
--- /dev/null
@@ -0,0 +1,60 @@
+thisdir = class/System.Reactive.Providers
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Providers.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+       Strings_Providers.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Providers.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+       $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+       cp $* $@
+
+dist-default: $(PREBUILT)
+
diff --git a/mcs/class/System.Reactive.Providers/Strings_Providers.resources.prebuilt b/mcs/class/System.Reactive.Providers/Strings_Providers.resources.prebuilt
new file mode 100644 (file)
index 0000000..de6ece6
Binary files /dev/null and b/mcs/class/System.Reactive.Providers/Strings_Providers.resources.prebuilt differ
diff --git a/mcs/class/System.Reactive.Providers/Strings_Providers.resx b/mcs/class/System.Reactive.Providers/Strings_Providers.resx
new file mode 100644 (file)
index 0000000..aba90dd
--- /dev/null
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="EXPECTED_TOQUERYABLE_METHODCALL" xml:space="preserve">
+    <value>Expected Qbservable.ToQueryable.</value>
+  </data>
+  <data name="INVALID_TREE_TYPE" xml:space="preserve">
+    <value>Invalid expression tree type.</value>
+  </data>
+  <data name="NO_MATCHING_METHOD_FOUND" xml:space="preserve">
+    <value>There is no method '{0}' on type '{1}' that matches the specified arguments.</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Reactive.Providers/System.Reactive.Providers.dll.sources b/mcs/class/System.Reactive.Providers/System.Reactive.Providers.dll.sources
new file mode 100644 (file)
index 0000000..13780f9
--- /dev/null
@@ -0,0 +1,12 @@
+../../../external/rx/Rx.NET/System.Reactive.Providers/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePattern.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Joins/QueryablePlan.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/ExpressionVisitor.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Observable.Queryable.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/Linq/Qbservable.Joins.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Reactive/ObservableQuery.cs
+../../../external/rx/Rx.NET/System.Reactive.Providers/Strings_Providers.Generated.cs
diff --git a/mcs/class/System.Reactive.Providers/more_build_args b/mcs/class/System.Reactive.Providers/more_build_args
new file mode 100644 (file)
index 0000000..264c0c0
--- /dev/null
@@ -0,0 +1,4 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_Providers.resources,System.Reactive.Strings_Providers.resources
diff --git a/mcs/class/System.Reactive.Runtime.Remoting/Makefile b/mcs/class/System.Reactive.Runtime.Remoting/Makefile
new file mode 100644 (file)
index 0000000..948dcef
--- /dev/null
@@ -0,0 +1,36 @@
+thisdir = class/System.Reactive.Runtime.Remoting
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Runtime.Remoting.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Runtime.Remoting.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.dll.sources b/mcs/class/System.Reactive.Runtime.Remoting/System.Reactive.Runtime.Remoting.dll.sources
new file mode 100644 (file)
index 0000000..ee06dc6
--- /dev/null
@@ -0,0 +1,4 @@
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/Observable.Remoting.cs
+../../../external/rx/Rx.NET/System.Reactive.Runtime.Remoting/Reactive/Linq/QueryLanguage.Remoting.cs
diff --git a/mcs/class/System.Reactive.Runtime.Remoting/more_build_args b/mcs/class/System.Reactive.Runtime.Remoting/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/System.Reactive.Windows.Forms/Makefile b/mcs/class/System.Reactive.Windows.Forms/Makefile
new file mode 100644 (file)
index 0000000..7fb7d8f
--- /dev/null
@@ -0,0 +1,37 @@
+thisdir = class/System.Reactive.Windows.Forms
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Windows.Forms.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll \
+               -r:System.Windows.Forms.dll
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Windows.Forms.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.dll.sources b/mcs/class/System.Reactive.Windows.Forms/System.Reactive.Windows.Forms.dll.sources
new file mode 100644 (file)
index 0000000..ab1f8f9
--- /dev/null
@@ -0,0 +1,4 @@
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Reactive/Linq/ControlObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Reactive/Concurrency/ControlScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Forms/Properties/AssemblyInfo.cs
diff --git a/mcs/class/System.Reactive.Windows.Forms/more_build_args b/mcs/class/System.Reactive.Windows.Forms/more_build_args
new file mode 100644 (file)
index 0000000..a53ee7b
--- /dev/null
@@ -0,0 +1,3 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
diff --git a/mcs/class/System.Reactive.Windows.Threading/Makefile b/mcs/class/System.Reactive.Windows.Threading/Makefile
new file mode 100644 (file)
index 0000000..ba11123
--- /dev/null
@@ -0,0 +1,61 @@
+thisdir = class/System.Reactive.Windows.Threading
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reactive.Windows.Threading.dll
+LIB_MCS_FLAGS = \
+               @more_build_args \
+               -r:System.dll \
+               -r:System.Core.dll \
+               -r:System.Reactive.Interfaces.dll \
+               -r:System.Reactive.Core.dll \
+               -r:System.Reactive.Linq.dll \
+               -r:WindowsBase.dll
+
+ifeq (true, $(GENERATE_RESOURCES))
+LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
+endif
+
+RESX_RESOURCES = \
+       Strings_WindowsThreading.resources
+
+CLEAN_FILES += $(RESX_RESOURCES)
+
+RESOURCES = $(RESX_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NO_TASK_DELAY
+endif
+
+NET_4_5 := $(filter 4.5, $(FRAMEWORK_VERSION))
+ifdef NET_4_5
+LIB_MCS_FLAGS += -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC
+endif
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
+
+VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.System.Reactive.Windows.Threading.dll
+NO_SIGN_ASSEMBLY = yes
+endif
+
+NO_INSTALL = yes
+NO_TEST = yes
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES)
+
+$(RESX_RESOURCES): %.resources: %.resx
+       $(RESGEN) $< || cp $@.prebuilt $@
+
+$(PREBUILT): %.prebuilt: %
+       cp $* $@
+
+dist-default: $(PREBUILT)
+
diff --git a/mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resources.prebuilt b/mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resources.prebuilt
new file mode 100644 (file)
index 0000000..6173d36
Binary files /dev/null and b/mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resources.prebuilt differ
diff --git a/mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx b/mcs/class/System.Reactive.Windows.Threading/Strings_WindowsThreading.resx
new file mode 100644 (file)
index 0000000..85f5101
--- /dev/null
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="NO_DISPATCHER_CURRENT_THREAD" xml:space="preserve">
+    <value>The current thread has no Dispatcher associated with it.</value>
+    <comment>Only on WPF/SL.</comment>
+  </data>
+  <data name="NO_WINDOW_CURRENT" xml:space="preserve">
+    <value>No current Window object found to obtain a CoreDispatcher from.</value>
+    <comment>Only on Jupiter.</comment>
+  </data>
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.dll.sources b/mcs/class/System.Reactive.Windows.Threading/System.Reactive.Windows.Threading.dll.sources
new file mode 100644 (file)
index 0000000..7b287a8
--- /dev/null
@@ -0,0 +1,8 @@
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/GlobalSuppressions.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/CoreDispatcherScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Internal/Constants.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/CoreDispatcherObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Linq/DispatcherObservable.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Reactive/Concurrency/DispatcherScheduler.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Properties/AssemblyInfo.cs
+../../../external/rx/Rx.NET/System.Reactive.Windows.Threading/Strings_WindowsThreading.Generated.cs
diff --git a/mcs/class/System.Reactive.Windows.Threading/more_build_args b/mcs/class/System.Reactive.Windows.Threading/more_build_args
new file mode 100644 (file)
index 0000000..aa3becf
--- /dev/null
@@ -0,0 +1,4 @@
+-d:SIGNED
+-delaysign
+-keyfile:../reactive.pub
+-resource:Strings_WindowsThreading.resources,System.Reactive.Strings_WindowsThreading.resources
index 8db9136f7002c8db5e1911eec31952ed9662804c..43b846aaad72480e334680b124f71208eb7a3f83 100755 (executable)
@@ -74,14 +74,16 @@ namespace System.Runtime.Serialization
          exists (and raises InvalidOperationException if required).
 
 */
+
        internal static class TypeExtensions
        {
+#if !NET_4_5
                public static T GetCustomAttribute<T> (this MemberInfo type, bool inherit)
                {
                        var arr = type.GetCustomAttributes (typeof (T), inherit);
                        return arr != null && arr.Length == 1 ? (T) arr [0] : default (T);
                }
-
+#endif
                public static IEnumerable<Type> GetInterfacesOrSelfInterface (this Type type)
                {
                        if (type.IsInterface)
index aa6aba42b6baf7ead86b09a11fb453b8471a6bf5..6d18817c20f5a9abd8139b296c59750e7ed2db84 100644 (file)
@@ -174,14 +174,23 @@ namespace System.Runtime.Serialization.Json
                                        OnDeserializing = mi;
                                else if (mi.GetCustomAttributes (typeof (OnDeserializedAttribute), false).Length > 0)
                                        OnDeserialized = mi;
+                               else if (mi.GetCustomAttributes (typeof (OnSerializingAttribute), false).Length > 0)
+                                       OnSerializing = mi;
+                               else if (mi.GetCustomAttributes (typeof (OnSerializedAttribute), false).Length > 0)
+                                       OnSerialized = mi;
                        }
                }
 
                public MethodInfo OnDeserializing { get; set; }
                public MethodInfo OnDeserialized { get; set; }
+               public MethodInfo OnSerializing { get; set; }
+               public MethodInfo OnSerialized { get; set; }
 
                public virtual void Serialize (JsonSerializationWriter outputter, object graph, string type)
                {
+                       if (OnSerializing != null)
+                               OnSerializing.Invoke (graph, new object [] {new StreamingContext (StreamingContextStates.All)});
+
                        outputter.Writer.WriteAttributeString ("type", type);
                        foreach (TypeMapMember member in members) {
                                object memberObj = member.GetMemberOf (graph);
@@ -190,6 +199,9 @@ namespace System.Runtime.Serialization.Json
                                outputter.WriteObjectContent (memberObj, false, false);
                                outputter.Writer.WriteEndElement ();
                        }
+
+                       if (OnSerialized != null)
+                               OnSerialized.Invoke (graph, new object [] {new StreamingContext (StreamingContextStates.All)});
                }
 
                internal static object CreateInstance (Type type)
index 587880e9c6c9850a397d5d010a1758a41a63d4c7..9857450eded085b17177d68690eac5f3a2245c29 100644 (file)
@@ -111,7 +111,7 @@ namespace System.ServiceModel.Web
                        // do nothing
                }
 
-#if NET_4_0
+#if NET_4_0 && !MOBILE
                static readonly XmlWriterSettings settings = new XmlWriterSettings () { OmitXmlDeclaration = true, Indent = false };
                XmlSerializer document_serializer, feed_serializer, item_serializer;
 
index f27a2d9d27b7c8795cc8d78d80593b102c7d7d7f..a41802469eb092bff030f7b736004a7c361e0978 100644 (file)
@@ -411,6 +411,16 @@ namespace MonoTests.System
                        Assert.AreEqual ("vv", m.QueryParameters ["p1"], "#5");
                }
 
+               [Test]
+               public void Match3 ()
+               {
+                       var template = new UriTemplate ("test");
+                       var match1 = template.Match (new Uri ("http://something"), new Uri ("http://something/test"));
+                       var match2 = template.Match (new Uri ("http://something/something2"), new Uri ("http://something/something2/test"));
+                       Assert.IsNotNull (match1, "#1");
+                       Assert.IsNotNull (match2, "#2");
+               }
+               
                [Test]
                public void MatchWildcard ()
                {
index 85f8666ad662c6b7bbc8c578ccaf06c163b4abe2..1aaf90fae44cf7210f605f6816acee19aeaa6187 100755 (executable)
@@ -48,7 +48,8 @@ TEST_EXTRA_FILES = \
        Test/XmlFiles/* \
        Test/System.ServiceModel.Channels/soap-fault*.xml \
        Test/System.ServiceModel.Channels/binary-message.raw \
-       Test/System.ServiceModel.Description/dump.xml
+       Test/System.ServiceModel.Description/dump.xml \
+       Test/MetadataTests/Resources/*
 
 EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_EXTRA_FILES)
 
index 35e67b9c082bb50eee1aa73e54778fcfeac74c67..66f2673acf8d3fcc554124a3c6362f70bb669927 100644 (file)
    <Compile Include="System.ServiceModel\AddressAccessDeniedException.cs" />
    <Compile Include="System.ServiceModel\AddressAlreadyInUseException.cs" />
    <Compile Include="System.ServiceModel\AllEnums.cs" />
-   <Compile Include="System.ServiceModel\BasicHttpBinding.cs" />
+   <Compile Include="System.ServiceModel\HttpBindingBase.cs" />
+   <Compile Include="System.ServiceModel\BasicHttpBinding_4_5.cs" />
    <Compile Include="System.ServiceModel\BasicHttpMessageSecurity.cs" />
    <Compile Include="System.ServiceModel\BasicHttpSecurity.cs" />
    <Compile Include="System.ServiceModel\CallbackBehaviorAttribute.cs" />
index 596f9df5de23fba187fa085692396590789300c1..5ab5d92ee0bb032129f4fd98a2467495cee3bedd 100644 (file)
@@ -138,18 +138,18 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
                        WsdlEndpointConversionContext context)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter,
                        PolicyConversionContext context)
                {
-                       throw new NotImplementedException ();
+                       PolicyAssertionCollection assertions = context.GetBindingAssertions ();
+                       XmlDocument doc = new XmlDocument ();
+
+                       assertions.Add (doc.CreateElement ("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
                }
 #endif
        }
index eb1ce2cc51d316b757444be1398c3efe357e9613..4a22c093813b6bed844487fc386ae53b40257042 100644 (file)
@@ -1,10 +1,12 @@
 //
 // ConnectionOrientedTransportBindingElement.cs
 //
-// Author:
+// Authors:
 //     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
 //
 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -31,12 +33,13 @@ using System.Net;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.Xml;
+using WS = System.Web.Services.Description;
 
 namespace System.ServiceModel.Channels
 {
        [MonoTODO]
        public abstract class ConnectionOrientedTransportBindingElement
-               : TransportBindingElement, IPolicyExportExtension
+               : TransportBindingElement, IPolicyExportExtension, IWsdlExportExtension
        {
                int connection_buf_size = 0x2000, max_buf_size = 0x10000,
                        max_pending_conn = 10, max_pending_accepts = 1;
@@ -138,6 +141,37 @@ namespace System.ServiceModel.Channels
                        return base.GetProperty<T> (context);
                }
 
+               void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
+                                                         WsdlContractConversionContext context)
+               {
+                       ;
+               }
+               
+               void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
+                                                         WsdlEndpointConversionContext context)
+               {
+                       var soap_binding = new WS.Soap12Binding ();
+                       soap_binding.Transport = "http://schemas.microsoft.com/soap/tcp";
+                       soap_binding.Style = WS.SoapBindingStyle.Document;
+                       context.WsdlBinding.Extensions.Add (soap_binding);
+
+                       var address = context.Endpoint.Address;
+                       var uri = address.Uri.AbsoluteUri;
+
+                       var soap_address = new WS.Soap12AddressBinding ();
+                       soap_address.Location = uri;
+                       context.WsdlPort.Extensions.Add (soap_address);
+
+                       var doc = new XmlDocument ();
+                       var endpoint_ref = doc.CreateElement (
+                               "EndpointReference", AddressingVersion.WSAddressing10.Namespace);
+                       var endpoint_addr = doc.CreateElement (
+                               "Address", AddressingVersion.WSAddressing10.Namespace);
+                       endpoint_addr.InnerText = uri;
+                       endpoint_ref.AppendChild (endpoint_addr);
+                       context.WsdlPort.Extensions.Add (endpoint_ref);
+               }
+
                void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter, PolicyConversionContext context)
                {
                        if (exporter == null)
@@ -148,8 +182,11 @@ namespace System.ServiceModel.Channels
                        PolicyAssertionCollection assertions = context.GetBindingAssertions ();
                        XmlDocument doc = new XmlDocument ();
 
-                       assertions.Add (doc.CreateElement ("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl"));
-                       assertions.Add (doc.CreateElement ("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
+                       var messageEncodingElement = ExportAddressingPolicy (context);
+                       if (messageEncodingElement == null)
+                               assertions.Add (doc.CreateElement (
+                                       "msb", "BinaryEncoding",
+                                       "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1"));
 
                        if (transfer_mode == TransferMode.Streamed || transfer_mode == TransferMode.StreamedRequest ||
                                transfer_mode == TransferMode.StreamedResponse)
index 470d0bc8cefa4a1cbbcffc93412e226203134809..d2da1dd5d8520b3ccae4e7e2f924de3d2d065823 100644 (file)
@@ -38,6 +38,9 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Channels.Http;
 #endif
 using System.ServiceModel.Description;
+#if !MOBILE
+using WS = System.Web.Services.Description;
+#endif
 using System.Xml;
 
 namespace System.ServiceModel.Channels
@@ -278,20 +281,54 @@ namespace System.ServiceModel.Channels
                        PolicyAssertionCollection assertions = context.GetBindingAssertions ();
                        XmlDocument doc = new XmlDocument ();
 
-                       assertions.Add (doc.CreateElement ("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl"));
+                       ExportAddressingPolicy (context);
 
                        switch (auth_scheme) {
-                               case AuthenticationSchemes.Basic:
-                               case AuthenticationSchemes.Digest:
-                               case AuthenticationSchemes.Negotiate:
-                               case AuthenticationSchemes.Ntlm:
-                                       assertions.Add (doc.CreateElement ("http", 
+                       case AuthenticationSchemes.Basic:
+                       case AuthenticationSchemes.Digest:
+                       case AuthenticationSchemes.Negotiate:
+                       case AuthenticationSchemes.Ntlm:
+                               assertions.Add (doc.CreateElement ("http", 
                                                auth_scheme.ToString () + "Authentication", 
                                                "http://schemas.microsoft.com/ws/06/2004/policy/http"));
-                                       break;
+                               break;
+                       }
+
+                       var transportProvider = this as ITransportTokenAssertionProvider;
+                       if (transportProvider != null) {
+                               var token = transportProvider.GetTransportTokenAssertion ();
+                               assertions.Add (CreateTransportBinding (token));
                        }
                }
 
+               XmlElement CreateTransportBinding (XmlElement transportToken)
+               {
+                       var doc = new XmlDocument ();
+                       var transportBinding = doc.CreateElement (
+                               "sp", "TransportBinding", PolicyImportHelper.SecurityPolicyNS);
+
+                       var token = doc.CreateElement (
+                               "sp", "TransportToken", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (token, transportToken);
+
+                       var algorithmSuite = doc.CreateElement (
+                               "sp", "AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS);
+                       var basic256 = doc.CreateElement (
+                               "sp", "Basic256", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (algorithmSuite, basic256);
+
+                       var layout = doc.CreateElement (
+                               "sp", "Layout", PolicyImportHelper.SecurityPolicyNS);
+                       var strict = doc.CreateElement (
+                               "sp", "Strict", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (layout, strict);
+
+                       PolicyImportHelper.AddWrappedPolicyElements (
+                               transportBinding, token, algorithmSuite, layout);
+
+                       return transportBinding;
+               }
+
                [MonoTODO]
                void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
                        WsdlContractConversionContext context)
@@ -303,7 +340,15 @@ namespace System.ServiceModel.Channels
                void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
                        WsdlEndpointConversionContext context)
                {
-                       throw new NotImplementedException ();
+                       var soap_binding = new WS.SoapBinding ();
+                       soap_binding.Transport = WS.SoapBinding.HttpTransport;
+                       soap_binding.Style = WS.SoapBindingStyle.Document;
+                       context.WsdlBinding.Extensions.Add (soap_binding);
+
+                       var soap_address = new WS.SoapAddressBinding ();
+                       soap_address.Location = context.Endpoint.Address.Uri.AbsoluteUri;
+                       
+                       context.WsdlPort.Extensions.Add (soap_address);
                }
 #endif
        }
index ad0c83047ef8b2f289fab3683b39167aa051e51c..52f3a0e20cd515ca2b69f26e4689009b833a8104 100644 (file)
@@ -84,10 +84,12 @@ namespace System.ServiceModel.Channels
                }
 
 #if !NET_2_1
-               [MonoTODO]
                public XmlElement GetTransportTokenAssertion ()
                {
-                       throw new NotImplementedException ();
+                       var doc = new XmlDocument ();
+                       var token = doc.CreateElement ("sp", "HttpsToken", PolicyImportHelper.SecurityPolicyNS);
+                       token.SetAttribute ("RequireClientCertificate", req_cli_cert ? "true" : "false");
+                       return token;
                }
 
                // overriden only in full profile
index fe96d70eec9454f832008d2866b160b521da0621..27bfc263baefde14d1240473bf9836b1085d7f8d 100644 (file)
@@ -1,9 +1,10 @@
 //
 // MessageEncodingBindingElementImporter.cs
 //
-// Author: Atsushi Enomoto (atsushi@ximian.com)
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
 //
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -39,7 +40,6 @@ namespace System.ServiceModel.Channels
        public class MessageEncodingBindingElementImporter
                : IWsdlImportExtension, IPolicyImportExtension
        {
-               [MonoTODO]
                void IWsdlImportExtension.BeforeImport (
                        ServiceDescriptionCollection wsdlDocuments,
                        XmlSchemaSet xmlSchemas,
@@ -47,22 +47,35 @@ namespace System.ServiceModel.Channels
                {
                }
 
-               [MonoTODO]
                void IWsdlImportExtension.ImportContract (WsdlImporter importer,
                        WsdlContractConversionContext context)
                {
                }
 
-               [MonoTODO]
                void IWsdlImportExtension.ImportEndpoint (WsdlImporter importer,
                        WsdlEndpointConversionContext context)
                {
                }
 
-               [MonoTODO]
                void IPolicyImportExtension.ImportPolicy (MetadataImporter importer,
                        PolicyConversionContext context)
                {
+                       var assertions = context.GetBindingAssertions ();
+
+                       var mtom = PolicyImportHelper.GetMtomMessageEncodingPolicy (assertions);
+                       if (mtom != null) {
+                               // http://www.w3.org/Submission/WS-MTOMPolicy/
+                               context.BindingElements.Add (new MtomMessageEncodingBindingElement ());
+                               return;
+                       }
+
+                       var binary = PolicyImportHelper.GetBinaryMessageEncodingPolicy (assertions);
+                       if (binary != null) {
+                               context.BindingElements.Add (new BinaryMessageEncodingBindingElement ());
+                               return;
+                       }
+
+                       context.BindingElements.Add (new TextMessageEncodingBindingElement ());
                }
        }
 }
index 586ba3b532ea5b1ef2d69c62b2e16825b8372037..2b43d40adf1ee86d451bd797132edf7191155937 100644 (file)
@@ -145,18 +145,18 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
                        WsdlEndpointConversionContext context)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                public void ExportPolicy (MetadataExporter exporter,
                        PolicyConversionContext context)
                {
-                       throw new NotImplementedException ();
+                       PolicyAssertionCollection assertions = context.GetBindingAssertions ();
+                       XmlDocument doc = new XmlDocument ();
+                       
+                       assertions.Add (doc.CreateElement ("wsoma", "OptimizedMimeSerialization", "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"));
                }
        }
 }
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PolicyImportHelper.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PolicyImportHelper.cs
new file mode 100644 (file)
index 0000000..4ae29b6
--- /dev/null
@@ -0,0 +1,263 @@
+//
+// PolicyImportHelper.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Xml;
+using System.Collections.Generic;
+using System.ServiceModel.Description;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+       internal static class PolicyImportHelper {
+
+               internal const string SecurityPolicyNS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+               internal const string PolicyNS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+               internal const string MimeSerializationNS = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
+               internal const string HttpAuthNS = "http://schemas.microsoft.com/ws/06/2004/policy/http";
+
+               internal const string FramingPolicyNS = "http://schemas.microsoft.com/ws/2006/05/framing/policy";
+               internal const string NetBinaryEncodingNS = "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1";
+
+               internal const string WSSecurityNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+
+               internal static XmlElement GetTransportBindingPolicy (PolicyAssertionCollection collection)
+               {
+                       return FindAndRemove (collection, "TransportBinding", SecurityPolicyNS);
+               }
+                       
+               internal static XmlElement GetStreamedMessageFramingPolicy (PolicyAssertionCollection collection)
+               {
+                       return FindAndRemove (collection, "Streamed", FramingPolicyNS); 
+               }
+
+               internal static XmlElement GetBinaryMessageEncodingPolicy (PolicyAssertionCollection collection)
+               {
+                       return FindAndRemove (collection, "BinaryEncoding", NetBinaryEncodingNS);
+               }
+
+               internal static XmlElement GetMtomMessageEncodingPolicy (PolicyAssertionCollection collection)
+               {
+                       return FindAndRemove (collection, "OptimizedMimeSerialization", MimeSerializationNS);
+               }
+
+               static XmlElement FindAndRemove (PolicyAssertionCollection collection, string name, string ns)
+               {
+                       var element = collection.Find (name, ns);
+                       if (element != null)
+                               collection.Remove (element);
+                       return element;
+               }
+
+               internal static List<XmlElement> FindAssertionByNS (
+                       PolicyAssertionCollection collection, string ns)
+               {
+                       var list = new List<XmlElement> ();
+                       foreach (var assertion in collection) {
+                               if (assertion.NamespaceURI.Equals (ns))
+                                       list.Add (assertion);
+                       }
+                       return list;
+               }
+
+               internal static List<XmlElement> GetPolicyElements (XmlElement root, out bool error)
+               {
+                       XmlElement policy = null;
+                       var list = new List<XmlElement> ();
+
+                       foreach (var node in root.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e == null)
+                                       continue;
+                               if (!PolicyNS.Equals (e.NamespaceURI) || !e.LocalName.Equals ("Policy")) {
+                                       error = true;
+                                       return list;
+                               }
+                               if (policy != null) {
+                                       error = true;
+                                       return list;
+                               }
+                               policy = e;
+                       }
+
+                       if (policy == null) {
+                               error = true;
+                               return list;
+                       }
+
+                       foreach (var node in policy.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e != null)
+                                       list.Add (e);
+                       }
+
+                       error = false;
+                       return list;
+               }
+
+               internal static bool FindPolicyElement (MetadataImporter importer, XmlElement root,
+                                                       QName name, bool required, bool removeWhenFound,
+                                                       out XmlElement element)
+               {
+                       if (!FindPolicyElement (root, name, removeWhenFound, out element)) {
+                               importer.AddWarning ("Invalid policy element: {0}", root.OuterXml);
+                               return false;
+                       }
+                       if (required && (element == null)) {
+                               importer.AddWarning ("Did not find policy element `{0}'.", name);
+                               return false;
+                       }
+                       return true;
+               }
+
+               internal static bool FindPolicyElement (XmlElement root, QName name,
+                                                       bool removeWhenFound, out XmlElement element)
+               {
+                       XmlElement policy = null;
+                       foreach (var node in root.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e == null)
+                                       continue;
+                               if (!PolicyNS.Equals (e.NamespaceURI) || !e.LocalName.Equals ("Policy")) {
+                                       element = null;
+                                       return false;
+                               }
+                               if (policy != null) {
+                                       element = null;
+                                       return false;
+                               }
+                               policy = e;
+                       }
+
+                       if (policy == null) {
+                               element = null;
+                               return true;
+                       }
+
+                       element = null;
+                       foreach (var node in policy.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e == null)
+                                       continue;
+                               if (!name.Namespace.Equals (e.NamespaceURI) || !name.Name.Equals (e.LocalName))
+                                       continue;
+
+                               element = e;
+                               break;
+                       }
+
+                       if (!removeWhenFound || (element == null))
+                               return true;
+
+                       policy.RemoveChild (element);
+
+                       bool foundAnother = false;
+                       foreach (var node in policy.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e != null) {
+                                       foundAnother = true;
+                                       break;
+                               }
+                       }
+
+                       if (!foundAnother)
+                               root.RemoveChild (policy);
+                       return true;
+               }
+
+               internal static XmlElement GetElement (MetadataImporter importer,
+                                                      XmlElement root, string name, string ns)
+               {
+                       return GetElement (importer, root, name, ns, false);
+               }
+
+               internal static XmlElement GetElement (MetadataImporter importer,
+                                                      XmlElement root, string name, string ns,
+                                                      bool required)
+               {
+                       return GetElement (importer, root, new QName (name, ns), required);
+               }
+
+               internal static XmlElement GetElement (MetadataImporter importer,
+                                                      XmlElement root, QName name, bool required)
+               {
+                       var list = root.GetElementsByTagName (name.Name, name.Namespace);
+                       if (list.Count < 1) {
+                               if (required)
+                                       importer.AddWarning ("Did not find required policy element `{0}'", name);
+                               return null;
+                       }
+
+                       if (list.Count > 1) {
+                               importer.AddWarning ("Found duplicate policy element `{0}'", name);
+                               return null;
+                       }
+
+                       var element = list [0] as XmlElement;
+                       if (required && (element == null))
+                               importer.AddWarning ("Did not find required policy element `{0}'", name);
+                       return element;
+               }
+
+               internal static XmlElement WrapPolicy (XmlElement element)
+               {
+                       var policy = element.OwnerDocument.CreateElement ("wsp", "Policy", PolicyNS);
+                       policy.AppendChild (element);
+                       return policy;
+               }
+
+               //
+               // Add a single element, wrapping it inside <wsp:Policy>
+               //
+               internal static void AddWrappedPolicyElement (XmlElement root, XmlElement element)
+               {
+                       if (root.OwnerDocument != element.OwnerDocument)
+                               element = (XmlElement)root.OwnerDocument.ImportNode (element, true);
+                       if (!element.NamespaceURI.Equals (PolicyNS) || !element.LocalName.Equals ("Policy"))
+                               element = WrapPolicy (element);
+                       root.AppendChild (element);
+               }
+
+               //
+               // Add multiple elements, wrapping them inside a single <wsp:Policy>
+               //
+               internal static void AddWrappedPolicyElements (XmlElement root, params XmlElement[] elements)
+               {
+                       var policy = root.OwnerDocument.CreateElement ("wsp", "Policy", PolicyNS);
+                       root.AppendChild (policy);
+
+                       foreach (var element in elements) {
+                               XmlElement imported;
+                               if (root.OwnerDocument != element.OwnerDocument)
+                                       imported = (XmlElement)root.OwnerDocument.ImportNode (element, true);
+                               else
+                                       imported = element;
+                               policy.AppendChild (element);
+                       }
+               }
+       }
+}
+
index e9f14563c7804c69d945742180e33619dcf0562f..3201ef86eb664118064f372eb0298e88d5d9b6d9 100644 (file)
@@ -82,7 +82,10 @@ namespace System.ServiceModel.Channels
                [MonoTODO]
                public XmlElement GetTransportTokenAssertion ()
                {
-                       throw new NotImplementedException ();
+                       var doc = new XmlDocument ();
+                       var element = doc.CreateElement (
+                               "msf", "SslTransportSecurity", PolicyImportHelper.FramingPolicyNS);
+                       return element;
                }
 
                [MonoTODO]
@@ -130,9 +133,11 @@ namespace System.ServiceModel.Channels
                [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (
                        MetadataExporter exporter,
-                       PolicyConversionContext policyContext)
+                       PolicyConversionContext context)
                {
-                       throw new NotImplementedException ();
+                       var token = GetTransportTokenAssertion ();
+                       var transportBinding = TransportBindingElement.CreateTransportBinding (token);
+                       context.GetBindingAssertions ().Add (transportBinding);
                }
                #endregion
        }
index 2147439eea9bdf3f309a501275b0c9851b97b8b2..a555cf8781d4af04e842056f2105a13775021baf 100644 (file)
 // StandardBindingImporter.cs
 //
 // Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
+//       Martin Baulig <martin.baulig@xamarin.com>
 //
-// Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
 //
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
 using System;
-using System.Collections.Generic;
-using System.ServiceModel.Description;
-using System.Web.Services.Description;
+using System.Net;
 using System.Xml;
 using System.Xml.Schema;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+using WS = System.Web.Services.Description;
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+       public class StandardBindingImporter : IWsdlImportExtension {
+               #region IWsdlImportExtension implementation
+
+               public void BeforeImport (WS.ServiceDescriptionCollection wsdlDocuments, XmlSchemaSet xmlSchemas,
+                                         ICollection<XmlElement> policy)
+               {
+               }
+
+               public void ImportContract (WsdlImporter importer, WsdlContractConversionContext contractContext)
+               {
+               }
+
+               WS.Port LookupPort (WsdlImporter importer, QName name)
+               {
+                       foreach (WS.ServiceDescription doc in importer.WsdlDocuments) {
+                               foreach (WS.Service service in doc.Services) {
+                                       foreach (WS.Port port in service.Ports) {
+                                               if (!name.Namespace.Equals (port.Binding.Namespace))
+                                                       continue;
+                                               if (!name.Name.Equals (port.Binding.Name))
+                                                       continue;
+                                               return port;
+                                       }
+                               }
+                       }
+
+                       return null;
+               }
+
+               public void ImportEndpoint (WsdlImporter importer, WsdlEndpointConversionContext context)
+               {
+                       var custom = context.Endpoint.Binding as CustomBinding;
+                       if (custom == null)
+                               return;
+
+                       var soapHttp = GetHttpSoapBinding (context.WsdlBinding);
+                       if (soapHttp != null) {
+                               ImportBasicHttpBinding (importer, context, custom, soapHttp);
+                               return;
+                       }
+
+                       var soapTcp = GetTcpSoapBinding (context.WsdlBinding);
+                       if (soapTcp != null) {
+                               ImportNetTcpBinding (importer, context, custom, soapTcp);
+                               return;
+                       }
+               }
 
-namespace System.ServiceModel.Channels
-{
-       [MonoTODO]
-       public class StandardBindingImporter : IWsdlImportExtension
-       {
-               [MonoTODO]
-               void IWsdlImportExtension.BeforeImport (
-                       ServiceDescriptionCollection wsdlDocuments,
-                       XmlSchemaSet xmlSchemas,
-                       ICollection<XmlElement> policy)
+               internal static WS.SoapBinding GetHttpSoapBinding (WS.Binding binding)
                {
+                       WS.SoapBinding soap = null;
+                       foreach (var extension in binding.Extensions) {
+                               var check = extension as WS.SoapBinding;
+                               if (check != null) {
+                                       soap = check;
+                                       break;
+                               }
+                       }
+                       
+                       if (soap == null)
+                               return null;
+                       if (soap.Transport != WS.SoapBinding.HttpTransport)
+                               return null;
+                       if (soap.Style != WS.SoapBindingStyle.Document)
+                               return null;
+                       return soap;
                }
 
-               [MonoTODO]
-               void IWsdlImportExtension.ImportContract (WsdlImporter importer,
-                       WsdlContractConversionContext context)
+               const string TcpTransport = "http://schemas.microsoft.com/soap/tcp";
+               
+               internal static WS.Soap12Binding GetTcpSoapBinding (WS.Binding binding)
                {
+                       WS.Soap12Binding soap = null;
+                       foreach (var extension in binding.Extensions) {
+                               var check = extension as WS.Soap12Binding;
+                               if (check != null) {
+                                       soap = check;
+                                       break;
+                               }
+                       }
+                       
+                       if (soap == null)
+                               return null;
+                       if (soap.Transport != TcpTransport)
+                               return null;
+                       if (soap.Style != WS.SoapBindingStyle.Document)
+                               return null;
+                       return soap;
                }
 
-               [MonoTODO]
-               void IWsdlImportExtension.ImportEndpoint (WsdlImporter importer,
-                       WsdlEndpointConversionContext context)
+               bool ImportBasicHttpBinding (
+                       WsdlImporter importer, WsdlEndpointConversionContext context,
+                       CustomBinding custom, WS.SoapBinding soap)
                {
+                       TransportBindingElement transportElement = null;
+                       MtomMessageEncodingBindingElement mtomElement = null;
+                       TextMessageEncodingBindingElement textElement = null;
+                       bool foundUnknownElement = false;
+
+                       foreach (var element in custom.Elements) {
+                               if (element is TransportBindingElement)
+                                       transportElement = (TransportBindingElement)element;
+                               else if (element is MtomMessageEncodingBindingElement)
+                                       mtomElement = (MtomMessageEncodingBindingElement)element;
+                               else if (element is TextMessageEncodingBindingElement)
+                                       textElement = (TextMessageEncodingBindingElement)element;
+                               else {
+                                       importer.AddWarning (
+                                               "Found unknown binding element `{0}' while attempting " +
+                                               "to import binding `{0}'.", element.GetType (),
+                                               custom.Name);
+                                       foundUnknownElement = true;
+                               }
+                       }
+
+                       if (foundUnknownElement)
+                               return false;
+
+                       if ((mtomElement != null) && (textElement != null)) {
+                               // FIXME: Should never happen
+                               importer.AddWarning (
+                                       "Found both MtomMessageEncodingBindingElement and " +
+                                       "TextMessageEncodingBindingElement while attempting to " +
+                                       "import binding `{0}'.", custom.Name);
+                               return false;
+                       }
+
+                       BasicHttpBinding httpBinding;
+                       AuthenticationSchemes authScheme;
+
+                       /*
+                        * FIXME: Maybe make the BasicHttpBinding use the transport element
+                        * that we created with the TransportBindingElementImporter ?
+                        * 
+                        * There seems to be no public API to do that, so maybe add a private .ctor ?
+                        * 
+                        */
+
+                       var httpsTransport = transportElement as HttpsTransportBindingElement;
+                       var httpTransport = transportElement as HttpTransportBindingElement;
+
+                       if (httpsTransport != null) {
+                               httpBinding = new BasicHttpBinding (BasicHttpSecurityMode.Transport);
+                               authScheme = httpsTransport.AuthenticationScheme;
+                       } else if (httpTransport != null) {
+                               authScheme = httpTransport.AuthenticationScheme;
+                               if ((authScheme != AuthenticationSchemes.None) &&
+                                       (authScheme != AuthenticationSchemes.Anonymous))
+                                       httpBinding = new BasicHttpBinding (
+                                               BasicHttpSecurityMode.TransportCredentialOnly);
+                               else
+                                       httpBinding = new BasicHttpBinding ();
+                       } else {
+                               httpBinding = new BasicHttpBinding ();
+                               authScheme = AuthenticationSchemes.Anonymous;
+                       }
+
+                       if (mtomElement != null)
+                               httpBinding.MessageEncoding = WSMessageEncoding.Mtom;
+                       else if (textElement != null)
+                               httpBinding.MessageEncoding = WSMessageEncoding.Text;
+                       else {
+                               importer.AddWarning (
+                                       "Found neither MtomMessageEncodingBindingElement nor " +
+                                       "TextMessageEncodingBindingElement while attempting to " +
+                                       "import binding `{0}'.", custom.Name);
+                               return false;
+                       }
+
+                       httpBinding.Name = context.Endpoint.Binding.Name;
+                       httpBinding.Namespace = context.Endpoint.Binding.Namespace;
+
+                       switch (authScheme) {
+                       case AuthenticationSchemes.None:
+                       case AuthenticationSchemes.Anonymous:
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
+                               break;
+                       case AuthenticationSchemes.Basic:
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
+                               break;
+                       case AuthenticationSchemes.Digest:
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Digest;
+                               break;
+                       case AuthenticationSchemes.Ntlm:
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+                               break;
+                       case AuthenticationSchemes.Negotiate:
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
+                               break;
+                       default:
+                               importer.AddWarning ("Invalid auth scheme: {0}", authScheme);
+                               return false;
+                       }
+
+                       if ((httpsTransport != null) && httpsTransport.RequireClientCertificate) {
+                               if (httpBinding.Security.Transport.ClientCredentialType != HttpClientCredentialType.None) {
+                                       importer.AddWarning ("Cannot use both client certificate and explicit auth type.");
+                                       return false;
+                               }
+                               httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
+                       }
+
+                       context.Endpoint.Binding = httpBinding;
+                       return true;
                }
+
+               bool ImportNetTcpBinding (
+                       WsdlImporter importer, WsdlEndpointConversionContext context,
+                       CustomBinding custom, WS.Soap12Binding soap)
+               {
+                       TcpTransportBindingElement transportElement = null;
+                       BinaryMessageEncodingBindingElement binaryElement = null;
+                       TransactionFlowBindingElement transactionFlowElement = null;
+                       WindowsStreamSecurityBindingElement windowsStreamElement = null;
+                       SslStreamSecurityBindingElement sslStreamElement = null;
+                       bool foundUnknownElement = false;
+                       
+                       foreach (var element in custom.Elements) {
+                               if (element is TcpTransportBindingElement)
+                                       transportElement = (TcpTransportBindingElement)element;
+                               else if (element is BinaryMessageEncodingBindingElement)
+                                       binaryElement = (BinaryMessageEncodingBindingElement)element;
+                               else if (element is TransactionFlowBindingElement)
+                                       transactionFlowElement = (TransactionFlowBindingElement)element;
+                               else if (element is WindowsStreamSecurityBindingElement)
+                                       windowsStreamElement = (WindowsStreamSecurityBindingElement)element;
+                               else if (element is SslStreamSecurityBindingElement)
+                                       sslStreamElement = (SslStreamSecurityBindingElement)element;
+                               else {
+                                       importer.AddWarning (
+                                               "Found unknown binding element `{0}' while importing " +
+                                               "binding `{1}'.", element.GetType (), custom.Name);
+                                       foundUnknownElement = true;
+                               }
+                       }
+
+                       if (foundUnknownElement)
+                               return false;
+
+                       if (transportElement == null) {
+                               importer.AddWarning (
+                                       "Missing TcpTransportBindingElement while importing " +
+                                       "binding `{0}'.", custom.Name);
+                               return false;
+                       }
+                       if (binaryElement == null) {
+                               importer.AddWarning (
+                                       "Missing BinaryMessageEncodingBindingElement while importing " +
+                                       "binding `{0}'.", custom.Name);
+                               return false;
+                       }
+
+                       if ((windowsStreamElement != null) && (sslStreamElement != null)) {
+                               importer.AddWarning (
+                                       "Found both WindowsStreamSecurityBindingElement and " +
+                                       "SslStreamSecurityBindingElement while importing binding `{0}.",
+                                       custom.Name);
+                               return false;
+                       }
+
+                       NetTcpSecurity security;
+                       if (windowsStreamElement != null) {
+                               security = new NetTcpSecurity (SecurityMode.Transport);
+                               security.Transport.ProtectionLevel = windowsStreamElement.ProtectionLevel;
+                       } else if (sslStreamElement != null) {
+                               security = new NetTcpSecurity (SecurityMode.TransportWithMessageCredential);
+                       } else {
+                               security = new NetTcpSecurity (SecurityMode.None);
+                       }
+
+                       var netTcp = new NetTcpBinding (transportElement, security, false);
+
+                       netTcp.Name = context.Endpoint.Binding.Name;
+                       netTcp.Namespace = context.Endpoint.Binding.Namespace;
+
+                       context.Endpoint.Binding = netTcp;
+                       return true;
+               }
+
+               #endregion
        }
 }
+
index 20b727467d9c4d1f250444b8026d348775f59b21..f75b96cf34195db348c47fb0db1c9086b112b810 100644 (file)
@@ -159,18 +159,14 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                void IWsdlExportExtension.ExportEndpoint (WsdlExporter exporter,
                        WsdlEndpointConversionContext context)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter,
                        PolicyConversionContext context)
                {
-                       throw new NotImplementedException ();
                }
 #endif
        }
index 58b9411e8f648b8db94d556a22ed4b2f1b75a473..9f0a92ffc93deb0483ea7e3ec005e1d4b6be3878 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Author:
 //     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
 //
 // Copyright (C) 2005, 2007 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -89,5 +91,70 @@ namespace System.ServiceModel.Channels
                                return (T) (object) MessageVersion.Soap12WSAddressing10;
                        return context.GetInnerProperty<T> ();
                }
+
+#if !NET_2_1
+               internal static XmlElement CreateTransportBinding (XmlElement transportToken)
+               {
+                       var doc = new XmlDocument ();
+                       var transportBinding = doc.CreateElement (
+                               "sp", "TransportBinding", PolicyImportHelper.SecurityPolicyNS);
+                       
+                       var token = doc.CreateElement (
+                               "sp", "TransportToken", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (token, transportToken);
+                       
+                       var algorithmSuite = doc.CreateElement (
+                               "sp", "AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS);
+                       var basic256 = doc.CreateElement (
+                               "sp", "Basic256", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (algorithmSuite, basic256);
+                       
+                       var layout = doc.CreateElement (
+                               "sp", "Layout", PolicyImportHelper.SecurityPolicyNS);
+                       var strict = doc.CreateElement (
+                               "sp", "Strict", PolicyImportHelper.SecurityPolicyNS);
+                       PolicyImportHelper.AddWrappedPolicyElement (layout, strict);
+                       
+                       PolicyImportHelper.AddWrappedPolicyElements (
+                               transportBinding, token, algorithmSuite, layout);
+                       
+                       return transportBinding;
+               }
+
+               internal static MessageEncodingBindingElement ExportAddressingPolicy (
+                       PolicyConversionContext context)
+               {
+                       MessageEncodingBindingElement messageEncodingElement = null;
+                       foreach (var element in context.BindingElements) {
+                               var check = element as MessageEncodingBindingElement;
+                               if (check == null)
+                                       continue;
+                               messageEncodingElement = check;
+                               break;
+                       }
+
+                       var doc = new XmlDocument ();
+                       var assertions = context.GetBindingAssertions ();
+                       
+                       if (messageEncodingElement == null) {
+                               assertions.Add (doc.CreateElement (
+                                       "wsaw", "UsingAddressing",
+                                       "http://www.w3.org/2006/05/addressing/wsdl"));
+                               return null;
+                       }
+
+                       var addressing = messageEncodingElement.MessageVersion.Addressing;
+                       if (addressing == AddressingVersion.WSAddressingAugust2004)
+                               assertions.Add (doc.CreateElement (
+                                       "wsaw", "UsingAddressing",
+                                       "http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"));
+                       else if (addressing != AddressingVersion.None)
+                               assertions.Add (doc.CreateElement (
+                                       "wsaw", "UsingAddressing",
+                                       "http://www.w3.org/2006/05/addressing/wsdl"));
+
+                       return messageEncodingElement;
+               }
+#endif
        }
 }
index f323ccaba40db5dda825d01521570118406625df..b76f0e12edd6c312bc91ad20d0709eb7a873fe15 100644 (file)
 // TransportBindingElementImporter.cs
 //
 // Author:
-//     Atsushi Enomoto <atsushi@ximian.com>
+//       Martin Baulig <martin.baulig@xamarin.com>
 //
-// Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
 //
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
 using System;
+using System.Net;
+using System.Net.Security;
+using System.Xml;
+using System.Xml.Schema;
 using System.Collections.Generic;
-using System.Runtime.Serialization;
 using System.ServiceModel;
-using System.ServiceModel.Configuration;
+using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
-using System.Web.Services.Description;
-using System.Xml;
-using System.Xml.Schema;
 
-namespace System.ServiceModel.Channels
-{
-       [MonoTODO]
-       public class TransportBindingElementImporter
-               : IWsdlImportExtension, IPolicyImportExtension
-       {
-               public TransportBindingElementImporter ()
+using WS = System.Web.Services.Description;
+using QName = System.Xml.XmlQualifiedName;
+
+namespace System.ServiceModel.Channels {
+
+       public class TransportBindingElementImporter : IWsdlImportExtension, IPolicyImportExtension {
+               #region IWsdlImportExtension implementation
+
+               public void BeforeImport (WS.ServiceDescriptionCollection wsdlDocuments, XmlSchemaSet xmlSchemas,
+                                         ICollection<XmlElement> policy)
+               {
+               }
+
+               public void ImportContract (WsdlImporter importer, WsdlContractConversionContext contractContext)
+               {
+               }
+
+               public void ImportEndpoint (WsdlImporter importer, WsdlEndpointConversionContext context)
                {
+                       // Only import the binding, not the endpoint.
+                       if (context.WsdlPort == null)
+                               return;
+                       
+                       DoImportEndpoint (context);
                }
 
-               void IWsdlImportExtension.BeforeImport (ServiceDescriptionCollection wsdlDocuments,
-                       XmlSchemaSet xmlSchemas, ICollection<XmlElement> policy)
+               bool DoImportEndpoint (WsdlEndpointConversionContext context)
                {
+                       if (ImportBasicHttpEndpoint (context))
+                               return true;
+                       if (ImportNetTcpEndpoint (context))
+                               return true;
+                       return false;
                }
 
-               void IWsdlImportExtension.ImportContract (WsdlImporter importer,
-                       WsdlContractConversionContext context)
+               bool ImportBasicHttpEndpoint (WsdlEndpointConversionContext context)
                {
+                       var http = context.Endpoint.Binding as BasicHttpBinding;
+                       if (http == null)
+                               return false;
+                       
+                       WS.SoapAddressBinding address = null;
+                       foreach (var extension in context.WsdlPort.Extensions) {
+                               var check = extension as WS.SoapAddressBinding;
+                               if (check != null) {
+                                       address = check;
+                                       break;
+                               }
+                       }
+                       
+                       if (address == null)
+                               return false;
+                       
+                       context.Endpoint.Address = new EndpointAddress (address.Location);
+                       context.Endpoint.ListenUri = new Uri (address.Location);
+                       context.Endpoint.ListenUriMode = ListenUriMode.Explicit;
+                       return true;
+               }
+
+               bool ImportNetTcpEndpoint (WsdlEndpointConversionContext context)
+               {
+                       var tcp = context.Endpoint.Binding as NetTcpBinding;
+                       if (tcp == null)
+                               return false;
+
+                       WS.Soap12AddressBinding address = null;
+                       foreach (var extension in context.WsdlPort.Extensions) {
+                               var check = extension as WS.Soap12AddressBinding;
+                               if (check != null) {
+                                       address = check;
+                                       break;
+                               }
+                       }
+                       
+                       if (address == null)
+                               return false;
+                       
+                       context.Endpoint.Address = new EndpointAddress (address.Location);
+                       context.Endpoint.ListenUri = new Uri (address.Location);
+                       context.Endpoint.ListenUriMode = ListenUriMode.Explicit;
+                       return true;
                }
 
-               void IWsdlImportExtension.ImportEndpoint(WsdlImporter importer,
-                       WsdlEndpointConversionContext context)
+               #endregion
+
+               #region IPolicyImportExtension implementation
+
+               public void ImportPolicy (MetadataImporter importer, PolicyConversionContext context)
                {
-                       for (int i = 0; i < context.WsdlBinding.Extensions.Count; i ++) {
-                               if (context.WsdlBinding.Extensions [i] is SoapBinding) {
-                                       SoapBinding transport = context.WsdlBinding.Extensions [i] as SoapBinding;
-                                       if (transport.Transport != SoapBinding.HttpTransport)
-                                               //FIXME: not http
-                                               return;
+                       var customCtx = context as CustomPolicyConversionContext;
+                       var customBinding = context.Endpoint.Binding as CustomBinding;
+                       if ((customCtx == null) || (customBinding == null))
+                               // FIXME: Should we allow this ?
+                               throw new InvalidOperationException ();
+
+                       var soapHttp = StandardBindingImporter.GetHttpSoapBinding (customCtx.WsdlBinding);
+                       if (soapHttp != null) {
+                               if (!ImportHttpPolicy (importer, customCtx, soapHttp))
+                                       context.BindingElements.Add (new HttpTransportBindingElement ());
+                               return;
+                       }
+
+                       var soapTcp = StandardBindingImporter.GetTcpSoapBinding (customCtx.WsdlBinding);
+                       if (soapTcp != null) {
+                               if (!ImportTcpPolicy (importer, customCtx, soapTcp))
+                                       context.BindingElements.Add (new TcpTransportBindingElement ());
+                               return;
+                       }
+               }
+
+               #endregion
 
-                                       if (! (context.Endpoint.Binding is CustomBinding))
-                                               //FIXME: 
-                                               throw new Exception ();
+               bool ImportHttpAuthScheme (MetadataImporter importer,
+                                          HttpTransportBindingElement bindingElement,
+                                          PolicyConversionContext context)
+               {
+                       var assertions = context.GetBindingAssertions ();
+                       var authSchemes = AuthenticationSchemes.None;
 
-                                       ((CustomBinding) context.Endpoint.Binding).Elements.Add (new HttpTransportBindingElement ());
-                                       //((CustomBinding) context.Endpoint.Binding).Scheme = "http";
+                       var httpsTransport = bindingElement as HttpsTransportBindingElement;
+                       bool certificate = httpsTransport != null ?
+                               httpsTransport.RequireClientCertificate : false;
 
-                                       for (int j = 0; j < context.WsdlPort.Extensions.Count; j ++) {
-                                               SoapAddressBinding address = context.WsdlPort.Extensions [j] as SoapAddressBinding;
-                                               if (address == null)
-                                                       continue;
+                       var authElements = PolicyImportHelper.FindAssertionByNS (
+                               assertions, PolicyImportHelper.HttpAuthNS);
+                       foreach (XmlElement authElement in authElements) {
+                               assertions.Remove (authElement);
 
-                                               context.Endpoint.Address = new EndpointAddress (address.Location);
-                                               context.Endpoint.ListenUri = new Uri (address.Location);
-                                       }
+                               if (certificate) {
+                                       importer.AddWarning (
+                                               "Invalid authentication assertion while " +
+                                               "using client certificate: {0}", authElement.OuterXml);
+                                       return false;
+                               }
 
+                               switch (authElement.LocalName) {
+                               case "BasicAuthentication":
+                                       authSchemes |= AuthenticationSchemes.Basic;
+                                       break;
+                               case "NtlmAuthentication":
+                                       authSchemes |= AuthenticationSchemes.Ntlm;
                                        break;
+                               case "DigestAuthentication":
+                                       authSchemes |= AuthenticationSchemes.Digest;
+                                       break;
+                               case "NegotiateAuthentication":
+                                       authSchemes |= AuthenticationSchemes.Negotiate;
+                                       break;
+                               default:
+                                       importer.AddWarning (
+                                               "Invalid policy assertion: {0}", authElement.OuterXml);
+                                       return false;
                                }
                        }
+
+                       bindingElement.AuthenticationScheme = authSchemes;
+                       return true;
+               }
+
+               bool ImportWindowsTransportSecurity (MetadataImporter importer,
+                                                    PolicyConversionContext context,
+                                                    XmlElement policyElement)
+               {
+                       var protectionLevel = PolicyImportHelper.GetElement (
+                               importer, policyElement, "ProtectionLevel",
+                               PolicyImportHelper.FramingPolicyNS, true);
+                       if (protectionLevel == null) {
+                               importer.AddWarning (
+                                       "Invalid policy assertion: {0}", policyElement.OuterXml);
+                               return false;
+                       }
+
+                       var element = new WindowsStreamSecurityBindingElement ();
+
+                       switch (protectionLevel.InnerText.ToLowerInvariant ()) {
+                       case "none":
+                               element.ProtectionLevel = ProtectionLevel.None;
+                               break;
+                       case "sign":
+                               element.ProtectionLevel = ProtectionLevel.Sign;
+                               break;
+                       case "encryptandsign":
+                               element.ProtectionLevel = ProtectionLevel.EncryptAndSign;
+                               break;
+                       default:
+                               importer.AddWarning (
+                                       "Invalid policy assertion: {0}", protectionLevel.OuterXml);
+                               return false;
+                       }
+
+                       context.BindingElements.Add (element);
+                       return true;
+               }
+
+               bool ImportTransport (MetadataImporter importer, TransportBindingElement bindingElement,
+                                     XmlElement transportPolicy)
+               {
+                       XmlElement algorithmSuite, layout;
+                       if (!PolicyImportHelper.FindPolicyElement (
+                               importer, transportPolicy,
+                               new QName ("AlgorithmSuite", PolicyImportHelper.SecurityPolicyNS),
+                               false, true, out algorithmSuite) ||
+                           !PolicyImportHelper.FindPolicyElement (
+                               importer, transportPolicy,
+                               new QName ("Layout", PolicyImportHelper.SecurityPolicyNS),
+                               false, true, out layout))
+                               return false;
+
+                       bool foundUnknown = false;
+                       foreach (var node in transportPolicy.ChildNodes) {
+                               var e = node as XmlElement;
+                               if (e == null)
+                                       continue;
+                               importer.AddWarning ("Unknown policy assertion: {0}", e.OuterXml);
+                               foundUnknown = true;
+                       }
+
+                       return !foundUnknown;
+               }
+
+               bool GetTransportToken (MetadataImporter importer, XmlElement transportPolicy,
+                                       out XmlElement transportToken)
+               {
+                       return PolicyImportHelper.FindPolicyElement (
+                               importer, transportPolicy,
+                               new QName ("TransportToken", PolicyImportHelper.SecurityPolicyNS),
+                               false, true, out transportToken);
+               }
+
+               bool ImportHttpTransport (MetadataImporter importer, PolicyConversionContext context,
+                                         XmlElement transportPolicy,
+                                         out HttpTransportBindingElement bindingElement)
+               {
+                       XmlElement transportToken;
+                       if (!GetTransportToken (importer, transportPolicy, out transportToken)) {
+                               bindingElement = null;
+                               return false;
+                       }
+
+                       if (transportToken == null) {
+                               bindingElement = new HttpTransportBindingElement ();
+                               return true;
+                       }
+                       
+                       bool error;
+                       var tokenElementList = PolicyImportHelper.GetPolicyElements (transportToken, out error);
+                       if (error || (tokenElementList.Count != 1)) {
+                               importer.AddWarning ("Invalid policy assertion: {0}", transportToken.OuterXml);
+                               bindingElement = null;
+                               return false;
+                       }
+
+                       var tokenElement = tokenElementList [0];
+                       if (!PolicyImportHelper.SecurityPolicyNS.Equals (tokenElement.NamespaceURI) ||
+                               !tokenElement.LocalName.Equals ("HttpsToken")) {
+                               importer.AddWarning ("Invalid policy assertion: {0}", tokenElement.OuterXml);
+                               bindingElement = null;
+                               return false;
+                       }
+
+                       var httpsTransport = new HttpsTransportBindingElement ();
+                       bindingElement = httpsTransport;
+
+                       var certAttr = tokenElement.GetAttribute ("RequireClientCertificate");
+                       if (!String.IsNullOrEmpty (certAttr))
+                               httpsTransport.RequireClientCertificate = Boolean.Parse (certAttr);
+                       return true;
+               }
+
+               bool ImportTcpTransport (MetadataImporter importer, PolicyConversionContext context,
+                                        XmlElement transportPolicy)
+               {
+                       XmlElement transportToken;
+                       if (!GetTransportToken (importer, transportPolicy, out transportToken))
+                               return false;
+
+                       if (transportToken == null)
+                               return true;
+
+                       bool error;
+                       var tokenElementList = PolicyImportHelper.GetPolicyElements (transportToken, out error);
+                       if (error || (tokenElementList.Count != 1)) {
+                               importer.AddWarning ("Invalid policy assertion: {0}", transportToken.OuterXml);
+                               return false;
+                       }
+
+                       var tokenElement = tokenElementList [0];
+                       if (!PolicyImportHelper.FramingPolicyNS.Equals (tokenElement.NamespaceURI)) {
+                               importer.AddWarning ("Invalid policy assertion: {0}", tokenElement.OuterXml);
+                               return false;
+                       }
+
+                       if (tokenElement.LocalName.Equals ("WindowsTransportSecurity")) {
+                               if (!ImportWindowsTransportSecurity (importer, context, tokenElement))
+                                       return false;
+                       } else if (tokenElement.LocalName.Equals ("SslTransportSecurity")) {
+                               context.BindingElements.Add (new SslStreamSecurityBindingElement ());
+                       }
+
+                       return true;
                }
 
-               void IPolicyImportExtension.ImportPolicy (MetadataImporter importer,
-                       PolicyConversionContext context)
+               bool ImportHttpPolicy (MetadataImporter importer, PolicyConversionContext context,
+                                      WS.SoapBinding soap)
                {
-                       throw new NotImplementedException ();
+                       HttpTransportBindingElement httpTransport;
+                       var assertions = context.GetBindingAssertions ();
+                       var transportPolicy = PolicyImportHelper.GetTransportBindingPolicy (assertions);
+                       if (transportPolicy != null) {
+                               if (!ImportHttpTransport (importer, context, transportPolicy, out httpTransport))
+                                       return false;
+                               if (!ImportTransport (importer, httpTransport, transportPolicy))
+                                       return false;
+                       } else {
+                               httpTransport = new HttpTransportBindingElement ();
+                       }
+
+                       if (!ImportHttpAuthScheme (importer, httpTransport, context))
+                               return false;
+
+                       context.BindingElements.Add (httpTransport);
+                       return true;
+               }
+
+               bool ImportTcpPolicy (MetadataImporter importer, PolicyConversionContext context,
+                                     WS.Soap12Binding soap)
+               {
+                       var assertions = context.GetBindingAssertions ();
+
+                       var tcpTransport = new TcpTransportBindingElement ();
+
+                       var transportPolicy = PolicyImportHelper.GetTransportBindingPolicy (assertions);
+                       if (transportPolicy != null) {
+                               if (!ImportTcpTransport (importer, context, transportPolicy))
+                                       return false;
+                               if (!ImportTransport (importer, tcpTransport, transportPolicy))
+                                       return false;
+                       }
+
+                       var streamed = PolicyImportHelper.GetStreamedMessageFramingPolicy (assertions);
+                       if (streamed != null)
+                               tcpTransport.TransferMode = TransferMode.Streamed;
+                       
+                       context.BindingElements.Add (tcpTransport);
+                       return true;
                }
        }
 }
index 0f0c61dd3984b7b4967029969346daee908b164c..e57cfde91e3b4e386d382a1607373eb66b5adf14 100644 (file)
@@ -32,12 +32,14 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.ServiceModel.Security;
 using System.ServiceModel.Security.Tokens;
+using System.Xml;
 
 namespace System.ServiceModel.Channels
 {
        [MonoTODO]
        public class WindowsStreamSecurityBindingElement
-               : BindingElement, ISecurityCapabilities, IPolicyExportExtension
+               : BindingElement, ISecurityCapabilities, IPolicyExportExtension,
+               ITransportTokenAssertionProvider
        {
                public WindowsStreamSecurityBindingElement ()
                {
@@ -121,9 +123,23 @@ namespace System.ServiceModel.Channels
                [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (
                        MetadataExporter exporter,
-                       PolicyConversionContext policyContext)
+                       PolicyConversionContext context)
                {
-                       throw new NotImplementedException ();
+                       var token = GetTransportTokenAssertion ();
+                       var transportBinding = TransportBindingElement.CreateTransportBinding (token);
+                       context.GetBindingAssertions ().Add (transportBinding);
+               }
+
+               public XmlElement GetTransportTokenAssertion ()
+               {
+                       var doc = new XmlDocument ();
+                       var element = doc.CreateElement (
+                               "msf", "WindowsTransportSecurity", PolicyImportHelper.FramingPolicyNS);
+                       var protectionLevel = doc.CreateElement (
+                               "msf", "ProtectionLevel", PolicyImportHelper.FramingPolicyNS);
+                       protectionLevel.InnerText = ProtectionLevel.ToString ();
+                       element.AppendChild (protectionLevel);
+                       return element;
                }
                #endregion
        }
index fe1c268edb5cfec6fa2b3a807cb19d9f0a19b886..d7d86f0f7d6cfc05e5c281c61c704abff5f393a6 100644 (file)
@@ -1,6 +1,11 @@
 //
 // BasicHttpBindingElement.cs
 //
+// See BasicHttpBindingElement_4_5.cs and HttpBindingBaseElement.cs
+// for the .NET 4.5 version of this class, where most of the code has
+// been moved into the new abstract HttpBindingBaseElement class.
+//
+//
 // Author:
 //     Atsushi Enomoto <atsushi@ximian.com>
 //
@@ -26,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NET_4_5
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -250,3 +256,4 @@ namespace System.ServiceModel.Configuration
        }
 
 }
+#endif
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs
new file mode 100644 (file)
index 0000000..691d90e
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// BasicHttpBindingElement_4_5.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public class BasicHttpBindingElement
+                : HttpBindingBaseElement,  IBindingConfigurationElement
+       {
+               ConfigurationPropertyCollection _properties;
+
+               public BasicHttpBindingElement ()
+               {
+               }
+
+               public BasicHttpBindingElement (string name) : base (name) { }
+
+               protected override Type BindingElementType {
+                       get { return typeof (BasicHttpBinding); }
+               }
+               
+               // Properties
+
+               [ConfigurationProperty ("messageEncoding",
+                        DefaultValue = "Text",
+                        Options = ConfigurationPropertyOptions.None)]
+               public WSMessageEncoding MessageEncoding {
+                       get { return (WSMessageEncoding) this ["messageEncoding"]; }
+                       set { this ["messageEncoding"] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get {
+                               if (_properties == null) {
+                                       _properties = base.Properties;
+                                       _properties.Add (new ConfigurationProperty ("messageEncoding", typeof (WSMessageEncoding), "Text", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("security", typeof (BasicHttpSecurityElement), null, null, null, ConfigurationPropertyOptions.None));
+                               }
+                               return _properties;
+                       }
+               }
+
+               [ConfigurationProperty ("security",
+                        Options = ConfigurationPropertyOptions.None)]
+               public BasicHttpSecurityElement Security {
+                       get { return (BasicHttpSecurityElement) this ["security"]; }
+               }
+
+               protected override void OnApplyConfiguration (Binding binding)
+               {
+                       base.OnApplyConfiguration (binding);
+                       BasicHttpBinding basicHttpBinding = (BasicHttpBinding) binding;
+                       
+                       basicHttpBinding.MessageEncoding = MessageEncoding;
+
+                       basicHttpBinding.Security.Mode = Security.Mode;
+                       Security.Transport.ApplyConfiguration (basicHttpBinding.Security.Transport);
+               }
+
+               protected internal override void InitializeFrom (Binding binding)
+               {
+                       BasicHttpBinding b = (BasicHttpBinding) binding;
+                       base.InitializeFrom (binding);
+
+                       MessageEncoding = b.MessageEncoding;
+
+                       Security.Mode = b.Security.Mode;
+                       Security.Transport.ApplyConfiguration (b.Security.Transport);
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
new file mode 100644 (file)
index 0000000..0669002
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// BasicHttpsBindingCollectionElement.cs
+//
+// Author:
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public partial class BasicHttpsBindingCollectionElement
+                : StandardBindingCollectionElement<BasicHttpsBinding, BasicHttpsBindingElement>
+       {
+       }
+
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
new file mode 100644 (file)
index 0000000..b167b6e
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// BasicHttpsBindingElement.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public class BasicHttpsBindingElement
+                : HttpBindingBaseElement,  IBindingConfigurationElement
+       {
+               ConfigurationPropertyCollection _properties;
+
+               public BasicHttpsBindingElement ()
+               {
+               }
+
+               public BasicHttpsBindingElement (string name) : base (name) { }
+
+               protected override Type BindingElementType {
+                       get { return typeof (BasicHttpsBinding); }
+               }
+               
+               // Properties
+
+               [ConfigurationProperty ("messageEncoding",
+                        DefaultValue = "Text",
+                        Options = ConfigurationPropertyOptions.None)]
+               public WSMessageEncoding MessageEncoding {
+                       get { return (WSMessageEncoding) this ["messageEncoding"]; }
+                       set { this ["messageEncoding"] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get {
+                               if (_properties == null) {
+                                       _properties = base.Properties;
+                                       _properties.Add (new ConfigurationProperty ("messageEncoding", typeof (WSMessageEncoding), "Text", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("security", typeof (BasicHttpsSecurityElement), null, null, null, ConfigurationPropertyOptions.None));
+                               }
+                               return _properties;
+                       }
+               }
+
+               [ConfigurationProperty ("security",
+                        Options = ConfigurationPropertyOptions.None)]
+               public BasicHttpsSecurityElement Security {
+                       get { return (BasicHttpsSecurityElement) this ["security"]; }
+               }
+
+               protected override void OnApplyConfiguration (Binding binding)
+               {
+                       base.OnApplyConfiguration (binding);
+                       BasicHttpsBinding basicHttpsBinding = (BasicHttpsBinding) binding;
+                       
+                       basicHttpsBinding.MessageEncoding = MessageEncoding;
+
+                       basicHttpsBinding.Security.Mode = Security.Mode;
+                       Security.Transport.ApplyConfiguration (basicHttpsBinding.Security.Transport);
+               }
+
+               protected internal override void InitializeFrom (Binding binding)
+               {
+                       BasicHttpsBinding b = (BasicHttpsBinding) binding;
+                       base.InitializeFrom (binding);
+
+                       MessageEncoding = b.MessageEncoding;
+
+                       Security.Mode = b.Security.Mode;
+                       Security.Transport.ApplyConfiguration (b.Security.Transport);
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
new file mode 100644 (file)
index 0000000..99cc407
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// BasicHttpsSecurityElement.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public sealed class BasicHttpsSecurityElement
+                : ConfigurationElement
+       {
+               // Properties
+
+               [ConfigurationProperty ("message",
+                        Options = ConfigurationPropertyOptions.None)]
+               public BasicHttpMessageSecurityElement Message {
+                       get { return (BasicHttpMessageSecurityElement) base ["message"]; }
+               }
+
+               [ConfigurationProperty ("mode",
+                        DefaultValue = "None",
+                        Options = ConfigurationPropertyOptions.None)]
+               public BasicHttpsSecurityMode Mode {
+                       get { return (BasicHttpsSecurityMode) base ["mode"]; }
+                       set { base ["mode"] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return base.Properties; }
+               }
+
+               [ConfigurationProperty ("transport",
+                        Options = ConfigurationPropertyOptions.None)]
+               public HttpTransportSecurityElement Transport {
+                       get { return (HttpTransportSecurityElement) base ["transport"]; }
+               }
+
+
+       }
+
+}
index bb6452aeffc2d8df6374e32115fc1ce3755e1510..806a63d570fe8d7956000c1bfd7ad4ab57890164 100644 (file)
@@ -67,6 +67,14 @@ namespace System.ServiceModel.Configuration
                        get { return (BasicHttpBindingCollectionElement) this ["basicHttpBinding"]; }
                }
 
+#if NET_4_5
+               [ConfigurationProperty ("basicHttpsBinding",
+                                       Options = ConfigurationPropertyOptions.None)]
+               public BasicHttpsBindingCollectionElement BasicHttpsBinding {
+                       get { return (BasicHttpsBindingCollectionElement) this ["basicHttpsBinding"]; }
+               }
+#endif
+
                [MonoTODO ("Not Implemented")]
                public List<BindingCollectionElement> BindingCollections {
                        get { throw new NotImplementedException (); }
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/HttpBindingBaseElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/HttpBindingBaseElement.cs
new file mode 100644 (file)
index 0000000..6aa8cee
--- /dev/null
@@ -0,0 +1,232 @@
+//
+// HttpBindingBaseElement.cs
+//
+// This is a .NET 4.5 addition and contains most of the code from
+// BasicHttpBindingElement.
+//
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Net;
+using System.Net.Security;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Principal;
+using System.IdentityModel.Claims;
+using System.IdentityModel.Policy;
+using System.IdentityModel.Tokens;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Diagnostics;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.MsmqIntegration;
+using System.ServiceModel.PeerResolvers;
+using System.ServiceModel.Security;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace System.ServiceModel.Configuration
+{
+       public abstract class HttpBindingBaseElement
+                : StandardBindingElement,  IBindingConfigurationElement
+       {
+               ConfigurationPropertyCollection _properties;
+
+               public HttpBindingBaseElement ()
+               {
+               }
+
+               public HttpBindingBaseElement (string name) : base (name) { }
+
+               // Properties
+
+               [ConfigurationProperty ("allowCookies",
+                       DefaultValue = false,
+                        Options = ConfigurationPropertyOptions.None)]
+               public bool AllowCookies {
+                       get { return (bool) this ["allowCookies"]; }
+                       set { this ["allowCookies"] = value; }
+               }
+
+               [ConfigurationProperty ("bypassProxyOnLocal",
+                       DefaultValue = false,
+                        Options = ConfigurationPropertyOptions.None)]
+               public bool BypassProxyOnLocal {
+                       get { return (bool) this ["bypassProxyOnLocal"]; }
+                       set { this ["bypassProxyOnLocal"] = value; }
+               }
+
+               [ConfigurationProperty ("hostNameComparisonMode",
+                        DefaultValue = "StrongWildcard",
+                        Options = ConfigurationPropertyOptions.None)]
+               public HostNameComparisonMode HostNameComparisonMode {
+                       get { return (HostNameComparisonMode) this ["hostNameComparisonMode"]; }
+                       set { this ["hostNameComparisonMode"] = value; }
+               }
+
+               [LongValidator ( MinValue = 0,
+                        MaxValue = 9223372036854775807,
+                       ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferPoolSize",
+                        DefaultValue = "524288",
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxBufferPoolSize {
+                       get { return (long) this ["maxBufferPoolSize"]; }
+                       set { this ["maxBufferPoolSize"] = value; }
+               }
+
+               [IntegerValidator ( MinValue = 1,
+                       MaxValue = int.MaxValue,
+                       ExcludeRange = false)]
+               [ConfigurationProperty ("maxBufferSize",
+                        DefaultValue = "65536",
+                        Options = ConfigurationPropertyOptions.None)]
+               public int MaxBufferSize {
+                       get { return (int) this ["maxBufferSize"]; }
+                       set { this ["maxBufferSize"] = value; }
+               }
+
+               [LongValidator ( MinValue = 1,
+                        MaxValue = 9223372036854775807,
+                       ExcludeRange = false)]
+               [ConfigurationProperty ("maxReceivedMessageSize",
+                        DefaultValue = "65536",
+                        Options = ConfigurationPropertyOptions.None)]
+               public long MaxReceivedMessageSize {
+                       get { return (long) this ["maxReceivedMessageSize"]; }
+                       set { this ["maxReceivedMessageSize"] = value; }
+               }
+
+               protected override ConfigurationPropertyCollection Properties {
+                       get {
+                               if (_properties == null) {
+                                       _properties = base.Properties;
+                                       _properties.Add (new ConfigurationProperty ("allowCookies", typeof (bool), "false", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("bypassProxyOnLocal", typeof (bool), "false", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("hostNameComparisonMode", typeof (HostNameComparisonMode), "StrongWildcard", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("maxBufferPoolSize", typeof (long), "524288", null, new LongValidator (0, 9223372036854775807, false), ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("maxBufferSize", typeof (int), "65536", null, new IntegerValidator (1, int.MaxValue, false), ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("maxReceivedMessageSize", typeof (long), "65536", null, new LongValidator (1, 9223372036854775807, false), ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("proxyAddress", typeof (Uri), null, new UriTypeConverter (), null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("readerQuotas", typeof (XmlDictionaryReaderQuotasElement), null, null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("textEncoding", typeof (Encoding), "utf-8", EncodingConverter.Instance, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("transferMode", typeof (TransferMode), "Buffered", null, null, ConfigurationPropertyOptions.None));
+                                       _properties.Add (new ConfigurationProperty ("useDefaultWebProxy", typeof (bool), "true", new BooleanConverter (), null, ConfigurationPropertyOptions.None));
+                               }
+                               return _properties;
+                       }
+               }
+
+               [ConfigurationProperty ("proxyAddress",
+                        DefaultValue = null,
+                        Options = ConfigurationPropertyOptions.None)]
+               public Uri ProxyAddress {
+                       get { return (Uri) this ["proxyAddress"]; }
+                       set { this ["proxyAddress"] = value; }
+               }
+
+               [ConfigurationProperty ("readerQuotas",
+                        Options = ConfigurationPropertyOptions.None)]
+               public XmlDictionaryReaderQuotasElement ReaderQuotas {
+                       get { return (XmlDictionaryReaderQuotasElement) this ["readerQuotas"]; }
+               }
+
+               [TypeConverter (typeof (EncodingConverter))]
+               [ConfigurationProperty ("textEncoding",
+                        DefaultValue = "utf-8",
+                        Options = ConfigurationPropertyOptions.None)]
+               public Encoding TextEncoding {
+                       get { return (Encoding) this ["textEncoding"]; }
+                       set { this ["textEncoding"] = value; }
+               }
+
+               [ConfigurationProperty ("transferMode",
+                        DefaultValue = "Buffered",
+                        Options = ConfigurationPropertyOptions.None)]
+               public TransferMode TransferMode {
+                       get { return (TransferMode) this ["transferMode"]; }
+                       set { this ["transferMode"] = value; }
+               }
+
+               [ConfigurationProperty ("useDefaultWebProxy",
+                       DefaultValue = true,
+                        Options = ConfigurationPropertyOptions.None)]
+               public bool UseDefaultWebProxy {
+                       get { return (bool) this ["useDefaultWebProxy"]; }
+                       set { this ["useDefaultWebProxy"] = value; }
+               }
+
+               protected override void OnApplyConfiguration (Binding binding)
+               {
+                       HttpBindingBase basicHttpBinding = (HttpBindingBase) binding;
+                       
+                       basicHttpBinding.AllowCookies = AllowCookies;
+                       basicHttpBinding.BypassProxyOnLocal = BypassProxyOnLocal;
+                       basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode;
+                       basicHttpBinding.MaxBufferPoolSize = MaxBufferPoolSize;
+                       basicHttpBinding.MaxBufferSize = MaxBufferSize;
+                       basicHttpBinding.MaxReceivedMessageSize = MaxReceivedMessageSize;
+                       basicHttpBinding.ProxyAddress = ProxyAddress;
+
+                       ReaderQuotas.ApplyConfiguration (basicHttpBinding.ReaderQuotas);
+
+                       basicHttpBinding.TextEncoding = TextEncoding;
+                       basicHttpBinding.TransferMode = TransferMode;
+                       basicHttpBinding.UseDefaultWebProxy = UseDefaultWebProxy;
+               }
+
+               protected internal override void InitializeFrom (Binding binding)
+               {
+                       HttpBindingBase b = (HttpBindingBase) binding;
+                       
+                       base.InitializeFrom (binding);
+                       AllowCookies = b.AllowCookies;
+                       BypassProxyOnLocal = b.BypassProxyOnLocal;
+                       HostNameComparisonMode = b.HostNameComparisonMode;
+                       MaxBufferPoolSize = b.MaxBufferPoolSize;
+                       MaxBufferSize = b.MaxBufferSize;
+                       MaxReceivedMessageSize = b.MaxReceivedMessageSize;
+                       ProxyAddress = b.ProxyAddress;
+
+                       ReaderQuotas.ApplyConfiguration (b.ReaderQuotas);
+
+                       TextEncoding = b.TextEncoding;
+                       TransferMode = b.TransferMode;
+                       UseDefaultWebProxy = b.UseDefaultWebProxy;
+               }
+       }
+
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/CustomPolicyConversionContext.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/CustomPolicyConversionContext.cs
new file mode 100644 (file)
index 0000000..1e40ee7
--- /dev/null
@@ -0,0 +1,133 @@
+//
+// CustomPolicyConversionContext.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Xml;
+using System.ServiceModel.Channels;
+using WS = System.Web.Services.Description;
+
+namespace System.ServiceModel.Description {
+
+       internal class CustomPolicyConversionContext : PolicyConversionContext {
+               WS.Binding binding;
+               PolicyAssertionCollection assertions;
+               BindingElementCollection binding_elements;
+
+               internal WS.Binding WsdlBinding {
+                       get { return binding; }
+               }
+
+               #region implemented abstract members of PolicyConversionContext
+
+               public override PolicyAssertionCollection GetBindingAssertions ()
+               {
+                       return assertions;
+               }
+
+               public override PolicyAssertionCollection GetFaultBindingAssertions (FaultDescription fault)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override PolicyAssertionCollection GetMessageBindingAssertions (MessageDescription message)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override PolicyAssertionCollection GetOperationBindingAssertions (OperationDescription operation)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override BindingElementCollection BindingElements {
+                       get { return binding_elements; }
+               }
+
+               #endregion
+
+               public CustomPolicyConversionContext (WS.Binding binding, ServiceEndpoint endpoint)
+                       : base (endpoint)
+               {
+                       this.binding = binding;
+                       assertions = new PolicyAssertionCollection ();
+                       binding_elements = ((CustomBinding)endpoint.Binding).Elements;
+               }
+
+               public CustomPolicyConversionContext (ServiceEndpoint endpoint)
+                       : base (endpoint)
+               {
+                       assertions = new PolicyAssertionCollection ();
+                       binding_elements = endpoint.Binding.CreateBindingElements ();
+               }
+
+               public void AddPolicyAssertion (XmlElement element)
+               {
+                       /*
+                        * http://www.w3.org/Submission/WS-Policy/#Policy_Assertion:
+                        *
+                        * <wsp:Policy … >
+                        *   <wsp:ExactlyOne>
+                        *     ( <wsp:All> ( <Assertion …> … </Assertion> )* </wsp:All> )*
+                        *   </wsp:ExactlyOne>
+                        * </wsp:Policy> 
+                        * 
+                        */
+
+                       var exactlyOne = element.FirstChild as XmlElement;
+                       if (exactlyOne == null) {
+                               // OOPS
+                               return;
+                       }
+
+                       if (!exactlyOne.NamespaceURI.Equals (Constants.WspNamespace) ||
+                               !exactlyOne.LocalName.Equals ("ExactlyOne")) {
+                               // FIXME: What to do with this ... ?
+                               return;
+                       }
+
+                       foreach (var node in exactlyOne.ChildNodes) {
+                               var child = node as XmlElement;
+                               if (child == null)
+                                       continue;
+
+                               if (!child.NamespaceURI.Equals (Constants.WspNamespace) ||
+                                   !child.LocalName.Equals ("All")) {
+                                       // FIXME: Can assertions go here ... ?
+                                       continue;
+                               }
+
+                               foreach (var node2 in child.ChildNodes) {
+                                       var assertion = node2 as XmlElement;
+                                       if (assertion == null)
+                                               continue;
+
+                                       assertions.Add (assertion);
+                               }
+                       }
+               }
+       }
+}
+
index 7c143d83cba0fb89985dca5b3924e6152057617b..fd8043da03b57a357e5a4f25b91ebfb67d73815f 100644 (file)
@@ -40,12 +40,14 @@ namespace System.ServiceModel.Description
        [MonoTODO]
        public abstract class MetadataExporter
        {
+               Collection<MetadataConversionError> errors = new Collection<MetadataConversionError> ();
+
                internal MetadataExporter ()
                {
                }
 
                public Collection<MetadataConversionError> Errors {
-                       get { throw new NotImplementedException (); }
+                       get { return errors; }
                }
 
                public Dictionary<Object,Object> State {
@@ -63,5 +65,39 @@ namespace System.ServiceModel.Description
                {
                        throw new NotImplementedException ();
                }
+
+               internal MetadataConversionError AddError (string message, params object[] args)
+               {
+                       var error = new MetadataConversionError (string.Format (message, args));
+                       Errors.Add (error);
+                       return error;
+               }
+               
+               internal MetadataConversionError AddWarning (string message, params object[] args)
+               {
+                       var error = new MetadataConversionError (string.Format (message, args), true);
+                       Errors.Add (error);
+                       return error;
+               }
+               
+               internal class MetadataExportException : Exception
+               {
+                       public MetadataConversionError Error {
+                               get;
+                               private set;
+                       }
+                       
+                       public MetadataExportException (MetadataConversionError error)
+                               : base (error.Message)
+                       {
+                               this.Error = error;
+                       }
+                       
+                       public MetadataExportException (MetadataConversionError error, Exception inner)
+                               : base (error.Message, inner)
+                       {
+                               this.Error = error;
+                       }
+               }
        }
 }
index febc85272134b8af9a4b53a75a76294d0c19237f..2257936225f1b17a69dfd3e33df2fe51458a4593 100644 (file)
@@ -56,7 +56,6 @@ namespace System.ServiceModel.Description
                        policy_extensions.Add (new MessageEncodingBindingElementImporter ());
                }
 
-               [MonoTODO ("Not in use yet")]
                public Collection<MetadataConversionError> Errors {
                        get { return errors; }
                }
@@ -86,5 +85,40 @@ namespace System.ServiceModel.Description
                        }
                        return (T) value;
                }
+
+               internal MetadataConversionError AddError (string message, params object[] args)
+               {
+                       var error = new MetadataConversionError (string.Format (message, args));
+                       Errors.Add (error);
+                       return error;
+               }
+               
+               internal MetadataConversionError AddWarning (string message, params object[] args)
+               {
+                       var error = new MetadataConversionError (string.Format (message, args), true);
+                       Errors.Add (error);
+                       return error;
+               }
+               
+               internal class MetadataImportException : Exception
+               {
+                       public MetadataConversionError Error {
+                               get;
+                               private set;
+                       }
+                       
+                       public MetadataImportException (MetadataConversionError error)
+                               : base (error.Message)
+                       {
+                               this.Error = error;
+                       }
+                       
+                       public MetadataImportException (MetadataConversionError error, Exception inner)
+                               : base (error.Message, inner)
+                       {
+                               this.Error = error;
+                       }
+               }
+
        }
 }
index 368cab78063cb1ae24d9e9a5e46d8acae58f1a87..5595d01edfc8501127f9eafd61f9e276ce8c6255 100644 (file)
@@ -36,14 +36,21 @@ namespace System.ServiceModel.Description
 {
        public abstract class PolicyConversionContext
        {
+               ServiceEndpoint endpoint;
+
                protected PolicyConversionContext (ServiceEndpoint endpoint)
                {
+                       this.endpoint = endpoint;
+               }
+
+               internal ServiceEndpoint Endpoint {
+                       get { return endpoint; }
                }
 
                public abstract BindingElementCollection BindingElements { get; }
 
                public ContractDescription Contract {
-                       get { throw new NotImplementedException (); }
+                       get { return endpoint.Contract; }
                }
 
                public abstract PolicyAssertionCollection GetBindingAssertions ();
index 0a5e892fe75c95593b89d7d8b2af2f86ea0eff2d..eaaa7b4eb2731dcfca00578a2d9e0a0c2ebfeebf 100644 (file)
@@ -4,8 +4,10 @@
 // Author:
 //     Atsushi Enomoto <atsushi@ximian.com>
 //     Ankit Jain <JAnkit@novell.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
 //
 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -65,10 +67,23 @@ namespace System.ServiceModel.Description
                        public List<IWsdlExportExtension> Results { get; private set; }
                }
 
-               private MetadataSet metadata;
-               private ServiceDescriptionCollection wsdl_colln;
-               private XsdDataContractExporter xsd_exporter;
-               private List<ContractExportMap> exported_contracts;
+               class EndpointExportMap
+               {
+                       public EndpointExportMap (string name, ServiceEndpoint endpoint)
+                       {
+                               Name = name;
+                               Endpoint = endpoint;
+                       }
+
+                       public string Name { get; private set; }
+                       public ServiceEndpoint Endpoint { get; private set; }
+               }
+
+               MetadataSet metadata;
+               ServiceDescriptionCollection wsdl_colln;
+               XsdDataContractExporter xsd_exporter;
+               Dictionary<ContractDescription, ContractExportMap> exported_contracts;
+               List<EndpointExportMap> exported_endpoints;
 
                public override MetadataSet GetGeneratedMetadata ()
                {
@@ -89,20 +104,19 @@ namespace System.ServiceModel.Description
 
                public override void ExportContract (ContractDescription contract)
                {
-                       ExportContractInternal (contract, true);
+                       ExportContractInternal (contract);
                }
 
-               List<IWsdlExportExtension> ExportContractInternal (ContractDescription contract, bool rejectDuplicate)
+               ContractExportMap ExportContractInternal (ContractDescription contract)
                {
+                       if (ExportedContracts.ContainsKey (contract))
+                               return ExportedContracts [contract];
+
                        QName qname = new QName (contract.Name, contract.Namespace);
-                       var map = ExportedContracts.FirstOrDefault (m => m.QName == qname);
-                       if (map != null) {
-                               if (map.Results != null && !rejectDuplicate)
-                                       return null; // already exported.
+                       if (ExportedContracts.Any (m => m.Value.QName == qname))
                                throw new ArgumentException (String.Format (
-                                       "A ContractDescription with Namespace : {0} and Name : {1} has already been exported.", 
+                                       "A ContractDescription with Namespace : {0} and Name : {1} has already been exported.",
                                        contract.Namespace, contract.Name));
-                       }
 
                        WSServiceDescription sd = GetServiceDescription (contract.Namespace);
 
@@ -169,24 +183,38 @@ namespace System.ServiceModel.Description
                        sd.Types.Schemas.Add (xs_import);
 
                        sd.PortTypes.Add (ws_port);
-                       ExportedContracts.Add (new ContractExportMap (qname, contract, extensions));
+                       var map = new ContractExportMap (qname, contract, extensions);
+                       ExportedContracts.Add (contract, map);
 
                        WsdlContractConversionContext context = new WsdlContractConversionContext (contract, ws_port);
                        foreach (IWsdlExportExtension extn in extensions)
                                extn.ExportContract (this, context);
 
-                       return extensions;
+                       return map;
                }
 
                public override void ExportEndpoint (ServiceEndpoint endpoint)
                {
-                       ExportEndpoint (endpoint, true);
+                       ExportEndpoint_Internal (endpoint);
                }
 
-               void ExportEndpoint (ServiceEndpoint endpoint, bool rejectDuplicate)
+               EndpointExportMap ExportEndpoint_Internal (ServiceEndpoint endpoint)
                {
-                       List<IWsdlExportExtension> extensions = ExportContractInternal (endpoint.Contract, rejectDuplicate);
-                       
+                       var map = ExportedEndpoints.FirstOrDefault (m => m.Endpoint == endpoint);
+                       if (map != null)
+                               return map;
+
+                       int index = 0;
+                       var baseName = String.Concat (endpoint.Binding.Name, "_", endpoint.Contract.Name);
+                       var name = baseName;
+                       while (ExportedEndpoints.Exists (m => m.Name == name))
+                               name = String.Concat (baseName, (++index).ToString ());
+
+                       map = new EndpointExportMap (name, endpoint);
+                       ExportedEndpoints.Add (map);
+
+                       var contract = ExportContractInternal (endpoint.Contract);
+
                        //FIXME: Namespace
                        WSServiceDescription sd = GetServiceDescription ("http://tempuri.org/");
                        if (sd.TargetNamespace != endpoint.Contract.Namespace) {
@@ -204,70 +232,48 @@ namespace System.ServiceModel.Description
                                        "Binding for ServiceEndpoint named '{0}' is null",
                                        endpoint.Name));
 
-                       bool msg_version_none =
-                               endpoint.Binding.MessageVersion != null &&
-                               endpoint.Binding.MessageVersion.Equals (MessageVersion.None);
+                       var extensions = new List<IWsdlExportExtension> ();
+                       var extensionTypes = new Dictionary<Type, IWsdlExportExtension> ();
+                       if (contract.Results != null) {
+                               foreach (var extension in contract.Results) {
+                                       var type = extension.GetType ();
+                                       if (extensionTypes.ContainsKey (type))
+                                               continue;
+                                       extensionTypes.Add (type, extension);
+                                       extensions.Add (extension);
+                               }
+                       }
+
+                       var bindingElements = endpoint.Binding.CreateBindingElements ();
+                       foreach (var element in bindingElements) {
+                               var extension = element as IWsdlExportExtension;
+                               if (extension == null)
+                                       continue;
+                               var type = extension.GetType ();
+                               if (extensionTypes.ContainsKey (type))
+                                       continue;
+                               extensionTypes.Add (type, extension);
+                               extensions.Add (extension);
+                       }
+
                        //ExportBinding
                        WSBinding ws_binding = new WSBinding ();
                        
                        //<binding name = .. 
-                       ws_binding.Name = String.Concat (endpoint.Binding.Name, "_", endpoint.Contract.Name);
+                       ws_binding.Name = name;
 
                        //<binding type = ..
                        ws_binding.Type = new QName (endpoint.Contract.Name, endpoint.Contract.Namespace);
                        sd.Bindings.Add (ws_binding);
 
-                       if (!msg_version_none) {
-                               SoapBinding soap_binding = new SoapBinding ();
-                               soap_binding.Transport = SoapBinding.HttpTransport;
-                               soap_binding.Style = SoapBindingStyle.Document;
-                               ws_binding.Extensions.Add (soap_binding);
-                       }
-
                        //      <operation
-                       foreach (OperationDescription sm_op in endpoint.Contract.Operations){
-                               OperationBinding op_binding = new OperationBinding ();
-                               op_binding.Name = sm_op.Name;
-
-                               //FIXME: Move to IWsdlExportExtension .. ?
-                               foreach (MessageDescription sm_md in sm_op.Messages) {
-                                       if (sm_md.Direction == MessageDirection.Input) {
-                                               //<input
-                                               InputBinding in_binding = new InputBinding ();
-
-                                               if (!msg_version_none) {
-                                                       SoapBodyBinding soap_body_binding = new SoapBodyBinding ();
-                                                       soap_body_binding.Use = SoapBindingUse.Literal;
-                                                       in_binding.Extensions.Add (soap_body_binding);
-
-                                                       //Set Action
-                                                       //<operation > <soap:operation soapAction .. >
-                                                       SoapOperationBinding soap_operation_binding = new SoapOperationBinding ();
-                                                       soap_operation_binding.SoapAction = sm_md.Action;
-                                                       soap_operation_binding.Style = SoapBindingStyle.Document;
-                                                       op_binding.Extensions.Add (soap_operation_binding);
-                                               }
-
-                                               op_binding.Input = in_binding;
-                                       } else {
-                                               //<output
-                                               OutputBinding out_binding = new OutputBinding ();
-
-                                               if (!msg_version_none) {
-                                                       SoapBodyBinding soap_body_binding = new SoapBodyBinding ();
-                                                       soap_body_binding.Use = SoapBindingUse.Literal;
-                                                       out_binding.Extensions.Add (soap_body_binding);
-                                               }
-                                               
-                                               op_binding.Output = out_binding;
-                                       }
-                               }
-
+                       foreach (OperationDescription sm_op in endpoint.Contract.Operations) {
+                               var op_binding = CreateOperationBinding (endpoint, sm_op);
                                ws_binding.Operations.Add (op_binding);
                        }
 
                        //Add <service
-                       Port ws_port = ExportService (sd, ws_binding, endpoint.Address, msg_version_none);
+                       Port ws_port = ExportService (sd, ws_binding, endpoint.Address);
 
                        //Call IWsdlExportExtension.ExportEndpoint
                        WsdlContractConversionContext contract_context = new WsdlContractConversionContext (
@@ -275,14 +281,105 @@ namespace System.ServiceModel.Description
                        WsdlEndpointConversionContext endpoint_context = new WsdlEndpointConversionContext (
                                contract_context, endpoint, ws_port, ws_binding);
 
-                       if (extensions != null)
-                               foreach (IWsdlExportExtension extn in extensions)
-                                       extn.ExportEndpoint (this, endpoint_context);
+                       foreach (var extension in extensions) {
+                               try {
+                                       extension.ExportEndpoint (this, endpoint_context);
+                               } catch (Exception ex) {
+                                       var error = AddError (
+                                               "Failed to export endpoint '{0}': wsdl exporter '{1}' " +
+                                               "threw an exception: {2}", endpoint.Name, extension.GetType (), ex);
+                                       throw new MetadataExportException (error, ex);
+                               }
+                       }
+
+                       try {
+                               ExportPolicy (endpoint, ws_binding);
+                       } catch (MetadataExportException) {
+                               throw;
+                       } catch (Exception ex) {
+                               var error = AddError (
+                                       "Failed to export endpoint '{0}': unhandled exception " +
+                                       "while exporting policy: {1}", endpoint.Name, ex);
+                               throw new MetadataExportException (error, ex);
+                       }
+
+                       return map;
+               }
+
+               OperationBinding CreateOperationBinding (ServiceEndpoint endpoint, OperationDescription sm_op)
+               {
+                       OperationBinding op_binding = new OperationBinding ();
+                       op_binding.Name = sm_op.Name;
+                       
+                       foreach (MessageDescription sm_md in sm_op.Messages) {
+                               if (sm_md.Direction == MessageDirection.Input) {
+                                       //<input
+                                       CreateInputBinding (endpoint, op_binding, sm_md);
+                               } else {
+                                       //<output
+                                       CreateOutputBinding (endpoint, op_binding, sm_md);
+                               }
+                       }
+
+                       return op_binding;
+               }
+
+               void CreateInputBinding (ServiceEndpoint endpoint, OperationBinding op_binding,
+                                        MessageDescription sm_md)
+               {
+                       var in_binding = new InputBinding ();
+                       op_binding.Input = in_binding;
+
+                       var message_version = endpoint.Binding.MessageVersion ?? MessageVersion.None;
+                       if (message_version == MessageVersion.None)
+                               return;
 
+                       SoapBodyBinding soap_body_binding;
+                       SoapOperationBinding soap_operation_binding;
+                       if (message_version.Envelope == EnvelopeVersion.Soap11) {
+                               soap_body_binding = new SoapBodyBinding ();
+                               soap_operation_binding = new SoapOperationBinding ();
+                       } else if (message_version.Envelope == EnvelopeVersion.Soap12) {
+                               soap_body_binding = new Soap12BodyBinding ();
+                               soap_operation_binding = new Soap12OperationBinding ();
+                       } else {
+                               throw new InvalidOperationException ();
+                       }
+
+                       soap_body_binding.Use = SoapBindingUse.Literal;
+                       in_binding.Extensions.Add (soap_body_binding);
                                
+                       //Set Action
+                       //<operation > <soap:operation soapAction .. >
+                       soap_operation_binding.SoapAction = sm_md.Action;
+                       soap_operation_binding.Style = SoapBindingStyle.Document;
+                       op_binding.Extensions.Add (soap_operation_binding);
                }
 
-               Port ExportService (WSServiceDescription sd, WSBinding ws_binding, EndpointAddress address, bool msg_version_none)
+               void CreateOutputBinding (ServiceEndpoint endpoint, OperationBinding op_binding,
+                                         MessageDescription sm_md)
+               {
+                       var out_binding = new OutputBinding ();
+                       op_binding.Output = out_binding;
+
+                       var message_version = endpoint.Binding.MessageVersion ?? MessageVersion.None;
+                       if (message_version == MessageVersion.None)
+                               return;
+
+                       SoapBodyBinding soap_body_binding;
+                       if (message_version.Envelope == EnvelopeVersion.Soap11) {
+                               soap_body_binding = new SoapBodyBinding ();
+                       } else if (message_version.Envelope == EnvelopeVersion.Soap12) {
+                               soap_body_binding = new Soap12BodyBinding ();
+                       } else {
+                               throw new InvalidOperationException ();
+                       }
+
+                       soap_body_binding.Use = SoapBindingUse.Literal;
+                       out_binding.Extensions.Add (soap_body_binding);
+               }
+               
+               Port ExportService (WSServiceDescription sd, WSBinding ws_binding, EndpointAddress address)
                {
                        if (address == null)
                                return null;
@@ -290,16 +387,9 @@ namespace System.ServiceModel.Description
                        Service ws_svc = GetService (sd, "service");
                        sd.Name = "service";
 
-                               Port ws_port = new Port ();
-                               ws_port.Name = ws_binding.Name;
-                               ws_port.Binding = new QName (ws_binding.Name, sd.TargetNamespace);
-
-                               if (!msg_version_none) {
-                                       SoapAddressBinding soap_addr = new SoapAddressBinding ();
-                                       soap_addr.Location = address.Uri.AbsoluteUri;
-
-                                       ws_port.Extensions.Add (soap_addr);
-                               }
+                       Port ws_port = new Port ();
+                       ws_port.Name = ws_binding.Name;
+                       ws_port.Binding = new QName (ws_binding.Name, sd.TargetNamespace);
 
                        ws_svc.Ports.Add (ws_port);
 
@@ -361,7 +451,7 @@ namespace System.ServiceModel.Description
                                if (ep.Contract.Name == ServiceMetadataBehavior.MexContractName)
                                        continue;
 
-                               ExportEndpoint (ep, false);
+                               ExportEndpoint (ep);
                        }
                }
 
@@ -374,14 +464,22 @@ namespace System.ServiceModel.Description
                        }
                }
 
-               List<ContractExportMap> ExportedContracts {
+               Dictionary<ContractDescription, ContractExportMap> ExportedContracts {
                        get {
                                if (exported_contracts == null)
-                                       exported_contracts = new List<ContractExportMap> ();
+                                       exported_contracts = new Dictionary<ContractDescription, ContractExportMap> ();
                                return exported_contracts;
                        }
                }
                
+               List<EndpointExportMap> ExportedEndpoints {
+                       get {
+                               if (exported_endpoints == null)
+                                       exported_endpoints = new List<EndpointExportMap> ();
+                               return exported_endpoints;
+                       }
+               }
+               
                XmlSerializerNamespaces GetNamespaces (string target_namespace)
                {
                        XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces ();
@@ -577,5 +675,49 @@ namespace System.ServiceModel.Description
                        return schema;
                }
 
+               PolicyConversionContext ExportPolicy (ServiceEndpoint endpoint, WSBinding binding)
+               {
+                       var context = new CustomPolicyConversionContext (endpoint);
+
+                       var elements = endpoint.Binding.CreateBindingElements ();
+                       foreach (var element in elements) {
+                               var exporter = element as IPolicyExportExtension;
+                               if (exporter == null)
+                                       continue;
+
+                               try {
+                                       exporter.ExportPolicy (this, context);
+                               } catch (Exception ex) {
+                                       var error = AddError (
+                                               "Failed to export endpoint '{0}': policy exporter " +
+                                               "'{1}' threw an exception: {2}", endpoint.Name,
+                                               element.GetType (), ex);
+                                       throw new MetadataExportException (error, ex);
+                               }
+                       }
+
+                       var assertions = context.GetBindingAssertions ();
+                       if (assertions.Count == 0)
+                               return context;
+
+                       var doc = new XmlDocument ();
+                       var policy = doc.CreateElement ("wsp", "Policy", PolicyImportHelper.PolicyNS);
+                       doc.AppendChild (policy);
+
+                       var exactlyOne = doc.CreateElement ("wsp", "ExactlyOne", PolicyImportHelper.PolicyNS);
+                       var all = doc.CreateElement ("wsp", "All", PolicyImportHelper.PolicyNS);
+
+                       policy.AppendChild (exactlyOne);
+                       exactlyOne.AppendChild (all);
+
+                       foreach (var assertion in assertions) {
+                               var imported = doc.ImportNode (assertion, true);
+                               all.AppendChild (imported);
+                       }
+
+                       binding.Extensions.Add (policy);
+                       return context;
+               }
+
        }
 }
index 7cda8c5adf00bdfac1c60ec38b7799ea268e853a..562e02b25d43fd7b718d077cd2a6c23a80d2277b 100644 (file)
@@ -1,11 +1,13 @@
 //
 // WsdlImporter.cs
 //
-// Author:
+// Authors:
 //     Atsushi Enomoto <atsushi@ximian.com>
 //     Ankit Jain <jankit@novell.com>  
+//     Martin Baulig <martin.baulig@xamarin.com>
 //
 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -36,6 +38,7 @@ using System.Xml;
 using System.Xml.Schema;
 
 using SMBinding = System.ServiceModel.Channels.Binding;
+using WS = System.Web.Services.Description;
 using WSServiceDescription = System.Web.Services.Description.ServiceDescription;
 using WSBinding = System.Web.Services.Description.Binding;
 using WSMessage = System.Web.Services.Description.Message;
@@ -50,6 +53,7 @@ namespace System.ServiceModel.Description
                XmlSchemaSet xmlschemas;
                List<XmlElement> policies; /* ?? */
                MetadataSet metadata;
+               bool beforeImportCalled;
 
                KeyedByTypeCollection<IWsdlImportExtension> wsdl_extensions;
                        
@@ -57,6 +61,13 @@ namespace System.ServiceModel.Description
                Collection<ContractDescription> contracts = null;
                ServiceEndpointCollection endpoint_colln = null;
 
+               // Contract by PortType
+               Dictionary<PortType, ContractDescription> contractHash = null;
+               // ServiceEndpoint by WSBinding
+               Dictionary<WSBinding, ServiceEndpoint> bindingHash = null;
+               // ServiceEndpoint by Port
+               Dictionary<Port, ServiceEndpoint> endpointHash = null;
+
                public WsdlImporter (
                        MetadataSet metadata,
                        IEnumerable<IPolicyImportExtension> policyImportExtensions,
@@ -71,7 +82,7 @@ namespace System.ServiceModel.Description
 
                                wsdl_extensions.Add (new DataContractSerializerMessageContractImporter ());
                                wsdl_extensions.Add (new XmlSerializerMessageContractImporter ());
-                               //wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
+                               wsdl_extensions.Add (new MessageEncodingBindingElementImporter ());
                                wsdl_extensions.Add (new TransportBindingElementImporter ());
                                wsdl_extensions.Add (new StandardBindingImporter ());
                        } else {
@@ -84,6 +95,9 @@ namespace System.ServiceModel.Description
                        this.wsdl_documents = new ServiceDescriptionCollection ();
                        this.xmlschemas = new XmlSchemaSet ();
                        this.policies = new List<XmlElement> ();
+                       this.contractHash = new Dictionary<PortType, ContractDescription> ();
+                       this.bindingHash = new Dictionary<WSBinding, ServiceEndpoint> ();
+                       this.endpointHash = new Dictionary<Port, ServiceEndpoint> ();
 
                        foreach (MetadataSection ms in metadata.MetadataSections) {
                                if (ms.Dialect == MetadataSection.ServiceDescriptionDialect &&
@@ -117,43 +131,168 @@ namespace System.ServiceModel.Description
                {
                        Collection<SMBinding> bindings = new Collection<SMBinding> ();
 
-                       foreach (WSServiceDescription sd in wsdl_documents)
-                               foreach (WSBinding binding in sd.Bindings)
-                                       bindings.Add (ImportBinding (binding));
+                       foreach (WSServiceDescription sd in wsdl_documents) {
+                               foreach (WSBinding binding in sd.Bindings) {
+                                       var endpoint = ImportBinding (binding, false);
+                                       if (endpoint != null)
+                                               bindings.Add (endpoint.Binding);
+                               }
+                       }
 
                        return bindings;
                }
 
-               public SMBinding ImportBinding (WSBinding binding)
+               void BeforeImport ()
                {
-                       /* Default, CustomBinding.. */
-                       CustomBinding smbinding = new CustomBinding ();
+                       if (beforeImportCalled)
+                               return;
 
                        foreach (IWsdlImportExtension extension in wsdl_extensions)
                                extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+                       
+                       beforeImportCalled = true;
+               }
 
-                       smbinding.Name = binding.Name;
-                       smbinding.Namespace = binding.ServiceDescription.TargetNamespace;
+               public SMBinding ImportBinding (WSBinding binding)
+               {
+                       return ImportBinding (binding, true).Binding;
+               }
 
-                       //FIXME: Added by MessageEncodingBindingElementConverter.ImportPolicy
-                       smbinding.Elements.Add (new TextMessageEncodingBindingElement ());
+               ServiceEndpoint ImportBinding (WSBinding binding, bool throwOnError)
+               {
+                       if (bindingHash.ContainsKey (binding)) {
+                               var sep = bindingHash [binding];
+                               if (sep != null)
+                                       return sep;
+
+                               if (!throwOnError)
+                                       return null;
+                               
+                               throw new InvalidOperationException (String.Format (
+                                       "Failed to import binding {0}, an error has " +
+                                       "already been reported before.", binding.Name));
+                       }
 
-                       /*ImportContract
-                       PortType portType = null;
-                       foreach (WSServiceDescription sd in wsdl_documents) {
-                               portType = sd.PortTypes [binding.Type.Name];
-                               if (portType != null)
-                                       break;
+                       try {
+                               var port_type = GetPortTypeFromBinding (binding);
+                               var contract = ImportContract (port_type);
+                               var contract_context = new WsdlContractConversionContext (contract, port_type);
+                       
+                               var sep = ImportBinding (binding, contract_context);
+                               bindingHash.Add (binding, sep);
+                               return sep;
+                       } catch (MetadataImportException) {
+                               bindingHash.Add (binding, null);
+                               if (throwOnError)
+                                       throw;
+                               return null;
+                       } catch (Exception ex) {
+                               bindingHash.Add (binding, null);
+                               var error = AddError (
+                                       "Failed to import binding `{0}': {1}", binding.Name, ex.Message);
+                               if (throwOnError)
+                                       throw new MetadataImportException (error, ex);
+                               return null;
                        }
+               }
+
+               ServiceEndpoint ImportBinding (WSBinding binding,
+                                              WsdlContractConversionContext contract_context)
+               {
+                       BeforeImport ();
 
-                       //FIXME: if portType == null
-                       */
+                       var sep = new ServiceEndpoint (contract_context.Contract);
+                       
+                       var custom = new CustomBinding ();
+                       custom.Name = binding.Name;
+                       custom.Namespace = binding.ServiceDescription.TargetNamespace;
+                       
+                       sep.Binding = custom;
+
+                       try {
+                               ImportPolicy (binding, sep);
+                       } catch (Exception ex) {
+                               // FIXME: Policy import is still experimental.
+                               AddWarning ("Exception while trying to import policy for " +
+                                           "binding `{0}': {1}", binding.Name, ex.Message);
+                       }
+                       
+                       var endpoint_context = new WsdlEndpointConversionContext (
+                               contract_context, sep, null, binding);
+                       
+                       foreach (IWsdlImportExtension extension in wsdl_extensions)
+                               extension.ImportEndpoint (this, endpoint_context);
                        
-                       // FIXME: ImportContract here..
+                       return sep;
+               }
+
+               void ImportPolicy (WSBinding binding, ServiceEndpoint endpoint)
+               {
+                       var context = new Description.CustomPolicyConversionContext (binding, endpoint);
+                       var assertions = context.GetBindingAssertions ();
+
+                       foreach (var ext in binding.Extensions) {
+                               var xml = ext as XmlElement;
+                               if (xml == null)
+                                       continue;
+                               if (!xml.NamespaceURI.Equals (Constants.WspNamespace))
+                                       continue;
+                               if (xml.LocalName.Equals ("Policy")) {
+                                       context.AddPolicyAssertion (xml);
+                                       continue;
+                               }
+                               if (!xml.LocalName.Equals ("PolicyReference"))
+                                       continue;
+                               var uri = xml.GetAttribute ("URI");
+
+                               if (!uri.StartsWith ("#")) {
+                                       // FIXME
+                                       AddWarning (
+                                               "Failed to resolve unknown policy reference `{0}' for " +
+                                               "binding `{1}'.", uri, binding.Name);
+                                       continue;
+                               }
+
+                               foreach (var sext in binding.ServiceDescription.Extensions) {
+                                       var sxml = sext as XmlElement;
+                                       if (sxml == null)
+                                               continue;
+                                       if (!sxml.NamespaceURI.Equals (Constants.WspNamespace))
+                                               continue;
+                                       if (!sxml.LocalName.Equals ("Policy"))
+                                               continue;
+                                       var id = sxml.GetAttribute ("Id", Constants.WsuNamespace);
+                                       if (!uri.Substring (1).Equals (id))
+                                               continue;
+                                       context.AddPolicyAssertion (sxml);
+                               }
+                       }
 
-                       return smbinding;
+                       foreach (IPolicyImportExtension extension in PolicyImportExtensions) {
+                               try {
+                                       extension.ImportPolicy (this, context);
+                               } catch (Exception ex) {
+                                       AddWarning (
+                                               "PolicyImportException `{0}' threw an exception while " +
+                                               "trying to import policy references for endpoint `{1}': {2}",
+                                               extension.GetType ().Name, endpoint.Name, ex.Message);
+                               }
+                       }
                }
 
+               PortType GetPortTypeFromBinding (WSBinding binding)
+               {
+                       foreach (WSServiceDescription sd in wsdl_documents) {
+                               var port_type = sd.PortTypes [binding.Type.Name];
+                               if (port_type != null)
+                                       return port_type;
+                       }
+                       
+                       throw new MetadataImportException (AddError (
+                               "PortType named {0} not found in namespace {1}.",
+                               binding.Type.Name, binding.Type.Namespace));
+               }
+               
                public override Collection<ContractDescription> ImportAllContracts ()
                {
                        if (contracts != null)
@@ -162,8 +301,11 @@ namespace System.ServiceModel.Description
                        contracts = new Collection<ContractDescription> ();
 
                        foreach (WSServiceDescription sd in wsdl_documents) {
-                               foreach (PortType pt in sd.PortTypes)
-                                       contracts.Add (ImportContract (pt));
+                               foreach (PortType pt in sd.PortTypes) {
+                                       var cd = ImportContract (pt, false);
+                                       if (cd != null)
+                                               contracts.Add (cd);
+                               }
                        }
 
                        return contracts;
@@ -176,23 +318,62 @@ namespace System.ServiceModel.Description
 
                        endpoint_colln = new ServiceEndpointCollection ();
 
-                       foreach (IWsdlImportExtension extension in wsdl_extensions) {
-                               extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+                       foreach (WSServiceDescription wsd in wsdl_documents) {
+                               foreach (Service service in wsd.Services) {
+                                       foreach (Port port in service.Ports) {
+                                               var sep = ImportEndpoint (port, false);
+                                               if (sep != null)
+                                                       endpoint_colln.Add (sep);
+                                       }
+                               }
                        }
 
-                       foreach (WSServiceDescription wsd in wsdl_documents)
-                               foreach (Service service in wsd.Services)
-                                       foreach (Port port in service.Ports)
-                                               endpoint_colln.Add (ImportEndpoint (port));
-
                        return endpoint_colln;
                }
 
                public ContractDescription ImportContract (PortType wsdlPortType)
                {
-                       foreach (IWsdlImportExtension extension in wsdl_extensions) {
-                               extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+                       return ImportContract (wsdlPortType, true);
+               }
+
+               ContractDescription ImportContract (PortType portType, bool throwOnError)
+               {
+                       if (contractHash.ContainsKey (portType)) {
+                               var cd = contractHash [portType];
+                               if (cd != null)
+                                       return cd;
+
+                               if (!throwOnError)
+                                       return null;
+
+                               throw new InvalidOperationException (String.Format (
+                                       "Failed to import contract for port type `{0}', " +
+                                       "an error has already been reported.", portType.Name));
+                       }
+
+                       try {
+                               var cd = DoImportContract (portType);
+                               contractHash.Add (portType, cd);
+                               return cd;
+                       } catch (MetadataImportException) {
+                               contractHash.Add (portType, null);
+                               if (throwOnError)
+                                       throw;
+                               return null;
+                       } catch (Exception ex) {
+                               contractHash.Add (portType, null);
+                               var error = AddError (
+                                       "Failed to import contract for port type `{0}': {1}",
+                                       portType.Name, ex.Message);
+                               if (throwOnError)
+                                       throw new MetadataImportException (error, ex);
+                               return null;
                        }
+               }
+
+               ContractDescription DoImportContract (PortType wsdlPortType)
+               {
+                       BeforeImport ();
 
                        ContractDescription cd = new ContractDescription (wsdlPortType.Name, wsdlPortType.ServiceDescription.TargetNamespace);
 
@@ -265,61 +446,140 @@ namespace System.ServiceModel.Description
 
                public ServiceEndpoint ImportEndpoint (Port wsdlPort)
                {
-                       foreach (IWsdlImportExtension extension in wsdl_extensions) {
-                               extension.BeforeImport (wsdl_documents, xmlschemas, policies);
+                       return ImportEndpoint (wsdlPort, true);
+               }
+
+               ServiceEndpoint ImportEndpoint (Port port, bool throwOnError)
+               {
+                       ServiceEndpoint endpoint;
+                       if (endpointHash.ContainsKey (port)) {
+                               endpoint = endpointHash [port];
+                               if (endpoint != null)
+                                       return endpoint;
+                               
+                               if (!throwOnError)
+                                       return null;
+                               
+                               throw new InvalidOperationException (String.Format (
+                                       "Failed to import port `{0}', an error has " +
+                                       "already been reported before.", port.Name));
                        }
 
-                       //Get the corresponding contract
-                       //via the PortType
-                       WSBinding wsb = wsdlPort.Service.ServiceDescription.Bindings [wsdlPort.Binding.Name];
-                       if (wsb == null)
-                               //FIXME
-                               throw new Exception (String.Format ("Binding named {0} not found.", wsdlPort.Binding.Name));
+                       var binding = port.Service.ServiceDescription.Bindings [port.Binding.Name];
+                       if (binding == null) {
+                               endpointHash.Add (port, null);
+                               var error = AddError (
+                                       "Failed to import port `{0}': cannot find binding `{1}' that " +
+                                       "this port depends on.", port.Name, port.Binding.Name);
+                               if (throwOnError)
+                                       throw new MetadataImportException (error);
+                               return null;
+                       }
 
-                       SMBinding binding = ImportBinding (wsb);
+                       try {
+                               endpoint = ImportBinding (binding, throwOnError);
+                       } catch (Exception ex) {
+                               endpointHash.Add (port, null);
+                               var error = AddError (
+                                       "Failed to import port `{0}': error while trying to import " +
+                                       "binding `{1}' that this port depends on: {2}",
+                                       port.Name, port.Binding.Name, ex.Message);
+                               if (throwOnError)
+                                       throw new MetadataImportException (error, ex);
+                               return null;
+                       }
 
-                       PortType port_type = null;
-                       foreach (WSServiceDescription sd in wsdl_documents) {
-                               port_type = sd.PortTypes [wsb.Type.Name];
-                               if (port_type != null)
-                                       break;
+                       if (endpoint == null) {
+                               endpointHash.Add (port, null);
+                               AddError (
+                                       "Failed to import port `{0}': error while trying to import " +
+                                       "binding `{1}' that this port depends on.",
+                                       port.Name, port.Binding.Name);
+                               return null;
                        }
 
-                       if (port_type == null)
-                               //FIXME
-                               throw new Exception (String.Format ("PortType named {0} not found.", wsb.Type.Name));
+                       try {
+                               ImportEndpoint (port, binding, endpoint, throwOnError);
+                               endpointHash.Add (port, endpoint);
+                               return endpoint;
+                       } catch (MetadataImportException) {
+                               endpointHash.Add (port, null);
+                               if (throwOnError)
+                                       throw;
+                               return null;
+                       } catch (Exception ex) {
+                               endpointHash.Add (port, null);
+                               var error = AddError (
+                                       "Failed to import port `{0}': {1}", port.Name, ex.Message);
+                               if (throwOnError)
+                                       throw new MetadataImportException (error, ex);
+                               return null;
+                       }
+               }
 
-                       ContractDescription contract = ImportContract (port_type);
-                       ServiceEndpoint sep = new ServiceEndpoint (contract);
+               void ImportEndpoint (Port port, WSBinding wsb, ServiceEndpoint sep, bool throwOnError)
+               {
+                       BeforeImport ();
 
-                       sep.Binding = binding;
+                       var port_type = GetPortTypeFromBinding (wsb);
 
-                       WsdlContractConversionContext contract_context = new WsdlContractConversionContext (contract, port_type);
+                       var contract_context = new WsdlContractConversionContext (sep.Contract, port_type);
                        WsdlEndpointConversionContext endpoint_context = new WsdlEndpointConversionContext (
-                                       contract_context, sep, wsdlPort, wsb);
+                                       contract_context, sep, port, wsb);
 
                        foreach (IWsdlImportExtension extension in wsdl_extensions)
                                extension.ImportEndpoint (this, endpoint_context);
+               }
 
-                       return sep;
+               void ImportEndpoints (ServiceEndpointCollection coll, WSBinding binding)
+               {
+                       foreach (WSServiceDescription wsd in wsdl_documents) {
+                               foreach (WS.Service service in wsd.Services) {
+                                       foreach (WS.Port port in service.Ports) {
+                                               if (!binding.Name.Equals (port.Binding.Name))
+                                                       continue;
+                                               var sep = ImportEndpoint (port, false);
+                                               if (sep != null)
+                                                       coll.Add (sep);
+                                       }
+                               }
+                       }
                }
 
-               public ServiceEndpointCollection ImportEndpoints (
-                       WSBinding binding)
+               public ServiceEndpointCollection ImportEndpoints (WSBinding binding)
                {
-                       throw new NotImplementedException ();
+                       var coll = new ServiceEndpointCollection ();
+                       ImportEndpoints (coll, binding);
+                       return coll;
                }
 
-               public ServiceEndpointCollection ImportEndpoints (
-                       PortType portType)
+               public ServiceEndpointCollection ImportEndpoints (PortType portType)
                {
-                       throw new NotImplementedException ();
+                       var coll = new ServiceEndpointCollection ();
+
+                       foreach (WSServiceDescription wsd in wsdl_documents) {
+                               foreach (WS.Binding binding in wsd.Bindings) {
+                                       if (!binding.Type.Name.Equals (portType.Name))
+                                               continue;
+
+                                       ImportEndpoints (coll, binding);
+                               }
+                       }
+
+                       return coll;
                }
 
-               public ServiceEndpointCollection ImportEndpoints (
-                       Service service)
+               public ServiceEndpointCollection ImportEndpoints (Service service)
                {
-                       throw new NotImplementedException ();
+                       var coll = new ServiceEndpointCollection ();
+                       
+                       foreach (Port port in service.Ports) {
+                               var sep = ImportEndpoint (port, false);
+                               if (sep != null)
+                                       coll.Add (sep);
+                       }
+
+                       return coll;
                }
        }
 }
index 36ce341867284718957a89edae8b690fef1f97e3..8baeb0a5ecd78d93bf64076f6ee7b9a560535503 100644 (file)
@@ -257,6 +257,7 @@ System.ServiceModel.Channels/PeerInputChannel.cs
 System.ServiceModel.Channels/PeerOutputChannel.cs
 System.ServiceModel.Channels/PeerTransportBindingElement.cs
 System.ServiceModel.Channels/PnrpPeerResolverBindingElement.cs
+System.ServiceModel.Channels/PolicyImportHelper.cs
 System.ServiceModel.Channels/PrivacyNoticeBindingElement.cs
 System.ServiceModel.Channels/ReliableSessionBindingElement.cs
 System.ServiceModel.Channels/ReliableSessionBindingElementImporter.cs
@@ -558,6 +559,7 @@ System.ServiceModel.Description/ClientCredentials.cs
 System.ServiceModel.Description/ClientViaBehavior.cs
 System.ServiceModel.Description/ContractDescription.cs
 System.ServiceModel.Description/ContractDescriptionGenerator.cs
+System.ServiceModel.Description/CustomPolicyConversionContext.cs
 System.ServiceModel.Description/DataContractSerializerMessageContractImporter.cs
 System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs
 System.ServiceModel.Description/FaultDescription.cs
index 262abe479141c870b297c647d362bf4d1c791451..5beb4fe90223553420f17a6a5ef72fa17d7835d8 100644 (file)
@@ -74,6 +74,14 @@ namespace System.ServiceModel
                TransportCredentialOnly,
        }
 
+#if NET_4_5
+       public enum BasicHttpsSecurityMode
+       {
+               Transport,
+               TransportWithMessageCredential
+       }
+#endif
+
        public enum CommunicationState
        {
                Created,
index 2ed2da27b4dc87a964d5525b4f5b6abc37b643fa..a52e1612627b3a08bea352be673b54d189df3977 100644 (file)
@@ -1,6 +1,9 @@
 //
 // BasicHttpBinding.cs
 //
+// See BasicHttpBinding_4_5.cs and HttpBindingBase.cs for the .NET 4.5
+// version of this class.
+//
 // Author:
 //     Atsushi Enomoto <atsushi@ximian.com>
 //
@@ -26,6 +29,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+#if !NET_4_5 || MOBILE
 using System;
 using System.Collections.Generic;
 using System.Net;
@@ -310,3 +314,4 @@ namespace System.ServiceModel
                }
        }
 }
+#endif
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs
new file mode 100644 (file)
index 0000000..276e92e
--- /dev/null
@@ -0,0 +1,196 @@
+//
+// BasicHttpBinding_4_5.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+       public class BasicHttpBinding : HttpBindingBase,
+               IBindingRuntimePreferences
+       {
+               WSMessageEncoding message_encoding = WSMessageEncoding.Text;
+               BasicHttpSecurity security;
+
+               public BasicHttpBinding ()
+                       : this (BasicHttpSecurityMode.None)
+               {
+               }
+
+               public BasicHttpBinding (string configurationName)
+                       : this ()
+               {
+                       BindingsSection bindingsSection = ConfigUtil.BindingsSection;
+                       BasicHttpBindingElement el = 
+                               bindingsSection.BasicHttpBinding.Bindings [configurationName];
+
+                       el.ApplyConfiguration (this);
+               }
+
+               public BasicHttpBinding (
+                       BasicHttpSecurityMode securityMode)
+               {
+                       security = new BasicHttpSecurity (securityMode);
+               }
+
+               public WSMessageEncoding MessageEncoding {
+                       get { return message_encoding; }
+                       set { message_encoding = value; }
+               }
+
+               public override string Scheme {
+                       get {
+                               switch (Security.Mode) {
+                               case BasicHttpSecurityMode.Transport:
+                               case BasicHttpSecurityMode.TransportWithMessageCredential:
+                                       return Uri.UriSchemeHttps;
+                               default:
+                                       return Uri.UriSchemeHttp;
+                               }
+                       }
+               }
+
+               public BasicHttpSecurity Security {
+                       get { return security; }
+               }
+
+               public override BindingElementCollection
+                       CreateBindingElements ()
+               {
+                       var list = new List<BindingElement> ();
+                       
+                       var security = CreateSecurityBindingElement ();
+                       if (security != null)
+                               list.Add (security);
+
+                       list.Add (BuildMessageEncodingBindingElement ());
+                       list.Add (GetTransport ());
+
+                       return new BindingElementCollection (list.ToArray ());
+               }
+               
+               SecurityBindingElement CreateSecurityBindingElement () 
+               {
+                       SecurityBindingElement element;
+                       switch (Security.Mode) {
+                       case BasicHttpSecurityMode.Message:
+                               if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+                                       throw new InvalidOperationException ("When Message security is enabled in a BasicHttpBinding, the message security credential type must be BasicHttpMessageCredentialType.Certificate.");
+                               element = SecurityBindingElement.CreateMutualCertificateBindingElement (
+                                   MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10);
+                               break;
+
+                       case BasicHttpSecurityMode.TransportWithMessageCredential:
+                               if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+                                       // FIXME: pass proper security token parameters.
+                                       element = SecurityBindingElement.CreateCertificateOverTransportBindingElement ();
+                               else
+                                       element = new AsymmetricSecurityBindingElement ();
+                               break;
+                       default: 
+                               return null;
+                       }
+
+                       element.SetKeyDerivation (false);
+                       element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
+                       return element;
+               }
+
+               MessageEncodingBindingElement BuildMessageEncodingBindingElement ()
+               {
+                       if (MessageEncoding == WSMessageEncoding.Text) {
+                               TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement (
+                                       MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+                               ReaderQuotas.CopyTo (tm.ReaderQuotas);
+                               return tm;
+                       } else {
+                               return new MtomMessageEncodingBindingElement (
+                                       MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+                       }
+               }
+
+               TransportBindingElement GetTransport ()
+               {
+                       HttpTransportBindingElement h;
+                       switch (Security.Mode) {
+                       case BasicHttpSecurityMode.Transport:
+                       case BasicHttpSecurityMode.TransportWithMessageCredential:
+                               h = new HttpsTransportBindingElement ();
+                               break;
+                       default:
+                               h = new HttpTransportBindingElement ();
+                               break;
+                       }
+
+                       h.AllowCookies = AllowCookies;
+                       h.BypassProxyOnLocal = BypassProxyOnLocal;
+                       h.HostNameComparisonMode = HostNameComparisonMode;
+                       h.MaxBufferPoolSize = MaxBufferPoolSize;
+                       h.MaxBufferSize = MaxBufferSize;
+                       h.MaxReceivedMessageSize = MaxReceivedMessageSize;
+                       h.ProxyAddress = ProxyAddress;
+                       h.UseDefaultWebProxy = UseDefaultWebProxy;
+                       h.TransferMode = TransferMode;
+                       h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
+
+                       switch (Security.Transport.ClientCredentialType) {
+                       case HttpClientCredentialType.Basic:
+                               h.AuthenticationScheme = AuthenticationSchemes.Basic;
+                               break;
+                       case HttpClientCredentialType.Ntlm:
+                               h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
+                               break;
+                       case HttpClientCredentialType.Windows:
+                               h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
+                               break;
+                       case HttpClientCredentialType.Digest:
+                               h.AuthenticationScheme = AuthenticationSchemes.Digest;
+                               break;
+                       case HttpClientCredentialType.Certificate:
+                               switch (Security.Mode) {
+                               case BasicHttpSecurityMode.Transport:
+                                       (h as HttpsTransportBindingElement).RequireClientCertificate = true;
+                                       break;
+                               case BasicHttpSecurityMode.TransportCredentialOnly:
+                                       throw new InvalidOperationException ("Certificate-based client authentication is not supported by 'TransportCredentialOnly' mode.");
+                               }
+                               break;
+                       }
+
+                       return h;
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs
new file mode 100644 (file)
index 0000000..6ac6310
--- /dev/null
@@ -0,0 +1,166 @@
+//
+// BasicHttpsBinding.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+       public class BasicHttpsBinding : HttpBindingBase,
+               IBindingRuntimePreferences
+       {
+               WSMessageEncoding message_encoding = WSMessageEncoding.Text;
+               BasicHttpsSecurity security;
+
+               public BasicHttpsBinding ()
+                       : this (BasicHttpsSecurityMode.Transport)
+               {
+               }
+
+               public BasicHttpsBinding (string configurationName)
+                       : this ()
+               {
+                       BindingsSection bindingsSection = ConfigUtil.BindingsSection;
+                       BasicHttpsBindingElement el = 
+                               bindingsSection.BasicHttpsBinding.Bindings [configurationName];
+
+                       el.ApplyConfiguration (this);
+               }
+
+               public BasicHttpsBinding (
+                       BasicHttpsSecurityMode securityMode)
+               {
+                       security = new BasicHttpsSecurity (securityMode);
+               }
+
+               public WSMessageEncoding MessageEncoding {
+                       get { return message_encoding; }
+                       set { message_encoding = value; }
+               }
+
+               public override string Scheme {
+                       get { return Uri.UriSchemeHttps; }
+               }
+
+               public BasicHttpsSecurity Security {
+                       get { return security; }
+               }
+
+               public override BindingElementCollection
+                       CreateBindingElements ()
+               {
+                       var list = new List<BindingElement> ();
+                       
+                       var security = CreateSecurityBindingElement ();
+                       if (security != null)
+                               list.Add (security);
+
+                       list.Add (BuildMessageEncodingBindingElement ());
+                       list.Add (GetTransport ());
+
+                       return new BindingElementCollection (list.ToArray ());
+               }
+               
+               SecurityBindingElement CreateSecurityBindingElement () 
+               {
+                       SecurityBindingElement element;
+                       switch (Security.Mode) {
+                       case BasicHttpsSecurityMode.TransportWithMessageCredential:
+                               if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate)
+                                       // FIXME: pass proper security token parameters.
+                                       element = SecurityBindingElement.CreateCertificateOverTransportBindingElement ();
+                               else
+                                       element = new AsymmetricSecurityBindingElement ();
+                               break;
+                       default: 
+                               return null;
+                       }
+
+                       element.SetKeyDerivation (false);
+                       element.SecurityHeaderLayout = SecurityHeaderLayout.Lax;
+                       return element;
+               }
+
+               MessageEncodingBindingElement BuildMessageEncodingBindingElement ()
+               {
+                       if (MessageEncoding == WSMessageEncoding.Text) {
+                               TextMessageEncodingBindingElement tm = new TextMessageEncodingBindingElement (
+                                       MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+                               ReaderQuotas.CopyTo (tm.ReaderQuotas);
+                               return tm;
+                       } else {
+                               return new MtomMessageEncodingBindingElement (
+                                       MessageVersion.CreateVersion (EnvelopeVersion, AddressingVersion.None), TextEncoding);
+                       }
+               }
+
+               TransportBindingElement GetTransport ()
+               {
+                       HttpsTransportBindingElement h = new HttpsTransportBindingElement ();
+
+                       h.AllowCookies = AllowCookies;
+                       h.BypassProxyOnLocal = BypassProxyOnLocal;
+                       h.HostNameComparisonMode = HostNameComparisonMode;
+                       h.MaxBufferPoolSize = MaxBufferPoolSize;
+                       h.MaxBufferSize = MaxBufferSize;
+                       h.MaxReceivedMessageSize = MaxReceivedMessageSize;
+                       h.ProxyAddress = ProxyAddress;
+                       h.UseDefaultWebProxy = UseDefaultWebProxy;
+                       h.TransferMode = TransferMode;
+                       h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
+
+                       switch (Security.Transport.ClientCredentialType) {
+                       case HttpClientCredentialType.Basic:
+                               h.AuthenticationScheme = AuthenticationSchemes.Basic;
+                               break;
+                       case HttpClientCredentialType.Ntlm:
+                               h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
+                               break;
+                       case HttpClientCredentialType.Windows:
+                               h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
+                               break;
+                       case HttpClientCredentialType.Digest:
+                               h.AuthenticationScheme = AuthenticationSchemes.Digest;
+                               break;
+                       case HttpClientCredentialType.Certificate:
+                               h.RequireClientCertificate = true;
+                               break;
+                       }
+
+                       return h;
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsSecurity.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsSecurity.cs
new file mode 100644 (file)
index 0000000..a77099e
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// BasicHttpsSecurity.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright 2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+
+namespace System.ServiceModel
+{
+       public sealed class BasicHttpsSecurity
+       {
+               internal BasicHttpsSecurity (BasicHttpsSecurityMode mode)
+               {
+                       this.mode = mode;
+                       this.message = new BasicHttpMessageSecurity ();
+                       this.transport = new HttpTransportSecurity ();
+               }
+
+               BasicHttpMessageSecurity message;
+               BasicHttpsSecurityMode mode;
+               HttpTransportSecurity transport;
+
+               public BasicHttpMessageSecurity Message {
+                       get { return message; }
+               }
+
+               public BasicHttpsSecurityMode Mode {
+                       get { return mode; }
+                       set { mode = value; }
+               }
+
+               public HttpTransportSecurity Transport {
+                       get { return transport; }
+               }
+       }
+}
index 0752a48aaa88404e6960f02a1137116241f3d144..62a0ac1499d6bd6e810686c1a76af39d30c0b50c 100644 (file)
@@ -361,7 +361,7 @@ namespace System.ServiceModel
                        public object [] Results { get; private set; }
                }
 
-#if NET_2_1
+#if NET_2_1 || NET_4_0
                protected internal
 #else
                internal
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/HttpBindingBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel/HttpBindingBase.cs
new file mode 100644 (file)
index 0000000..2e486b8
--- /dev/null
@@ -0,0 +1,143 @@
+//
+// HttpBindingBase.cs
+//
+// Authors:
+//     Atsushi Enomoto <atsushi@ximian.com>
+//     Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
+// Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Configuration;
+
+namespace System.ServiceModel
+{
+       public abstract class HttpBindingBase : Binding,
+               IBindingRuntimePreferences
+       {
+               bool allow_cookies, bypass_proxy_on_local;
+               HostNameComparisonMode host_name_comparison_mode
+                       = HostNameComparisonMode.StrongWildcard;
+               long max_buffer_pool_size = 0x80000;
+               int max_buffer_size = 0x10000;
+               long max_recv_message_size = 0x10000;
+               Uri proxy_address;
+               XmlDictionaryReaderQuotas reader_quotas
+                       = new XmlDictionaryReaderQuotas ();
+               EnvelopeVersion env_version = EnvelopeVersion.Soap11;
+               Encoding text_encoding = new UTF8Encoding ();
+               TransferMode transfer_mode
+                        = TransferMode.Buffered;
+               bool use_default_web_proxy = true;
+
+               public bool AllowCookies {
+                       get { return allow_cookies; }
+                       set { allow_cookies = value; }
+               }
+
+               public bool BypassProxyOnLocal {
+                       get { return bypass_proxy_on_local; }
+                       set { bypass_proxy_on_local = value; }
+               }
+
+               public HostNameComparisonMode HostNameComparisonMode {
+                       get { return host_name_comparison_mode; }
+                       set { host_name_comparison_mode = value; }
+               }
+
+               public long MaxBufferPoolSize {
+                       get { return max_buffer_pool_size; }
+                       set {
+                               if (value <= 0)
+                                       throw new ArgumentOutOfRangeException ();
+                               max_buffer_pool_size = value;
+                       }
+               }
+
+               public int MaxBufferSize {
+                       get { return max_buffer_size; }
+                       set {
+                               if (value <= 0)
+                                       throw new ArgumentOutOfRangeException ();
+                               max_buffer_size = value;
+                       }
+               }
+
+               public long MaxReceivedMessageSize {
+                       get { return max_recv_message_size; }
+                       set {
+                               if (value <= 0)
+                                       throw new ArgumentOutOfRangeException ();
+                               max_recv_message_size = value;
+                       }
+               }
+
+               public Uri ProxyAddress {
+                       get { return proxy_address; }
+                       set { proxy_address = value; }
+               }
+
+               public XmlDictionaryReaderQuotas ReaderQuotas {
+                       get { return reader_quotas; }
+                       set { reader_quotas = value; }
+               }
+
+               public override abstract string Scheme {
+                       get;
+               }
+
+               public EnvelopeVersion EnvelopeVersion {
+                       get { return env_version; }
+               }
+
+               public Encoding TextEncoding {
+                       get { return text_encoding; }
+                       set { text_encoding = value; }
+               }
+
+               public TransferMode TransferMode {
+                       get { return transfer_mode; }
+                       set { transfer_mode = value; }
+               }
+
+               public bool UseDefaultWebProxy {
+                       get { return use_default_web_proxy; }
+                       set { use_default_web_proxy = value; }
+               }
+
+               public override abstract BindingElementCollection CreateBindingElements ();
+
+               // explicit interface implementations
+
+               bool IBindingRuntimePreferences.ReceiveSynchronously {
+                       get { return false; }
+               }
+       }
+}
index c99b341052fc80d24cc665dc41207305b8d39cad..223faff637c7585e11ba417098edc929b3350c57 100644 (file)
@@ -45,7 +45,7 @@ namespace System.ServiceModel
                XmlDictionaryReaderQuotas reader_quotas;
                bool transaction_flow;
                TransactionProtocol transaction_protocol;
-               TcpTransportBindingElement transport = new TcpTransportBindingElement ();
+               TcpTransportBindingElement transport;
 
                public NetTcpBinding ()
                        : this (SecurityMode.Transport)
@@ -61,6 +61,15 @@ namespace System.ServiceModel
                        bool reliableSessionEnabled)
                {
                        security = new NetTcpSecurity (securityMode);
+                       transport = new TcpTransportBindingElement ();
+               }
+
+               internal NetTcpBinding (TcpTransportBindingElement transport,
+                                       NetTcpSecurity security,
+                                       bool reliableSessionEnabled)
+               {
+                       this.transport = transport;
+                       this.security = security;
                }
 
                public HostNameComparisonMode HostNameComparisonMode {
@@ -223,8 +232,14 @@ namespace System.ServiceModel
                BindingElement CreateTransportSecurity ()
                {
                        switch (Security.Mode) {
-                       case SecurityMode.None:
-                       case SecurityMode.Message:
+                       case SecurityMode.Transport:
+                               return new WindowsStreamSecurityBindingElement () {
+                                       ProtectionLevel = Security.Transport.ProtectionLevel };
+
+                       case SecurityMode.TransportWithMessageCredential:
+                               return new SslStreamSecurityBindingElement ();
+
+                       default:
                                return null;
                        }
 
index bd6d6c3438e2eb45ec2fb493b55de75a648d6707..c71ac9b0aa5ce2f0f9b592aacb065ed7ba025c12 100644 (file)
@@ -200,3 +200,13 @@ System.ServiceModel/TransactionProtocolTest.cs
 System.ServiceModel/UriSchemeKeyedCollectionTest.cs
 System.ServiceModel/WSFederationHttpBindingTest.cs
 System.ServiceModel/WSHttpBindingTest.cs
+MetadataTests/BindingTestAssertions.cs
+MetadataTests/MiscImportTests.cs
+MetadataTests/ImportTests.cs
+MetadataTests/ImportTests_CreateMetadata.cs
+MetadataTests/ImportTests_LoadMetadata.cs
+MetadataTests/ImportTests_RoundTrip.cs
+MetadataTests/MetadataSamples.cs
+MetadataTests/TestContext.cs
+MetadataTests/TestLabel.cs
+MetadataTests/ExportTests.cs
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/AssemblyInfo.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..6b4eab1
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("MetadataTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Xamarin")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Xamarin Inc. (http://www.xamarin.com)")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/BindingTestAssertions.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/BindingTestAssertions.cs
new file mode 100644 (file)
index 0000000..a4e9f89
--- /dev/null
@@ -0,0 +1,841 @@
+//
+// BindingTestAssertions.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Net.Security;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using QName = System.Xml.XmlQualifiedName;
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public static class BindingTestAssertions {
+
+               const string WspNamespace = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+               const string WsuNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+               const string MsbNamespace = "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1";
+               const string WsawNamespace = "http://www.w3.org/2006/05/addressing/wsdl";
+               const string MsfNamespace = "http://schemas.microsoft.com/ws/2006/05/framing/policy";
+               const string SpNamespace = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+               const string WsrmNamespace = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
+               const string HttpNamespace = "http://schemas.microsoft.com/ws/06/2004/policy/http";
+               const string WsomaNamespace = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
+               const string Wsa10Namespace = "http://www.w3.org/2005/08/addressing";
+
+               static readonly QName BinaryEncodingQName = new QName ("BinaryEncoding", MsbNamespace);
+               static readonly QName UsingAddressingQName = new QName ("UsingAddressing", WsawNamespace);
+               static readonly QName StreamedTransferQName = new QName ("Streamed", MsfNamespace);
+               static readonly QName ReliableSessionQName = new QName ("RMAssertion", WsrmNamespace);
+               static readonly QName TransportBindingQName = new QName ("TransportBinding", SpNamespace);
+               static readonly QName AsymmetricBindingQName = new QName ("AsymmetricBinding", SpNamespace);
+               static readonly QName SymmetricBindingQName = new QName ("SymmetricBinding", SpNamespace);
+               static readonly QName EndorsingSupportingQName = new QName ("EndorsingSupportingTokens", SpNamespace);
+               static readonly QName SignedSupportingQName = new QName ("SignedSupportingTokens", SpNamespace);
+               static readonly QName Wss10QName = new QName ("Wss10", SpNamespace);
+               static readonly QName Wss11QName = new QName ("Wss11", SpNamespace);
+               static readonly QName Trust10QName = new QName ("Trust10", SpNamespace);
+               static readonly QName NtlmAuthenticationQName = new QName ("NtlmAuthentication", HttpNamespace);
+               static readonly QName MtomEncodingQName = new QName ("OptimizedMimeSerialization", WsomaNamespace);
+
+               public static void CheckImportErrors (WsdlImporter importer, TestLabel label)
+               {
+                       bool foundErrors = false;
+                       foreach (var error in importer.Errors) {
+                               if (error.IsWarning)
+                                       Console.WriteLine ("WARNING ({0}): {1}", label, error.Message);
+                               else {
+                                       Console.WriteLine ("ERROR ({0}): {1}", label, error.Message);
+                                       foundErrors = true;
+                               }
+                       }
+
+                       if (foundErrors)
+                               Assert.Fail ("Found import errors", label);
+               }
+
+               static void CheckSoapBinding (object extension, string transport, TestLabel label)
+               {
+                       label.EnterScope ("soap");
+                       Assert.That (extension, Is.InstanceOfType (typeof (WS.SoapBinding)), label.Get ());
+                       var soap = (WS.SoapBinding)extension;
+                       Assert.That (soap.Style, Is.EqualTo (WS.SoapBindingStyle.Document), label.Get ());
+                       Assert.That (soap.Transport, Is.EqualTo (transport), label.Get ());
+                       Assert.That (soap.Required, Is.False, label.Get ());
+                       label.LeaveScope ();
+               }
+
+               public static void CheckBasicHttpBinding (
+                       Binding binding, string scheme, BasicHttpSecurityMode security,
+                       WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+                       AuthenticationSchemes authScheme, TestLabel label)
+               {
+                       label.EnterScope ("http");
+
+                       if (security == BasicHttpSecurityMode.Message) {
+                               Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+                       } else {
+                               Assert.That (binding, Is.InstanceOfType (typeof(BasicHttpBinding)), label.Get ());
+                               var basicHttp = (BasicHttpBinding)binding;
+                               Assert.That (basicHttp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap11), label.Get ());
+                               Assert.That (basicHttp.MessageVersion, Is.EqualTo (MessageVersion.Soap11), label.Get ());
+                               Assert.That (basicHttp.Scheme, Is.EqualTo (scheme), label.Get ());
+                               Assert.That (basicHttp.TransferMode, Is.EqualTo (TransferMode.Buffered), label.Get ());
+                               Assert.That (basicHttp.MessageEncoding, Is.EqualTo (encoding), label.Get ());
+                               Assert.That (basicHttp.Security, Is.Not.Null, label.Get ());
+                               Assert.That (basicHttp.Security.Mode, Is.EqualTo (security), label.Get ());
+                               Assert.That (basicHttp.Security.Transport.ClientCredentialType, Is.EqualTo (clientCred), label.Get ());
+                               Assert.That (basicHttp.Security.Message.AlgorithmSuite, Is.EqualTo (SecurityAlgorithmSuite.Basic256), label.Get ());
+                       }
+
+                       label.EnterScope ("elements");
+
+                       var elements = binding.CreateBindingElements ();
+                       Assert.That (elements, Is.Not.Null, label.Get ());
+                       if ((security == BasicHttpSecurityMode.Message) ||
+                               (security == BasicHttpSecurityMode.TransportWithMessageCredential))
+                               Assert.That (elements.Count, Is.EqualTo (3), label.Get ());
+                       else
+                               Assert.That (elements.Count, Is.EqualTo (2), label.Get ());
+                       
+                       TextMessageEncodingBindingElement textElement = null;
+                       TransportSecurityBindingElement securityElement = null;
+                       HttpTransportBindingElement transportElement = null;
+                       AsymmetricSecurityBindingElement asymmSecurityElement = null;
+                       MtomMessageEncodingBindingElement mtomElement = null;
+                       
+                       foreach (var element in elements) {
+                               if (element is TextMessageEncodingBindingElement)
+                                       textElement = (TextMessageEncodingBindingElement)element;
+                               else if (element is HttpTransportBindingElement)
+                                       transportElement = (HttpTransportBindingElement)element;
+                               else if (element is TransportSecurityBindingElement)
+                                       securityElement = (TransportSecurityBindingElement)element;
+                               else if (element is AsymmetricSecurityBindingElement)
+                                       asymmSecurityElement = (AsymmetricSecurityBindingElement)element;
+                               else if (element is MtomMessageEncodingBindingElement)
+                                       mtomElement = (MtomMessageEncodingBindingElement)element;
+                               else
+                                       Assert.Fail (string.Format (
+                                               "Unknown element: {0}", element.GetType ()), label.Get ());
+                       }
+
+                       label.EnterScope ("text");
+                       if (encoding == WSMessageEncoding.Text) {
+                               Assert.That (textElement, Is.Not.Null, label.Get ());
+                               Assert.That (textElement.WriteEncoding, Is.InstanceOfType (typeof(UTF8Encoding)), label.Get ());
+                       } else {
+                               Assert.That (textElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("mtom");
+                       if (encoding == WSMessageEncoding.Mtom) {
+                               Assert.That (mtomElement, Is.Not.Null, label.Get ());
+                       } else {
+                               Assert.That (mtomElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("security");
+                       if (security == BasicHttpSecurityMode.TransportWithMessageCredential) {
+                               Assert.That (securityElement, Is.Not.Null, label.Get ());
+                               Assert.That (securityElement.SecurityHeaderLayout,
+                                            Is.EqualTo (SecurityHeaderLayout.Lax), label.Get ());
+                       } else {
+                               Assert.That (securityElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("asymmetric");
+                       if (security == BasicHttpSecurityMode.Message) {
+                               Assert.That (asymmSecurityElement, Is.Not.Null, label.Get ());
+                       } else {
+                               Assert.That (asymmSecurityElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("transport");
+                       Assert.That (transportElement, Is.Not.Null, label.Get ());
+                       
+                       Assert.That (transportElement.Realm, Is.Empty, label.Get ());
+                       Assert.That (transportElement.Scheme, Is.EqualTo (scheme), label.Get ());
+                       Assert.That (transportElement.TransferMode, Is.EqualTo (TransferMode.Buffered), label.Get ());
+
+                       label.EnterScope ("auth");
+                       Assert.That (transportElement.AuthenticationScheme, Is.EqualTo (authScheme), label.Get ());
+                       label.LeaveScope (); // auth
+                       label.LeaveScope (); // transport
+                       label.LeaveScope (); // elements
+                       label.LeaveScope (); // http
+               }
+
+               static void CheckEndpoint (ServiceEndpoint endpoint, string uri, TestLabel label)
+               {
+                       label.EnterScope ("endpoint");
+                       Assert.That (endpoint.ListenUri, Is.EqualTo (new Uri (uri)), label.Get ());
+                       Assert.That (endpoint.ListenUriMode, Is.EqualTo (ListenUriMode.Explicit), label.Get ());
+                       Assert.That (endpoint.Contract, Is.Not.Null, label.Get ());
+                       Assert.That (endpoint.Contract.Name, Is.EqualTo ("MyContract"), label.Get ());
+                       Assert.That (endpoint.Address, Is.Not.Null, label.Get ());
+                       Assert.That (endpoint.Address.Uri, Is.EqualTo (new Uri (uri)), label.Get ());
+                       Assert.That (endpoint.Address.Identity, Is.Null, label.Get ());
+                       Assert.That (endpoint.Address.Headers, Is.Not.Null, label.Get ());
+                       Assert.That (endpoint.Address.Headers.Count, Is.EqualTo (0), label.Get ());
+                       label.LeaveScope ();
+               }
+
+               public static void BasicHttpBinding (
+                       TestContext context, MetadataSet doc, WSMessageEncoding encoding, TestLabel label)
+               {
+                       BasicHttpBinding (
+                               context, doc, BasicHttpSecurityMode.None, encoding,
+                               HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+                               label);
+               }
+
+               public static void BasicHttpBinding (
+                       TestContext context, MetadataSet doc, BasicHttpSecurityMode security, TestLabel label)
+               {
+                       BasicHttpBinding (
+                               context, doc, security, WSMessageEncoding.Text,
+                               HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+                               label);
+               }
+               
+               public static void BasicHttpBinding (
+                       TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+                       WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+                       AuthenticationSchemes authScheme, TestLabel label)
+               {
+                       label.EnterScope ("basicHttpBinding");
+                       BasicHttpBinding_inner (
+                               context, doc, security, encoding, clientCred,
+                               authScheme, false, label);
+                       label.LeaveScope ();
+               }
+
+               public static void BasicHttpsBinding (
+                       TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+                       WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+                       AuthenticationSchemes authScheme, TestLabel label)
+               {
+                       label.EnterScope ("basicHttpsBinding");
+                       BasicHttpBinding_inner (
+                               context, doc, security, encoding, clientCred,
+                               authScheme, true, label);
+                       label.LeaveScope ();
+               }
+               
+               static void BasicHttpBinding_inner (
+                       TestContext context, MetadataSet doc, BasicHttpSecurityMode security,
+                       WSMessageEncoding encoding, HttpClientCredentialType clientCred,
+                       AuthenticationSchemes authScheme, bool isHttps, TestLabel label)
+               {
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+                       label.EnterScope ("wsdl");
+                       label.EnterScope ("bindings");
+                       Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+
+                       var binding = sd.Bindings [0];
+                       Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+                       Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+
+                       bool hasPolicyXml;
+
+                       switch (security) {
+                       case BasicHttpSecurityMode.None:
+                               if (isHttps)
+                                       throw new InvalidOperationException ();
+                               hasPolicyXml = encoding == WSMessageEncoding.Mtom;
+                               break;
+                       case BasicHttpSecurityMode.Message:
+                       case BasicHttpSecurityMode.Transport:
+                       case BasicHttpSecurityMode.TransportWithMessageCredential:
+                               if (encoding == WSMessageEncoding.Mtom)
+                                       throw new InvalidOperationException ();
+                               hasPolicyXml = true;
+                               break;
+                       case BasicHttpSecurityMode.TransportCredentialOnly:
+                               if (isHttps)
+                                       throw new InvalidOperationException ();
+                               hasPolicyXml = true;
+                               break;
+                       default:
+                               throw new InvalidOperationException ();
+                       }
+                       label.LeaveScope ();
+
+                       WS.SoapBinding soap = null;
+                       XmlElement xml = null;
+
+                       foreach (var ext in binding.Extensions) {
+                               if (ext is WS.SoapBinding)
+                                       soap = (WS.SoapBinding)ext;
+                               else if (ext is XmlElement)
+                                       xml = (XmlElement)ext;
+                       }
+
+                       CheckSoapBinding (soap, WS.SoapBinding.HttpTransport, label);
+                       label.LeaveScope ();
+
+                       label.EnterScope ("policy-xml");
+                       if (!hasPolicyXml)
+                               Assert.That (xml, Is.Null, label.Get ());
+                       else {
+                               Assert.That (xml, Is.Not.Null, label.Get ());
+                               var assertions = AssertPolicy (sd, xml, label);
+                               Assert.That (assertions, Is.Not.Null, label.Get ());
+                               if (clientCred == HttpClientCredentialType.Ntlm)
+                                       AssertPolicy (assertions, NtlmAuthenticationQName, label);
+                               if (encoding == WSMessageEncoding.Mtom)
+                                       AssertPolicy (assertions, MtomEncodingQName, label);
+                               switch (security) {
+                               case BasicHttpSecurityMode.Message:
+                                       AssertPolicy (assertions, AsymmetricBindingQName, label);
+                                       AssertPolicy (assertions, Wss10QName, label);
+                                       break;
+                               case BasicHttpSecurityMode.Transport:
+                                       AssertPolicy (assertions, TransportBindingQName, label);
+                                       break;
+                               case BasicHttpSecurityMode.TransportWithMessageCredential:
+                                       AssertPolicy (assertions, SignedSupportingQName, label);
+                                       AssertPolicy (assertions, TransportBindingQName, label);
+                                       AssertPolicy (assertions, Wss10QName, label);
+                                       break;
+                               default:
+                                       break;
+                               }
+                               Assert.That (assertions.Count, Is.EqualTo (0), label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("services");
+                       Assert.That (sd.Services, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+                       var service = sd.Services [0];
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+                       var port = service.Ports [0];
+                       
+                       label.EnterScope ("port");
+                       Assert.That (port.Extensions, Is.Not.Null, label.Get ());
+                       Assert.That (port.Extensions.Count, Is.EqualTo (1), label.Get ());
+                       
+                       WS.SoapAddressBinding soap_addr_binding = null;
+                       foreach (var extension in port.Extensions) {
+                               if (extension is WS.SoapAddressBinding)
+                                       soap_addr_binding = (WS.SoapAddressBinding)extension;
+                               else
+                                       Assert.Fail (label.Get ());
+                       }
+                       Assert.That (soap_addr_binding, Is.Not.Null, label.Get ());
+                       label.LeaveScope ();
+
+                       label.LeaveScope (); // wsdl
+
+                       var importer = new WsdlImporter (doc);
+
+                       label.EnterScope ("bindings");
+                       var bindings = importer.ImportAllBindings ();
+                       CheckImportErrors (importer, label);
+
+                       Assert.That (bindings, Is.Not.Null, label.Get ());
+                       Assert.That (bindings.Count, Is.EqualTo (1), label.Get ());
+
+                       string scheme;
+                       if ((security == BasicHttpSecurityMode.Transport) ||
+                           (security == BasicHttpSecurityMode.TransportWithMessageCredential))
+                               scheme = "https";
+                       else
+                               scheme = "http";
+
+                       CheckBasicHttpBinding (
+                               bindings [0], scheme, security, encoding, clientCred,
+                               authScheme, label);
+                       label.LeaveScope ();
+
+                       label.EnterScope ("endpoints");
+                       var endpoints = importer.ImportAllEndpoints ();
+                       CheckImportErrors (importer, label);
+
+                       Assert.That (endpoints, Is.Not.Null, label.Get ());
+                       Assert.That (endpoints.Count, Is.EqualTo (1), label.Get ());
+
+                       var uri = isHttps ? MetadataSamples.HttpsUri : MetadataSamples.HttpUri;
+
+                       CheckEndpoint (endpoints [0], uri, label);
+                       label.LeaveScope ();
+               }
+
+               public static void CheckNetTcpBinding (
+                       Binding binding, SecurityMode security, bool reliableSession,
+                       TransferMode transferMode, TestLabel label)
+               {
+                       label.EnterScope ("net-tcp");
+                       if (security == SecurityMode.Message) {
+                               Assert.That (binding, Is.InstanceOfType (typeof(CustomBinding)), label.Get ());
+                       } else {
+                               Assert.That (binding, Is.InstanceOfType (typeof(NetTcpBinding)), label.Get ());
+                               var netTcp = (NetTcpBinding)binding;
+                               Assert.That (netTcp.EnvelopeVersion, Is.EqualTo (EnvelopeVersion.Soap12), label.Get ());
+                               Assert.That (netTcp.MessageVersion, Is.EqualTo (MessageVersion.Soap12WSAddressing10), label.Get ());
+                               Assert.That (netTcp.Scheme, Is.EqualTo ("net.tcp"), label.Get ());
+                               Assert.That (netTcp.TransferMode, Is.EqualTo (transferMode), label.Get ());
+
+                               label.EnterScope ("security");
+                               Assert.That (netTcp.Security, Is.Not.Null, label.Get ());
+                               Assert.That (netTcp.Security.Mode, Is.EqualTo (security), label.Get ());
+
+                               Assert.That (netTcp.Security.Transport, Is.Not.Null, label.Get ());
+                               Assert.That (netTcp.Security.Transport.ProtectionLevel, Is.EqualTo (ProtectionLevel.EncryptAndSign), label.Get ());
+                               Assert.That (netTcp.Security.Transport.ClientCredentialType, Is.EqualTo (TcpClientCredentialType.Windows), label.Get ());
+                               label.LeaveScope ();
+                       }
+
+                       label.EnterScope ("elements");
+                       
+                       var elements = binding.CreateBindingElements ();
+                       Assert.That (elements, Is.Not.Null, label.Get ());
+
+                       TcpTransportBindingElement transportElement = null;
+                       TransactionFlowBindingElement transactionFlowElement = null;
+                       BinaryMessageEncodingBindingElement encodingElement = null;
+                       WindowsStreamSecurityBindingElement windowsStreamElement = null;
+                       ReliableSessionBindingElement reliableSessionElement = null;
+                       TransportSecurityBindingElement transportSecurityElement = null;
+                       SslStreamSecurityBindingElement sslStreamElement = null;
+                       SymmetricSecurityBindingElement symmSecurityElement = null;
+                       
+                       foreach (var element in elements) {
+                               if (element is TcpTransportBindingElement)
+                                       transportElement = (TcpTransportBindingElement)element;
+                               else if (element is TransactionFlowBindingElement)
+                                       transactionFlowElement = (TransactionFlowBindingElement)element;
+                               else if (element is BinaryMessageEncodingBindingElement)
+                                       encodingElement = (BinaryMessageEncodingBindingElement)element;
+                               else if (element is WindowsStreamSecurityBindingElement)
+                                       windowsStreamElement = (WindowsStreamSecurityBindingElement)element;
+                               else if (element is ReliableSessionBindingElement)
+                                       reliableSessionElement = (ReliableSessionBindingElement)element;
+                               else if (element is TransportSecurityBindingElement)
+                                       transportSecurityElement = (TransportSecurityBindingElement)element;
+                               else if (element is SslStreamSecurityBindingElement)
+                                       sslStreamElement = (SslStreamSecurityBindingElement)element;
+                               else if (element is SymmetricSecurityBindingElement)
+                                       symmSecurityElement = (SymmetricSecurityBindingElement)element;
+                               else
+                                       Assert.Fail (string.Format (
+                                               "Unknown element `{0}'.", element.GetType ()), label.Get ());
+                       }
+
+                       label.EnterScope ("windows-stream");
+                       if (security == SecurityMode.Transport) {
+                               Assert.That (windowsStreamElement, Is.Not.Null, label.Get ());
+                               Assert.That (windowsStreamElement.ProtectionLevel, Is.EqualTo (ProtectionLevel.EncryptAndSign), label.Get ());
+                       } else {
+                               Assert.That (windowsStreamElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("reliable-session");
+                       if (reliableSession) {
+                               Assert.That (reliableSessionElement, Is.Not.Null, label.Get ());
+                       } else {
+                               Assert.That (reliableSessionElement, Is.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("encoding");
+                       Assert.That (encodingElement, Is.Not.Null, label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("transaction");
+                       if (security == SecurityMode.Message) {
+                               Assert.That (transactionFlowElement, Is.Null, label.Get ());
+                       } else {
+                               Assert.That (transactionFlowElement, Is.Not.Null, label.Get ());
+                       }
+                       label.LeaveScope ();
+
+                       label.EnterScope ("transport");
+                       Assert.That (transportElement, Is.Not.Null, label.Get ());
+
+                       Assert.That (transportElement.Scheme, Is.EqualTo ("net.tcp"), label.Get ());
+                       Assert.That (transportElement.TransferMode, Is.EqualTo (transferMode), label.Get ());
+                       label.LeaveScope (); // transport
+
+                       label.EnterScope ("security");
+                       switch (security) {
+                       case SecurityMode.None:
+                       case SecurityMode.Transport:
+                               Assert.That (transportSecurityElement, Is.Null, label.Get ());
+                               Assert.That (sslStreamElement, Is.Null, label.Get ());
+                               Assert.That (symmSecurityElement, Is.Null, label.Get ());
+                               break;
+                       case SecurityMode.TransportWithMessageCredential:
+                               Assert.That (transportSecurityElement, Is.Not.Null, label.Get ());
+                               Assert.That (sslStreamElement, Is.Not.Null, label.Get ());
+                               Assert.That (symmSecurityElement, Is.Null, label.Get ());
+                               break;
+                       case SecurityMode.Message:
+                               Assert.That (transportSecurityElement, Is.Null, label.Get ());
+                               Assert.That (sslStreamElement, Is.Null, label.Get ());
+                               Assert.That (symmSecurityElement, Is.Not.Null, label.Get ());
+                               break;
+                       default:
+                               throw new InvalidOperationException ();
+                       }
+                       label.LeaveScope ();
+
+                       label.LeaveScope (); // elements
+                       label.LeaveScope (); // net-tcp
+               }
+
+               public static void NetTcpBinding (
+                       TestContext context, MetadataSet doc, SecurityMode security,
+                       bool reliableSession, TransferMode transferMode, TestLabel label)
+               {
+                       label.EnterScope ("netTcpBinding");
+
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+
+                       label.EnterScope ("wsdl");
+
+                       label.EnterScope ("bindings");
+                       Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+                       var binding = sd.Bindings [0];
+                       Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+                       Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+
+                       WS.Soap12Binding soap = null;
+                       XmlElement xml = null;
+                       
+                       foreach (var ext in binding.Extensions) {
+                               if (ext is WS.Soap12Binding)
+                                       soap = (WS.Soap12Binding)ext;
+                               else if (ext is XmlElement)
+                                       xml = (XmlElement)ext;
+                       }
+                       
+                       CheckSoapBinding (soap, "http://schemas.microsoft.com/soap/tcp", label);
+
+                       label.EnterScope ("policy-xml");
+                       Assert.That (xml, Is.Not.Null, label.Get ());
+                       var assertions = AssertPolicy (sd, xml, label);
+                       Assert.That (assertions, Is.Not.Null, label.Get ());
+                       AssertPolicy (assertions, BinaryEncodingQName, label);
+                       AssertPolicy (assertions, UsingAddressingQName, label);
+                       if (transferMode == TransferMode.Streamed)
+                               AssertPolicy (assertions, StreamedTransferQName, label);
+                       switch (security) {
+                       case SecurityMode.Message:
+                               AssertPolicy (assertions, SymmetricBindingQName, label);
+                               AssertPolicy (assertions, Wss11QName, label);
+                               AssertPolicy (assertions, Trust10QName, label);
+                               break;
+                       case SecurityMode.Transport:
+                               AssertPolicy (assertions, TransportBindingQName, label);
+                               break;
+                       case SecurityMode.TransportWithMessageCredential:
+                               AssertPolicy (assertions, TransportBindingQName, label);
+                               AssertPolicy (assertions, EndorsingSupportingQName, label);
+                               AssertPolicy (assertions, Wss11QName, label);
+                               AssertPolicy (assertions, Trust10QName, label);
+                               break;
+                       default:
+                               break;
+                       }
+                       if (reliableSession)
+                               AssertPolicy (assertions, ReliableSessionQName, label);
+                       Assert.That (assertions.Count, Is.EqualTo (0), label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("services");
+                       Assert.That (sd.Services, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+                       var service = sd.Services [0];
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+                       var port = service.Ports [0];
+
+                       label.EnterScope ("port");
+                       Assert.That (port.Extensions, Is.Not.Null, label.Get ());
+                       Assert.That (port.Extensions.Count, Is.EqualTo (2), label.Get ());
+
+                       WS.Soap12AddressBinding soap_addr_binding = null;
+                       XmlElement port_xml = null;
+                       foreach (var extension in port.Extensions) {
+                               if (extension is WS.Soap12AddressBinding)
+                                       soap_addr_binding = (WS.Soap12AddressBinding)extension;
+                               else if (extension is XmlElement)
+                                       port_xml = (XmlElement)extension;
+                               else
+                                       Assert.Fail (label.Get ());
+                       }
+                       Assert.That (soap_addr_binding, Is.Not.Null, label.Get ());
+                       Assert.That (port_xml, Is.Not.Null, label.Get ());
+                       Assert.That (port_xml.NamespaceURI, Is.EqualTo (Wsa10Namespace), label.Get ());
+                       Assert.That (port_xml.LocalName, Is.EqualTo ("EndpointReference"), label.Get ());
+                       label.LeaveScope ();
+                       label.LeaveScope ();
+
+                       label.LeaveScope (); // wsdl
+
+                       var importer = new WsdlImporter (doc);
+
+                       label.EnterScope ("bindings");
+                       var bindings = importer.ImportAllBindings ();
+                       CheckImportErrors (importer, label);
+                       Assert.That (bindings, Is.Not.Null, label.Get ());
+                       Assert.That (bindings.Count, Is.EqualTo (1), label.Get ());
+                       
+                       CheckNetTcpBinding (
+                               bindings [0], security, reliableSession,
+                               transferMode, label);
+                       label.LeaveScope ();
+
+                       label.EnterScope ("endpoints");
+                       var endpoints = importer.ImportAllEndpoints ();
+                       CheckImportErrors (importer, label);
+                       Assert.That (endpoints, Is.Not.Null, label.Get ());
+                       Assert.That (endpoints.Count, Is.EqualTo (1), label.Get ());
+                       
+                       CheckEndpoint (endpoints [0], MetadataSamples.NetTcpUri, label);
+                       label.LeaveScope ();
+
+                       label.LeaveScope ();
+               }
+
+               public static void Dump (PolicyAssertionCollection assertions)
+               {
+                       foreach (var assertion in assertions)
+                               Console.WriteLine ("ASSERTION: {0}", assertion.OuterXml);
+               }
+
+               public static void AssertPolicy (
+                       PolicyAssertionCollection assertions, QName qname, TestLabel label)
+               {
+                       var assertion = assertions.Find (qname.Name, qname.Namespace);
+                       label.EnterScope (qname.Name);
+                       Assert.That (assertion, Is.Not.Null, label.ToString ());
+                       assertions.Remove (assertion);
+                       label.LeaveScope ();
+               }
+
+               static XmlElement ResolvePolicy (WS.ServiceDescription sd, XmlElement policy)
+               {
+                       if (policy.LocalName.Equals ("Policy"))
+                               return policy;
+
+                       var uri = policy.GetAttribute ("URI");
+                       if (!uri.StartsWith ("#"))
+                               return null;
+                       
+                       foreach (var sext in sd.Extensions) {
+                               var sxml = sext as XmlElement;
+                               if (sxml == null)
+                                       continue;
+                               if (!sxml.NamespaceURI.Equals (WspNamespace))
+                                       continue;
+                               if (!sxml.LocalName.Equals ("Policy"))
+                                       continue;
+                               var id = sxml.GetAttribute ("Id", WsuNamespace);
+                               if (uri.Substring (1).Equals (id))
+                                       return sxml;
+                       }
+
+                       return null;
+               }
+
+               public static PolicyAssertionCollection AssertPolicy (
+                       WS.Binding binding, TestLabel label)
+               {
+                       label.EnterScope ("FindPolicy");
+                       XmlElement policy = null;
+               
+                       foreach (var extension in binding.Extensions) {
+                               var xml = extension as XmlElement;
+                               if (xml == null)
+                                       continue;
+                               Assert.That (policy, Is.Null, label.Get ());
+                               policy = xml;
+                       }
+                       Assert.That (policy, Is.Not.Null, label.Get ());
+                       try {
+                               return AssertPolicy (binding.ServiceDescription, policy, label);
+                       } finally {
+                               label.LeaveScope ();
+                       }
+               }
+
+               static XmlElement AssertExactlyOneChildElement (XmlElement element)
+               {
+                       XmlElement found = null;
+                       foreach (var node in element.ChildNodes) {
+                               if (node is XmlWhitespace)
+                                       continue;
+                               var e = node as XmlElement;
+                               if (e == null)
+                                       return null;
+                               if (found != null)
+                                       return null;
+                               found = e;
+                       }
+
+                       return found;
+               }
+               
+               public static PolicyAssertionCollection AssertPolicy (
+                       WS.ServiceDescription sd, XmlElement element, TestLabel label)
+               {
+                       label.EnterScope ("wsp:Policy");
+                       Assert.That (element.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+                       Assert.That (element.LocalName, Is.EqualTo ("Policy") | Is.EqualTo ("PolicyReference"), label.Get ());
+
+                       var policy = ResolvePolicy (sd, element);
+                       Assert.That (policy, Is.Not.Null, label.Get ());
+
+                       label.EnterScope ("wsp:ExactlyOne");
+                       var exactlyOne = AssertExactlyOneChildElement (policy);
+                       Assert.That (exactlyOne, Is.Not.Null, label.Get ());
+                       Assert.That (exactlyOne.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+                       Assert.That (exactlyOne.LocalName, Is.EqualTo ("ExactlyOne"), label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("wsp:Any");
+                       var all = AssertExactlyOneChildElement (exactlyOne);
+                       Assert.That (all, Is.Not.Null, label.Get ());
+                       Assert.That (all.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ());
+                       Assert.That (all.LocalName, Is.EqualTo ("All"), label.Get ());
+                       label.LeaveScope ();
+
+                       var collection = new PolicyAssertionCollection ();
+
+                       label.EnterScope ("assertions");
+                       foreach (var node in all.ChildNodes) {
+                               if (node is XmlWhitespace)
+                                       continue;
+                               Assert.That (node, Is.InstanceOfType (typeof (XmlElement)), label.ToString ());
+                               collection.Add ((XmlElement)node);
+                       }
+                       label.LeaveScope ();
+
+                       label.LeaveScope ();
+
+                       return collection;
+               }
+
+               public static void TestOperation (MetadataSet metadata, bool soap12, TestLabel label)
+               {
+                       label.EnterScope ("TestOperation");
+
+                       label.EnterScope ("metadata");
+                       WS.ServiceDescription sd = null;
+                       foreach (var ms in metadata.MetadataSections) {
+                               if (!ms.Dialect.Equals ("http://schemas.xmlsoap.org/wsdl/"))
+                                       continue;
+                               sd = ms.Metadata as WS.ServiceDescription;
+                       }
+                       Assert.That (sd, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+                       var binding = sd.Bindings [0];
+                       label.LeaveScope ();
+
+                       label.EnterScope ("operation");
+                       Assert.That (binding.Operations, Is.Not.Null, label.Get ());
+                       Assert.That (binding.Operations.Count, Is.EqualTo (1), label.Get ());
+                       var op = binding.Operations [0];
+
+                       Assert.That (op.Name, Is.EqualTo ("Hello"), label.Get ());
+                       Assert.That (op.ExtensibleAttributes, Is.Null, label.Get ());
+
+                       label.EnterScope ("extensions");
+                       Assert.That (op.Extensions, Is.Not.Null, label.Get ());
+                       Assert.That (op.Extensions.Count, Is.EqualTo (1), label.Get ());
+                       Assert.That (op.Extensions [0], Is.InstanceOfType (typeof (WS.SoapOperationBinding)), label.Get ());
+                       var soap = (WS.SoapOperationBinding)op.Extensions [0];
+                       TestSoap (soap, soap12, label);
+                       label.LeaveScope ();
+
+                       TestSoapMessage (op.Input, soap12, label);
+                       TestSoapMessage (op.Output, soap12, label);
+                       label.LeaveScope (); // operation
+
+                       label.LeaveScope ();
+               }
+
+               static void TestSoap (WS.SoapOperationBinding soap, bool soap12, TestLabel label)
+               {
+                       label.EnterScope ("soap");
+                       var type = soap12 ? typeof (WS.Soap12OperationBinding) : typeof (WS.SoapOperationBinding);
+                       Assert.That (soap.GetType (), Is.EqualTo (type), label.Get ());
+                       Assert.That (soap.Style, Is.EqualTo (WS.SoapBindingStyle.Document), label.Get ());
+                       Assert.That (soap.SoapAction, Is.EqualTo ("http://tempuri.org/IMyContract/Hello"), label.Get ());
+                       Assert.That (soap.Required, Is.False, label.Get ());
+                       label.LeaveScope ();
+               }
+
+               static void TestSoapMessage (WS.MessageBinding binding, bool soap12, TestLabel label)
+               {
+                       label.EnterScope (binding is WS.InputBinding ? "input" : "output");
+
+                       Assert.That (binding, Is.Not.Null, label.Get ());
+                       Assert.That (binding.Name, Is.Null, label.Get ());
+                       Assert.That (binding.ExtensibleAttributes, Is.Null, label.Get ());
+                       Assert.That (binding.Extensions, Is.Not.Null, label.Get ());
+                       Assert.That (binding.Extensions.Count, Is.EqualTo (1), label.Get ());
+                       Assert.That (binding.Extensions [0], Is.InstanceOfType (typeof (WS.SoapBodyBinding)), label.Get ());
+                       var body = (WS.SoapBodyBinding)binding.Extensions [0];
+                       TestSoapBody (body, soap12, label);
+                       label.LeaveScope ();
+               }
+
+               static void TestSoapBody (WS.SoapBodyBinding soap, bool soap12, TestLabel label)
+               {
+                       label.EnterScope ("soap-body");
+                       var type = soap12 ? typeof (WS.Soap12BodyBinding) : typeof (WS.SoapBodyBinding);
+                       Assert.That (soap.GetType (), Is.EqualTo (type), label.Get ());
+                       Assert.That (soap.Encoding, Is.Empty, label.Get ());
+                       Assert.That (soap.Namespace, Is.Empty, label.Get ());
+                       Assert.That (soap.Parts, Is.Null, label.Get ());
+                       Assert.That (soap.Use, Is.EqualTo (WS.SoapBindingUse.Literal), label.Get ());
+                       label.LeaveScope ();
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ExportTests.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ExportTests.cs
new file mode 100644 (file)
index 0000000..3bd64b7
--- /dev/null
@@ -0,0 +1,243 @@
+//
+// TestExport.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Net;
+using System.Xml;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+
+using QName = System.Xml.XmlQualifiedName;
+using WS = System.Web.Services.Description;
+
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       [TestFixture]
+       public class TestExport {
+               internal const string HttpUri = "http://tempuri.org/TestHttp/";
+
+               [Test]
+               public void SimpleExport ()
+               {
+                       var label = new TestLabel ("DuplicateContract");
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       var endpoint = new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+                       
+                       var exporter = new WsdlExporter ();
+                       exporter.ExportContract (cd);
+                       exporter.ExportEndpoint (endpoint);
+                       
+                       CheckExport (
+                               exporter, new QName ("MyContract", "http://tempuri.org/"),
+                               "BasicHttpBinding", 1, label);
+               }
+
+               [Test]
+               public void DuplicateContract ()
+               {
+                       var label = new TestLabel ("DuplicateContract");
+
+                       var cd = new ContractDescription ("MyContract");
+                       var endpoint = new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+                       var exporter = new WsdlExporter ();
+                       exporter.ExportContract (cd);
+                       exporter.ExportContract (cd);
+                       exporter.ExportEndpoint (endpoint);
+
+                       CheckExport (
+                               exporter, new QName ("MyContract", "http://tempuri.org/"),
+                               "BasicHttpBinding", 1, label);
+               }
+
+               [Test]
+               public void DuplicateEndpoint ()
+               {
+                       var label = new TestLabel ("DuplicateEndpoint");
+
+                       var cd = new ContractDescription ("MyContract");
+                       var endpoint = new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+
+                       var exporter = new WsdlExporter ();
+                       exporter.ExportEndpoint (endpoint);
+                       exporter.ExportEndpoint (endpoint);
+
+                       CheckExport (
+                               exporter, new QName ("MyContract", "http://tempuri.org/"),
+                               "BasicHttpBinding", 1, label);
+               }
+
+               [Test]
+               public void DuplicateEndpoint2 ()
+               {
+                       var label = new TestLabel ("DuplicateEndpoint2");
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       var endpoint = new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+                       var endpoint2 = new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));
+                       
+                       var exporter = new WsdlExporter ();
+                       exporter.ExportEndpoint (endpoint);
+                       exporter.ExportEndpoint (endpoint);
+                       exporter.ExportEndpoint (endpoint2);
+                       
+                       CheckExport (
+                               exporter, new QName ("MyContract", "http://tempuri.org/"),
+                               "BasicHttpBinding", 2, label);
+               }
+
+               public static void CheckExport (
+                       WsdlExporter exporter, QName contractName, string bindingName,
+                       int countEndpoints, TestLabel label)
+               {
+                       Assert.That (exporter.GeneratedWsdlDocuments, Is.Not.Null, label.Get ());
+                       Assert.That (exporter.GeneratedWsdlDocuments.Count, Is.EqualTo (1), label.Get ());
+                       
+                       var wsdl = exporter.GeneratedWsdlDocuments [0];
+                       CheckExport (wsdl, contractName, bindingName, countEndpoints, label);
+               }
+
+               public static void CheckExport (
+                       WS.ServiceDescription wsdl, QName contractName, string bindingName,
+                       int countEndpoints, TestLabel label)
+               {
+                       label.EnterScope ("ServiceDescription");
+                       Assert.That (wsdl.TargetNamespace, Is.EqualTo (contractName.Namespace), label.Get ());
+                       Assert.That (wsdl.Name, Is.EqualTo ("service"), label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("Bindings");
+                       Assert.That (wsdl.Bindings, Is.Not.Null, label.Get ());
+                       Assert.That (wsdl.Bindings.Count, Is.EqualTo (countEndpoints), label.Get ());
+                       
+                       for (int i = 0; i < countEndpoints; i++) {
+                               label.EnterScope (string.Format ("#{0}", i+1));
+                               var binding = wsdl.Bindings [i];
+                               var expectedName = string.Format (
+                                       "{0}_{1}{2}", bindingName, contractName.Name,
+                                       i > 0 ? i.ToString () : "");
+                               Assert.That (binding.Name, Is.EqualTo (expectedName), label.Get ());
+                               Assert.That (binding.Type, Is.EqualTo (contractName), label.Get ());
+                               label.LeaveScope ();
+                       }
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("PortTypes");
+                       Assert.That (wsdl.PortTypes, Is.Not.Null, label.Get ());
+                       Assert.That (wsdl.PortTypes.Count, Is.EqualTo (1), label.Get ());
+                       var portType = wsdl.PortTypes [0];
+                       Assert.That (portType.Name, Is.EqualTo (contractName.Name), label.Get ());
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("Services");
+                       Assert.That (wsdl.Services, Is.Not.Null, label.Get ());
+                       Assert.That (wsdl.Services.Count, Is.EqualTo (1), label.Get ());
+                       var service = wsdl.Services [0];
+                       Assert.That (service.Name, Is.EqualTo ("service"), label.Get ());
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("Ports");
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (countEndpoints), label.Get ());
+                       for (int i = 0; i < countEndpoints; i++) {
+                               label.EnterScope (string.Format ("#{0}", i+1));
+                               var port = service.Ports [i];
+                               var expectedName = string.Format (
+                                       "{0}_{1}{2}", bindingName, contractName.Name,
+                                       i > 0 ? i.ToString () : "");
+                               var qname = new QName (expectedName, contractName.Namespace);
+                               Assert.That (port.Name, Is.EqualTo (qname.Name), label.Get ());
+                               Assert.That (port.Binding, Is.EqualTo (qname), label.Get ());
+                               label.LeaveScope ();
+                       }
+                       label.LeaveScope ();
+               }
+
+               [Test]
+               public void Mtom_Policy ()
+               {
+                       var label = new TestLabel ("Mtom_Policy");
+                       var contract = new ContractDescription ("MyContract");
+                       var binding = new BasicHttpBinding ();
+                       binding.MessageEncoding = WSMessageEncoding.Mtom;
+
+                       var endpoint = new ServiceEndpoint (
+                               contract, binding, new EndpointAddress (HttpUri));
+
+                       var exporter = new WsdlExporter ();
+                       exporter.ExportEndpoint (endpoint);
+
+                       Assert.That (exporter.GeneratedWsdlDocuments, Is.Not.Null, label.Get ());
+                       Assert.That (exporter.GeneratedWsdlDocuments.Count, Is.EqualTo (1), label.Get ());
+                       var wsdl = exporter.GeneratedWsdlDocuments [0];
+
+                       Assert.That (wsdl.Bindings, Is.Not.Null, label.Get ());
+                       Assert.That (wsdl.Bindings.Count, Is.EqualTo (1), label.Get ());
+
+                       var wsb = wsdl.Bindings [0];
+                       label.EnterScope ("Binding");
+                       Assert.That (wsb.Extensions, Is.Not.Null, label.Get ());
+                       Assert.That (wsb.Extensions.Count, Is.EqualTo (2), label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("Extensions");
+                       WS.SoapBinding soap = null;
+                       XmlElement xml = null;
+                       foreach (var extension in wsb.Extensions) {
+                               if (extension is WS.SoapBinding)
+                                       soap = (WS.SoapBinding)extension;
+                               else if (extension is XmlElement)
+                                       xml = (XmlElement)extension;
+                               else
+                                       Assert.Fail ("Unknown extension.", label);
+                       }
+
+                       Assert.That (soap, Is.Not.Null, label.Get ());
+                       Assert.That (xml, Is.Not.Null, label.Get ());
+                       label.LeaveScope ();
+
+                       label.EnterScope ("Policy");
+                       var assertions = BindingTestAssertions.AssertPolicy (wsdl, xml, label);
+                       Assert.That (assertions.Count, Is.EqualTo (1), label.Get ());
+                       var assertion = assertions [0];
+                       Assert.That (assertion.NamespaceURI, Is.EqualTo ("http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"), label.Get ());
+                       Assert.That (assertion.LocalName, Is.EqualTo ("OptimizedMimeSerialization"), label.Get ());
+                       label.LeaveScope ();
+               }
+       }
+}
+
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.cs
new file mode 100644 (file)
index 0000000..c113808
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Main.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public static class ExportUtil {
+               public static void Main (string[] args)
+               {
+                       MetadataSamples.Export ();
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.csproj b/mcs/class/System.ServiceModel/Test/MetadataTests/ExportUtil.csproj
new file mode 100644 (file)
index 0000000..4b304af
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D4C1B0BD-3488-441C-92B9-7E017041E137}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>ExportUtil</RootNamespace>
+    <AssemblyName>ExportUtil</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>False</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>True</Externalconsole>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>True</Externalconsole>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.ServiceModel" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Web.Services" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs" />
+    <Compile Include="ExportUtil.cs" />
+    <Compile Include="MetadataSamples.cs" />
+    <Compile Include="TestContext.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests.cs
new file mode 100644 (file)
index 0000000..05b290a
--- /dev/null
@@ -0,0 +1,296 @@
+//
+// Testcases.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       /*
+        * This class is abstract to allow it to be run multiple times with
+        * different TestContexts.
+        */
+       [Category ("MetadataTests")]
+       public abstract class ImportTests {
+
+               public abstract TestContext Context {
+                       get;
+               }
+
+               protected MetadataSet GetMetadata (string name, out TestLabel label)
+               {
+                       label = new TestLabel (name);
+                       return Context.GetMetadata (name);
+               }
+
+               [Test]
+               public virtual void BasicHttp ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, BasicHttpSecurityMode.None, label);
+               }
+               
+               [Test]
+               public virtual void BasicHttp_TransportSecurity ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_TransportSecurity", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, BasicHttpSecurityMode.Transport, label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void BasicHttp_MessageSecurity ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_MessageSecurity", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, BasicHttpSecurityMode.Message, label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void BasicHttp_TransportWithMessageCredential ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_TransportWithMessageCredential", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, BasicHttpSecurityMode.TransportWithMessageCredential, label);
+               }
+               
+               [Test]
+               public virtual void BasicHttp_Mtom ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_Mtom", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, WSMessageEncoding.Mtom, label);
+               }
+
+               [Test]
+               public virtual void BasicHttp_NtlmAuth ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_NtlmAuth", out label);
+
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, BasicHttpSecurityMode.TransportCredentialOnly,
+                               WSMessageEncoding.Text, HttpClientCredentialType.Ntlm,
+                               AuthenticationSchemes.Ntlm, label);
+               }
+
+#if NET_4_5
+               [Test]
+               public virtual void BasicHttps ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttps", out label);
+
+                       BindingTestAssertions.BasicHttpsBinding (
+                               Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+                               HttpClientCredentialType.None, AuthenticationSchemes.Anonymous,
+                               label);
+               }
+               
+               [Test]
+               public virtual void BasicHttps_NtlmAuth ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttps_NtlmAuth", out label);
+
+                       BindingTestAssertions.BasicHttpsBinding (
+                               Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+                               HttpClientCredentialType.Ntlm, AuthenticationSchemes.Ntlm,
+                               label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void BasicHttps_Certificate ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttps_Certificate", out label);
+
+                       BindingTestAssertions.BasicHttpsBinding (
+                               Context, doc, BasicHttpSecurityMode.Transport, WSMessageEncoding.Text,
+                               HttpClientCredentialType.Certificate, AuthenticationSchemes.Anonymous,
+                               label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void BasicHttps_TransportWithMessageCredential ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttps_TransportWithMessageCredential", out label);
+
+                       BindingTestAssertions.BasicHttpsBinding (
+                               Context, doc, BasicHttpSecurityMode.TransportWithMessageCredential,
+                               WSMessageEncoding.Text, HttpClientCredentialType.None,
+                               AuthenticationSchemes.Anonymous, label);
+               }
+#endif
+               
+               [Test]
+               public virtual void NetTcp ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.None, false, TransferMode.Buffered, label);
+               }
+
+               [Test]
+               public virtual void NetTcp_TransferMode ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_TransferMode", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.None, false,
+                               TransferMode.Streamed, label);
+               }
+
+               [Test]
+               public virtual void NetTcp_TransportSecurity ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_TransportSecurity", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.Transport, false,
+                               TransferMode.Buffered, label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void NetTcp_MessageSecurity ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_MessageSecurity", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.Message, false,
+                               TransferMode.Buffered, label);
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void NetTcp_TransportWithMessageCredential ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_TransportWithMessageCredential", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.TransportWithMessageCredential, false,
+                               TransferMode.Buffered, label);
+               }
+
+               [Test]
+               public virtual void NetTcp_Binding ()
+               {
+                       var label = new TestLabel ("NetTcp_Binding");
+
+                       label.EnterScope ("None");
+                       BindingTestAssertions.CheckNetTcpBinding (
+                               new NetTcpBinding (SecurityMode.None), SecurityMode.None,
+                               false, TransferMode.Buffered, label);
+                       label.LeaveScope ();
+
+                       label.EnterScope ("Transport");
+                       BindingTestAssertions.CheckNetTcpBinding (
+                               new NetTcpBinding (SecurityMode.Transport), SecurityMode.Transport,
+                               false, TransferMode.Buffered, label);
+                       label.LeaveScope ();
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void NetTcp_Binding2 ()
+               {
+                       var label = new TestLabel ("NetTcp_Binding2");
+
+                       label.EnterScope ("TransportWithMessageCredential");
+                       BindingTestAssertions.CheckNetTcpBinding (
+                               new NetTcpBinding (SecurityMode.TransportWithMessageCredential),
+                               SecurityMode.TransportWithMessageCredential, false,
+                               TransferMode.Buffered, label);
+                       label.LeaveScope ();
+               }
+               
+               [Test]
+               [Category ("NotWorking")]
+               public virtual void NetTcp_ReliableSession ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_ReliableSession", out label);
+
+                       BindingTestAssertions.NetTcpBinding (
+                               Context, doc, SecurityMode.None, true,
+                               TransferMode.Buffered, label);
+               }
+
+               [Test]
+               public virtual void BasicHttp_Operation ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_Operation", out label);
+
+                       BindingTestAssertions.TestOperation (doc, false, label);
+               }
+
+               [Test]
+               public virtual void NetTcp_Operation ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("NetTcp_Operation", out label);
+
+                       BindingTestAssertions.TestOperation (doc, true, label);
+               }
+       }
+
+}
+
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_CreateMetadata.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_CreateMetadata.cs
new file mode 100644 (file)
index 0000000..ca521a5
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// ImportTests_CreateMetadata.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       /*
+        * Create the metadata programmatically.
+        * 
+        */
+       [TestFixture]
+       public class ImportTests_CreateMetadata : ImportTests {
+               
+               public override TestContext Context {
+                       get { return TestContext.CreateMetadataContext; }
+               }
+
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_LoadMetadata.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_LoadMetadata.cs
new file mode 100644 (file)
index 0000000..3a92db1
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// ImportTests_LoadMetadata.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+       
+       /*
+        * Load the metadata from a file / embedded resource.
+        * 
+        */
+       [TestFixture]
+       public class ImportTests_LoadMetadata : ImportTests {
+
+               public override TestContext Context {
+                       get { return TestContext.LoadMetadataContext; }
+               }
+
+               [Test]
+               public virtual void BasicHttp_Mtom_EmbeddedPolicy ()
+               {
+                       TestLabel label;
+                       var doc = GetMetadata ("BasicHttp_Mtom_EmbeddedPolicy", out label);
+                       
+                       BindingTestAssertions.BasicHttpBinding (
+                               Context, doc, WSMessageEncoding.Mtom, label);
+               }
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_RoundTrip.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/ImportTests_RoundTrip.cs
new file mode 100644 (file)
index 0000000..7d4da80
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// ImportTests_RoundTrip.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       /*
+        * Export the metadata into a string, then import it back.
+        * 
+        * This tests both the WsdlExporter and the WsdlImporter.
+        * 
+        */
+       [TestFixture]
+       public class ImportTests_RoundTrip : ImportTests {
+               
+               public override TestContext Context {
+                       get { return TestContext.RoundTripContext; }
+               }
+
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataSamples.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataSamples.cs
new file mode 100644 (file)
index 0000000..34ecab8
--- /dev/null
@@ -0,0 +1,395 @@
+//
+// MetadataProvider.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.IO;
+using System.Reflection;
+using System.ServiceModel;
+using System.ServiceModel.Security;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.ServiceModel.Configuration;
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public static class MetadataSamples  {
+
+               internal const string HttpUri = "http://tempuri.org/TestHttp/";
+               internal const string HttpsUri = "https://tempuri.org/TestHttps/";
+               internal const string NetTcpUri = "net-tcp://tempuri.org:8000/TestNetTcp/";
+               internal const string CustomUri = "custom://tempuri.org:8000/Test/";
+
+               [MetadataSample]
+               public static MetadataSet BasicHttp ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new BasicHttpBinding (), new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet BasicHttp_TransportSecurity ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpBinding ();
+                       binding.Security.Mode = BasicHttpSecurityMode.Transport;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet BasicHttp_MessageSecurity ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpBinding ();
+                       binding.Security.Mode = BasicHttpSecurityMode.Message;
+                       binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet BasicHttp_TransportWithMessageCredential ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpBinding ();
+                       binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet BasicHttp_Mtom ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpBinding ();
+                       binding.MessageEncoding = WSMessageEncoding.Mtom;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet BasicHttp_NtlmAuth ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpBinding (BasicHttpSecurityMode.TransportCredentialOnly);
+                       binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+#if NET_4_5
+               [MetadataSample]
+               public static MetadataSet BasicHttps ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new BasicHttpsBinding (), new EndpointAddress (HttpsUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet BasicHttps_NtlmAuth ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpsBinding ();
+                       
+                       binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpsUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet BasicHttps_Certificate ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpsBinding ();
+                       binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpsUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet BasicHttps_TransportWithMessageCredential ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new BasicHttpsBinding (BasicHttpsSecurityMode.TransportWithMessageCredential);
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpsUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+#endif
+               
+               [MetadataSample]
+               public static MetadataSet NetTcp ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new NetTcpBinding (SecurityMode.None, false),
+                               new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet NetTcp_TransportSecurity ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new NetTcpBinding (SecurityMode.Transport, false),
+                               new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet NetTcp_MessageSecurity ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new NetTcpBinding (SecurityMode.Message, false),
+                               new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet NetTcp_TransportWithMessageCredential ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new NetTcpBinding (SecurityMode.TransportWithMessageCredential, false),
+                               new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet NetTcp_ReliableSession ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new NetTcpBinding (SecurityMode.None, true);
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+               
+               [MetadataSample]
+               public static MetadataSet NetTcp_TransferMode ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = new ContractDescription ("MyContract");
+                       
+                       var binding = new NetTcpBinding (SecurityMode.None, false);
+                       binding.TransferMode = TransferMode.Streamed;
+
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [ServiceContract]
+               public interface IMyContract {
+                       [OperationContract]
+                       void Hello ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet BasicHttp_Operation ()
+               {
+                       var exporter = new WsdlExporter ();
+
+                       var cd = ContractDescription.GetContract (typeof (IMyContract));
+
+                       var binding = new BasicHttpBinding ();
+
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, binding, new EndpointAddress (HttpUri)));
+
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               [MetadataSample]
+               public static MetadataSet NetTcp_Operation ()
+               {
+                       var exporter = new WsdlExporter ();
+                       
+                       var cd = ContractDescription.GetContract (typeof (IMyContract));
+                       
+                       exporter.ExportEndpoint (new ServiceEndpoint (
+                               cd, new NetTcpBinding (SecurityMode.None, false),
+                               new EndpointAddress (NetTcpUri)));
+                       
+                       return exporter.GetGeneratedMetadata ();
+               }
+
+               #region Helper API
+
+               public static void Export ()
+               {
+                       var bf = BindingFlags.Public | BindingFlags.Static;
+                       foreach (var method in typeof (MetadataSamples).GetMethods (bf)) {
+                               MetadataSampleAttribute sampleAttr = null;
+                               foreach (var obj in method.GetCustomAttributes (false)) {
+                                       var cattr = obj as MetadataSampleAttribute;
+                                       if (cattr != null) {
+                                               sampleAttr = cattr;
+                                               break;
+                                       }
+                               }
+
+                               if (sampleAttr == null)
+                                       continue;
+
+                               var name = sampleAttr.Name ?? method.Name;
+                               var doc = (MetadataSet)method.Invoke (null, null);
+                               TestContext.SaveMetadata (name, doc);
+                       }
+               }
+
+               public static MetadataSet GetMetadataByName (string name)
+               {
+                       if (name.EndsWith (".xml"))
+                               name = name.Substring (name.Length - 4);
+
+                       var bf = BindingFlags.Public | BindingFlags.Static;
+                       foreach (var method in typeof (MetadataSamples).GetMethods (bf)) {
+                               MetadataSampleAttribute sampleAttr = null;
+                               foreach (var obj in method.GetCustomAttributes (false)) {
+                                       var cattr = obj as MetadataSampleAttribute;
+                                       if (cattr != null) {
+                                               sampleAttr = cattr;
+                                               break;
+                                       }
+                               }
+                               
+                               if (sampleAttr == null)
+                                       continue;
+                               
+                               if (!name.Equals (sampleAttr.Name ?? method.Name))
+                                       continue;
+
+                               return (MetadataSet)method.Invoke (null, null);
+                       }
+
+                       throw new InvalidOperationException ();
+               }
+
+               public class MetadataSampleAttribute : Attribute {
+                       
+                       public MetadataSampleAttribute ()
+                       {
+                       }
+                       
+                       public MetadataSampleAttribute (string name)
+                       {
+                               Name = name;
+                       }
+                       
+                       public string Name {
+                               get; set;
+                       }
+                       
+               }
+
+               #endregion
+       }
+}
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.csproj b/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.csproj
new file mode 100644 (file)
index 0000000..5c86832
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>MetadataTests</RootNamespace>
+    <AssemblyName>MetadataTests</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>False</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;USE_EMBEDDED_METADATA;NET_4_5</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="nunit.framework" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs" />
+    <Compile Include="BindingTestAssertions.cs" />
+    <Compile Include="MetadataSamples.cs" />
+    <Compile Include="TestContext.cs" />
+    <Compile Include="TestLabel.cs" />
+    <Compile Include="MiscImportTests.cs" />
+    <Compile Include="ImportTests.cs" />
+    <Compile Include="ImportTests_LoadMetadata.cs" />
+    <Compile Include="ImportTests_CreateMetadata.cs" />
+    <Compile Include="ImportTests_RoundTrip.cs" />
+    <Compile Include="ExportTests.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <None Include="README.txt" />
+    <None Include="Resources\BasicHttp_Operation.xml" />
+    <None Include="Resources\NetTcp_Operation.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Resources\" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Resources\BasicHttp.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_MessageSecurity.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_Mtom.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_NtlmAuth.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_TransportSecurity.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_TransportWithMessageCredential.xml" />
+    <EmbeddedResource Include="Resources\BasicHttps.xml" />
+    <EmbeddedResource Include="Resources\BasicHttps_Certificate.xml" />
+    <EmbeddedResource Include="Resources\BasicHttps_NtlmAuth.xml" />
+    <EmbeddedResource Include="Resources\BasicHttps_TransportWithMessageCredential.xml" />
+    <EmbeddedResource Include="Resources\NetTcp.xml" />
+    <EmbeddedResource Include="Resources\NetTcp_MessageSecurity.xml" />
+    <EmbeddedResource Include="Resources\NetTcp_ReliableSession.xml" />
+    <EmbeddedResource Include="Resources\NetTcp_TransferMode.xml" />
+    <EmbeddedResource Include="Resources\NetTcp_TransportSecurity.xml" />
+    <EmbeddedResource Include="Resources\NetTcp_TransportWithMessageCredential.xml" />
+    <EmbeddedResource Include="Resources\http-error.xml" />
+    <EmbeddedResource Include="Resources\BasicHttp_Mtom_EmbeddedPolicy.xml" />
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.sln b/mcs/class/System.ServiceModel/Test/MetadataTests/MetadataTests.sln
new file mode 100644 (file)
index 0000000..3086179
--- /dev/null
@@ -0,0 +1,26 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 11.00\r
+# Visual Studio 2010\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetadataTests", "MetadataTests.csproj", "{7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}"\r
+EndProject\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExportUtil", "ExportUtil.csproj", "{D4C1B0BD-3488-441C-92B9-7E017041E137}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Any CPU = Debug|Any CPU\r
+               Release|Any CPU = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {7731D464-5152-4A1B-AACB-6B5A7CA9ACAA}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {D4C1B0BD-3488-441C-92B9-7E017041E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {D4C1B0BD-3488-441C-92B9-7E017041E137}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {D4C1B0BD-3488-441C-92B9-7E017041E137}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {D4C1B0BD-3488-441C-92B9-7E017041E137}.Release|Any CPU.Build.0 = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(MonoDevelopProperties) = preSolution\r
+               StartupItem = MetadataTests.csproj\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/MiscImportTests.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/MiscImportTests.cs
new file mode 100644 (file)
index 0000000..f6656e5
--- /dev/null
@@ -0,0 +1,281 @@
+//
+// Test_Misc.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+using WS = System.Web.Services.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public class MiscImportTests {
+
+               [Test]
+               public void BasicHttpBinding_ImportBinding ()
+               {
+                       var label = new TestLabel ("BasicHttpBinding_ImportBinding");
+                       
+                       var doc = TestContext.LoadMetadata ("BasicHttp");
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+                       var wsdlBinding = sd.Bindings [0];
+                       
+                       var importer = new WsdlImporter (doc);
+                       
+                       Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+                       
+                       var binding = importer.ImportBinding (wsdlBinding);
+                       BindingTestAssertions.CheckImportErrors (importer, label);
+                       Assert.That (binding, Is.Not.Null, label.Get ());
+               }
+               
+               [Test]
+               public void BasicHttpBinding_ImportEndpoint ()
+               {
+                       var label = new TestLabel ("BasicHttpBinding_ImportEndpoint");
+                       
+                       var doc = TestContext.LoadMetadata ("BasicHttp");
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+                       
+                       label.EnterScope ("wsdl");
+                       Assert.That (sd.Services, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+                       
+                       var service = sd.Services [0];
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+                       label.LeaveScope ();
+                       
+                       var importer = new WsdlImporter (doc);
+                       
+                       var port = importer.ImportEndpoint (service.Ports [0]);
+                       BindingTestAssertions.CheckImportErrors (importer, label);
+                       Assert.That (port, Is.Not.Null, label.Get ());
+               }
+               
+               [Test]
+               public void BasicHttpBinding_Error ()
+               {
+                       var label = new TestLabel ("BasicHttpBinding_Error");
+                       
+                       var doc = TestContext.LoadMetadata ("http-error.xml");
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+                       var wsdlBinding = sd.Bindings [0];
+                       
+                       var importer = new WsdlImporter (doc);
+                       
+                       label.EnterScope ("all");
+                       
+                       var bindings = importer.ImportAllBindings ();
+                       Assert.That (bindings, Is.Not.Null, label.Get ());
+                       Assert.That (bindings.Count, Is.EqualTo (0), label.Get ());
+                       
+                       label.EnterScope ("errors");
+                       Assert.That (importer.Errors, Is.Not.Null, label.Get ());
+                       Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
+                       
+                       var error = importer.Errors [0];
+                       Assert.That (error.IsWarning, Is.False, label.Get ());
+                       label.LeaveScope ();
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("single");
+                       
+                       try {
+                               importer.ImportBinding (wsdlBinding);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       Assert.That (importer.Errors.Count, Is.EqualTo (1), label.Get ());
+                       
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("single-first");
+                       
+                       var importer2 = new WsdlImporter (doc);
+                       
+                       try {
+                               importer2.ImportBinding (wsdlBinding);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       Assert.That (importer2.Errors.Count, Is.EqualTo (1), label.Get ());
+                       
+                       try {
+                               importer2.ImportBinding (wsdlBinding);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       var bindings2 = importer.ImportAllBindings ();
+                       Assert.That (bindings2, Is.Not.Null, label.Get ());
+                       Assert.That (bindings2.Count, Is.EqualTo (0), label.Get ());
+                       
+                       label.LeaveScope ();
+               }
+               
+               [Test]
+               public void BasicHttpBinding_Error2 ()
+               {
+                       var label = new TestLabel ("BasicHttpBinding_Error2");
+                       
+                       var doc = TestContext.LoadMetadata ("http-error.xml");
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+                       
+                       label.EnterScope ("wsdl");
+                       Assert.That (sd.Services, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+                       
+                       var service = sd.Services [0];
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+                       label.LeaveScope ();
+                       
+                       var importer = new WsdlImporter (doc);
+                       
+                       label.EnterScope ("all");
+                       
+                       var endpoints = importer.ImportAllEndpoints ();
+                       Assert.That (endpoints, Is.Not.Null, label.Get ());
+                       Assert.That (endpoints.Count, Is.EqualTo (0), label.Get ());
+                       
+                       label.EnterScope ("errors");
+                       Assert.That (importer.Errors, Is.Not.Null, label.Get ());
+                       Assert.That (importer.Errors.Count, Is.EqualTo (2), label.Get ());
+                       
+                       Assert.That (importer.Errors [0].IsWarning, Is.False, label.Get ());
+                       Assert.That (importer.Errors [1].IsWarning, Is.False, label.Get ());
+                       label.LeaveScope ();
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("single");
+                       
+                       try {
+                               importer.ImportEndpoint (service.Ports [0]);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       Assert.That (importer.Errors.Count, Is.EqualTo (2), label.Get ());
+                       
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("single-first");
+                       
+                       var importer2 = new WsdlImporter (doc);
+                       
+                       try {
+                               importer2.ImportEndpoint (service.Ports [0]);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       Assert.That (importer2.Errors.Count, Is.EqualTo (2), label.Get ());
+                       
+                       try {
+                               importer2.ImportEndpoint (service.Ports [0]);
+                               Assert.Fail (label.Get ());
+                       } catch {
+                               ;
+                       }
+                       
+                       var endpoints2 = importer.ImportAllEndpoints ();
+                       Assert.That (endpoints2, Is.Not.Null, label.Get ());
+                       Assert.That (endpoints2.Count, Is.EqualTo (0), label.Get ());
+                       
+                       label.LeaveScope ();
+               }
+               
+               [Test]
+               public void BasicHttpBinding_ImportEndpoints ()
+               {
+                       var label = new TestLabel ("BasicHttpBinding_ImportEndpoints");
+                       
+                       var doc = TestContext.LoadMetadata ("BasicHttp");
+                       var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata;
+                       
+                       label.EnterScope ("wsdl");
+                       Assert.That (sd.Bindings, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Bindings.Count, Is.EqualTo (1), label.Get ());
+                       var binding = sd.Bindings [0];
+                       
+                       Assert.That (sd.Services, Is.Not.Null, label.Get ());
+                       Assert.That (sd.Services.Count, Is.EqualTo (1), label.Get ());
+                       var service = sd.Services [0];
+                       
+                       Assert.That (service.Ports, Is.Not.Null, label.Get ());
+                       Assert.That (service.Ports.Count, Is.EqualTo (1), label.Get ());
+                       var port = service.Ports [0];
+                       
+                       Assert.That (sd.PortTypes, Is.Not.Null, label.Get ());
+                       Assert.That (sd.PortTypes.Count, Is.EqualTo (1), label.Get ());
+                       var portType = sd.PortTypes [0];
+                       
+                       label.LeaveScope ();
+                       
+                       var importer = new WsdlImporter (doc);
+                       
+                       label.EnterScope ("by-service");
+                       var byService = importer.ImportEndpoints (service);
+                       BindingTestAssertions.CheckImportErrors (importer, label);
+                       Assert.That (byService, Is.Not.Null, label.Get ());
+                       Assert.That (byService.Count, Is.EqualTo (1), label.Get ());
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("by-binding");
+                       var byBinding = importer.ImportEndpoints (binding);
+                       BindingTestAssertions.CheckImportErrors (importer, label);
+                       Assert.That (byBinding, Is.Not.Null, label.Get ());
+                       Assert.That (byBinding.Count, Is.EqualTo (1), label.Get ());
+                       label.LeaveScope ();
+                       
+                       label.EnterScope ("by-port-type");
+                       var byPortType = importer.ImportEndpoints (portType);
+                       BindingTestAssertions.CheckImportErrors (importer, label);
+                       Assert.That (byPortType, Is.Not.Null, label.Get ());
+                       Assert.That (byPortType.Count, Is.EqualTo (1), label.Get ());
+                       label.LeaveScope ();
+               }
+
+       }
+}
+
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/README.txt b/mcs/class/System.ServiceModel/Test/MetadataTests/README.txt
new file mode 100644 (file)
index 0000000..a1ed18e
--- /dev/null
@@ -0,0 +1,54 @@
+Metadata Tests
+==============
+
+These tests can be run either as part of System.ServiceModel_test_<profile>.dll
+or as the stand-alone MetadataTests.dll, which bundles all the XML files as
+embedded resources.
+
+Generating and updating the XML Samples:
+========================================
+
+Mono's WsdlExporter is not yet capable of generating the wsdl files that
+are used as test input here.
+
+To generate the XML files, compile the ExportUtil.exe tool either by using the
+ExportUtil.csproj or compiling it manually:
+
+  mcs -r:System.ServiceModel -r:System.Web.Services ExportUtil.cs MetadataSamples.cs TestContext.cs 
+
+Then copy the binary to a Windows machine and run it there.  This will generate a bunch of
+.xml files.  Run dos2unix on them and copy them into the Resources/ subdirectory.
+
+Adding new Tests:
+=================
+
+To add a new test, add a method with the [MetadataaSample] attribute to
+MetadataSamples.cs, like this:
+
+       [MetadataSample]
+       public static MetadataSet MyXML ()
+       {
+               ....
+       }
+
+You may also specify a name:
+
+       [MetadataSample ("MyXML")]
+       public static MetadataSet RandomMethodName ()   
+       {
+       }
+
+Re-compile ExportUtil.exe and it will produce a new 'MyXML.xml' file.
+
+Then write a new test case:
+
+       [Test]
+       public void MyXML ()
+       {
+               var doc = TestContext.GetMetadata ("MyXML");
+               ... test it here
+       }
+
+The idea behind the 'TestContext' class is to allow "self-hosting" at a
+later time, ie. use Mono's WsdlExporter to generate the metadata instead
+of loading the on-disk file without having to modify a bunch of tests.
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp.xml
new file mode 100644 (file)
index 0000000..82ce03c
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_MessageSecurity.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_MessageSecurity.xml
new file mode 100644 (file)
index 0000000..7a442ff
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:InitiatorToken>
+                  <wsp:Policy>
+                    <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                      <wsp:Policy>
+                        <sp:WssX509V3Token10 />
+                      </wsp:Policy>
+                    </sp:X509Token>
+                  </wsp:Policy>
+                </sp:InitiatorToken>
+                <sp:RecipientToken>
+                  <wsp:Policy>
+                    <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+                      <wsp:Policy>
+                        <sp:WssX509V3Token10 />
+                      </wsp:Policy>
+                    </sp:X509Token>
+                  </wsp:Policy>
+                </sp:RecipientToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Lax />
+                  </wsp:Policy>
+                </sp:Layout>
+                <sp:IncludeTimestamp />
+                <sp:OnlySignEntireHeadersAndBody />
+              </wsp:Policy>
+            </sp:AsymmetricBinding>
+            <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:MustSupportRefKeyIdentifier />
+                <sp:MustSupportRefIssuerSerial />
+              </wsp:Policy>
+            </sp:Wss10>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom.xml
new file mode 100644 (file)
index 0000000..9e827c0
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom_EmbeddedPolicy.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Mtom_EmbeddedPolicy.xml
new file mode 100644 (file)
index 0000000..ed056bb
--- /dev/null
@@ -0,0 +1,68 @@
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <MetadataSection Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="service" targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+      <types>
+        <xs:schema xmlns:tns="http://tempuri.org/Imports" targetNamespace="http://tempuri.org/Imports" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+          <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
+        </xs:schema>
+      </types>
+      <portType name="MyContract" />
+      <binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+          <wsp:ExactlyOne>
+            <wsp:All>
+              <wsoma:OptimizedMimeSerialization xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />
+            </wsp:All>
+          </wsp:ExactlyOne>
+        </wsp:Policy>
+      </binding>
+      <service name="service">
+        <port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </port>
+      </service>
+    </definitions>
+  </MetadataSection>
+  <MetadataSection Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://schemas.microsoft.com/2003/10/Serialization/">
+    <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+      <xs:element name="anyType" nillable="true" type="xs:anyType" />
+      <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
+      <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
+      <xs:element name="boolean" nillable="true" type="xs:boolean" />
+      <xs:element name="byte" nillable="true" type="xs:byte" />
+      <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
+      <xs:element name="decimal" nillable="true" type="xs:decimal" />
+      <xs:element name="double" nillable="true" type="xs:double" />
+      <xs:element name="float" nillable="true" type="xs:float" />
+      <xs:element name="int" nillable="true" type="xs:int" />
+      <xs:element name="long" nillable="true" type="xs:long" />
+      <xs:element name="QName" nillable="true" type="xs:QName" />
+      <xs:element name="short" nillable="true" type="xs:short" />
+      <xs:element name="string" nillable="true" type="xs:string" />
+      <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
+      <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
+      <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
+      <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
+      <xs:element name="char" nillable="true" type="tns:char" />
+      <xs:simpleType name="char">
+        <xs:restriction base="xs:int" />
+      </xs:simpleType>
+      <xs:element name="duration" nillable="true" type="tns:duration" />
+      <xs:simpleType name="duration">
+        <xs:restriction base="xs:duration">
+          <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
+          <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
+          <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
+        </xs:restriction>
+      </xs:simpleType>
+      <xs:element name="guid" nillable="true" type="tns:guid" />
+      <xs:simpleType name="guid">
+        <xs:restriction base="xs:string">
+          <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
+        </xs:restriction>
+      </xs:simpleType>
+      <xs:attribute name="FactoryType" type="xs:QName" />
+    </xs:schema>
+  </MetadataSection>
+</Metadata>
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_NtlmAuth.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_NtlmAuth.xml
new file mode 100644 (file)
index 0000000..e865018
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <http:NtlmAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Operation.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_Operation.xml
new file mode 100644 (file)
index 0000000..1f82a4d
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsdl:types>
+        <xsd:schema targetNamespace="http://tempuri.org/Imports">
+          <xsd:import namespace="http://tempuri.org/" />
+        </xsd:schema>
+      </wsdl:types>
+      <wsdl:message name="IMyContract_Hello_InputMessage">
+        <wsdl:part name="parameters" element="tns:Hello" />
+      </wsdl:message>
+      <wsdl:message name="IMyContract_Hello_OutputMessage">
+        <wsdl:part name="parameters" element="tns:HelloResponse" />
+      </wsdl:message>
+      <wsdl:portType name="IMyContract">
+        <wsdl:operation name="Hello">
+          <wsdl:input wsaw:Action="http://tempuri.org/IMyContract/Hello" message="tns:IMyContract_Hello_InputMessage" />
+          <wsdl:output wsaw:Action="http://tempuri.org/IMyContract/HelloResponse" message="tns:IMyContract_Hello_OutputMessage" />
+        </wsdl:operation>
+      </wsdl:portType>
+      <wsdl:binding name="BasicHttpBinding_IMyContract" type="tns:IMyContract">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="Hello">
+          <soap:operation soapAction="http://tempuri.org/IMyContract/Hello" style="document" />
+          <wsdl:input>
+            <soap:body use="literal" />
+          </wsdl:input>
+          <wsdl:output>
+            <soap:body use="literal" />
+          </wsdl:output>
+        </wsdl:operation>
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_IMyContract" binding="tns:BasicHttpBinding_IMyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+  <wsx:MetadataSection xmlns="" Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://tempuri.org/">
+    <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+      <xs:element name="Hello">
+        <xs:complexType>
+          <xs:sequence />
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="HelloResponse">
+        <xs:complexType>
+          <xs:sequence />
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportSecurity.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportSecurity.xml
new file mode 100644 (file)
index 0000000..82ab01b
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="false" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+              </wsp:Policy>
+            </sp:TransportBinding>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportWithMessageCredential.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttp_TransportWithMessageCredential.xml
new file mode 100644 (file)
index 0000000..0905542
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="false" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Lax />
+                  </wsp:Policy>
+                </sp:Layout>
+                <sp:IncludeTimestamp />
+              </wsp:Policy>
+            </sp:TransportBinding>
+            <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                  <wsp:Policy>
+                    <sp:WssUsernameToken10 />
+                  </wsp:Policy>
+                </sp:UsernameToken>
+              </wsp:Policy>
+            </sp:SignedSupportingTokens>
+            <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy />
+            </sp:Wss10>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps.xml
new file mode 100644 (file)
index 0000000..9ed00e4
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="false" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+              </wsp:Policy>
+            </sp:TransportBinding>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+          <soap:address location="https://tempuri.org/TestHttps/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_Certificate.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_Certificate.xml
new file mode 100644 (file)
index 0000000..f8b19cc
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="true" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+              </wsp:Policy>
+            </sp:TransportBinding>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+          <soap:address location="https://tempuri.org/TestHttps/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_NtlmAuth.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_NtlmAuth.xml
new file mode 100644 (file)
index 0000000..ad6772e
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <http:NtlmAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" />
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="false" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+              </wsp:Policy>
+            </sp:TransportBinding>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+          <soap:address location="https://tempuri.org/TestHttps/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_TransportWithMessageCredential.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/BasicHttps_TransportWithMessageCredential.xml
new file mode 100644 (file)
index 0000000..f688906
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="BasicHttpsBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <sp:HttpsToken RequireClientCertificate="false" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Lax />
+                  </wsp:Policy>
+                </sp:Layout>
+                <sp:IncludeTimestamp />
+              </wsp:Policy>
+            </sp:TransportBinding>
+            <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                  <wsp:Policy>
+                    <sp:WssUsernameToken10 />
+                  </wsp:Policy>
+                </sp:UsernameToken>
+              </wsp:Policy>
+            </sp:SignedSupportingTokens>
+            <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy />
+            </sp:Wss10>
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpsBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#BasicHttpsBinding_MyContract_policy" />
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpsBinding_MyContract" binding="tns:BasicHttpsBinding_MyContract">
+          <soap:address location="https://tempuri.org/TestHttps/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp.xml
new file mode 100644 (file)
index 0000000..7edf87a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_MessageSecurity.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_MessageSecurity.xml
new file mode 100644 (file)
index 0000000..5953464
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:ProtectionToken>
+                  <wsp:Policy>
+                    <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                      <wsp:Policy>
+                        <sp:RequireDerivedKeys />
+                        <sp:BootstrapPolicy>
+                          <wsp:Policy>
+                            <sp:SignedParts>
+                              <sp:Body />
+                              <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                              <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+                            </sp:SignedParts>
+                            <sp:EncryptedParts>
+                              <sp:Body />
+                            </sp:EncryptedParts>
+                            <sp:SymmetricBinding>
+                              <wsp:Policy>
+                                <sp:ProtectionToken>
+                                  <wsp:Policy>
+                                    <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                                      <wsp:Policy>
+                                        <sp:RequireDerivedKeys />
+                                      </wsp:Policy>
+                                    </sp:SpnegoContextToken>
+                                  </wsp:Policy>
+                                </sp:ProtectionToken>
+                                <sp:AlgorithmSuite>
+                                  <wsp:Policy>
+                                    <sp:Basic256 />
+                                  </wsp:Policy>
+                                </sp:AlgorithmSuite>
+                                <sp:Layout>
+                                  <wsp:Policy>
+                                    <sp:Strict />
+                                  </wsp:Policy>
+                                </sp:Layout>
+                                <sp:IncludeTimestamp />
+                                <sp:EncryptSignature />
+                                <sp:OnlySignEntireHeadersAndBody />
+                              </wsp:Policy>
+                            </sp:SymmetricBinding>
+                            <sp:Wss11>
+                              <wsp:Policy />
+                            </sp:Wss11>
+                            <sp:Trust10>
+                              <wsp:Policy>
+                                <sp:MustSupportIssuedTokens />
+                                <sp:RequireClientEntropy />
+                                <sp:RequireServerEntropy />
+                              </wsp:Policy>
+                            </sp:Trust10>
+                          </wsp:Policy>
+                        </sp:BootstrapPolicy>
+                      </wsp:Policy>
+                    </sp:SecureConversationToken>
+                  </wsp:Policy>
+                </sp:ProtectionToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+                <sp:IncludeTimestamp />
+                <sp:OnlySignEntireHeadersAndBody />
+              </wsp:Policy>
+            </sp:SymmetricBinding>
+            <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy />
+            </sp:Wss11>
+            <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:MustSupportIssuedTokens />
+                <sp:RequireClientEntropy />
+                <sp:RequireServerEntropy />
+              </wsp:Policy>
+            </sp:Trust10>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_Operation.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_Operation.xml
new file mode 100644 (file)
index 0000000..a2775b6
--- /dev/null
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_IMyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types>
+        <xsd:schema targetNamespace="http://tempuri.org/Imports">
+          <xsd:import namespace="http://tempuri.org/" />
+        </xsd:schema>
+      </wsdl:types>
+      <wsdl:message name="IMyContract_Hello_InputMessage">
+        <wsdl:part name="parameters" element="tns:Hello" />
+      </wsdl:message>
+      <wsdl:message name="IMyContract_Hello_OutputMessage">
+        <wsdl:part name="parameters" element="tns:HelloResponse" />
+      </wsdl:message>
+      <wsdl:portType name="IMyContract">
+        <wsdl:operation name="Hello">
+          <wsdl:input wsaw:Action="http://tempuri.org/IMyContract/Hello" message="tns:IMyContract_Hello_InputMessage" />
+          <wsdl:output wsaw:Action="http://tempuri.org/IMyContract/HelloResponse" message="tns:IMyContract_Hello_OutputMessage" />
+        </wsdl:operation>
+      </wsdl:portType>
+      <wsdl:binding name="NetTcpBinding_IMyContract" type="tns:IMyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_IMyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+        <wsdl:operation name="Hello">
+          <soap12:operation soapAction="http://tempuri.org/IMyContract/Hello" style="document" />
+          <wsdl:input>
+            <soap12:body use="literal" />
+          </wsdl:input>
+          <wsdl:output>
+            <soap12:body use="literal" />
+          </wsdl:output>
+        </wsdl:operation>
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_IMyContract" binding="tns:NetTcpBinding_IMyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+  <wsx:MetadataSection xmlns="" Dialect="http://www.w3.org/2001/XMLSchema" Identifier="http://tempuri.org/">
+    <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+      <xs:element name="Hello">
+        <xs:complexType>
+          <xs:sequence />
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="HelloResponse">
+        <xs:complexType>
+          <xs:sequence />
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_ReliableSession.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_ReliableSession.xml
new file mode 100644 (file)
index 0000000..85d1bd0
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <wsrm:RMAssertion xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
+              <wsrm:InactivityTimeout Milliseconds="600000" />
+              <wsrm:AcknowledgementInterval Milliseconds="200" />
+            </wsrm:RMAssertion>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransferMode.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransferMode.xml
new file mode 100644 (file)
index 0000000..f8c5e45
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <msf:Streamed xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportSecurity.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportSecurity.xml
new file mode 100644 (file)
index 0000000..3ba464a
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <msf:WindowsTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy">
+                      <msf:ProtectionLevel>EncryptAndSign</msf:ProtectionLevel>
+                    </msf:WindowsTransportSecurity>
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+              </wsp:Policy>
+            </sp:TransportBinding>
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportWithMessageCredential.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/NetTcp_TransportWithMessageCredential.xml
new file mode 100644 (file)
index 0000000..9d26993
--- /dev/null
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsp:Policy wsu:Id="NetTcpBinding_MyContract_policy">
+        <wsp:ExactlyOne>
+          <wsp:All>
+            <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
+            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:TransportToken>
+                  <wsp:Policy>
+                    <msf:SslTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+                  </wsp:Policy>
+                </sp:TransportToken>
+                <sp:AlgorithmSuite>
+                  <wsp:Policy>
+                    <sp:Basic256 />
+                  </wsp:Policy>
+                </sp:AlgorithmSuite>
+                <sp:Layout>
+                  <wsp:Policy>
+                    <sp:Strict />
+                  </wsp:Policy>
+                </sp:Layout>
+                <sp:IncludeTimestamp />
+              </wsp:Policy>
+            </sp:TransportBinding>
+            <sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                  <wsp:Policy>
+                    <sp:BootstrapPolicy>
+                      <wsp:Policy>
+                        <sp:SignedParts>
+                          <sp:Body />
+                          <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
+                          <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
+                        </sp:SignedParts>
+                        <sp:EncryptedParts>
+                          <sp:Body />
+                        </sp:EncryptedParts>
+                        <sp:TransportBinding>
+                          <wsp:Policy>
+                            <sp:TransportToken>
+                              <wsp:Policy>
+                                <msf:SslTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy" />
+                              </wsp:Policy>
+                            </sp:TransportToken>
+                            <sp:AlgorithmSuite>
+                              <wsp:Policy>
+                                <sp:Basic256 />
+                              </wsp:Policy>
+                            </sp:AlgorithmSuite>
+                            <sp:Layout>
+                              <wsp:Policy>
+                                <sp:Strict />
+                              </wsp:Policy>
+                            </sp:Layout>
+                            <sp:IncludeTimestamp />
+                          </wsp:Policy>
+                        </sp:TransportBinding>
+                        <sp:EndorsingSupportingTokens>
+                          <wsp:Policy>
+                            <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                              <wsp:Policy />
+                            </sp:SpnegoContextToken>
+                          </wsp:Policy>
+                        </sp:EndorsingSupportingTokens>
+                        <sp:Wss11>
+                          <wsp:Policy />
+                        </sp:Wss11>
+                        <sp:Trust10>
+                          <wsp:Policy>
+                            <sp:MustSupportIssuedTokens />
+                            <sp:RequireClientEntropy />
+                            <sp:RequireServerEntropy />
+                          </wsp:Policy>
+                        </sp:Trust10>
+                      </wsp:Policy>
+                    </sp:BootstrapPolicy>
+                  </wsp:Policy>
+                </sp:SecureConversationToken>
+              </wsp:Policy>
+            </sp:EndorsingSupportingTokens>
+            <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy />
+            </sp:Wss11>
+            <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+              <wsp:Policy>
+                <sp:MustSupportIssuedTokens />
+                <sp:RequireClientEntropy />
+                <sp:RequireServerEntropy />
+              </wsp:Policy>
+            </sp:Trust10>
+            <wsaw:UsingAddressing />
+          </wsp:All>
+        </wsp:ExactlyOne>
+      </wsp:Policy>
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="NetTcpBinding_MyContract" type="tns:MyContract">
+        <wsp:PolicyReference URI="#NetTcpBinding_MyContract_policy" />
+        <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="NetTcpBinding_MyContract" binding="tns:NetTcpBinding_MyContract">
+          <soap12:address location="net-tcp://tempuri.org:8000/TestNetTcp/" />
+          <wsa10:EndpointReference>
+            <wsa10:Address>net-tcp://tempuri.org:8000/TestNetTcp/</wsa10:Address>
+          </wsa10:EndpointReference>
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/http-error.xml b/mcs/class/System.ServiceModel/Test/MetadataTests/Resources/http-error.xml
new file mode 100644 (file)
index 0000000..d8678d5
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex">
+  <wsx:MetadataSection xmlns="" Dialect="http://schemas.xmlsoap.org/wsdl/" Identifier="http://tempuri.org/">
+    <wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+      <wsdl:types />
+      <wsdl:portType name="MyContract" />
+      <wsdl:binding name="BasicHttpBinding_MyContract" type="tns:NonExisting">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+      </wsdl:binding>
+      <wsdl:service name="service">
+        <wsdl:port name="BasicHttpBinding_MyContract" binding="tns:BasicHttpBinding_MyContract">
+          <soap:address location="http://tempuri.org/TestHttp/" />
+        </wsdl:port>
+      </wsdl:service>
+    </wsdl:definitions>
+  </wsx:MetadataSection>
+</Metadata>
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/TestContext.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/TestContext.cs
new file mode 100644 (file)
index 0000000..989be63
--- /dev/null
@@ -0,0 +1,175 @@
+//
+// ITestContext.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Text;
+using System.Reflection;
+using System.ServiceModel.Description;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public abstract class TestContext {
+
+               #region Abstract API
+
+               public abstract MetadataSet GetMetadata (string name);
+
+               #endregion
+
+               #region Default Context
+
+               public static TestContext LoadMetadataContext = new _LoadMetadataContext ();
+
+               public static TestContext CreateMetadataContext = new _CreateMetadataContext ();
+
+               public static TestContext RoundTripContext = new _RoundTripContext ();
+
+               #endregion
+
+               #region Implementations
+
+               class _LoadMetadataContext : TestContext {
+                       public override MetadataSet GetMetadata (string name)
+                       {
+                               return LoadMetadata (name);
+                       }
+               }
+
+               class _CreateMetadataContext : TestContext {
+                       public override MetadataSet GetMetadata (string name)
+                       {
+                               return MetadataSamples.GetMetadataByName (name);
+                       }
+               }
+
+               class _RoundTripContext : TestContext {
+                       public override MetadataSet GetMetadata (string name)
+                       {
+                               return RoundTrip (name);
+                       }
+               }
+
+               #endregion
+
+               #region Public Static API
+
+               public static MetadataSet LoadMetadata (string name)
+               {
+#if USE_EMBEDDED_METADATA
+                       return LoadMetadataFromResource (name);
+#else
+                       return LoadMetadataFromFile (name);
+#endif
+               }
+
+               public static void SaveMetadata (string name, MetadataSet metadata)
+               {
+                       SaveMetadataToFile (name, metadata);
+               }
+
+               public static MetadataSet LoadMetadataFromFile (string name)
+               {
+                       var asm = Assembly.GetExecutingAssembly ();
+                       if (!name.EndsWith (".xml"))
+                               name = name + ".xml";
+                       var uri = new Uri (asm.CodeBase);
+                       var path = Path.GetDirectoryName (uri.AbsolutePath);
+                       path = Path.Combine (path, "Test");
+                       path = Path.Combine (path, "MetadataTests");
+                       path = Path.Combine (path, "Resources");
+                       var filename = Path.Combine (path, name);
+                       using (var stream = new StreamReader (filename)) {
+                               var reader = new XmlTextReader (stream);
+                               return MetadataSet.ReadFrom (reader);
+                       }
+               }
+
+               public static MetadataSet LoadMetadataFromResource (string name)
+               {
+                       var asm = Assembly.GetExecutingAssembly ();
+                       if (!name.EndsWith (".xml"))
+                               name = name + ".xml";
+                       
+                       var resname = "MetadataTests.Resources." + name;
+                       using (var stream = asm.GetManifestResourceStream (resname)) {
+                               if (stream == null)
+                                       throw new InvalidOperationException (
+                                               "No such resource: " + name);
+                               var reader = new XmlTextReader (stream);
+                               return MetadataSet.ReadFrom (reader);
+                       }
+               }
+               
+               public static void SaveMetadataToFile (string name, MetadataSet metadata)
+               {
+                       var filename = name + ".xml";
+                       if (File.Exists (filename))
+                               return;
+
+                       using (var file = new StreamWriter (filename, false)) {
+                               var writer = new XmlTextWriter (file);
+                               writer.Formatting = Formatting.Indented;
+                               metadata.WriteTo (writer);
+                       }
+
+                       Console.WriteLine ("Exported {0}.", filename);
+               }
+
+               internal static string SaveMetadataToString (MetadataSet metadata)
+               {
+                       using (var ms = new MemoryStream ()) {
+                               var writer = new XmlTextWriter (new StreamWriter (ms));
+                               writer.Formatting = Formatting.Indented;
+                               metadata.WriteTo (writer);
+                               writer.Flush ();
+
+                               return Encoding.UTF8.GetString (ms.GetBuffer (), 0, (int)ms.Position);
+                       }
+               }
+
+               internal static MetadataSet LoadMetadataFromString (string doc)
+               {
+                       var buffer = Encoding.UTF8.GetBytes (doc);
+                       using (var ms = new MemoryStream (buffer)) {
+                               var reader = new XmlTextReader (ms);
+                               return MetadataSet.ReadFrom (reader);
+                       }
+               }
+
+               public static MetadataSet RoundTrip (string name)
+               {
+                       var metadata = MetadataSamples.GetMetadataByName (name);
+
+                       var doc = SaveMetadataToString (metadata);
+                       return LoadMetadataFromString (doc);
+               }
+
+               #endregion
+       }
+}
+
diff --git a/mcs/class/System.ServiceModel/Test/MetadataTests/TestLabel.cs b/mcs/class/System.ServiceModel/Test/MetadataTests/TestLabel.cs
new file mode 100644 (file)
index 0000000..76bd1ff
--- /dev/null
@@ -0,0 +1,138 @@
+//
+// TestLabel.cs
+//
+// Author:
+//       Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+namespace MonoTests.System.ServiceModel.MetadataTests {
+
+       public class TestLabel {
+
+               List<Scope> scopes;
+               string delimiter;
+               Style defaultStyle;
+
+               public enum Style {
+                       Letter,
+                       Number,
+                       HexNumer
+               }
+
+               public TestLabel (string prefix)
+                       : this (prefix, ".", Style.Letter)
+               {
+               }
+
+               public TestLabel (string prefix, string delimiter, Style style)
+               {
+                       if ((prefix == null) || (prefix.Equals (string.Empty)))
+                               throw new ArgumentException ("Cannot be null or empty.", "prefix");
+                       if (delimiter == null)
+                               throw new ArgumentNullException ("delimiter");
+
+                       scopes = new List<Scope> ();
+                       scopes.Add (new Scope (prefix, style));
+
+                       this.delimiter = delimiter;
+                       this.defaultStyle = style;
+               }
+
+               class Scope {
+                       public readonly string Text;
+                       public readonly Style Style;
+                       int id;
+
+                       public Scope (string text, Style style)
+                       {
+                               this.Text = text;
+                               this.Style = style;
+                               this.id = 0;
+                       }
+
+                       public int GetID ()
+                       {
+                               return ++id;
+                       }
+               }
+
+               public void EnterScope (string scope)
+               {
+                       scopes.Add (new Scope (scope, defaultStyle));
+               }
+
+               public void LeaveScope ()
+               {
+                       if (scopes.Count <= 1)
+                               throw new InvalidOperationException ();
+                       scopes.RemoveAt (scopes.Count - 1);
+               }
+
+               public string Get ()
+               {
+                       var sb = new StringBuilder ();
+                       for (int i = 0; i < scopes.Count; i++) {
+                               sb.Append (scopes [i].Text);
+                               sb.Append (delimiter);
+                       }
+
+                       var scope = scopes [scopes.Count - 1];
+                       var id = scope.GetID ();
+
+                       switch (scope.Style) {
+                       case Style.Letter:
+                               if (id <= 26)
+                                       sb.Append ((char)('a' + id - 1));
+                               else
+                                       goto case Style.Number;
+                               break;
+
+                       case Style.Number:
+                               sb.Append (id);
+                               break;
+
+                       case Style.HexNumer:
+                               sb.AppendFormat ("{0:x2}", id);
+                               break;
+                       }
+
+                       return sb.ToString ();
+               }
+
+               public override string ToString ()
+               {
+                       var sb = new StringBuilder ();
+                       sb.Append ("[");
+                       for (int i = 0; i < scopes.Count; i++) {
+                               if (i > 0)
+                                       sb.Append (delimiter);
+                               sb.Append (scopes [i].Text);
+                       }
+                       sb.Append ("]");
+                       return sb.ToString ();
+               }
+       }
+}
+
index b02351389143639fe087021fdc64c30eb8687be6..09e9f40ce54b89c91d31f34c3691852deb31e651 100644 (file)
@@ -121,6 +121,80 @@ namespace MonoTests.System.ServiceModel.Channels
 
                        return null;
                }
+
+               XmlNode FindAssertionByLocalName (PolicyAssertionCollection assertionCollection, string name)
+               {
+                       foreach (XmlNode node in assertionCollection)
+                               if (node.LocalName == name)
+                                       return node;
+                       
+                       return null;
+               }
+
+               class MyMessageEncodingElement : MessageEncodingBindingElement {
+                       MessageVersion version;
+
+                       public MyMessageEncodingElement (MessageVersion version)
+                       {
+                               this.version = version;
+                       }
+
+                       public override BindingElement Clone ()
+                       {
+                               return new MyMessageEncodingElement (version);
+                       }
+                       public override MessageEncoderFactory CreateMessageEncoderFactory ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       public override MessageVersion MessageVersion {
+                               get {
+                                       return version;
+                               }
+                               set {
+                                       throw new NotImplementedException ();
+                               }
+                       }
+               }
+
+               [Test]
+               public void ExportPolicy_CustomEncoding_Soap12 ()
+               {
+                       ConnectionOrientedTransportBindingElement binding_element = new NamedPipeTransportBindingElement ();
+                       IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+                       PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+                       conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12));
+                       export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+                       
+                       PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+                       BindingElementCollection binding_elements = conversion_context.BindingElements;
+                       Assert.AreEqual (0, binding_assertions.Count, "#A0");
+                       Assert.AreEqual (1, binding_elements.Count, "#A1");
+               }
+                       
+               [Test]
+               public void ExportPolicy_CustomEncoding_Soap12August2004 ()
+               {
+                       ConnectionOrientedTransportBindingElement binding_element = new NamedPipeTransportBindingElement ();
+                       IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+                       PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+                       conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12WSAddressingAugust2004));
+                       export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+                       
+                       PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+                       BindingElementCollection binding_elements = conversion_context.BindingElements;
+                       Assert.AreEqual (1, binding_assertions.Count, "#A0");
+                       Assert.AreEqual (1, binding_elements.Count, "#A1");
+
+                       // UsingAddressing
+                       XmlNode using_addressing_node = FindAssertionByLocalName (binding_assertions, "UsingAddressing");
+                       Assert.AreEqual (true, using_addressing_node != null, "#B0");
+                       Assert.AreEqual ("UsingAddressing", using_addressing_node.LocalName, "#B1");
+                       Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/08/addressing/policy", using_addressing_node.NamespaceURI, "#B2");
+                       Assert.AreEqual (String.Empty, using_addressing_node.InnerText, "#B3");
+                       Assert.AreEqual (0, using_addressing_node.Attributes.Count, "#B4");
+                       Assert.AreEqual (0, using_addressing_node.ChildNodes.Count, "#B5");
+               }
        }
 }
 
index 4b9c15e6860870832552a7a554203dc385319d73..ab1f8dd87501c479098ec7f41432263a6bf81a4c 100644 (file)
@@ -84,12 +84,49 @@ namespace MonoTests.System.ServiceModel.Channels
                        Assert.AreEqual (4, cb.CreateBindingElements ().Count, "#9");
                }
 
+               class MessageVersionBindingElement : BindingElement {
+                       public MessageVersion Version {
+                               get;
+                               private set;
+                       }
+                       
+                       public MessageVersionBindingElement (MessageVersion version)
+                       {
+                               this.Version = version;
+                       }
+                       
+                       public override BindingElement Clone ()
+                       {
+                               return new MessageVersionBindingElement (Version);
+                       }
+                       
+                       public override T GetProperty<T> (BindingContext context)
+                       {
+                               if (typeof (T) == typeof (MessageVersion))
+                                       return (T)(object) Version;
+                               return null;
+                       }
+               }
+               
                [Test]
                public void MessageVersionProperty ()
                {
                        Assert.IsNull (new CustomBinding ().MessageVersion, "#1");
                        Assert.AreEqual (MessageVersion.Soap12WSAddressing10, new CustomBinding (new HttpTransportBindingElement ()).MessageVersion, "#2");
                        Assert.AreEqual (MessageVersion.Soap12WSAddressing10, new CustomBinding (new TextMessageEncodingBindingElement ()).MessageVersion, "#3");
+
+                       var versions = new[] {
+                               MessageVersion.Soap11, MessageVersion.Soap11WSAddressing10,
+                               MessageVersion.Soap11WSAddressingAugust2004,
+                               MessageVersion.Soap12, MessageVersion.Soap12WSAddressing10,
+                               MessageVersion.Soap12WSAddressingAugust2004
+                       };
+                       
+                       foreach (var version in versions) {
+                               var binding = new CustomBinding ();
+                               binding.Elements.Add (new MessageVersionBindingElement (version));
+                               Assert.AreEqual (version, binding.MessageVersion, "#4:" + version);
+                       }
                }
 
                [Test]
index 919fd86a67b614a6422a496a3b75ab2931cfb0d6..705d4ed2af1562a41fd76fbc077b41b928f217dc 100644 (file)
@@ -506,6 +506,80 @@ namespace MonoTests.System.ServiceModel.Channels
                        return null;
                }
 
+               XmlNode FindAssertionByLocalName (PolicyAssertionCollection assertionCollection, string name)
+               {
+                       foreach (XmlNode node in assertionCollection)
+                               if (node.LocalName == name)
+                                       return node;
+                       
+                       return null;
+               }
+
+               class MyMessageEncodingElement : MessageEncodingBindingElement {
+                       MessageVersion version;
+                       
+                       public MyMessageEncodingElement (MessageVersion version)
+                       {
+                               this.version = version;
+                       }
+                       
+                       public override BindingElement Clone ()
+                       {
+                               return new MyMessageEncodingElement (version);
+                       }
+                       public override MessageEncoderFactory CreateMessageEncoderFactory ()
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       public override MessageVersion MessageVersion {
+                               get {
+                                       return version;
+                               }
+                               set {
+                                       throw new NotImplementedException ();
+                               }
+                       }
+               }
+               
+               [Test]
+               public void ExportPolicy_CustomEncoding_Soap12 ()
+               {
+                       HttpTransportBindingElement binding_element = new HttpTransportBindingElement ();
+                       IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+                       PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+                       conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12));
+                       export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+                       
+                       PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+                       BindingElementCollection binding_elements = conversion_context.BindingElements;
+                       Assert.AreEqual (0, binding_assertions.Count, "#A0");
+                       Assert.AreEqual (1, binding_elements.Count, "#A1");
+               }
+               
+               [Test]
+               public void ExportPolicy_CustomEncoding_Soap12August2004 ()
+               {
+                       HttpTransportBindingElement binding_element = new HttpTransportBindingElement ();
+                       IPolicyExportExtension export_extension = binding_element as IPolicyExportExtension;
+                       PolicyConversionContext conversion_context = new CustomPolicyConversionContext ();
+                       conversion_context.BindingElements.Add (new MyMessageEncodingElement (MessageVersion.Soap12WSAddressingAugust2004));
+                       export_extension.ExportPolicy (new WsdlExporter (), conversion_context);
+                       
+                       PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions ();
+                       BindingElementCollection binding_elements = conversion_context.BindingElements;
+                       Assert.AreEqual (1, binding_assertions.Count, "#A0");
+                       Assert.AreEqual (1, binding_elements.Count, "#A1");
+                       
+                       // UsingAddressing
+                       XmlNode using_addressing_node = FindAssertionByLocalName (binding_assertions, "UsingAddressing");
+                       Assert.AreEqual (true, using_addressing_node != null, "#B0");
+                       Assert.AreEqual ("UsingAddressing", using_addressing_node.LocalName, "#B1");
+                       Assert.AreEqual ("http://schemas.xmlsoap.org/ws/2004/08/addressing/policy", using_addressing_node.NamespaceURI, "#B2");
+                       Assert.AreEqual (String.Empty, using_addressing_node.InnerText, "#B3");
+                       Assert.AreEqual (0, using_addressing_node.Attributes.Count, "#B4");
+                       Assert.AreEqual (0, using_addressing_node.ChildNodes.Count, "#B5");
+               }
+
                #endregion
     }
 }
index 24630a2826307df14d71e7f7d7fce1debea457c7..cf2289e4d7d11a70bc3331cd41096437c1783776 100644 (file)
@@ -236,26 +236,6 @@ namespace MonoTests.System.ServiceModel.Description
                        Assert.AreEqual (name, ((XmlElement) o).Name);
                }
 
-               [Test]
-               public void BindingsTest ()
-               {
-                       NoExtensionsSetup ();
-                       IEnumerable<SMBinding> bindings = wi.ImportAllBindings ();
-
-                       int count = 0;
-                       foreach (SMBinding b in bindings) {
-                               Assert.AreEqual (typeof (CustomBinding), b.GetType (), "#B1");
-                               Assert.AreEqual ("BasicHttpBinding_IEchoService", b.Name, "#B2");
-                               Assert.AreEqual ("http://tempuri.org/", b.Namespace, "#B3");
-                               Assert.AreEqual ("", b.Scheme, "#B4");
-
-                               //FIXME: Test BindingElements
-
-                               count++;
-                       }
-                       Assert.AreEqual (1, count);
-               }
-
                [Test]
                [Category ("NotWorking")]
                public void ContractsTest ()
@@ -586,7 +566,7 @@ namespace MonoTests.System.ServiceModel.Description
                        var mset = new MetadataSet ();
                        WSServiceDescription sd = null;
 
-                       sd = WSServiceDescription.Read (XmlReader.Create ("670945.wsdl"));
+                       sd = WSServiceDescription.Read (XmlReader.Create ("Test/XmlFiles/670945.wsdl"));
                        mset.MetadataSections.Add (new MetadataSection () {
                                Dialect = MetadataSection.ServiceDescriptionDialect,
                                Metadata = sd });
index 374ee6b427900363917beccbfe7dd37045576364..700c289f4746f80491c3b01215fca8b0787b930e 100644 (file)
@@ -1 +1,10 @@
 #include net_4_0_System.ServiceModel.dll.sources
+System.ServiceModel/HttpBindingBase.cs
+System.ServiceModel/BasicHttpBinding_4_5.cs
+System.ServiceModel/BasicHttpsBinding.cs
+System.ServiceModel/BasicHttpsSecurity.cs
+System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs
+System.ServiceModel.Configuration/HttpBindingBaseElement.cs
+System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
+System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
+System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
index 66e99f2610616786a64eb56b06cf1a35646b2e95..22feb8530d7193050ee835f034ae9af5dd08beab 100644 (file)
@@ -127,7 +127,7 @@ namespace System.Web
                }
 
                public override HttpSessionStateBase Session {
-                       get { return new HttpSessionStateWrapper (w.Session); }
+                       get { return w.Session == null ? null : new HttpSessionStateWrapper (w.Session); }
                }
 
                public override bool SkipAuthorization {
index 9f693753f556e21891bae1f0a5eca558972d55fb..46bef52a7b4f64906830397780935780134ab0f5 100644 (file)
@@ -2,9 +2,10 @@
 // JsonDeserializer.cs
 //
 // Author:
-//   Marek Habersack <mhabersack@novell.com>
+//   Marek Habersack <grendel@twistedcode.net>
 //
 // (C) 2008 Novell, Inc.  http://novell.com/
+// Copyright 2011, Xamarin, Inc (http://xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 // Code is based on JSON_checker (http://www.json.org/JSON_checker/) and JSON_parser
-// (http://fara.cs.uni-potsdam.de/~jsg/json_parser/) C sources. License for the original code
-// follows:
-
-#region Original License
-/*
-Copyright (c) 2005 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-#endregion
+// (http://fara.cs.uni-potsdam.de/~jsg/json_parser/) C sources.
 
 using System;
 using System.Collections;
index f12ec329484b73f80fc105e8a479767e150382ae..b8e4d604ed241e9abf596c2d073557b46683d741 100644 (file)
@@ -68,12 +68,24 @@ namespace System.Web.Routing
                        if (values == null)
                                throw new ArgumentNullException ("values");
 
-                       foreach (string allowed in AllowedMethods)
+                       switch (routeDirection) {
+                       case RouteDirection.IncomingRequest:
                                // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
-                               if (httpContext.Request.HttpMethod == allowed)
+                               return AllowedMethods.Contains (httpContext.Request.HttpMethod);
+
+                       case RouteDirection.UrlGeneration:
+                               // See: aspnetwebstack's WebAPI equivalent for details.
+                               object method;
+
+                               if (!values.TryGetValue (parameterName, out method))
                                        return true;
 
-                       return false;
+                               // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
+                               return AllowedMethods.Contains (Convert.ToString (method));
+
+                       default:
+                               throw new ArgumentException ("Invalid routeDirection: " + routeDirection);
+                       }
                }
        }
 }
index 4571bc754a886c38d70ee3202c10af62519e6ee3..aacc322bf343b6b3260ad12850f1679f55a9c092 100644 (file)
@@ -352,6 +352,10 @@ namespace System.Web.Routing
                                        if (tokens.Count != 1)
                                                return null;
 
+                                       // if token is catch-all, we're done.
+                                       if (tokens [0].Type == PatternTokenType.CatchAll)
+                                               break;
+
                                        if (!defaults.ContainsKey (tokens [0].Name))
                                                return null;
                                }
@@ -361,11 +365,12 @@ namespace System.Web.Routing
                        return AddDefaults (ret, defaults);
                }
                
-               public bool BuildUrl (Route route, RequestContext requestContext, RouteValueDictionary userValues, out string value)
+               public string BuildUrl (Route route, RequestContext requestContext, RouteValueDictionary userValues, RouteValueDictionary constraints, out RouteValueDictionary usedValues)
                {
-                       value = null;
+                       usedValues = null;
+
                        if (requestContext == null)
-                               return false;
+                               return null;
 
                        RouteData routeData = requestContext.RouteData;
                        RouteValueDictionary defaultValues = route != null ? route.Defaults : null;
@@ -407,10 +412,10 @@ namespace System.Web.Routing
                                        // Has the user provided value for it?
                                        if (userValues == null || !userValues.ContainsKey (parameterName)) {
                                                if (allMustBeInUserValues)
-                                                       return false; // partial override => no match
+                                                       return null; // partial override => no match
                                                
                                                if (!canTakeFromAmbient || ambientValues == null || !ambientValues.ContainsKey (parameterName))
-                                                       return false; // no value provided => no match
+                                                       return null; // no value provided => no match
                                        } else if (canTakeFromAmbient)
                                                allMustBeInUserValues = true;
                                }
@@ -431,28 +436,16 @@ namespace System.Web.Routing
                                                object defaultValue = de.Value;
                                                if (defaultValue is string && parameterValue is string) {
                                                        if (String.Compare ((string)defaultValue, (string)parameterValue, StringComparison.Ordinal) != 0)
-                                                               return false; // different value => no match
+                                                               return null; // different value => no match
                                                } else if (defaultValue != parameterValue)
-                                                       return false; // different value => no match
+                                                       return null; // different value => no match
                                        }
                                }
                        }
 
-                       // Check the constraints
-                       RouteValueDictionary constraints = route != null ? route.Constraints : null;
-                       if (constraints != null && constraints.Count > 0) {
-                               HttpContextBase context = requestContext.HttpContext;
-                               bool invalidConstraint;
-                               
-                               foreach (var de in constraints) {
-                                       if (!Route.ProcessConstraintInternal (context, route, de.Value, de.Key, userValues, RouteDirection.UrlGeneration, requestContext, out invalidConstraint) ||
-                                           invalidConstraint)
-                                               return false; // constraint not met => no match
-                               }
-                       }
-
                        // We're a match, generate the URL
                        var ret = new StringBuilder ();
+                       usedValues = new RouteValueDictionary ();
                        bool canTrim = true;
                        
                        // Going in reverse order, so that we can trim without much ado
@@ -475,6 +468,9 @@ namespace System.Web.Routing
 
 #if SYSTEMCORE_DEP
                                if (userValues.GetValue (parameterName, out tokenValue)) {
+                                       if (tokenValue != null)
+                                               usedValues.Add (parameterName, tokenValue.ToString ());
+
                                        if (!defaultValues.Has (parameterName, tokenValue)) {
                                                canTrim = false;
                                                if (tokenValue != null)
@@ -484,6 +480,7 @@ namespace System.Web.Routing
 
                                        if (!canTrim && tokenValue != null)
                                                ret.Insert (0, tokenValue.ToString ());
+
                                        continue;
                                }
 
@@ -491,16 +488,21 @@ namespace System.Web.Routing
                                        object ambientTokenValue;
                                        if (ambientValues.GetValue (parameterName, out ambientTokenValue))
                                                tokenValue = ambientTokenValue;
-                                       
+
                                        if (!canTrim && tokenValue != null)
                                                ret.Insert (0, tokenValue.ToString ());
+
+                                       usedValues.Add (parameterName, tokenValue.ToString ());
                                        continue;
                                }
 
                                canTrim = false;
                                if (ambientValues.GetValue (parameterName, out tokenValue)) {
                                        if (tokenValue != null)
+                                       {
                                                ret.Insert (0, tokenValue.ToString ());
+                                               usedValues.Add (parameterName, tokenValue.ToString ());
+                                       }
                                        continue;
                                }
 #endif
@@ -538,11 +540,12 @@ namespace System.Web.Routing
                                        ret.Append ('=');
                                        if (parameterValue != null)
                                                ret.Append (Uri.EscapeDataString (de.Value.ToString ()));
+
+                                       usedValues.Add (parameterName, de.Value.ToString ());
                                }
                        }
                        
-                       value = ret.ToString ();
-                       return true;
+                       return ret.ToString ();
                }
        }
 }
index 1a7ce99e8333b1e0fa7174ad071cf99ba2920bf0..32b0ba9705a080ee98cf0a91f65e00a1e024543d 100644 (file)
@@ -102,11 +102,8 @@ namespace System.Web.Routing
                        if (values == null)
                                return null;
 
-                       RouteValueDictionary constraints = Constraints;
-                       if (constraints != null)
-                               foreach (var p in constraints)
-                                       if (!ProcessConstraint (httpContext, p.Value, p.Key, values, RouteDirection.IncomingRequest))
-                                               return null;
+                       if (!ProcessConstraints (httpContext, values, RouteDirection.IncomingRequest))
+                               return null;
                        
                        var rd = new RouteData (this, RouteHandler);
                        RouteValueDictionary rdValues = rd.Values;
@@ -135,14 +132,27 @@ namespace System.Web.Routing
                        // if (values == null)
                        //      values = requestContext.RouteData.Values;
 
-                       string s;
-                       if (!url.BuildUrl (this, requestContext, values, out s))
+                       RouteValueDictionary usedValues;
+                       string resultUrl = url.BuildUrl (this, requestContext, values, Constraints, out usedValues);
+
+                       if (resultUrl == null)
+                               return null;
+
+                       if (!ProcessConstraints (requestContext.HttpContext, usedValues, RouteDirection.UrlGeneration))
                                return null;
 
-                       return new VirtualPathData (this, s);
+                       var result = new VirtualPathData (this, resultUrl);
+
+                       RouteValueDictionary dataTokens = DataTokens;
+                       if (dataTokens != null) {
+                               foreach (var item in dataTokens)
+                                       result.DataTokens[item.Key] = item.Value;
+                       }
+
+                       return result;
                }
 
-               internal static bool ProcessConstraintInternal (HttpContextBase httpContext, Route route, object constraint, string parameterName,
+               private bool ProcessConstraintInternal (HttpContextBase httpContext, Route route, object constraint, string parameterName,
                                                                RouteValueDictionary values, RouteDirection routeDirection, RequestContext reqContext,
                                                                out bool invalidConstraint)
                {
@@ -203,7 +213,7 @@ namespace System.Web.Routing
                                        constraint += "$";
                        }
 
-                       return Regex.Match (value, constraint).Success;
+                       return Regex.IsMatch (value, constraint, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled);
                }
                
                protected virtual bool ProcessConstraint (HttpContextBase httpContext, object constraint, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
@@ -234,6 +244,20 @@ namespace System.Web.Routing
 
                        return ret;
                }
+
+               private bool ProcessConstraints (HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection)
+               {
+                       var constraints = Constraints;
+
+                       if (Constraints != null) {
+                               foreach (var p in constraints)
+                                       if (!ProcessConstraint (httpContext, p.Value, p.Key, values, routeDirection))
+                                               return false;
+                       }
+
+                       return true;
+               }
+
 #if NET_4_0
                RequestContext SafeGetContext (HttpRequestBase req)
                {
index 44f12551055ca61f3c782ce86f25ae2dd3a1eee7..85a4273f7b8a5f802ab6be2710ebc365c5e5fbd3 100644 (file)
@@ -99,7 +99,7 @@ namespace MonoTests.System.Web.Routing
                public void Match ()
                {
                        var c = new MyHttpMethodConstraint (new string [0]);
-                       Assert.IsFalse (c.CallMatch (new HttpContextStub (), new Route (null, null), "foo", new RouteValueDictionary (), RouteDirection.IncomingRequest));
+                       Assert.IsFalse (c.CallMatch (new HttpContextStub (""), new Route (null, null), "foo", new RouteValueDictionary (), RouteDirection.IncomingRequest));
                }
 
                [Test]
@@ -121,5 +121,18 @@ namespace MonoTests.System.Web.Routing
                        // LAMESPEC: .NET allows case-insensitive comparison, which violates RFC 2616
                        // Assert.IsFalse (c.CallMatch (new HttpContextStub ("", "", "get"), new Route (null, null), "", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#4");
                }
+
+               [Test]
+               public void UrlGeneration ()
+               {
+                       var c = new HttpMethodConstraint (new string[] { "GET" }) as IRouteConstraint;
+                       var req = new HttpContextStub ("", "", "HEAD");
+
+                       var values = new RouteValueDictionary () { { "httpMethod", "GET" } };
+                       Assert.IsTrue (c.Match (req, new Route (null, null), "httpMethod", values, RouteDirection.UrlGeneration), "#1");
+
+                       values = new RouteValueDictionary() { { "httpMethod", "POST" } };
+                       Assert.IsFalse (c.Match (req, new Route (null, null), "httpMethod", values, RouteDirection.UrlGeneration), "#2");
+               }
        }
 }
index 5310aafbbf1067b2cd029be90a3f731538039ac6..18b52ea11ba3e77e607c455a04e753e395eb9dc3 100644 (file)
@@ -537,6 +537,63 @@ namespace MonoTests.System.Web.Routing
                        Assert.IsNull (vp, "#C1");
                }
 
+               [Test]
+               public void GetVirtualPath8 ()
+               {
+                       var routes = new RouteCollection();
+
+                       routes.Add (new MyRoute ("login", new MyRouteHandler ()) {
+                               Defaults = new RouteValueDictionary (new { controller = "Home", action = "LogOn" })
+                       });
+
+                       routes.Add (new MyRoute ("{site}/{controller}/{action}", new MyRouteHandler ()) {
+                               Defaults = new RouteValueDictionary (new { site = "_", controller = "Home", action = "Index" }),
+                               Constraints = new RouteValueDictionary ( new { site = "_?[0-9A-Za-z-]*" })
+                       });
+
+                       routes.Add (new MyRoute ("{*path}", new MyRouteHandler ()) {
+                               Defaults = new RouteValueDictionary (new { controller = "Error", action = "NotFound" }),
+                       });
+
+                       var hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+                       hc.SetResponse (new HttpResponseStub (3));
+                       var rd = routes.GetRouteData (hc);
+                       var rvs = new RouteValueDictionary () {
+                               { "controller", "Home" },
+                               { "action" , "Index" }
+                       };
+                       var vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+                       Assert.IsNotNull (vpd, "#A1");
+                       Assert.AreEqual ("/", vpd.VirtualPath, "#A2");
+                       Assert.AreEqual (0, vpd.DataTokens.Count, "#A3");
+
+                       hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+                       hc.SetResponse (new HttpResponseStub (3));
+                       rd = routes.GetRouteData (hc);
+                       rvs = new RouteValueDictionary () {
+                               { "controller", "Home" }
+                       };
+                       vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+                       Assert.IsNotNull (vpd, "#B1");
+                       Assert.AreEqual ("/login", vpd.VirtualPath, "#B2");
+                       Assert.AreEqual (0, vpd.DataTokens.Count, "#B3");
+
+                       hc = new HttpContextStub2 ("~/login", String.Empty, String.Empty);
+                       hc.SetResponse (new HttpResponseStub (3));
+                       rd = routes.GetRouteData (hc);
+                       rvs = new RouteValueDictionary () {
+                               { "action" , "Index" }
+                       };
+                       vpd = routes.GetVirtualPath (new RequestContext (hc, rd), rvs);
+                       Assert.IsNotNull (vpd, "#C1");
+                       Assert.AreEqual ("/", vpd.VirtualPath, "#C2");
+                       Assert.AreEqual (0, vpd.DataTokens.Count, "#C3");
+
+                       hc = new HttpContextStub2 ("~/", String.Empty, String.Empty);
+                       rd = routes.GetRouteData (hc);
+                       Assert.IsNotNull (rd, "#D1");
+               }
+
                [Test]
                [Ignore ("looks like RouteExistingFiles ( = false) does not affect... so this test needs more investigation")]
                public void GetVirtualPathToExistingFile ()
index a2852749c1a6a1a406841950510db48528b435b7..ab9765ea6a4c07630c0e7fe194ec84646b2524f7 100644 (file)
@@ -974,12 +974,68 @@ namespace MonoTests.System.Web.Routing
                                })
                        };
                        
-                       var hc = new HttpContextStub ("/Foo/x123", String.Empty);
+                       var hc = new HttpContextStub ("~/Foo/x123", String.Empty);
                        var rd = r.GetRouteData (hc);
 
                        Assert.IsNull (rd, "#1");
                }
-               
+
+               [Test]
+               public void GetRouteDataWithCatchAll ()
+               {
+                       var r = new Route ("{*path}", new StopRoutingHandler ()) {
+                               Defaults = new RouteValueDictionary (new {
+                                       controller = "Error",
+                                       action = "NotFound"
+                               })
+                       };
+
+                       var hc = new HttpContextStub ("~/", String.Empty);
+                       var rd = r.GetRouteData (hc);
+
+                       Assert.IsNotNull (rd, "#1");
+
+                       hc = new HttpContextStub ("~/Foo/x123", String.Empty);
+                       rd = r.GetRouteData (hc);
+
+                       Assert.IsNotNull (rd, "#2");
+               }
+
+               [Test]
+               public void GetRouteDataWithCatchAll2 ()
+               {
+                       var r = new Route ("something/{*path}", new StopRoutingHandler ()) {
+                               Defaults = new RouteValueDictionary (new {
+                                       controller = "Error",
+                                       action = "NotFound"
+                               })
+                       };
+
+                       var hc = new HttpContextStub ("~/", String.Empty);
+                       var rd = r.GetRouteData (hc);
+
+                       Assert.IsNull (rd, "#1");
+
+                       hc = new HttpContextStub ("~/something", String.Empty);
+                       rd = r.GetRouteData (hc);
+
+                       Assert.IsNotNull (rd, "#2");
+                       Assert.IsNull (rd.Values["path"], "#2.1");
+
+                       hc = new HttpContextStub ("~/something/", String.Empty);
+                       rd = r.GetRouteData (hc);
+
+                       Assert.IsNotNull (rd, "#3");
+                       Assert.IsNull (rd.Values["path"], "#3.1");
+
+                       hc = new HttpContextStub ("~/something/algo", String.Empty);
+                       rd = r.GetRouteData (hc);
+
+                       Assert.IsNotNull (rd, "#4");
+                       Assert.AreEqual ("algo", rd.Values["path"], "#4.1");
+
+               }
+
                [Test]
                [ExpectedException (typeof (ArgumentNullException))]
                public void GetVirtualPathNullContext ()
index e2cb34bcc0e81b127b7f2393929391a7b4fc0774..ddda8757888cd472296fa40f7c1e3ed562796f38 100644 (file)
@@ -35,7 +35,7 @@ using System.Collections.Generic;
 using System.Configuration;
 using System.IO;
 using System.Text;
-#if NET_4_0
+#if NET_4_0 && !MOBILE
 using System.Web.Configuration;
 #endif
 
@@ -188,6 +188,9 @@ namespace System.Web.Util
 
                static HttpEncoder GetCustomEncoderFromConfig ()
                {
+#if MOBILE
+                       return defaultEncoder.Value;
+#else
                        var cfg = HttpRuntime.Section;
                        string typeName = cfg.EncoderType;
 
@@ -204,6 +207,7 @@ namespace System.Web.Util
                                );
 
                        return Activator.CreateInstance (t, false) as HttpEncoder;
+#endif
                }
 #endif
 #if NET_4_0
index e05ae9761bb67a2222c1bb02d7aafa56b4f63d46..bb821a573cfc29f7bc7d0ba0ec1e224ceb956df2 100644 (file)
@@ -552,10 +552,12 @@ namespace System.Web {
                        if (value == null)
                                return null;
 
+#if !MOBILE
                        IHtmlString htmlString = value as IHtmlString;
                        if (htmlString != null)
                                return htmlString.ToHtmlString ();
-                       
+#endif
+
                        return HtmlEncode (value.ToString ());
                }
 
index e9888f114846eb2810678365ab9a6c7fb75419d6..63c87fe7df4cecba306a7d7042e963b475294e2a 100644 (file)
@@ -247,7 +247,8 @@ namespace System.Xml.Serialization {
 
                XmlTypeMapping CreateTypeMapping (TypeData typeData, XmlRootAttribute root, string defaultXmlType, string defaultNamespace)
                {
-                       string rootNamespace = defaultNamespace;
+                       bool hasTypeNamespace = !string.IsNullOrEmpty (defaultNamespace);
+                       string rootNamespace = null;
                        string typeNamespace = null;
                        string elementName;
                        bool includeInSchema = true;
@@ -273,8 +274,10 @@ namespace System.Xml.Serialization {
 
                        if (atts.XmlType != null)
                        {
-                               if (atts.XmlType.Namespace != null)
+                               if (atts.XmlType.Namespace != null) {
                                        typeNamespace = atts.XmlType.Namespace;
+                                       hasTypeNamespace = true;
+                               }
 
                                if (atts.XmlType.TypeName != null && atts.XmlType.TypeName != string.Empty)
                                        defaultXmlType = XmlConvert.EncodeLocalName (atts.XmlType.TypeName);
@@ -288,13 +291,15 @@ namespace System.Xml.Serialization {
                        {
                                if (root.ElementName.Length != 0)
                                        elementName = XmlConvert.EncodeLocalName(root.ElementName);
-                               if (root.Namespace != null)
+                               if (root.Namespace != null) {
                                        rootNamespace = root.Namespace;
+                                       hasTypeNamespace = true;
+                               }
                                nullable = root.IsNullable;
                        }
 
-                       if (rootNamespace == null) rootNamespace = "";
-                       if (typeNamespace == null) typeNamespace = rootNamespace;
+                       rootNamespace = rootNamespace ?? defaultNamespace ?? string.Empty;
+                       typeNamespace = typeNamespace ?? rootNamespace;
                        
                        XmlTypeMapping map;
                        switch (typeData.SchemaType) {
@@ -310,7 +315,7 @@ namespace System.Xml.Serialization {
                                                        typeData, defaultXmlType, typeNamespace);
                                        break;
                                default:
-                                       map = new XmlTypeMapping (elementName, rootNamespace, typeData, defaultXmlType, typeNamespace);
+                                       map = new XmlTypeMapping (elementName, rootNamespace, typeData, defaultXmlType, hasTypeNamespace ? typeNamespace : null);
                                        break;
                        }
 
@@ -368,7 +373,8 @@ namespace System.Xml.Serialization {
                                if (rmember.XmlAttributes.XmlIgnore) continue;
                                if (rmember.DeclaringType != null && rmember.DeclaringType != type) {
                                        XmlTypeMapping bmap = ImportClassMapping (rmember.DeclaringType, root, defaultNamespace);
-                                       ns = bmap.XmlTypeNamespace;
+                                       if (bmap.HasXmlTypeNamespace)
+                                               ns = bmap.XmlTypeNamespace;
                                }
 
                                try {
index c23c5dd16c8994e894fe9813e1ae606a18dbd634..2b0f8bd829d2768ed76993523618639fae3e1f0c 100644 (file)
@@ -107,10 +107,15 @@ namespace System.Xml.Serialization
 
                internal string XmlTypeNamespace
                {
-                       get { return xmlTypeNamespace; }
+                       get { return xmlTypeNamespace ?? string.Empty; }
                        set { xmlTypeNamespace = value; }
                }
 
+               internal bool HasXmlTypeNamespace
+               {
+                       get { return xmlTypeNamespace != null; }
+               }
+
                internal ArrayList DerivedTypes
                {
                        get { return _derivedTypes; }
@@ -170,9 +175,9 @@ namespace System.Xml.Serialization
 
                internal XmlTypeMapping GetRealElementMap (string name, string ens)
                {
-                       if (xmlType == name && xmlTypeNamespace == ens) return this;
+                       if (xmlType == name && XmlTypeNamespace == ens) return this;
                        foreach (XmlTypeMapping map in _derivedTypes)
-                               if (map.xmlType == name && map.xmlTypeNamespace == ens) return map;
+                               if (map.xmlType == name && map.XmlTypeNamespace == ens) return map;
                        
                        return null;
                }
index 459620cb13f8ee748e29c6b87d3aa3c5b2b3c983..362d61fbcf7f260015744fae20312ef274242da6 100644 (file)
@@ -1621,5 +1621,48 @@ namespace MonoTests.System.XmlSerialization
                                Assert.IsNull(foobar.Baz);
                        }
                }
+
+               [Test] // bug #8468
+               public void TestUseSubclassDefaultNamespace ()
+               {
+                       XmlSerializer xs = new XmlSerializer (typeof (Bug8468Subclass));
+                       string msg = "<Test xmlns=\"http://test-namespace\"><Base>BaseValue</Base><Mid>MidValue</Mid></Test>";
+                       var res1 = (Bug8468Subclass)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res1);
+                       Assert.AreEqual ("BaseValue", res1.Base);
+                       Assert.AreEqual ("MidValue", res1.Mid);
+
+                       xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespace), "http://test-namespace");
+                       var res2 = (Bug8468SubclassNoNamespace)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res2);
+                       Assert.AreEqual ("BaseValue", res2.Base);
+                       Assert.AreEqual ("MidValue", res2.Mid);
+
+                       xs = new XmlSerializer (typeof (Bug8468SubclassV2));
+                       var res3 = (Bug8468SubclassV2)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res3);
+                       Assert.IsNull (res3.Base);
+                       Assert.AreEqual ("MidValue", res3.Mid);
+
+                       xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespaceV2), "http://test-namespace");
+                       var res4 = (Bug8468SubclassNoNamespaceV2)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res4);
+                       Assert.IsNull (res4.Base);
+                       Assert.AreEqual ("MidValue", res4.Mid);
+
+                       msg = "<Test xmlns=\"http://test-namespace\"><Base xmlns=\"\">BaseValue</Base><Mid>MidValue</Mid></Test>";
+
+                       xs = new XmlSerializer (typeof (Bug8468SubclassV2));
+                       var res5 = (Bug8468SubclassV2)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res5);
+                       Assert.AreEqual ("BaseValue", res5.Base);
+                       Assert.AreEqual ("MidValue", res5.Mid);
+
+                       xs = new XmlSerializer (typeof (Bug8468SubclassNoNamespaceV2), "http://test-namespace");
+                       var res6 = (Bug8468SubclassNoNamespaceV2)xs.Deserialize (new StringReader (msg));
+                       Assert.IsNotNull (res6);
+                       Assert.AreEqual ("BaseValue", res6.Base);
+                       Assert.AreEqual ("MidValue", res6.Mid); 
+               }
        }
 }
index 955a8e3f7cb12f20d34d8afeb3ecd968cd0ddab0..006202d5860953f26af003dddd1a8c2a6859dc9b 100644 (file)
@@ -1053,5 +1053,46 @@ namespace MonoTests.System.Xml.TestClasses
                [XmlElementAttribute (DataType = "date")]
                public DateTime SomeDate;
        }
+
+       public class Bug8468BaseClass
+       {
+               public string Base;
+       }
+
+       public class Bug8468MidClass: Bug8468BaseClass
+       {
+               public string Mid;
+       }
+
+       [XmlRoot("Test", Namespace="http://test-namespace")]
+       public class Bug8468Subclass: Bug8468MidClass
+       {
+       }
+
+       [XmlRoot("Test")]
+       public class Bug8468SubclassNoNamespace: Bug8468MidClass
+       {
+       }
+
+       [XmlRoot("Test", Namespace="")]
+       public class Bug8468BaseClassV2
+       {
+               public string Base;
+       }
+
+       public class Bug8468MidClassV2: Bug8468BaseClassV2
+       {
+               public string Mid;
+       }
+
+       [XmlRoot("Test", Namespace="http://test-namespace")]
+       public class Bug8468SubclassV2: Bug8468MidClassV2
+       {
+       }
+
+       [XmlRoot("Test")]
+       public class Bug8468SubclassNoNamespaceV2: Bug8468MidClassV2
+       {
+       }
 }
 
diff --git a/mcs/class/System/Documentation/en/System.Threading/SemaphoreFullException.xml b/mcs/class/System/Documentation/en/System.Threading/SemaphoreFullException.xml
deleted file mode 100644 (file)
index 0da2482..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<Type Name="SemaphoreFullException" FullName="System.Threading.SemaphoreFullException">
-  <TypeSignature Language="C#" Value="public class SemaphoreFullException : SystemException" />
-  <AssemblyInfo>
-    <AssemblyName>System</AssemblyName>
-    <AssemblyVersion>2.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.SystemException</BaseTypeName>
-  </Base>
-  <Interfaces />
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-    <since version=".NET 2.0" />
-  </Docs>
-  <Members>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public SemaphoreFullException ();" />
-      <MemberType>Constructor</MemberType>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-        <since version=".NET 2.0" />
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public SemaphoreFullException (string message);" />
-      <MemberType>Constructor</MemberType>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-        <since version=".NET 2.0" />
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="protected SemaphoreFullException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
-      <MemberType>Constructor</MemberType>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="context">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-        <since version=".NET 2.0" />
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public SemaphoreFullException (string message, Exception innerException);" />
-      <MemberType>Constructor</MemberType>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-        <Parameter Name="innerException" Type="System.Exception" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <param name="innerException">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-        <since version=".NET 2.0" />
-      </Docs>
-      <AssemblyInfo>
-        <AssemblyVersion>2.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-    </Member>
-  </Members>
-</Type>
index 716beaaa851b95ecc463ed2127e4741a8727ba7c..26039bdd79b3de87fccd138b2345b4f809967f16 100644 (file)
@@ -381,8 +381,10 @@ namespace Mono.CSharp
                                                break;
                                }
                        }
-                       
-#if NET_4_0
+
+#if NET_4_5                    
+                       args.Append("/sdk:4.5");
+#elif NET_4_0
                        args.Append("/sdk:4");
 #else
                        args.Append("/sdk:2");
index 07f0fbc1e6ad6467cded948ac9bb220e27ef7990..f1b678827f2364df9b50f190738eb3d53bef26d0 100644 (file)
@@ -76,6 +76,7 @@ namespace Mono.Http
                                Type1Message type1 = new Type1Message ();
                                type1.Domain = domain;
                                type1.Host = ""; // MS does not send it
+                               type1.Flags |= NtlmFlags.NegotiateNtlm2Key;
                                message = type1;
                        } else if (message.Type == 1) {
                                // Should I check the credentials?
@@ -88,11 +89,8 @@ namespace Mono.Http
                                if (password == null)
                                        password = "";
 
-                               Type3Message type3 = new Type3Message ();
-                               type3.Domain = domain;
-                               // type3.Host = ""; MS sends the machine name for type 3 packets
+                               Type3Message type3 = new Type3Message (type2);
                                type3.Username = userName;
-                               type3.Challenge = type2.Nonce;
                                type3.Password = password;
                                message = type3;
                                completed = true;
index e5fb5ad7f59eff5bb9778826056e2e21b312a860..b72c5eabc9d0b18d8a487e8cec6804128231f2da 100644 (file)
@@ -23,7 +23,7 @@
 //
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Threading;
index 5998c061ab0302690b8f07f5328a0919759de805..233662a8d7701ce90e49416083f9add271a4fe05 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 using System;
 using System.Collections;
 using System.Collections.Generic;
index 61183792a5be9df7be1328782c5bab6b6eb0432a..ec30f9d783722ce5866c99e1bc1e5d6f3ca7eefb 100644 (file)
@@ -25,7 +25,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-#if NET_2_1 || NET_4_0
+#if NET_2_1 || MOBILE || NET_4_0
 
 namespace System.Collections.Generic {
        public interface ISet<T> : ICollection<T>
index 79b3308feb693aeaeab14417707b5863bc5ae35c..5b88dfd5af51da609e032a4cf1d63d15b0333ec3 100644 (file)
@@ -84,8 +84,7 @@ namespace System.Configuration {
 #if (CONFIGURATION_DEP)
                        foreach (SettingsProvider provider in Providers) {
                                IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider;
-                               if (iasp != null)
-                                       iasp.Reset (Context);
+                               CacheValuesByProvider(provider);
                        }
 #endif
                }
@@ -93,14 +92,9 @@ namespace System.Configuration {
                public void Reset()
                {
 #if (CONFIGURATION_DEP)
-                       // Code bellow is identical to code in Reload().
-                       // foreach (SettingsProvider provider in Providers) {
-                       //         IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider;
-                       //         if (iasp != null)
-                       //              iasp.Reset (Context);
-                       // }
-                                                
                        Reload ();
+                       foreach (SettingsPropertyValue pv in PropertyValues)
+                               pv.PropertyValue = pv.Reset();
 #endif
                }
 
@@ -190,7 +184,12 @@ namespace System.Configuration {
 
                        if (col.Count > 0) {
                                SettingsPropertyValueCollection vals = provider.GetPropertyValues (Context, col);
-                               PropertyValues.Add (vals);
+                               foreach (SettingsPropertyValue prop in vals) {
+                                       if (PropertyValues [prop.Name] != null)
+                                               PropertyValues [prop.Name].PropertyValue = prop.PropertyValue;
+                                       else
+                                               PropertyValues.Add (prop);
+                               }
                        }
 
                        OnSettingsLoaded (this, new SettingsLoadedEventArgs (provider));
index 7d70eefabbc52486c9d53f816ccd82989cc8d6f9..2ee1c984503043efa9079fc3616568c093c17033 100644 (file)
@@ -615,47 +615,49 @@ namespace System.Configuration
                        if (userGroup == null) {
                                userGroup = new UserSettingsGroup ();
                                config.SectionGroups.Add ("userSettings", userGroup);
-                               ApplicationSettingsBase asb = context.CurrentSettings;
-                               ClientSettingsSection cs = new ClientSettingsSection ();
-                               string class_name = NormalizeInvalidXmlChars ((asb != null ? asb.GetType () : typeof (ApplicationSettingsBase)).FullName);
-                               userGroup.Sections.Add (class_name, cs);
+                       }
+                       ApplicationSettingsBase asb = context.CurrentSettings;
+                       string class_name = NormalizeInvalidXmlChars ((asb != null ? asb.GetType () : typeof (ApplicationSettingsBase)).FullName);
+                       ClientSettingsSection userSection = null;
+                       ConfigurationSection cnf = userGroup.Sections.Get (class_name);
+                       userSection = cnf as ClientSettingsSection;
+                       if (userSection == null) {
+                               userSection = new ClientSettingsSection ();
+                               userGroup.Sections.Add (class_name, userSection);
                        }
 
                        bool hasChanges = false;
 
-                       foreach (ConfigurationSection section in userGroup.Sections) {
-                               ClientSettingsSection userSection = section as ClientSettingsSection;
-                               if (userSection == null)
-                                       continue;
+                       if (userSection == null)
+                               return;
 
-                               foreach (SettingsPropertyValue value in collection) {
-                                       if (checkUserLevel && value.Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
-                                               continue;
-                                       // The default impl does not save the ApplicationScopedSetting properties
-                                       if (value.Property.Attributes.Contains (typeof (ApplicationScopedSettingAttribute)))
-                                               continue;
+                       foreach (SettingsPropertyValue value in collection) {
+                               if (checkUserLevel && value.Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
+                                       continue;
+                               // The default impl does not save the ApplicationScopedSetting properties
+                               if (value.Property.Attributes.Contains (typeof (ApplicationScopedSettingAttribute)))
+                                       continue;
 
-                                       hasChanges = true;
-                                       SettingElement element = userSection.Settings.Get (value.Name);
-                                       if (element == null) {
-                                               element = new SettingElement (value.Name, value.Property.SerializeAs);
-                                               userSection.Settings.Add (element);
-                                       }
-                                       if (element.Value.ValueXml == null)
-                                               element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
-                                       switch (value.Property.SerializeAs) {
-                                       case SettingsSerializeAs.Xml:
-                                               element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
-                                               break;
-                                       case SettingsSerializeAs.String:
-                                               element.Value.ValueXml.InnerText = value.SerializedValue as string;
-                                               break;
-                                       case SettingsSerializeAs.Binary:
-                                               element.Value.ValueXml.InnerText = value.SerializedValue != null ? Convert.ToBase64String (value.SerializedValue as byte []) : string.Empty;
-                                               break;
-                                       default:
-                                               throw new NotImplementedException ();
-                                       }
+                               hasChanges = true;
+                               SettingElement element = userSection.Settings.Get (value.Name);
+                               if (element == null) {
+                                       element = new SettingElement (value.Name, value.Property.SerializeAs);
+                                       userSection.Settings.Add (element);
+                               }
+                               if (element.Value.ValueXml == null)
+                                       element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
+                               switch (value.Property.SerializeAs) {
+                               case SettingsSerializeAs.Xml:
+                                       element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
+                                       break;
+                               case SettingsSerializeAs.String:
+                                       element.Value.ValueXml.InnerText = value.SerializedValue as string;
+                                       break;
+                               case SettingsSerializeAs.Binary:
+                                       element.Value.ValueXml.InnerText = value.SerializedValue != null ? Convert.ToBase64String (value.SerializedValue as byte []) : string.Empty;
+                                       break;
+                               default:
+                                       throw new NotImplementedException ();
                                }
                        }
                        if (hasChanges)
@@ -792,21 +794,19 @@ namespace System.Configuration
                {
                        CreateExeMap ();
 
-                       if (values == null) {
-                               values = new SettingsPropertyValueCollection ();
-                               string groupName = context ["GroupName"] as string;
-                               groupName = NormalizeInvalidXmlChars (groupName); // we likely saved the element removing the non valid xml chars.
-                               LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "applicationSettings", false, groupName);
-                               LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "userSettings", false, groupName);
+                       values = new SettingsPropertyValueCollection ();
+                       string groupName = context ["GroupName"] as string;
+                       groupName = NormalizeInvalidXmlChars (groupName); // we likely saved the element removing the non valid xml chars.
+                       LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "applicationSettings", false, groupName);
+                       LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.None, "userSettings", false, groupName);
 
-                               LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoaming, "userSettings", true, groupName);
-                               LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoamingAndLocal, "userSettings", true, groupName);
+                       LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoaming, "userSettings", true, groupName);
+                       LoadProperties (exeMapCurrent, collection, ConfigurationUserLevel.PerUserRoamingAndLocal, "userSettings", true, groupName);
 
-                               // create default values if not exist
-                               foreach (SettingsProperty p in collection)
-                                       if (values [p.Name] == null)
-                                               values.Add (new SettingsPropertyValue (p));
-                       }
+                       // create default values if not exist
+                       foreach (SettingsProperty p in collection)
+                               if (values [p.Name] == null)
+                                       values.Add (new SettingsPropertyValue (p));
                        return values;
                }
 
@@ -859,13 +859,14 @@ namespace System.Configuration
                public void Reset (SettingsContext context)
                {
                        SettingsPropertyCollection coll = new SettingsPropertyCollection ();
-                       GetPropertyValues (context, coll);
-                       foreach (SettingsPropertyValue propertyValue in values) {
-                               // Can't use propertyValue.Property.DefaultValue
-                               // as it may cause InvalidCastException (see bug# 532180)
-                               propertyValue.PropertyValue = propertyValue.Reset ();
+                       // GetPropertyValues (context, coll);
+                       if (values != null) {
+                               foreach (SettingsPropertyValue propertyValue in values) {
+                                       // Can't use propertyValue.Property.DefaultValue
+                                       // as it may cause InvalidCastException (see bug# 532180)
+                                       values[propertyValue.Name].PropertyValue = propertyValue.Reset ();
+                               }
                        }
-                       SetPropertyValues (context, values);
                }
 
                // FIXME: implement
index 2d554cc7571ff2069d05c817a5c3db0d2c07ba76..9bf62c00c62a743e986ca0439c5bd075f5f7678f 100644 (file)
@@ -171,7 +171,7 @@ namespace System.Configuration
                private object GetDeserializedDefaultValue ()
                {
                        if (property.DefaultValue == null)
-                               if (property.PropertyType.IsValueType)
+                               if (property.PropertyType != null && property.PropertyType.IsValueType)
                                        return Activator.CreateInstance (property.PropertyType);
                                else
                                        return null;
index c3f68c8b7899af3a0e60e63286641ad3692b33e2..40fe3a36b157ac461654e70c532d17ec06966ce7 100644 (file)
@@ -794,10 +794,10 @@ namespace System.Diagnostics
                        [DllImport ("advapi32.dll", SetLastError=true)]
                        public static extern int DeregisterEventSource (IntPtr hEventLog);
 
-                       [DllImport ("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
+                       [DllImport ("kernel32", CharSet=CharSet.Auto, SetLastError=true)]
                        public static extern int FormatMessage (FormatMessageFlags dwFlags, IntPtr lpSource, uint dwMessageId, int dwLanguageId, ref IntPtr lpBuffer, int nSize, IntPtr [] arguments);
 
-                       [DllImport ("kernel32.dll", SetLastError=true)]
+                       [DllImport ("kernel32", SetLastError=true)]
                        public static extern bool FreeLibrary (IntPtr hModule);
 
                        [DllImport ("advapi32.dll", SetLastError=true)]
@@ -806,10 +806,10 @@ namespace System.Diagnostics
                        [DllImport ("advapi32.dll", SetLastError=true)]
                        public static extern int GetOldestEventLogRecord (IntPtr hEventLog, ref int OldestRecord);
 
-                       [DllImport ("kernel32.dll", SetLastError=true)]
+                       [DllImport ("kernel32", SetLastError=true)]
                        public static extern IntPtr LoadLibraryEx (string lpFileName, IntPtr hFile, LoadFlags dwFlags);
 
-                       [DllImport ("kernel32.dll", SetLastError=true)]
+                       [DllImport ("kernel32", SetLastError=true)]
                        public static extern IntPtr LocalFree (IntPtr hMem);
 
                        [DllImport ("advapi32.dll", SetLastError=true)]
@@ -822,7 +822,7 @@ namespace System.Diagnostics
                                ref uint cchReferencedDomainName,
                                out SidNameUse peUse);
 
-                       [DllImport ("Advapi32.dll", SetLastError = true)]
+                       [DllImport ("advapi32.dll", SetLastError = true)]
                        public static extern int NotifyChangeEventLog (IntPtr hEventLog, IntPtr hEvent);
 
                        [DllImport ("advapi32.dll", SetLastError=true)]
@@ -831,7 +831,7 @@ namespace System.Diagnostics
                        [DllImport ("advapi32.dll", SetLastError=true)]
                        public static extern IntPtr RegisterEventSource (string machineName, string sourceName);
 
-                       [DllImport ("Advapi32.dll", SetLastError=true)]
+                       [DllImport ("advapi32.dll", SetLastError=true)]
                        public static extern int ReportEvent (IntPtr hHandle, ushort wType,
                                ushort wCategory, uint dwEventID, IntPtr sid, ushort wNumStrings,
                                uint dwDataSize, string [] lpStrings, byte [] lpRawData);
index f30973fc3462568fcd3a81548aa90d56eb13dd3f..fc0d45dbd20adb9314b7128203680ccf64373f88 100644 (file)
@@ -23,8 +23,8 @@ namespace System.IO.Ports
                const uint GenericWrite = 0x40000000;
                const uint OpenExisting = 3;
                const uint FileFlagOverlapped = 0x40000000;
-               const uint PurgeRxClear = 0x0004;
-               const uint PurgeTxClear = 0x0008;
+               const uint PurgeRxClear = 0x0008;
+               const uint PurgeTxClear = 0x0004;
                const uint WinInfiniteTimeout = 0xFFFFFFFF;
                const uint FileIOPending = 997;
 
@@ -375,7 +375,7 @@ namespace System.IO.Ports
 
                public void DiscardOutBuffer ()
                {
-                       if (!PurgeComm (handle, PurgeRxClear))
+                       if (!PurgeComm (handle, PurgeTxClear))
                                ReportIOError (null);
                }
 
index d44d2338cb71b8fb49841a6587eb92b3c2830200..dd90140a1a643dfeed16fdc1494516b47b67fd79 100644 (file)
@@ -12,7 +12,7 @@ namespace Mono.Audio {
 #endif
        abstract class AudioData {
                protected const int buffer_size = 4096;
-               bool stopped = false;
+               bool stopped;
 
                public abstract int Channels {
                        get;
@@ -58,8 +58,8 @@ namespace Mono.Audio {
                short channels;
                ushort frame_divider;
                int sample_rate;
-               int data_len = 0;
-               long data_offset = 0;
+               int data_len;
+               long data_offset;
                AudioFormat format;
 
                public WavData (Stream data) {
@@ -100,7 +100,7 @@ namespace Mono.Audio {
                                        byte_rate |= buffer [idx++] << 8;
                                        byte_rate |= buffer [idx++] << 16;
                                        byte_rate |= buffer [idx++] << 24;
-                                       int block_align = buffer [idx++] | (buffer [idx++] << 8);
+//                                     int block_align = buffer [idx++] | (buffer [idx++] << 8);
                                        int sign_bits = buffer [idx++] | (buffer [idx++] << 8);
 
                                        switch (sign_bits) {
@@ -203,8 +203,8 @@ namespace Mono.Audio {
                short channels;
                ushort frame_divider;
                int sample_rate;
-               int data_len = 0;
-               int data_offset = 0;
+               int data_len ;
+//             int data_offset;
                AudioFormat format;
 
                public AuData (Stream data) {
@@ -265,7 +265,7 @@ namespace Mono.Audio {
                        byte[] chunk_to_play     = new byte [chunk_size];
                        
                        // Read only Au data, don't care about file header here !
-                       stream.Position = (long)data_offset;
+                       stream.Position = 0; //(long)data_offset;
                        stream.Read (buffer, 0, data_len); 
                        
                        while (!IsStopped && count >= 0){
index 5946766b5b23d862e3debf548f094ed1d222e206..fb4d22a6c878500a22c6f22dd703fe2c8b263a50 100644 (file)
@@ -550,31 +550,31 @@ namespace System.Net.NetworkInformation {
 
                // PInvokes
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetTcpTable (byte [] pTcpTable, ref int pdwSize, bool bOrder);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetTcp6Table (byte [] TcpTable, ref int SizePointer, bool Order);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetUdpTable (byte [] pUdpTable, ref int pdwSize, bool bOrder);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetUdp6Table (byte [] Udp6Table, ref int SizePointer, bool Order);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetTcpStatisticsEx (out Win32_MIB_TCPSTATS pStats, int dwFamily);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetUdpStatisticsEx (out Win32_MIB_UDPSTATS pStats, int dwFamily);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetIcmpStatistics (out Win32_MIBICMPINFO pStats, int dwFamily);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetIcmpStatisticsEx (out Win32_MIB_ICMP_EX pStats, int dwFamily);
 
-               [DllImport ("Iphlpapi.dll")]
+               [DllImport ("iphlpapi.dll")]
                static extern int GetIpStatisticsEx (out Win32_MIB_IPSTATS pStats, int dwFamily);
 
                // Win32 structures
index b51e5050ce7cd9987c40c2c924a022834090ccd7..65126ca24f202905b7bc9320e5c9a7cfe25c057a 100644 (file)
@@ -32,7 +32,7 @@
 
 using System.IO;
 using System.Runtime.InteropServices;
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
 using System.Timers;
 using System.Threading;
 #endif
@@ -142,7 +142,7 @@ namespace System.Net.Sockets
                        }
                }
 
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
 #if TARGET_JVM
                [MonoNotSupported ("Not supported since Socket.ReceiveTimeout is not supported")]
 #endif
@@ -178,7 +178,7 @@ namespace System.Net.Sockets
                        }
                }
 
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
 #if TARGET_JVM
                [MonoNotSupported ("Not supported since Socket.SendTimeout is not supported")]
 #endif
@@ -267,7 +267,7 @@ namespace System.Net.Sockets
                }
                
 
-#if !NET_2_1
+#if !NET_2_1 || MOBILE
                public void Close (int timeout)
                {
                        if (timeout < -1) {
index f213b0d29e156704baef9450a37558a6cf578564..a21cf97c658412b7768c337c806372c1d9b57a4e 100644 (file)
@@ -729,16 +729,22 @@ namespace System.Net
                }
                
                class CFWebProxy : IWebProxy {
+                       ICredentials credentials;
+                       bool userSpecified;
+                       
                        public CFWebProxy ()
                        {
-                               
                        }
                        
                        public ICredentials Credentials {
-                               get; set;
+                               get { return credentials; }
+                               set {
+                                       userSpecified = true;
+                                       credentials = value;
+                               }
                        }
                        
-                       static Uri GetProxyUri (CFProxy proxy)
+                       static Uri GetProxyUri (CFProxy proxy, out NetworkCredential credentials)
                        {
                                string protocol;
                                
@@ -751,6 +757,7 @@ namespace System.Net
                                        protocol = "http://";
                                        break;
                                default:
+                                       credentials = null;
                                        return null;
                                }
                                
@@ -758,29 +765,26 @@ namespace System.Net
                                string password = proxy.Password;
                                string hostname = proxy.HostName;
                                int port = proxy.Port;
-                               string userinfo;
                                string uri;
                                
-                               if (username != null) {
-                                       if (password != null)
-                                               userinfo = Uri.EscapeDataString (username) + ':' + Uri.EscapeDataString (password) + '@';
-                                       else
-                                               userinfo = Uri.EscapeDataString (username) + '@';
-                               } else {
-                                       userinfo = string.Empty;
-                               }
+                               if (username != null)
+                                       credentials = new NetworkCredential (username, password);
+                               else
+                                       credentials = null;
                                
-                               uri = protocol + userinfo + hostname + (port != 0 ? ':' + port.ToString () : string.Empty);
+                               uri = protocol + hostname + (port != 0 ? ':' + port.ToString () : string.Empty);
                                
                                return new Uri (uri, UriKind.Absolute);
                        }
                        
-                       static Uri GetProxyUriFromScript (IntPtr script, Uri targetUri)
+                       static Uri GetProxyUriFromScript (IntPtr script, Uri targetUri, out NetworkCredential credentials)
                        {
                                CFProxy[] proxies = CFNetwork.GetProxiesForAutoConfigurationScript (script, targetUri);
                                
-                               if (proxies == null)
+                               if (proxies == null) {
+                                       credentials = null;
                                        return targetUri;
+                               }
                                
                                for (int i = 0; i < proxies.Length; i++) {
                                        switch (proxies[i].ProxyType) {
@@ -788,60 +792,76 @@ namespace System.Net
                                        case CFProxyType.HTTP:
                                        case CFProxyType.FTP:
                                                // create a Uri based on the hostname/port/etc info
-                                               return GetProxyUri (proxies[i]);
+                                               return GetProxyUri (proxies[i], out credentials);
                                        case CFProxyType.SOCKS:
                                        default:
                                                // unsupported proxy type, try the next one
                                                break;
                                        case CFProxyType.None:
                                                // no proxy should be used
+                                               credentials = null;
                                                return targetUri;
                                        }
                                }
                                
+                               credentials = null;
+                               
                                return null;
                        }
                        
                        public Uri GetProxy (Uri targetUri)
                        {
+                               NetworkCredential credentials = null;
+                               Uri proxy = null;
+                               
                                if (targetUri == null)
                                        throw new ArgumentNullException ("targetUri");
                                
                                try {
                                        CFProxySettings settings = CFNetwork.GetSystemProxySettings ();
                                        CFProxy[] proxies = CFNetwork.GetProxiesForUri (targetUri, settings);
-                                       Uri uri;
                                        
-                                       if (proxies == null)
-                                               return targetUri;
-                                       
-                                       for (int i = 0; i < proxies.Length; i++) {
-                                               switch (proxies[i].ProxyType) {
-                                               case CFProxyType.AutoConfigurationJavaScript:
-                                                       if ((uri = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri)) != null)
-                                                               return uri;
-                                                       break;
-                                               case CFProxyType.AutoConfigurationUrl:
-                                                       // unsupported proxy type (requires fetching script from remote url)
-                                                       break;
-                                               case CFProxyType.HTTPS:
-                                               case CFProxyType.HTTP:
-                                               case CFProxyType.FTP:
-                                                       // create a Uri based on the hostname/port/etc info
-                                                       return GetProxyUri (proxies[i]);
-                                               case CFProxyType.SOCKS:
-                                                       // unsupported proxy type, try the next one
-                                                       break;
-                                               case CFProxyType.None:
-                                                       // no proxy should be used
-                                                       return targetUri;
+                                       if (proxies != null) {
+                                               for (int i = 0; i < proxies.Length && proxy == null; i++) {
+                                                       switch (proxies[i].ProxyType) {
+                                                       case CFProxyType.AutoConfigurationJavaScript:
+                                                               proxy = GetProxyUriFromScript (proxies[i].AutoConfigurationJavaScript, targetUri, out credentials);
+                                                               break;
+                                                       case CFProxyType.AutoConfigurationUrl:
+                                                               // unsupported proxy type (requires fetching script from remote url)
+                                                               break;
+                                                       case CFProxyType.HTTPS:
+                                                       case CFProxyType.HTTP:
+                                                       case CFProxyType.FTP:
+                                                               // create a Uri based on the hostname/port/etc info
+                                                               proxy = GetProxyUri (proxies[i], out credentials);
+                                                               break;
+                                                       case CFProxyType.SOCKS:
+                                                               // unsupported proxy type, try the next one
+                                                               break;
+                                                       case CFProxyType.None:
+                                                               // no proxy should be used
+                                                               proxy = targetUri;
+                                                               break;
+                                                       }
+                                               }
+                                               
+                                               if (proxy == null) {
+                                                       // no supported proxies for this Uri, fall back to trying to connect to targetUri directly
+                                                       proxy = targetUri;
                                                }
+                                       } else {
+                                               proxy = targetUri;
                                        }
                                } catch {
                                        // ignore errors while retrieving proxy data
+                                       proxy = targetUri;
                                }
-                               // no supported proxies for this Uri, fall back to trying to connect to targetUri directly.
-                               return targetUri;
+                               
+                               if (!userSpecified)
+                                       this.credentials = credentials;
+                               
+                               return proxy;
                        }
                        
                        public bool IsBypassed (Uri targetUri)
@@ -853,13 +873,9 @@ namespace System.Net
                        }
                }
                
-               static CFWebProxy defaultWebProxy;
                public static IWebProxy GetDefaultProxy ()
                {
-                       if (defaultWebProxy == null)
-                               defaultWebProxy = new CFWebProxy ();
-                       
-                       return defaultWebProxy;
+                       return new CFWebProxy ();
                }
        }
 }
index 6ab7278c08593cd054188f03aab44bc32f0ed5fe..4922fb3291c34bbeac6e02b87b7e9720e0995a86 100644 (file)
@@ -773,7 +773,11 @@ namespace System.Net
 
                        request.SetWriteStream (new WebConnectionStream (this, request));
                }
-               
+
+#if MONOTOUCH
+               static bool warned_about_queue = false;
+#endif
+
                internal EventHandler SendRequest (HttpWebRequest request)
                {
                        if (request.Aborted)
@@ -786,6 +790,12 @@ namespace System.Net
                                        ThreadPool.QueueUserWorkItem (initConn, request);
                                } else {
                                        lock (queue) {
+#if MONOTOUCH
+                                               if (!warned_about_queue) {
+                                                       warned_about_queue = true;
+                                                       Console.WriteLine ("WARNING: An HttpWebRequest was added to the ConnectionGroup queue because the connection limit was reached.");
+                                               }
+#endif
                                                queue.Enqueue (request);
                                        }
                                }
index e952f2a0992ebc13cc18dda6c50d5654d7e12a70..ff370e9e8ba78d1e6f6275a49b9f6cb34570def0 100644 (file)
@@ -70,6 +70,12 @@ namespace System.Net
 
                public WebConnectionStream (WebConnection cnc)
                {
+                       if (cnc.Data == null)
+                               throw new InvalidOperationException ("cnc.Data was not initialized");
+                       if (cnc.Data.Headers == null)
+                               throw new InvalidOperationException ("cnc.Data.Headers was not initialized");
+                       if (cnc.Data.request == null)
+                               throw new InvalidOperationException ("cnc.Data.request was not initialized");
                        isRead = true;
                        cb_wrapper = new AsyncCallback (ReadCallbackWrapper);
                        pending = new ManualResetEvent (true);
index 0013d96d9c76d0d4cccaaf58313ea451dc0fcfaf..948633d00d5030da87f6187c79f3af8e5b6d9387 100644 (file)
@@ -68,7 +68,7 @@ namespace System.Security.Cryptography.X509Certificates {
                                        raw_data = value [0].GetBytes ();
 
                                X509Extension newt = null;
-#if MOONLIGHT
+#if MOONLIGHT || FULL_AOT_RUNTIME
                                // non-extensible
                                switch (oid) {
                                case "2.5.29.14":
index 9d18feabd0ca0a3924908669cdfbf5e5529ae7f2..378a3b872fe2cd8379e6da72e5983990f0525824 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Text.RegularExpressions {
        [Serializable]
        public partial class Regex : ISerializable {
 
-#if !TARGET_JVM
+#if !TARGET_JVM && !FULL_AOT_RUNTIME
                [MonoTODO]
                public static void CompileToAssembly (RegexCompilationInfo [] regexes, AssemblyName aname)
                {
index 7e7e2c6849f28703935fe233447eb181a78d5e41..3117da4d3a01c011336ec20bd0c6a45a5bb3be0c 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Diagnostics;
index 70c5ed81a4198c6ab4116cb8c6d3712caecf5d92..bcf4ddbc27736359bca8bc2fa825c379dd036ef1 100644 (file)
@@ -24,7 +24,7 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Runtime.Serialization;
index 09dd7f00ec7ef2669275115a4a84aa4be55608b5..d22c2ebd7926eba6c856d22dcb7a8ccf825b39ea 100644 (file)
@@ -149,6 +149,8 @@ System.Collections.Generic/SortedDictionary.cs
 System.Collections.Generic/SortedList.cs
 System.Collections.Generic/SortedSet.cs
 System.Collections.Generic/Stack.cs
+System.Collections.Concurrent/BlockingCollection.cs
+System.Collections.Concurrent/ConcurrentBag.cs
 System.Collections.ObjectModel/ObservableCollection.cs
 System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
 System.Collections.Specialized/BitVector32.cs
@@ -1047,8 +1049,6 @@ System.Runtime.InteropServices.ComTypes/STGMEDIUM.cs
 System.Runtime.InteropServices.ComTypes/TYMED.cs
 System/IUriData.cs
 System/UriData.cs
-System.Collections.Concurrent/BlockingCollection.cs
-System.Collections.Concurrent/ConcurrentBag.cs
 
 ../corlib/System.Threading.Tasks/CyclicDeque.cs
 ../corlib/System.Threading.Tasks/PopResult.cs
index f56a59532e6e985b4e8022e7a4962cf0d625b265..d57cb679c6cf7b3e32b34af95c38b6e707899b56 100644 (file)
@@ -1033,18 +1033,13 @@ namespace System {
                                        if (segments [k] != segments2 [k]) 
                                                break;
                                
-                               for (int i = k + 1; i < segments.Length; i++)
+                               for (int i = k; i < segments.Length && segments [i].EndsWith ("/"); i++)
                                        result += "../";
                                for (int i = k; i < segments2.Length; i++)
                                        result += segments2 [i];
                                
-                               // if there is more than 1 segment and if the last segment of segments
-                               // ends with separator char, assume its a directory and prepend "../"
-                               if (segments.Length > 1) {
-                                       var lastSegment = segments [segments.Length - 1];
-                                       if (lastSegment.EndsWith ("/"))
-                                               result = "../" + result;
-                               }
+                               if (result == string.Empty)
+                                       result = "./";
                        }
                        uri.AppendQueryAndFragment (ref result);
 
index 5763a0b9723370a74ec10bbb82784a59736a90f0..88be568f429b51540cf9967c8e84e15cc1864c36 100644 (file)
@@ -585,6 +585,50 @@ namespace MonoTests.System.ComponentModel
                        Assert.AreEqual (0, list_changed_index, "4");
                        Assert.AreEqual (1, poker.Count, "5");
                }
+
+               private class Item : INotifyPropertyChanged {
+
+                       public event PropertyChangedEventHandler PropertyChanged;
+
+                       string _name;
+
+                       public string Name {
+                               get { return _name; }
+                               set {
+                                       if (_name != value) {
+                                               _name = value;
+                                               OnPropertyChanged ("Name");
+                                       }
+                               }
+                       }
+
+                       void OnPropertyChanged (string name)
+                       {
+                               var fn = PropertyChanged;
+                               if (fn != null)
+                                       fn (this, new PropertyChangedEventArgs (name));
+                       }
+               }
+
+               [Test] // https://bugzilla.xamarin.com/show_bug.cgi?id=8366
+               public void Bug8366 ()
+               {
+                       bool added = false;
+                       bool changed = false;
+                       var list = new BindingList<Item> ();
+                       list.ListChanged += (object sender, ListChangedEventArgs e) => {
+                               added |= e.ListChangedType == ListChangedType.ItemAdded;
+                               changed |= e.ListChangedType == ListChangedType.ItemChanged;
+                       };
+
+                       var item = new Item () { Name = "1" };
+                       list.Add (item);
+
+                       item.Name = "2";
+
+                       Assert.IsTrue (added, "ItemAdded");
+                       Assert.IsTrue (changed, "ItemChanged");
+               }
        }
 }
 
index 4325fad2ff486b8a9d861b411573fa969ec6348a..98d87d4ab9840017f1ff66ac8dd607330142258d 100644 (file)
@@ -379,14 +379,97 @@ namespace MonoTests.System.Configuration {
                 }
 
                 [Test] // bug #532180
-                public void DefaultSettingValueAsWithReload() {
+                public void DefaultSettingValueAsWithReload() 
+               {
                         Bug532180 settings = new Bug532180();
-                        Assert.AreEqual(10, settings.IntSetting, "A1");
+                        Assert.AreEqual (10, settings.IntSetting, "A1");
                         settings.IntSetting = 1;
-                        Assert.AreEqual(1, settings.IntSetting, "A2");
-                        settings.Reload();
-                        Assert.AreEqual(10, settings.IntSetting, "A3");
+                        Assert.AreEqual (1, settings.IntSetting, "A2");
+                        settings.Reload ();
+                        Assert.AreEqual (10, settings.IntSetting, "A3");
                 }                        
+               
+               class Bug8592ConfHolder : ApplicationSettingsBase {
+                       [UserScopedSetting]
+                       public string TestKey1OnHolder { 
+                               get { return (string) this ["TestKey1OnHolder"] ?? ""; }
+                               set { this ["TestKey1OnHolder"] = value; }
+                       }
+               }
+
+               [Test]
+               public void TestBug8592BasicOperations ()
+               {
+                       var holder = new Bug8592ConfHolder ();
+                       holder.Reset ();
+                       holder.Save ();
+                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+                       holder.TestKey1OnHolder = "candy";
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       holder.Reload ();
+                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+                       holder.TestKey1OnHolder = "candy";
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       holder.Save ();
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       holder.Reload ();
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       holder.Reset ();
+                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+               }
+
+               class Bug8533ConfHolder1 : ApplicationSettingsBase {
+                       [UserScopedSetting]
+                       public string TestKey1OnHolder1 {
+                               get { return (string) this ["TestKey1OnHolder1"] ?? ""; }
+                               set { this ["TestKey1OnHolder1"] = value; }
+                       }
+
+                       [UserScopedSetting]
+                       public string TestKey1OnHolder2 {
+                               get { return (string) this ["TestKey1OnHolder2"] ?? ""; }
+                               set { this ["TestKey1OnHolder2"] = value; }
+                       }
+                       
+                       [UserScopedSetting]
+                       public string TestKey {
+                               get { return (string) this ["TestKey"] ?? ""; }
+                               set { this ["TestKey"] = value; }
+                       }
+               }
+
+               class Bug8533ConfHolder2 : ApplicationSettingsBase {
+                       [UserScopedSetting]
+                       public string TestKey1OnHolder2 {
+                               get { return (string) this ["TestKey1OnHolder2"] ?? ""; }
+                               set { this ["TestKey1OnHolder2"] = value; }
+                       }
+
+                       [UserScopedSetting]
+                       public string TestKey {
+                               get { return (string) this ["TestKey"] ?? ""; }
+                               set { this ["TestKey"] = value; }
+                       }
+               }
+
+               [Test]
+               public void TestBug8533ConfHandlerWronglyMixedUp ()
+               {
+                       var holder1 = new Bug8533ConfHolder1 ();
+                       var holder2 = new Bug8533ConfHolder2 ();
+                       holder1.TestKey1OnHolder1 = "candy";
+                       holder2.TestKey1OnHolder2 = "donut";
+                       holder1.TestKey = "eclair";
+                       holder1.Save ();
+                       holder2.Save ();
+                       holder1.Reload ();
+                       holder2.Reload();
+                       Assert.AreEqual ("", holder1.TestKey1OnHolder2);
+                       Assert.AreEqual ("candy", holder1.TestKey1OnHolder1);
+                       Assert.AreEqual ("donut", holder2.TestKey1OnHolder2);
+                       Assert.AreEqual ("eclair", holder1.TestKey);
+                       Assert.AreEqual ("", holder2.TestKey);
+               }
        }
 }
 
index cf06911489b470f5cb7b75dffa08598ce1705bd0..da4e7c4d5503344a62c467c9947dafc8f5882368 100644 (file)
@@ -441,6 +441,7 @@ namespace MonoTests.System
                        Uri uri13 = new Uri ("mailto:xxx@xxx.com/foo/bar");
                        Uri uri14 = new Uri ("http://www.contoso.com/test1/");
                        Uri uri15 = new Uri ("http://www.contoso.com/");
+                       Uri uri16 = new Uri ("http://www.contoso.com/test");
 
                        AssertRelativeUri ("foo/bar/index.htm#fragment", uri1, uri2, "#A");
                        AssertRelativeUri ("../../index.htm?x=2", uri2, uri1, "#B");
@@ -474,6 +475,59 @@ namespace MonoTests.System
                        Assert.AreEqual (uri5.OriginalString, relativeUri.OriginalString, "#N3");
 
                        AssertRelativeUri ("../", uri14, uri15, "#O");
+                       AssertRelativeUri ("./", uri16, uri15, "#P");
+
+                       Uri a1 = new Uri ("http://something/something2/test/");
+                       Uri a2 = new Uri ("http://something/something2/");
+                       Uri a3 = new Uri ("http://something/something2/test");
+                       Uri a4 = new Uri ("http://something/something2");
+
+                       AssertRelativeUri ("../", a1, a2, "Q1");
+                       AssertRelativeUri ("../../something2", a1, a4, "Q2");
+                       AssertRelativeUri ("./", a3, a2, "Q3");
+                       AssertRelativeUri ("../something2", a3, a4, "Q4");
+
+                       Uri b1 = new Uri ("http://something/test/");
+                       Uri b2 = new Uri ("http://something/");
+                       Uri b3 = new Uri ("http://something/test");
+                       Uri b4 = new Uri ("http://something");
+                       
+                       AssertRelativeUri ("../", b1, b2, "R1");
+                       AssertRelativeUri ("../", b1, b4, "R2");
+                       AssertRelativeUri ("./", b3, b2, "R3");
+                       AssertRelativeUri ("./", b3, b4, "R4");
+
+                       Uri c1 = new Uri ("C:\\something\\something2\\test\\");
+                       Uri c2 = new Uri ("C:\\something\\something2\\");
+                       Uri c3 = new Uri ("C:\\something\\something2\\test");
+                       Uri c4 = new Uri ("C:\\something\\something2");
+                       
+                       AssertRelativeUri ("../", c1, c2, "S1");
+                       AssertRelativeUri ("../../something2", c1, c4, "S2");
+                       AssertRelativeUri ("./", c3, c2, "S3");
+                       AssertRelativeUri ("../something2", c3, c4, "S4");
+
+                       Uri d1 = new Uri ("C:\\something\\test\\");
+                       Uri d2 = new Uri ("C:\\something\\");
+                       Uri d3 = new Uri ("C:\\something\\test");
+                       Uri d4 = new Uri ("C:\\something");
+                       
+                       AssertRelativeUri ("../", d1, d2, "T1");
+                       AssertRelativeUri ("../../something", d1, d4, "T2");
+                       AssertRelativeUri ("./", d3, d2, "T3");
+                       AssertRelativeUri ("../something", d3, d4, "T4");
+
+                       Uri e1 = new Uri ("C:\\something\\");
+                       Uri e2 = new Uri ("C:\\");
+                       Uri e3 = new Uri ("C:\\something");
+                       
+                       AssertRelativeUri ("../", e1, e2, "U1");
+                       AssertRelativeUri ("./", e3, e2, "U2");
+                       AssertRelativeUri ("", e1, e1, "U3");
+                       AssertRelativeUri ("", e3, e3, "U4");
+                       AssertRelativeUri ("../something", e1, e3, "U5");
+                       AssertRelativeUri ("something/", e3, e1, "U6");
+                       AssertRelativeUri ("something", e2, e3, "U7");
                }
 
                [Test]
index 00b640ae9fdbf2b2b26cf2811c6535b58734a2ed..8e9573170cc4ab51b42fd150b8c93346b05c7e52 100644 (file)
@@ -4,6 +4,10 @@
 ../corlib/System.Collections.Generic/CollectionDebuggerView.cs
 ../corlib/System.Collections/CollectionDebuggerView.cs
 ../corlib/Mono/DataConverter.cs
+../corlib/System.Threading.Tasks/CyclicDeque.cs
+../corlib/System.Threading.Tasks/IConcurrentDeque.cs
+../corlib/System.Threading.Tasks/PopResult.cs
+../corlib/System.Threading/AtomicBoolean.cs
 
 Assembly/AssemblyInfo.cs
 Mono.Http/NtlmClient.cs
@@ -11,12 +15,14 @@ System.CodeDom.Compiler/GeneratedCodeAttribute.cs
 System.Collections.Generic/ISet.cs
 System.Collections.Generic/LinkedList.cs
 System.Collections.Generic/LinkedListNode.cs
-System.Collections.Generic/Queue.cs
 System.Collections.Generic/RBTree.cs
+System.Collections.Generic/Queue.cs
 System.Collections.Generic/SortedDictionary.cs
 System.Collections.Generic/SortedList.cs
 System.Collections.Generic/SortedSet.cs
 System.Collections.Generic/Stack.cs
+System.Collections.Concurrent/BlockingCollection.cs
+System.Collections.Concurrent/ConcurrentBag.cs
 System.Collections.ObjectModel/ObservableCollection.cs
 System.Collections.ObjectModel/ReadOnlyObservableCollection.cs
 System.Collections.Specialized/BitVector32.cs
@@ -60,6 +66,8 @@ System.ComponentModel.Design/MenuCommand.cs
 System.ComponentModel.Design/ServiceCreatorCallback.cs
 System.ComponentModel.Design/StandardCommands.cs
 System.ComponentModel.Design/ViewTechnology.cs
+System.ComponentModel/AddingNewEventArgs.cs
+System.ComponentModel/AddingNewEventHandler.cs
 System.ComponentModel/ArrayConverter.cs
 System.ComponentModel/AsyncCompletedEventArgs.cs
 System.ComponentModel/AsyncCompletedEventHandler.cs
@@ -69,6 +77,7 @@ System.ComponentModel/AttributeCollection.cs
 System.ComponentModel/BackgroundWorker.cs
 System.ComponentModel/BaseNumberConverter.cs
 System.ComponentModel/BindableSupport.cs
+System.ComponentModel/BindingList.cs
 System.ComponentModel/BooleanConverter.cs
 System.ComponentModel/BrowsableAttribute.cs
 System.ComponentModel/ByteConverter.cs
@@ -111,6 +120,7 @@ System.ComponentModel/ExpandableObjectConverter.cs
 System.ComponentModel/GuidConverter.cs
 System.ComponentModel/IBindingList.cs
 System.ComponentModel/IBindingListView.cs
+System.ComponentModel/ICancelAddNew.cs
 System.ComponentModel/IChangeTracking.cs
 System.ComponentModel/IComNativeDescriptorHandler.cs
 System.ComponentModel/IComponent.cs
@@ -120,9 +130,11 @@ System.ComponentModel/ICustomTypeDescriptor.cs
 System.ComponentModel/IDataErrorInfo.cs
 System.ComponentModel/IDataErrorInfo.cs
 System.ComponentModel/IEditableObject.cs
+System.ComponentModel/IExtenderProvider.cs
 System.ComponentModel/IListSource.cs
 System.ComponentModel/INotifyPropertyChanged.cs
 System.ComponentModel/INotifyPropertyChanging.cs
+System.ComponentModel/IRaiseItemChangedEvents.cs
 System.ComponentModel/IRevertibleChangeTracking.cs
 System.ComponentModel/ISite.cs
 System.ComponentModel/ISupportInitialize.cs
@@ -333,6 +345,7 @@ System.Net.Sockets/TcpClient.cs
 System.Net.Sockets/TcpListener.cs
 System.Net.Sockets/TransmitFileOptions.cs
 System.Net.Sockets/UdpClient.cs
+System.Net.Sockets/UdpReceiveResult.cs
 System.Net/AuthenticationManager.cs
 System.Net/AuthenticationSchemeSelector.cs
 System.Net/AuthenticationSchemes.cs
@@ -352,6 +365,7 @@ System.Net/DecompressionMethods.cs
 System.Net/DefaultCertificatePolicy.cs
 System.Net/DigestClient.cs
 System.Net/Dns.cs
+System.Net/DnsEndPoint.cs
 System.Net/DownloadDataCompletedEventArgs.cs
 System.Net/DownloadDataCompletedEventHandler.cs
 System.Net/DownloadProgressChangedEventArgs.cs
@@ -423,6 +437,7 @@ System.Net/SecurityProtocolType.cs
 System.Net/ServicePoint.cs
 System.Net/ServicePointManager.cs
 System.Net/SocketAddress.cs
+System.Net/TransportContext.cs
 System.Net/TransportType.cs
 System.Net/UploadDataCompletedEventArgs.cs
 System.Net/UploadDataCompletedEventHandler.cs
@@ -449,6 +464,7 @@ System.Net/WebProxy.cs
 System.Net/WebRequest.cs
 System.Net/WebRequestMethods.cs
 System.Net/WebResponse.cs
+System.Runtime.InteropServices/DefaultParameterValueAttribute.cs
 System.Security.AccessControl/SemaphoreAccessRule.cs
 System.Security.AccessControl/SemaphoreAuditRule.cs
 System.Security.AccessControl/SemaphoreRights.cs
@@ -457,8 +473,19 @@ System.Security.Authentication/AuthenticationException.cs
 System.Security.Authentication/CipherAlgorithmType.cs
 System.Security.Authentication/ExchangeAlgorithmType.cs
 System.Security.Authentication/HashAlgorithmType.cs
-System.Security.Authentication/InvalidCredentialException.cs
 System.Security.Authentication/SslProtocols.cs
+System.Security.Authentication/InvalidCredentialException.cs
+System.Security.Authentication.ExtendedProtection/ChannelBinding.cs
+System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs
+System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs
+System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs
+System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs
+System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs
+System.Security.Authentication.ExtendedProtection/ServiceNameCollection.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs
+System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs
 System.Security.Cryptography.X509Certificates/OSX509Certificates.cs
 System.Security.Cryptography.X509Certificates/OpenFlags.cs
 System.Security.Cryptography.X509Certificates/PublicKey.cs
@@ -523,6 +550,8 @@ System.Text.RegularExpressions/parser.cs
 System.Text.RegularExpressions/quicksearch.cs
 System.Text.RegularExpressions/replace.cs
 System.Text.RegularExpressions/syntax.cs
+System.Threading/Barrier.cs
+System.Threading/BarrierPostPhaseException.cs
 System.Threading/Semaphore.cs
 System.Threading/SemaphoreFullException.cs
 System.Threading/ThreadExceptionEventArgs.cs
@@ -555,4 +584,4 @@ System/UriPartial.cs
 System/UriTypeConverter.cs
 System/UriElements.cs
 System/UriParseComponents.cs
-System.Windows.Input/ICommand.cs
\ No newline at end of file
+System.Windows.Input/ICommand.cs
index e0d6a102ffdd3a3f65e909d6f716c5a8920b8b0a..eac7130d6401004f4d0e4e618b82fe7bb404aa7c 100644 (file)
@@ -32,7 +32,6 @@ using System.Runtime.CompilerServices;
 #else
 
 using System;
-using System.Windows;
 
 namespace System.Collections.Specialized {
 
index 4cd981ae02bacd2827cde6a74eff8f36fa612f2c..ed9d824c339d54b0b75b502eb2f7ff8b274dd824 100644 (file)
@@ -33,7 +33,6 @@ namespace System.ComponentModel {
        {
                protected GroupDescription ()
                {
-                       throw new NotImplementedException ();
                }
 
                public ObservableCollection<object> GroupNames {
@@ -54,7 +53,8 @@ namespace System.ComponentModel {
 
                protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
                {
-                       throw new NotImplementedException ();
+                       if (PropertyChanged != null)
+                               PropertyChanged (this, e);
                }
 
                [EditorBrowsable (EditorBrowsableState.Never)]
diff --git a/mcs/class/WindowsBase/System.ComponentModel/IEditableCollectionViewAddNewItem.cs b/mcs/class/WindowsBase/System.ComponentModel/IEditableCollectionViewAddNewItem.cs
new file mode 100644 (file)
index 0000000..07f9c24
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// IEditableCollectionViewAddNewItem.cs
+//
+// Author:
+//       Antonius Riha <antoniusriha@gmail.com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0
+
+namespace System.ComponentModel
+{
+       public interface IEditableCollectionViewAddNewItem : IEditableCollectionView
+       {
+               bool CanAddNewItem { get; }
+               object AddNewItem (object newItem);
+       }
+}
+
+#endif
index 26a0197f53bd2ec69d3c7746f47aaa1327dd9582..59c81c5be7becd861e9df9b30bdae76b53d5ee54 100644 (file)
@@ -58,6 +58,7 @@
    <Compile Include="System.ComponentModel\ICollectionView.cs" />
    <Compile Include="System.ComponentModel\ICollectionViewFactory.cs" />
    <Compile Include="System.ComponentModel\IEditableCollectionView.cs" />
+   <Compile Include="System.ComponentModel\IEditableCollectionViewAddNewItem.cs" />
    <Compile Include="System.ComponentModel\IItemProperties.cs" />
    <Compile Include="System.ComponentModel\ItemPropertyInfo.cs" />
    <Compile Include="System.ComponentModel\NewItemPlaceholderPosition.cs" />
index 73fa0f8da88a0bb62c44434a68c0a959c894e6a4..78b5ba275de24099ab96f71cacf202c0a7cfb678 100644 (file)
@@ -58,6 +58,7 @@
    <Compile Include="System.ComponentModel\ICollectionView.cs" />
    <Compile Include="System.ComponentModel\ICollectionViewFactory.cs" />
    <Compile Include="System.ComponentModel\IEditableCollectionView.cs" />
+   <Compile Include="System.ComponentModel\IEditableCollectionViewAddNewItem.cs" />
    <Compile Include="System.ComponentModel\IItemProperties.cs" />
    <Compile Include="System.ComponentModel\ItemPropertyInfo.cs" />
    <Compile Include="System.ComponentModel\NewItemPlaceholderPosition.cs" />
index 2e76f6e8a423ff86e6e44b22358138548ced0057..f0a6e5c2ab68e58364251c20accbd8f2784cb8ca 100644 (file)
@@ -14,6 +14,7 @@ System.ComponentModel/GroupDescription.cs
 System.ComponentModel/ICollectionView.cs
 System.ComponentModel/ICollectionViewFactory.cs
 System.ComponentModel/IEditableCollectionView.cs
+System.ComponentModel/IEditableCollectionViewAddNewItem.cs
 System.ComponentModel/IItemProperties.cs
 System.ComponentModel/ItemPropertyInfo.cs
 System.ComponentModel/NewItemPlaceholderPosition.cs
diff --git a/mcs/class/build-rx-dll-sources.sh b/mcs/class/build-rx-dll-sources.sh
new file mode 100644 (file)
index 0000000..e12f2be
--- /dev/null
@@ -0,0 +1,80 @@
+
+// useful grep
+// grep -h "#if" /svn/mono/external/rx/Rx.NET/System.Reactive.*/*.cs /svn/mono/external/rx/Rx.NET/System.Reactive.*/*/*.cs /svn/mono/external/rx/Rx.NET/System.Reactive.*/*/*/*.cs | sort | uniq
+
+using System.Diagnostics;
+using System.IO;
+using System.Xml.Linq;
+using System.Xml.XPath;
+
+var asses = new string [] {
+       "System.Reactive.Interfaces",
+       "System.Reactive.Core",
+       "System.Reactive.PlatformServices",
+       "System.Reactive.Linq",
+       "System.Reactive.Debugger", // maybe needed for testing assembly.
+       "System.Reactive.Experimental", // needed for testing assembly.
+       "System.Reactive.Providers",
+       "System.Reactive.Runtime.Remoting",
+       "System.Reactive.Windows.Forms",
+       "System.Reactive.Windows.Threading",
+       "Microsoft.Reactive.Testing",
+       "Tests.System.Reactive",
+       };
+
+var blacklist = new string [] {
+       // FIXME: this is the only source that we cannot build.
+       //Test/../../../../external/rx/Rx.NET/Tests.System.Reactive/Tests/ObservableExTest.cs(1478,27): error CS0411: The type arguments for method `System.Reactive.Linq.ObservableEx.ManySelect<TSource,TResult>(this System.IObservable<TSource>, System.Func<System.IObservable<TSource>,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+       "ObservableExTest.cs",
+
+       // WPF Dispatcher.Invoke() is not implemented.
+       "DispatcherSchedulerTest.cs",
+       // This is not limited to Dispatcher, but many of them are relevant to it, or Winforms (we filter it out by not defining HAS_WINFORMS)
+       "ObservableConcurrencyTest.cs",
+       };
+
+foreach (var ass in asses) {
+
+       var monoass = ass == "Microsoft.Reactive.Testing" ?
+               "Mono.Reactive.Testing" : ass;
+       var basePath = "../../external/rx/Rx.NET";
+       var csproj = Path.Combine (basePath, ass, ass + ".csproj");
+       var pathPrefix = ass == "Tests.System.Reactive" ? "../../" : "../";
+
+       // tests are built under Mono.Reactive.Testing directory.
+       var sources =
+               monoass == "Tests.System.Reactive" ?
+               Path.Combine ("Mono.Reactive.Testing", "Mono.Reactive.Testing_test.dll.sources") :
+               Path.Combine (monoass, monoass + ".dll.sources");
+
+       var doc = XDocument.Load (csproj);
+       var rootNS = doc.XPathSelectElement ("//*[local-name()='RootNamespace']").Value;
+       using (var tw = File.CreateText (sources)) {
+               foreach (var path in doc.XPathSelectElements ("//*[local-name()='Compile']")
+                       .Select (el => el.Attribute ("Include").Value)
+                       .Select (s => s.Replace ("\\", "/")))
+                       if (!blacklist.Any (b => path.Contains (b)))
+                               tw.WriteLine (Path.Combine (pathPrefix, basePath, ass, path));
+       }
+
+       var argsPath = Path.Combine (Path.GetDirectoryName (sources), "more_build_args");
+       using (var tw = File.CreateText (argsPath)) {
+               tw.WriteLine ("-d:SIGNED");
+               tw.WriteLine ("-delaysign");
+               tw.WriteLine ("-keyfile:../reactive.pub");
+
+               foreach (var path in doc.XPathSelectElements ("//*[local-name()='EmbeddedResource']")) {
+                       var res = path.Attribute ("Include").Value;
+                       var resx = Path.Combine (basePath, ass, res);
+                       var resFileName = res.Replace ("resx", "resources");
+                       var resxDest = Path.Combine (monoass, res);
+                       var resPath = Path.Combine (monoass, resFileName);
+                       if (File.Exists (resxDest))
+                               File.Delete (resxDest);
+                       File.Copy (resx, resxDest);
+                       //Process.Start ("resgen", String.Format ("{0} {1}", resx, resPath));
+                       tw.WriteLine ("-resource:{0},{1}.{2}", resFileName, rootNS, resFileName);
+               }
+       }
+}
+
diff --git a/mcs/class/corlib/Documentation/en/System/Action.xml b/mcs/class/corlib/Documentation/en/System/Action.xml
deleted file mode 100644 (file)
index 724af18..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="Action" FullName="System.Action">
-  <TypeSignature Language="C#" Value="public delegate void Action();" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters />
-  <ReturnValue>
-    <ReturnType>System.Void</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Action`1.xml b/mcs/class/corlib/Documentation/en/System/Action`1.xml
deleted file mode 100644 (file)
index accc1e8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<Type Name="Action&lt;T&gt;" FullName="System.Action&lt;T&gt;">
-  <TypeSignature Language="C#" Value="public delegate void Action&lt;in T&gt;(T obj);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>2.0.0.0</AssemblyVersion>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Parameters>
-    <Parameter Name="obj" Type="T" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>System.Void</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T">The type.   </typeparam>
-    <param name="obj">The object on which to perform an action.</param>
-    <summary>A delegate to a method that returns no values, and takes one parameter.</summary>
-    <remarks>Since the compiler can infer the types, you do not need to provide the type, this is typically used with the <see cref="T:System.Array.Foreach" /> method or the <see cref="T:System.Collections.Generic.List" />'s ForEach method.
-
-<example><code lang="C#">
-//
-// Simple "echo" implementation
-//
-using System;
-
-class X {
-
-       static void Main (string [] args)
-       {
-               Array.ForEach (args, print);
-               Console.WriteLine ();
-       }
-
-       static void print (string a)
-       {
-               Console.Write (a);
-               Console.Write (" ");
-       }
-}
-  </code></example></remarks>
-    <since version=".NET 2.0" />
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Action`2.xml b/mcs/class/corlib/Documentation/en/System/Action`2.xml
deleted file mode 100644 (file)
index 8241ea6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<Type Name="Action&lt;T1,T2&gt;" FullName="System.Action&lt;T1,T2&gt;">
-  <TypeSignature Language="C#" Value="public delegate void Action&lt;in T1,in T2&gt;(T1 arg1, T2 arg2);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>System.Void</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Action`3.xml b/mcs/class/corlib/Documentation/en/System/Action`3.xml
deleted file mode 100644 (file)
index b535b47..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<Type Name="Action&lt;T1,T2,T3&gt;" FullName="System.Action&lt;T1,T2,T3&gt;">
-  <TypeSignature Language="C#" Value="public delegate void Action&lt;in T1,in T2,in T3&gt;(T1 arg1, T2 arg2, T3 arg3);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T3">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-    <Parameter Name="arg3" Type="T3" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>System.Void</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <typeparam name="T3">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <param name="arg3">To be added.</param>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Action`4.xml b/mcs/class/corlib/Documentation/en/System/Action`4.xml
deleted file mode 100644 (file)
index 0c0ba7b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<Type Name="Action&lt;T1,T2,T3,T4&gt;" FullName="System.Action&lt;T1,T2,T3,T4&gt;">
-  <TypeSignature Language="C#" Value="public delegate void Action&lt;in T1,in T2,in T3,in T4&gt;(T1 arg1, T2 arg2, T3 arg3, T4 arg4);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T3">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T4">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-    <Parameter Name="arg3" Type="T3" />
-    <Parameter Name="arg4" Type="T4" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>System.Void</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <typeparam name="T3">To be added.</typeparam>
-    <typeparam name="T4">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <param name="arg3">To be added.</param>
-    <param name="arg4">To be added.</param>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Func`1.xml b/mcs/class/corlib/Documentation/en/System/Func`1.xml
deleted file mode 100644 (file)
index a83dfa2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<Type Name="Func&lt;TResult&gt;" FullName="System.Func&lt;TResult&gt;">
-  <TypeSignature Language="C#" Value="public delegate TResult Func&lt;out TResult&gt;();" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="TResult">
-      <Constraints>
-        <ParameterAttribute>Covariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters />
-  <ReturnValue>
-    <ReturnType>TResult</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="TResult">To be added.</typeparam>
-    <summary>To be added.</summary>
-    <value>To be added.</value>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Func`2.xml b/mcs/class/corlib/Documentation/en/System/Func`2.xml
deleted file mode 100644 (file)
index 54d8e04..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="Func&lt;T,TResult&gt;" FullName="System.Func&lt;T,TResult&gt;">
-  <TypeSignature Language="C#" Value="public delegate TResult Func&lt;in T,out TResult&gt;(T arg1);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="TResult">
-      <Constraints>
-        <ParameterAttribute>Covariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>TResult</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T">To be added.</typeparam>
-    <typeparam name="TResult">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <summary>To be added.</summary>
-    <value>To be added.</value>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Func`3.xml b/mcs/class/corlib/Documentation/en/System/Func`3.xml
deleted file mode 100644 (file)
index 98b1f6b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<Type Name="Func&lt;T1,T2,TResult&gt;" FullName="System.Func&lt;T1,T2,TResult&gt;">
-  <TypeSignature Language="C#" Value="public delegate TResult Func&lt;in T1,in T2,out TResult&gt;(T1 arg1, T2 arg2);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="TResult">
-      <Constraints>
-        <ParameterAttribute>Covariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>TResult</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <typeparam name="TResult">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <summary>To be added.</summary>
-    <value>To be added.</value>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Func`4.xml b/mcs/class/corlib/Documentation/en/System/Func`4.xml
deleted file mode 100644 (file)
index e230df7..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<Type Name="Func&lt;T1,T2,T3,TResult&gt;" FullName="System.Func&lt;T1,T2,T3,TResult&gt;">
-  <TypeSignature Language="C#" Value="public delegate TResult Func&lt;in T1,in T2,in T3,out TResult&gt;(T1 arg1, T2 arg2, T3 arg3);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T3">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="TResult">
-      <Constraints>
-        <ParameterAttribute>Covariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-    <Parameter Name="arg3" Type="T3" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>TResult</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <typeparam name="T3">To be added.</typeparam>
-    <typeparam name="TResult">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <param name="arg3">To be added.</param>
-    <summary>To be added.</summary>
-    <value>To be added.</value>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/Func`5.xml b/mcs/class/corlib/Documentation/en/System/Func`5.xml
deleted file mode 100644 (file)
index dcba2aa..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<Type Name="Func&lt;T1,T2,T3,T4,TResult&gt;" FullName="System.Func&lt;T1,T2,T3,T4,TResult&gt;">
-  <TypeSignature Language="C#" Value="public delegate TResult Func&lt;in T1,in T2,in T3,in T4,out TResult&gt;(T1 arg1, T2 arg2, T3 arg3, T4 arg4);" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <TypeParameters>
-    <TypeParameter Name="T1">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T2">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T3">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="T4">
-      <Constraints>
-        <ParameterAttribute>Contravariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-    <TypeParameter Name="TResult">
-      <Constraints>
-        <ParameterAttribute>Covariant</ParameterAttribute>
-      </Constraints>
-    </TypeParameter>
-  </TypeParameters>
-  <Base>
-    <BaseTypeName>System.Delegate</BaseTypeName>
-  </Base>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Parameters>
-    <Parameter Name="arg1" Type="T1" />
-    <Parameter Name="arg2" Type="T2" />
-    <Parameter Name="arg3" Type="T3" />
-    <Parameter Name="arg4" Type="T4" />
-  </Parameters>
-  <ReturnValue>
-    <ReturnType>TResult</ReturnType>
-  </ReturnValue>
-  <Docs>
-    <typeparam name="T1">To be added.</typeparam>
-    <typeparam name="T2">To be added.</typeparam>
-    <typeparam name="T3">To be added.</typeparam>
-    <typeparam name="T4">To be added.</typeparam>
-    <typeparam name="TResult">To be added.</typeparam>
-    <param name="arg1">To be added.</param>
-    <param name="arg2">To be added.</param>
-    <param name="arg3">To be added.</param>
-    <param name="arg4">To be added.</param>
-    <summary>To be added.</summary>
-    <value>To be added.</value>
-    <remarks>To be added.</remarks>
-  </Docs>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/InvalidTimeZoneException.xml b/mcs/class/corlib/Documentation/en/System/InvalidTimeZoneException.xml
deleted file mode 100644 (file)
index f3783b5..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<Type Name="InvalidTimeZoneException" FullName="System.InvalidTimeZoneException">
-  <TypeSignature Language="C#" Value="public class InvalidTimeZoneException : Exception" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.Exception</BaseTypeName>
-  </Base>
-  <Interfaces />
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public InvalidTimeZoneException ();" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public InvalidTimeZoneException (string message);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="protected InvalidTimeZoneException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext sc);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="sc" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="sc">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public InvalidTimeZoneException (string message, Exception e);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-        <Parameter Name="e" Type="System.Exception" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <param name="e">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-  </Members>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/TimeZoneInfo+AdjustmentRule.xml b/mcs/class/corlib/Documentation/en/System/TimeZoneInfo+AdjustmentRule.xml
deleted file mode 100644 (file)
index 03cdb17..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<Type Name="TimeZoneInfo+AdjustmentRule" FullName="System.TimeZoneInfo+AdjustmentRule">
-  <TypeSignature Language="C#" Value="public sealed class TimeZoneInfo.AdjustmentRule : IEquatable&lt;TimeZoneInfo.AdjustmentRule&gt;, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.Object</BaseTypeName>
-  </Base>
-  <Interfaces>
-    <Interface>
-      <InterfaceName>System.IEquatable&lt;System.TimeZoneInfo+AdjustmentRule&gt;</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
-    </Interface>
-  </Interfaces>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName="CreateAdjustmentRule">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo.AdjustmentRule CreateAdjustmentRule (DateTime dateStart, DateTime dateEnd, TimeSpan daylightDelta, TimeZoneInfo.TransitionTime daylightTransitionStart, TimeZoneInfo.TransitionTime daylightTransitionEnd);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+AdjustmentRule</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateStart" Type="System.DateTime" />
-        <Parameter Name="dateEnd" Type="System.DateTime" />
-        <Parameter Name="daylightDelta" Type="System.TimeSpan" />
-        <Parameter Name="daylightTransitionStart" Type="System.TimeZoneInfo+TransitionTime" />
-        <Parameter Name="daylightTransitionEnd" Type="System.TimeZoneInfo+TransitionTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateStart">To be added.</param>
-        <param name="dateEnd">To be added.</param>
-        <param name="daylightDelta">To be added.</param>
-        <param name="daylightTransitionStart">To be added.</param>
-        <param name="daylightTransitionEnd">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DateEnd">
-      <MemberSignature Language="C#" Value="public DateTime DateEnd { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DateStart">
-      <MemberSignature Language="C#" Value="public DateTime DateStart { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DaylightDelta">
-      <MemberSignature Language="C#" Value="public TimeSpan DaylightDelta { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DaylightTransitionEnd">
-      <MemberSignature Language="C#" Value="public TimeZoneInfo.TransitionTime DaylightTransitionEnd { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DaylightTransitionStart">
-      <MemberSignature Language="C#" Value="public TimeZoneInfo.TransitionTime DaylightTransitionStart { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Equals">
-      <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo.AdjustmentRule other);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="other" Type="System.TimeZoneInfo+AdjustmentRule" />
-      </Parameters>
-      <Docs>
-        <param name="other">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetHashCode">
-      <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
-      <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="sender" Type="System.Object" />
-      </Parameters>
-      <Docs>
-        <param name="sender">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
-      <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="context">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-  </Members>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/TimeZoneInfo+TransitionTime.xml b/mcs/class/corlib/Documentation/en/System/TimeZoneInfo+TransitionTime.xml
deleted file mode 100644 (file)
index 677456c..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-<Type Name="TimeZoneInfo+TransitionTime" FullName="System.TimeZoneInfo+TransitionTime">
-  <TypeSignature Language="C#" Value="public struct TimeZoneInfo.TransitionTime : IEquatable&lt;TimeZoneInfo.TransitionTime&gt;, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.ValueType</BaseTypeName>
-  </Base>
-  <Interfaces>
-    <Interface>
-      <InterfaceName>System.IEquatable&lt;System.TimeZoneInfo+TransitionTime&gt;</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
-    </Interface>
-  </Interfaces>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName="CreateFixedDateRule">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo.TransitionTime CreateFixedDateRule (DateTime timeOfDay, int month, int day);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="timeOfDay" Type="System.DateTime" />
-        <Parameter Name="month" Type="System.Int32" />
-        <Parameter Name="day" Type="System.Int32" />
-      </Parameters>
-      <Docs>
-        <param name="timeOfDay">To be added.</param>
-        <param name="month">To be added.</param>
-        <param name="day">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="CreateFloatingDateRule">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo.TransitionTime CreateFloatingDateRule (DateTime timeOfDay, int month, int week, DayOfWeek dayOfWeek);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+TransitionTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="timeOfDay" Type="System.DateTime" />
-        <Parameter Name="month" Type="System.Int32" />
-        <Parameter Name="week" Type="System.Int32" />
-        <Parameter Name="dayOfWeek" Type="System.DayOfWeek" />
-      </Parameters>
-      <Docs>
-        <param name="timeOfDay">To be added.</param>
-        <param name="month">To be added.</param>
-        <param name="week">To be added.</param>
-        <param name="dayOfWeek">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Day">
-      <MemberSignature Language="C#" Value="public int Day { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DayOfWeek">
-      <MemberSignature Language="C#" Value="public DayOfWeek DayOfWeek { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DayOfWeek</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Equals">
-      <MemberSignature Language="C#" Value="public override bool Equals (object other);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="other" Type="System.Object" />
-      </Parameters>
-      <Docs>
-        <param name="other">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Equals">
-      <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo.TransitionTime other);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="other" Type="System.TimeZoneInfo+TransitionTime" />
-      </Parameters>
-      <Docs>
-        <param name="other">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetHashCode">
-      <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsFixedDateRule">
-      <MemberSignature Language="C#" Value="public bool IsFixedDateRule { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Month">
-      <MemberSignature Language="C#" Value="public int Month { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="op_Equality">
-      <MemberSignature Language="C#" Value="public static bool op_Equality (TimeZoneInfo.TransitionTime t1, TimeZoneInfo.TransitionTime t2);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="t1" Type="System.TimeZoneInfo+TransitionTime" />
-        <Parameter Name="t2" Type="System.TimeZoneInfo+TransitionTime" />
-      </Parameters>
-      <Docs>
-        <param name="t1">To be added.</param>
-        <param name="t2">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="op_Inequality">
-      <MemberSignature Language="C#" Value="public static bool op_Inequality (TimeZoneInfo.TransitionTime t1, TimeZoneInfo.TransitionTime t2);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="t1" Type="System.TimeZoneInfo+TransitionTime" />
-        <Parameter Name="t2" Type="System.TimeZoneInfo+TransitionTime" />
-      </Parameters>
-      <Docs>
-        <param name="t1">To be added.</param>
-        <param name="t2">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
-      <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="sender" Type="System.Object" />
-      </Parameters>
-      <Docs>
-        <param name="sender">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
-      <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="context">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="TimeOfDay">
-      <MemberSignature Language="C#" Value="public DateTime TimeOfDay { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Week">
-      <MemberSignature Language="C#" Value="public int Week { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-  </Members>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/TimeZoneInfo.xml b/mcs/class/corlib/Documentation/en/System/TimeZoneInfo.xml
deleted file mode 100644 (file)
index 1fdf45c..0000000
+++ /dev/null
@@ -1,808 +0,0 @@
-<Type Name="TimeZoneInfo" FullName="System.TimeZoneInfo">
-  <TypeSignature Language="C#" Value="public sealed class TimeZoneInfo : IEquatable&lt;TimeZoneInfo&gt;, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.Object</BaseTypeName>
-  </Base>
-  <Interfaces>
-    <Interface>
-      <InterfaceName>System.IEquatable&lt;System.TimeZoneInfo&gt;</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
-    </Interface>
-    <Interface>
-      <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
-    </Interface>
-  </Interfaces>
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName="BaseUtcOffset">
-      <MemberSignature Language="C#" Value="public TimeSpan BaseUtcOffset { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ClearCachedData">
-      <MemberSignature Language="C#" Value="public static void ClearCachedData ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTime">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="destinationTimeZone">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTime">
-      <MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTime (DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTimeOffset</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-        <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <param name="destinationTimeZone">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTime">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="sourceTimeZone" Type="System.TimeZoneInfo" />
-        <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="sourceTimeZone">To be added.</param>
-        <param name="destinationTimeZone">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeBySystemTimeZoneId">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string destinationTimeZoneId);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="destinationTimeZoneId" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="destinationTimeZoneId">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeBySystemTimeZoneId">
-      <MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTimeBySystemTimeZoneId (DateTimeOffset dateTimeOffset, string destinationTimeZoneId);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTimeOffset</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-        <Parameter Name="destinationTimeZoneId" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <param name="destinationTimeZoneId">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeBySystemTimeZoneId">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="sourceTimeZoneId" Type="System.String" />
-        <Parameter Name="destinationTimeZoneId" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="sourceTimeZoneId">To be added.</param>
-        <param name="destinationTimeZoneId">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeFromUtc">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTimeFromUtc (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="destinationTimeZone">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeToUtc">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ConvertTimeToUtc">
-      <MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.DateTime</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-        <Parameter Name="sourceTimeZone" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <param name="sourceTimeZone">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="CreateCustomTimeZone">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="id" Type="System.String" />
-        <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
-        <Parameter Name="displayName" Type="System.String" />
-        <Parameter Name="standardDisplayName" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="id">To be added.</param>
-        <param name="baseUtcOffset">To be added.</param>
-        <param name="displayName">To be added.</param>
-        <param name="standardDisplayName">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="CreateCustomTimeZone">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.AdjustmentRule[] adjustmentRules);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="id" Type="System.String" />
-        <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
-        <Parameter Name="displayName" Type="System.String" />
-        <Parameter Name="standardDisplayName" Type="System.String" />
-        <Parameter Name="daylightDisplayName" Type="System.String" />
-        <Parameter Name="adjustmentRules" Type="System.TimeZoneInfo+AdjustmentRule[]" />
-      </Parameters>
-      <Docs>
-        <param name="id">To be added.</param>
-        <param name="baseUtcOffset">To be added.</param>
-        <param name="displayName">To be added.</param>
-        <param name="standardDisplayName">To be added.</param>
-        <param name="daylightDisplayName">To be added.</param>
-        <param name="adjustmentRules">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="CreateCustomTimeZone">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.AdjustmentRule[] adjustmentRules, bool disableDaylightSavingTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="id" Type="System.String" />
-        <Parameter Name="baseUtcOffset" Type="System.TimeSpan" />
-        <Parameter Name="displayName" Type="System.String" />
-        <Parameter Name="standardDisplayName" Type="System.String" />
-        <Parameter Name="daylightDisplayName" Type="System.String" />
-        <Parameter Name="adjustmentRules" Type="System.TimeZoneInfo+AdjustmentRule[]" />
-        <Parameter Name="disableDaylightSavingTime" Type="System.Boolean" />
-      </Parameters>
-      <Docs>
-        <param name="id">To be added.</param>
-        <param name="baseUtcOffset">To be added.</param>
-        <param name="displayName">To be added.</param>
-        <param name="standardDisplayName">To be added.</param>
-        <param name="daylightDisplayName">To be added.</param>
-        <param name="adjustmentRules">To be added.</param>
-        <param name="disableDaylightSavingTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DaylightName">
-      <MemberSignature Language="C#" Value="public string DaylightName { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="DisplayName">
-      <MemberSignature Language="C#" Value="public string DisplayName { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Equals">
-      <MemberSignature Language="C#" Value="public bool Equals (TimeZoneInfo other);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="other" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="other">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="FindSystemTimeZoneById">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo FindSystemTimeZoneById (string id);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="id" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="id">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="FromSerializedString">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo FromSerializedString (string source);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="source" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="source">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetAdjustmentRules">
-      <MemberSignature Language="C#" Value="public TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo+AdjustmentRule[]</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetAmbiguousTimeOffsets">
-      <MemberSignature Language="C#" Value="public TimeSpan[] GetAmbiguousTimeOffsets (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan[]</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetAmbiguousTimeOffsets">
-      <MemberSignature Language="C#" Value="public TimeSpan[] GetAmbiguousTimeOffsets (DateTimeOffset dateTimeOffset);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan[]</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetHashCode">
-      <MemberSignature Language="C#" Value="public override int GetHashCode ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Int32</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetSystemTimeZones">
-      <MemberSignature Language="C#" Value="public static System.Collections.ObjectModel.ReadOnlyCollection&lt;TimeZoneInfo&gt; GetSystemTimeZones ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection&lt;System.TimeZoneInfo&gt;</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetUtcOffset">
-      <MemberSignature Language="C#" Value="public TimeSpan GetUtcOffset (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="GetUtcOffset">
-      <MemberSignature Language="C#" Value="public TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeSpan</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="HasSameRules">
-      <MemberSignature Language="C#" Value="public bool HasSameRules (TimeZoneInfo other);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="other" Type="System.TimeZoneInfo" />
-      </Parameters>
-      <Docs>
-        <param name="other">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Id">
-      <MemberSignature Language="C#" Value="public string Id { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsAmbiguousTime">
-      <MemberSignature Language="C#" Value="public bool IsAmbiguousTime (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsAmbiguousTime">
-      <MemberSignature Language="C#" Value="public bool IsAmbiguousTime (DateTimeOffset dateTimeOffset);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsDaylightSavingTime">
-      <MemberSignature Language="C#" Value="public bool IsDaylightSavingTime (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsDaylightSavingTime">
-      <MemberSignature Language="C#" Value="public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
-      </Parameters>
-      <Docs>
-        <param name="dateTimeOffset">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="IsInvalidTime">
-      <MemberSignature Language="C#" Value="public bool IsInvalidTime (DateTime dateTime);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="dateTime" Type="System.DateTime" />
-      </Parameters>
-      <Docs>
-        <param name="dateTime">To be added.</param>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Local">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo Local { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="StandardName">
-      <MemberSignature Language="C#" Value="public string StandardName { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="SupportsDaylightSavingTime">
-      <MemberSignature Language="C#" Value="public bool SupportsDaylightSavingTime { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Boolean</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization">
-      <MemberSignature Language="C#" Value="void IDeserializationCallback.OnDeserialization (object sender);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="sender" Type="System.Object" />
-      </Parameters>
-      <Docs>
-        <param name="sender">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
-      <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.Void</ReturnType>
-      </ReturnValue>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="context">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ToSerializedString">
-      <MemberSignature Language="C#" Value="public string ToSerializedString ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="ToString">
-      <MemberSignature Language="C#" Value="public override string ToString ();" />
-      <MemberType>Method</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.String</ReturnType>
-      </ReturnValue>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <returns>To be added.</returns>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName="Utc">
-      <MemberSignature Language="C#" Value="public static TimeZoneInfo Utc { get; }" />
-      <MemberType>Property</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <ReturnValue>
-        <ReturnType>System.TimeZoneInfo</ReturnType>
-      </ReturnValue>
-      <Docs>
-        <summary>To be added.</summary>
-        <value>To be added.</value>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-  </Members>
-</Type>
diff --git a/mcs/class/corlib/Documentation/en/System/TimeZoneNotFoundException.xml b/mcs/class/corlib/Documentation/en/System/TimeZoneNotFoundException.xml
deleted file mode 100644 (file)
index 975fe7f..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<Type Name="TimeZoneNotFoundException" FullName="System.TimeZoneNotFoundException">
-  <TypeSignature Language="C#" Value="public class TimeZoneNotFoundException : Exception" />
-  <AssemblyInfo>
-    <AssemblyName>mscorlib</AssemblyName>
-    <AssemblyVersion>4.0.0.0</AssemblyVersion>
-  </AssemblyInfo>
-  <Base>
-    <BaseTypeName>System.Exception</BaseTypeName>
-  </Base>
-  <Interfaces />
-  <Attributes>
-    <Attribute>
-      <AttributeName>System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")</AttributeName>
-    </Attribute>
-  </Attributes>
-  <Docs>
-    <summary>To be added.</summary>
-    <remarks>To be added.</remarks>
-  </Docs>
-  <Members>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public TimeZoneNotFoundException ();" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters />
-      <Docs>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public TimeZoneNotFoundException (string message);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="protected TimeZoneNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext sc);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
-        <Parameter Name="sc" Type="System.Runtime.Serialization.StreamingContext" />
-      </Parameters>
-      <Docs>
-        <param name="info">To be added.</param>
-        <param name="sc">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-    <Member MemberName=".ctor">
-      <MemberSignature Language="C#" Value="public TimeZoneNotFoundException (string message, Exception e);" />
-      <MemberType>Constructor</MemberType>
-      <AssemblyInfo>
-        <AssemblyVersion>4.0.0.0</AssemblyVersion>
-      </AssemblyInfo>
-      <Parameters>
-        <Parameter Name="message" Type="System.String" />
-        <Parameter Name="e" Type="System.Exception" />
-      </Parameters>
-      <Docs>
-        <param name="message">To be added.</param>
-        <param name="e">To be added.</param>
-        <summary>To be added.</summary>
-        <remarks>To be added.</remarks>
-      </Docs>
-    </Member>
-  </Members>
-</Type>
index 6f6c04cbbf8a69069bcf1cf7f434f2017a1da8bc..b97f416a83d50549462a94c2bb9b9f9fd10a9c78 100644 (file)
@@ -27,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Collections;
 using System.Reflection;
@@ -153,3 +153,4 @@ namespace Mono.Interop
                }
        }
 }
+#endif
index 4d42f16293646454c4ada2dd305ee995e1b5f023..4c7dced4bfba6e3c062e0c2a9710a3ed61869769 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Runtime.InteropServices;
 
@@ -39,3 +40,4 @@ namespace Mono.Interop
        {
        }
 }
+#endif
index 197058974f8d0591f238c6cffc9b5b705efbe11c..0755113912f21cbed11b2274d20f966ea7e190b8 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Runtime.InteropServices;
 
@@ -39,3 +40,4 @@ namespace Mono.Interop
        {
        }
 }
+#endif
index 54600853272c3c96a81135e3106af7718430aa06..8dfdbd165674c8f9022c78f11589aa83178c6ba9 100644 (file)
@@ -45,16 +45,15 @@ using System.Text;
 namespace Mono {
 
 #if MONO_DATACONVERTER_PUBLIC
-       unsafe public abstract class DataConverter {
-#else
-       unsafe internal abstract class DataConverter {
+       public
+#endif
+       unsafe abstract class DataConverter {
 
 // Disables the warning: CLS compliance checking will not be performed on
 //  `XXXX' because it is not visible from outside this assembly
 #pragma warning disable  3019
-#endif
-               static DataConverter SwapConv = new SwapConverter ();
-               static DataConverter CopyConv = new CopyConverter ();
+               static readonly DataConverter SwapConv = new SwapConverter ();
+               static readonly DataConverter CopyConv = new CopyConverter ();
 
                public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
                        
index 02113358021b795cd8d3eb873ff73c66549469fa..d7b3544dfe5a9ee1ba57fbb171344fedc9492eaa 100644 (file)
@@ -110,5 +110,15 @@ namespace System.Diagnostics
                public Debugger()
                {
                }
+
+#if MONODROID
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               private extern static void Mono_UnhandledException_internal (Exception ex);
+
+               internal static void Mono_UnhandledException (Exception ex)
+               {
+                       Mono_UnhandledException_internal (ex);
+               }
+#endif
        }
 }
index 5493215a529e6890d10c94303b8023069a33e479..0b0da05f27e41c5c1b030439487744810bb5a13f 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Resources;
@@ -1197,3 +1198,4 @@ namespace System.Reflection.Emit
 #endif
        }
 }
+#endif
index 68ed8819965cd942f2b4f3f0421c887a313fc3ae..1aceb94ef07fb636b397d88853fcd8c23a1316f4 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit
@@ -45,3 +46,4 @@ namespace System.Reflection.Emit
 #endif
   }
 }
+#endif
index 88a27676b7c57283ccf29cf50377f304c9d8a3b6..2391dc8be2cae1cf3696be5be1e14be8c5b007e4 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -411,3 +412,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index 9b29c058dac094b7dc90892ef76c8f430d099366..ea3cee589d0694f9b06fbb4149255699745f1d4c 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Globalization;
 using System.Reflection;
@@ -192,3 +193,4 @@ namespace System.Reflection.Emit
        }
 }
 
+#endif
index d389617c5bc159ef63ef69e2d4cb552ef9d14bd1..862420a6cc00386986437580b30ffe69c4706d35 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -535,3 +536,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index eca84939f88fc2aba56b1e5a48292097d77e30d9..4d8b2ee34ba918eaaca8660fbcd515c1b552b850 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;
@@ -460,3 +461,4 @@ namespace System.Reflection.Emit
        }
 
 }
+#endif
index 17551e3874c5486cb9c7780536acd4a6f7fbc6b2..c086c63bd15be59bdd815103f4356af28233bdb2 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Runtime.InteropServices;
@@ -129,3 +130,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 5378f7e2a01ac831793cfaef65d451e912c46b6d..931573d5449459c3860e103b5dab2811d820ee2c 100644 (file)
@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 
 using System;
 using System.Reflection;
@@ -450,3 +451,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 2d0c5249701a97ed34e127795ed83433f1723323..50a674473779299209f339f4915230de6f31272a 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -419,3 +420,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index 457e343b9e3fce69698b3ddacdbb536ac1093574..2393e2abc9b64a55857808cf1b0c01747bbbc921 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -161,3 +162,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 32e957493921a18250d341910c3316ab07c7fe53..2e4367ab96573525b9f8da270f134b7d83b8d06a 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Collections;
 using System.Globalization;
@@ -129,3 +130,4 @@ namespace System.Reflection.Emit
                }
        }
 }
+#endif
index 6d04142bc52297ef01038a4d55a98949c64c8d98..912aa16abb561219c3bced66566f861ab48948bf 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -100,3 +101,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index d3da37811c4ff7464e4c1a6c1c9134138bb0ae0f..053d8c831e4d05ea750b5b98b6324e0bb84d254f 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001-2002 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -247,3 +248,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index c431bad1e9c9865fe84b6b8fa182f72dbafbe7ae..ca3d43d85f94e49655d5a260e903cf04fd51b103 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Globalization;
 using System.Reflection;
@@ -128,3 +129,4 @@ namespace System.Reflection.Emit
                }
        }
 }
+#endif
index 85cc6599ee68be075f36f9a36fb4d9b325fe4abd..7c7135ee17225f65d8a7cf1279ca2f15fb598938 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -99,3 +100,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 55795aa4478b2cf855d9b14fbc4d5e6f5b642432..0a7a464b7689b621308c54d3e7af15eaadf3aab6 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -87,3 +88,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 7f51aea6a38358ba693439081df86db3bc2f724d..696ec9cef3a69e9f45eb30dd3d46704398152997 100644 (file)
@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;
@@ -456,3 +457,4 @@ namespace System.Reflection.Emit
                }
        }
 }
+#endif
index cd521f59a38ca88d9164be18ca676dd3abe8b921..cc039c54d9c99082b7c03665867cdd094978b79b 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Collections;
 using System.Diagnostics.SymbolStore;
@@ -1156,3 +1157,4 @@ namespace System.Reflection.Emit {
                public int EndCol;
        }
 }
+#endif
index 4834aa2cf2d837e8352424331589e1a66f5f7af9..94d35f80f51808459d13eda5261c5367b0f4c0a5 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -72,3 +73,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index 87a72256aa5b8a9ce36353502543b9366ef0f75f..98c9addf5042a6b7e3e1c3de26954577bbfcc4b8 100644 (file)
@@ -33,6 +33,7 @@
 // (C) 2001, 2002 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -129,3 +130,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index 11644739c0b0b3664ed6cb5fa139a51ff12269da..ef727b615de442426cc7cf20892b05968b9ae8f5 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -679,3 +680,4 @@ namespace System.Reflection.Emit
 #endif
        }
 }
+#endif
index 6f37b59ce18d04b8cb7c59b668c1e5bd261b5107..aa19ecef3bf94e12a6756ec021d142fb4f3e4514 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Globalization;
 using System.Reflection;
@@ -279,3 +280,4 @@ namespace System.Reflection.Emit
        }
 }
 
+#endif
index 2aeb1eedb736eccfab3296db954fdf9ce207d47f..b4bc04785229c75e78c391c082407cfae1c3b2ad 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Security.Permissions;
 using System.Runtime.InteropServices;
 
@@ -81,3 +82,4 @@ namespace System.Reflection.Emit
        }
 }
 
+#endif
index f4ad83a767aebb7577d13d61172971fe5d7f6bdd..2ccff2a919bf83e184df1bdb0476d7cf456a5128 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -98,3 +99,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 9548789299dbe85dc342ccc4e6d220e82b158da7..76524c6ab1d2e9b8770ff73d598d744cd866592c 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Collections;
@@ -994,3 +995,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 02c334dc5a0ba45fdc7832220af39acf627d1313..dc9ca4073eea67e9325b9126353883632fbb6e1c 100644 (file)
@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Globalization;
 using System.Runtime.CompilerServices;
@@ -146,3 +147,4 @@ namespace System.Reflection {
                }
        }
 }
+#endif
index e85c58f7009336c6e8647492c144cf9e6cf06dec..81edbd5b5ad44382a6662842d83f6e813940a794 100644 (file)
@@ -26,6 +26,7 @@
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -152,3 +153,4 @@ namespace System.Reflection.Emit {
                }
        }
 } 
+#endif
index 67ddad4a581323bc34bab0f11809093484e2224f..bcac4a31c1d4421dd23724a8dd74e3604236c4e9 100644 (file)
@@ -1,3 +1,4 @@
+#if !FULL_AOT_RUNTIME
 namespace System.Reflection.Emit {
        static class OpCodeNames {
                internal static readonly string [] names = {
@@ -308,3 +309,4 @@ namespace System.Reflection.Emit {
                };
        }
 }
+#endif
index c50e574bde82417420d35eeb1f3fe13579459372..681ea6e4ff58da99ad03856642bc6f4bc2d6de80 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -74,3 +75,4 @@ namespace System.Reflection.Emit {
        }
 
 }
+#endif
index 03317d2626f5da094b1f6d8d504192fd19532f52..840ee183ffcba131c010ab00eda22b672c6631a2 100644 (file)
@@ -1,3 +1,4 @@
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -928,3 +929,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index f7c5d0a7dc55f5189ad2ad0b5cb44dd5057dfe8e..c8f785d0d3d84d3341a7519d9936430d28916cc5 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -112,3 +113,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index f28340e0e24b020d1e5ebd272da56b4cb594b97c..4cf610fab3561f9e72eb1abcae318b25832aac9f 100644 (file)
@@ -22,6 +22,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -35,3 +36,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index f3db05c67baac715cade05ffc04f4107e3ec1f82..08052a3386e7344b5e141c5746eaa0c0351f6af9 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -71,3 +72,4 @@ namespace System.Reflection.Emit {
 }
 
 
+#endif
index a6a246d1074568c7516d08f3e489e4e804c716bc..97f998051304136cc366fea080def4168c65dd44 100644 (file)
@@ -32,6 +32,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -175,3 +176,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 87f56282a29fe87828cb8b71c2e7287b13db5bfe..9c42bb136f8a38334ee0104bba32edb067df01a5 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -98,3 +99,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 058930c9f9fcbf3e73bd84435a7708bb14ae175a..8e53d04614f6edf8656c1bcd719fbdcaefec4702 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -204,3 +205,4 @@ namespace System.Reflection.Emit {
        }
 }
 
+#endif
index 3d401a1b7a7ff927c28160af8beb4e72dd027885..578cf06a5d12e2bd27ae113edd8a1647f055b20d 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Globalization;
 using System.Reflection;
@@ -158,3 +159,4 @@ namespace System.Reflection.Emit
        }
 }
 
+#endif
index ca4868ec3ca0a93c2ca50ab34ad649c864e2a441..e1f2c846965167f1cb4c3028d00b1040977df0ce 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -98,3 +99,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 00a3f366807bc9ea08b09294ed3df6b1266e0237..d56f96256c0230333e03a1afe31b549d5c289e21 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -430,3 +431,4 @@ namespace System.Reflection.Emit {
                 }
        }
 }
+#endif
index 193feb610ecd2ae2e9ee70b494581b565b519ec3..9c6e32ee7b2d929b7c1cea69f76d11aa04e0f4a2 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -97,3 +98,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 524ea8d30598e57bda0c07b0a2b2c21381f3b615..689197c919cba83dcb55d5a2a50417a6e5cc7112 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -152,3 +153,4 @@ namespace System.Reflection.Emit {
        }
 
 }
+#endif
index 2bba43467ff0815a8b4e85a6b98b783f5ec0ade9..ece7c0c62105b32b4190623fc1d499ad13c31e97 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -96,3 +97,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index fc60d1a377a67fdd7d7b114b8b0c026db552da5a..462717057ccb0cf364ce10a8d0b79e8dc6b5a74c 100644 (file)
@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Text;
 using System.Reflection;
@@ -1928,3 +1929,4 @@ namespace System.Reflection.Emit
                }
        }
 }
+#endif
index 4a8a56b1d9e3ae5cab268a6f0a3888702a885b13..9a8970e9cf1d7b60c9e46f8edaf02188d95fee25 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -98,3 +99,4 @@ namespace System.Reflection.Emit {
 
 }
 
+#endif
index 9c123e9706800c70cfdcbaf99ff7095168d04445..7cf8c8a5717167a37f5c29d40678931067c77dfa 100644 (file)
@@ -31,6 +31,7 @@
 // (C) 2001-2002 Ximian, Inc.  http://www.ximian.com
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 using System.Runtime.InteropServices;
 using System;
@@ -128,3 +129,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif
index 6c26ab284a576fa926badc02992bb046e90cb34f..97e2bc6a984b12f8df8f435fcc7bf601e2e3f500 100644 (file)
@@ -889,7 +889,6 @@ namespace System.Reflection {
                                }
                        }
                }
-#endif
                
 #if NET_4_0
                public virtual PermissionSet PermissionSet {
@@ -901,6 +900,8 @@ namespace System.Reflection {
                }
 #endif
 
+#endif
+
 #if NET_4_0 || MOONLIGHT || MOBILE
                static Exception CreateNIE ()
                {
index 8e96227d2d292eda1c4e7a36b07fac64f2699cf3..f49c70a8474e84a700e982df9c667d20b6d09db6 100644 (file)
@@ -248,6 +248,9 @@ namespace System.Reflection {
 
                private bool IsPublicKeyValid {
                        get {
+#if FULL_AOT_RUNTIME
+                               return true;
+#else
                                // check for ECMA key
                                if (publicKey.Length == 16) {
                                        int i = 0;
@@ -281,6 +284,7 @@ namespace System.Reflection {
                                }
 
                                return false;
+#endif
                        }
                }
 
@@ -303,6 +307,9 @@ namespace System.Reflection {
 
                private byte [] ComputePublicKeyToken ()
                {
+#if FULL_AOT_RUNTIME
+                       return new byte [0];
+#else
                        HashAlgorithm ha = SHA1.Create ();
                        byte [] hash = ha.ComputeHash (publicKey);
                        // we need the last 8 bytes in reverse order
@@ -310,6 +317,7 @@ namespace System.Reflection {
                        Array.Copy (hash, (hash.Length - 8), token, 0, 8);
                        Array.Reverse (token, 0, 8);
                        return token;
+#endif
                }
 
                [MonoTODO]
index 3bb636451ed976488fc263a2ed96656e0d63753c..295b2960138bfc1d451eefeb89acd1bef747b2e6 100644 (file)
@@ -555,6 +555,7 @@ namespace System.Reflection
                                                var requiredType = methodArgs [j].ParameterType;
                                                if (types [j] == requiredType)
                                                        continue;
+#if !MOBILE
                                                if (types [j] == typeof (__ComObject) && requiredType.IsInterface) {
                                                        var iface = Marshal.GetComInterfaceForObject (parameters [j], requiredType);
                                                        if (iface != IntPtr.Zero) {
@@ -563,6 +564,7 @@ namespace System.Reflection
                                                                continue;
                                                        }
                                                }
+#endif
                                                break;
                                        }
 
index 7d82fdcb818283466175403ef2353627a181826e..61267f9cfd19ee94f650c97b18ab51bf139d8545 100644 (file)
@@ -84,6 +84,16 @@ namespace System.Reflection {
 #endif
                void AddEventHandler (object target, Delegate handler)
                {
+// this optimization cause problems with full AOT
+// see bug https://bugzilla.xamarin.com/show_bug.cgi?id=3682
+#if FULL_AOT_RUNTIME
+                       MethodInfo add = GetAddMethod ();
+                       if (add == null)
+                               throw new InvalidOperationException ("Cannot add a handler to an event that doesn't have a visible add method");
+                       if (target == null && !add.IsStatic)
+                               throw new TargetException ("Cannot add a handler to a non static event with a null target");
+                       add.Invoke (target, new object [] {handler});
+#else
                        if (cached_add_event == null) {
                                MethodInfo add = GetAddMethod ();
                                if (add == null)
@@ -99,6 +109,7 @@ namespace System.Reflection {
                        //if (target == null && is_instance)
                        //      throw new TargetException ("Cannot add a handler to a non static event with a null target");
                        cached_add_event (target, handler);
+#endif
                }
 
                public MethodInfo GetAddMethod() {
@@ -187,7 +198,13 @@ namespace System.Reflection {
                {
                        throw new NotImplementedException ();
                }
+
                delegate void AddEventAdapter (object _this, Delegate dele);
+
+// this optimization cause problems with full AOT
+// see bug https://bugzilla.xamarin.com/show_bug.cgi?id=3682
+// do not revove the above delegate or it's field since it's required by the runtime!
+#if !FULL_AOT_RUNTIME
                delegate void AddEvent<T, D> (T _this, D dele);
                delegate void StaticAddEvent<D> (D dele);
 
@@ -246,5 +263,6 @@ namespace System.Reflection {
                        adapterFrame = adapterFrame.MakeGenericMethod (typeVector);
                        return (AddEventAdapter)Delegate.CreateDelegate (typeof (AddEventAdapter), addHandlerDelegate, adapterFrame, true);
                }
+#endif
        }
 }
index b03c97bead8c2a390222518beb3b4273474c0b1e..1f62fe62fde273337a53f83be994e2c3db751001 100644 (file)
@@ -30,7 +30,9 @@
 
 using System.Diagnostics;
 using System.Globalization;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -181,6 +183,7 @@ namespace System.Reflection {
                }
 
                internal virtual int get_next_table_index (object obj, int table, bool inc) {
+#if !FULL_AOT_RUNTIME
                        if (this is MethodBuilder) {
                                MethodBuilder mb = (MethodBuilder)this;
                                return mb.get_next_table_index (obj, table, inc);
@@ -189,6 +192,7 @@ namespace System.Reflection {
                                ConstructorBuilder mb = (ConstructorBuilder)this;
                                return mb.get_next_table_index (obj, table, inc);
                        }
+#endif
                        throw new Exception ("Method is not a builder method");
                }
 
index 8bfead758167cf507506b4daad2b66a83c21f4bb..b861da70e00c7ec541394c814b7e50dc310ef39a 100644 (file)
@@ -30,7 +30,9 @@ using System;
 using System.Collections;
 using System.Globalization;
 using System.Runtime.InteropServices;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Collections.Generic;
 
 namespace System.Reflection {
@@ -57,7 +59,7 @@ namespace System.Reflection {
                        throw new ArgumentException ("name", "Name cannot be empty");
 
                        res = InternalGetType (null, name, throwOnError, ignoreCase);
-#if !(NET_4_0 || MOONLIGHT || MOBILE)
+#if !(NET_4_0 || MOONLIGHT || MOBILE) && !FULL_AOT_RUNTIME
                        if (res is TypeBuilder) {
                                if (throwOnError)
                                        throw new TypeLoadException (string.Format ("Could not load type '{0}' from assembly '{1}'", name, this));
index 9e6d28c61a9d8bbc578d64b830437983bf581e5f..ad5e9436fee22d32349fc7aa8367d1f5e8b6f1e1 100644 (file)
@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;
@@ -510,3 +511,4 @@ namespace System.Reflection
        }
 }
 
+#endif
index 40366b43d0f43101cc18d7e04a7229339d143c29..79d9e15a18d03e589618fabc7475c4dcea39b581 100644 (file)
@@ -34,7 +34,9 @@ using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Security;
 using System.Threading;
 using System.Text;
@@ -392,8 +394,10 @@ namespace System.Reflection {
                                        hasUserType = true;
                        }
 
+#if !FULL_AOT_RUNTIME
                        if (hasUserType)
                                return new MethodOnTypeBuilderInst (this, methodInstantiation);
+#endif
 
                        MethodInfo ret = MakeGenericMethod_impl (methodInstantiation);
                        if (ret == null)
index 8d16f7e63a6324b10550a3ec21ded6dfd2c42060..e072223b36e0b730ea7445999034bc33e3e80593 100644 (file)
@@ -25,7 +25,9 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
@@ -50,6 +52,7 @@ namespace System.Reflection
                protected ParameterInfo () {
                }
 
+#if !FULL_AOT_RUNTIME
                internal ParameterInfo (ParameterBuilder pb, Type type, MemberInfo member, int position) {
                        this.ClassImpl = type;
                        this.MemberImpl = member;
@@ -63,6 +66,7 @@ namespace System.Reflection
                                this.AttrsImpl = ParameterAttributes.None;
                        }
                }
+#endif
 
                /*FIXME this constructor looks very broken in the position parameter*/
                internal ParameterInfo (ParameterInfo pinfo, Type type, MemberInfo member, int position) {
index d9f68bb4e6d9a817654d8e361684dc0b9647e435..d30f264b39310be48e102b4ed104312eb37a9d98 100644 (file)
@@ -30,6 +30,7 @@
 // (C) 2002 Ximian, Inc.
 using System;
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices.ComTypes
 {
        [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices.ComTypes
                public int scode;
        }
 }
+#endif
index a20ba838fee5f8d902cd7334803829b17e795c05..dfc5a2a29f2d9440596efcacf5034d3ff8d357b8 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices
@@ -49,3 +50,4 @@ namespace System.Runtime.InteropServices
                }
        }
 }
+#endif
index f3d4b8b6bfbcbc4b95b87f7c09dd835c0290f927..0e61c36b7fd57029c7db92ec042e5a68b6a15426 100644 (file)
@@ -30,6 +30,7 @@
 
 using System;
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -49,3 +50,4 @@ namespace System.Runtime.InteropServices
        }
 }
 
+#endif
index 0588b940bb59ffeb951d9f6b9328f546d4ec795a..4bf947af4bce6a827bef0b3ab5da7834cd8a12cf 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices
@@ -60,3 +61,4 @@ namespace System.Runtime.InteropServices
                }
        }
 }
+#endif
index 487c890f088667c655ff24a8c3179464b3164613..1e335ba7c1c5ea8d18e2ebc709d364328e5bf811 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 using System.Reflection.Emit;
 
@@ -46,3 +47,4 @@ namespace System.Runtime.InteropServices {
                bool GetPrimaryInteropAssembly (Guid g, int major, int minor, int lcid, out string asmName, out string asmCodeBase);
        }
 }
+#endif
index 6e87d5902f34dcb0211794a8c799393364f9203c..8dc67cd262638972c18fbd2cce20db9ec090dc15 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices {
 
        [ComVisible (true)]
@@ -41,3 +42,4 @@ namespace System.Runtime.InteropServices {
 
        }
 }
+#endif
index c7983560e77d10f20168b615514e39b6b0d85732..b8ee0fedf174edc299bf20b9a5b75cf65680c698 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 
 namespace System.Runtime.InteropServices {
@@ -42,3 +43,4 @@ namespace System.Runtime.InteropServices {
                object ResolveRef (Assembly assembly);
        }
 }
+#endif
index 832992c8a58addf78ae3998a7ca19ed4b4223bfc..a51817b73206586117cf4bf3d4039871f87e90be 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 
 namespace System.Runtime.InteropServices {
@@ -41,3 +42,4 @@ namespace System.Runtime.InteropServices {
                Assembly ResolveRef([MarshalAs(UnmanagedType.Interface)] object typeLib);
        }
 }
+#endif
index 933a535514c8c0727c008334efa15d4614a3198b..2a26c7839592e83bf36a86f46b70da5e8fa2fca3 100644 (file)
@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
                }
        } 
 }
+#endif
index 1e9673cb3576aafb659dfdaeae965aa02980b135..4cfb7c2b5ebe0b0e7beab6047b350981997e03d5 100644 (file)
@@ -40,12 +40,11 @@ using System.Threading;
 
 using System.Runtime.ConstrainedExecution;
 #if !MOONLIGHT
+#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices.ComTypes;
-#endif
-
-#if !MOONLIGHT
 using Mono.Interop;
 #endif
+#endif
 
 namespace System.Runtime.InteropServices
 {
@@ -55,14 +54,20 @@ namespace System.Runtime.InteropServices
                public static readonly int SystemMaxDBCSCharSize = 2; // don't know what this is
                public static readonly int SystemDefaultCharSize = Environment.OSVersion.Platform == PlatformID.Win32NT ? 2 : 1;
 
+#if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int AddRefInternal (IntPtr pUnk);
+#endif
 
                public static int AddRef (IntPtr pUnk)
                {
+#if !MOBILE
                        if (pUnk == IntPtr.Zero)
                                throw new ArgumentException ("Value cannot be null.", "pUnk");
                        return AddRefInternal (pUnk);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -184,7 +189,7 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
                public static object CreateWrapperOfType (object o, Type t)
                {
                        __ComObject co = o as __ComObject;
@@ -267,7 +272,7 @@ namespace System.Runtime.InteropServices
                        FreeHGlobal (s);
                }
 
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
                public static Guid GenerateGuidForType (Type type)
                {
                        return type.GUID;
@@ -302,6 +307,7 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static IntPtr GetCCW (object o, Type T);
 
@@ -312,12 +318,17 @@ namespace System.Runtime.InteropServices
                        else
                                return GetCCW (o, T);
                }
+#endif
 
                public static IntPtr GetComInterfaceForObject (object o, Type T)
                {
+#if !MOBILE
                        IntPtr pItf = GetComInterfaceForObjectInternal (o, T);
                        AddRef (pItf);
                        return pItf;
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                [MonoTODO]
@@ -332,11 +343,14 @@ namespace System.Runtime.InteropServices
                        throw new NotSupportedException ("MSDN states user code should never need to call this method.");
                }
 
+#if !MOBILE
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static int GetComSlotForMethodInfoInternal (MemberInfo m);
+#endif
 
                public static int GetComSlotForMethodInfo (MemberInfo m)
                {
+#if !MOBILE
                        if (m == null)
                                throw new ArgumentNullException ("m");
                        if (!(m is MethodInfo))
@@ -344,6 +358,9 @@ namespace System.Runtime.InteropServices
                        if (!m.DeclaringType.IsInterface)
                                throw new ArgumentException ("The MemberInfo must be an interface method.", "m");
                        return GetComSlotForMethodInfoInternal (m);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                [MonoTODO]
@@ -372,8 +389,9 @@ namespace System.Runtime.InteropServices
 
                        return m.GetHINSTANCE ();
                }
-#endif // !NET_2_1
+#endif // !MOONLIGHT
 
+#if !FULL_AOT_RUNTIME
                [MonoTODO ("SetErrorInfo")]
                public static int GetHRForException (Exception e)
                {
@@ -447,11 +465,14 @@ namespace System.Runtime.InteropServices
                        Marshal.StructureToPtr(vt, pDstNativeVariant, false);
                }
 
+#if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private static extern object GetObjectForCCW (IntPtr pUnk);
+#endif
 
                public static object GetObjectForIUnknown (IntPtr pUnk)
                {
+#if !MOBILE
                        object obj = GetObjectForCCW (pUnk);
                        // was not a CCW
                        if (obj == null) {
@@ -459,6 +480,9 @@ namespace System.Runtime.InteropServices
                                obj = proxy.GetTransparentProxy ();
                        }
                        return obj;
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant)
@@ -510,6 +534,7 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
+#if !FULL_AOT_RUNTIME
                [Obsolete]
                [MonoTODO]
                public static string GetTypeInfoName (UCOMITypeInfo pTI)
@@ -577,6 +602,7 @@ namespace System.Runtime.InteropServices
                {
                        throw new NotImplementedException ();
                }
+#endif
 
                [MonoTODO]
                [Obsolete ("This method has been deprecated")]
@@ -585,8 +611,15 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern static bool IsComObject (object o);
+#else
+               public static bool IsComObject (object o)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif         
 
                [MonoTODO]
                public static bool IsTypeVisibleFromCom (Type t)
@@ -600,6 +633,7 @@ namespace System.Runtime.InteropServices
                        throw new NotImplementedException ();
                }
 #endif // !NET_2_1
+#endif
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
@@ -638,8 +672,15 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static string PtrToStringUni (IntPtr ptr, int len);
 
+#if !MOBILE
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static string PtrToStringBSTR (IntPtr ptr);
+#else
+               public static string PtrToStringBSTR (IntPtr ptr)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
                
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                [ComVisible (true)]
@@ -649,14 +690,20 @@ namespace System.Runtime.InteropServices
                [ComVisible (true)]
                public extern static object PtrToStructure (IntPtr ptr, Type structureType);
 
+#if !MOBILE
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int QueryInterfaceInternal (IntPtr pUnk, ref Guid iid, out IntPtr ppv);
+#endif
 
                public static int QueryInterface (IntPtr pUnk, ref Guid iid, out IntPtr ppv)
                {
+#if !MOBILE
                        if (pUnk == IntPtr.Zero)
                                throw new ArgumentException ("Value cannot be null.", "pUnk");
                        return QueryInterfaceInternal (pUnk, ref iid, out ppv);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                public static byte ReadByte (IntPtr ptr)
@@ -747,18 +794,26 @@ namespace System.Runtime.InteropServices
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
 
+#if !MOBILE
                [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int ReleaseInternal (IntPtr pUnk);
+#endif
 
                [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                public static int Release (IntPtr pUnk)
                {
+#if !MOBILE
                        if (pUnk == IntPtr.Zero)
                                throw new ArgumentException ("Value cannot be null.", "pUnk");
+
                        return ReleaseInternal (pUnk);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
+#if !FULL_AOT_RUNTIME
 #if !MOONLIGHT
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int ReleaseComObjectInternal (object co);
@@ -785,6 +840,7 @@ namespace System.Runtime.InteropServices
                        throw new NotSupportedException ("MSDN states user code should never need to call this method.");
                }
 #endif // !NET_2_1
+#endif
 
                [ComVisible (true)]
                public static int SizeOf (object structure)
@@ -1068,12 +1124,14 @@ namespace System.Runtime.InteropServices
                        return null;
                }
 
+#if !FULL_AOT_RUNTIME
 #if !MOONLIGHT
                public static int FinalReleaseComObject (object o)
                {
                        while (ReleaseComObject (o) != 0);
                        return 0;
                }
+#endif
 #endif
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
index d2037138b448cfa951a5114959c00651c4c2fdc8..29bebe4592294bd5184ffbdace0e79e0a16a0e4f 100644 (file)
@@ -34,6 +34,7 @@ using System.Reflection;
 namespace System.Runtime.InteropServices
 {
        
+#if !MOBILE    
        [ComVisible(true)]
        [Guid ("475e398f-8afa-43a7-a3be-f4ef8d6787c9")]
        [ClassInterface (ClassInterfaceType.None)]
@@ -50,10 +51,9 @@ namespace System.Runtime.InteropServices
                        return guidManagedCategory;
                }
 
-               [MonoTODO ("implement")]
                public virtual string GetProgIdForType (Type type)
                {
-                       throw new NotImplementedException ();
+                       return Marshal.GenerateProgIdForType(type);
                }
 
                [MonoTODO ("implement")]
@@ -107,4 +107,5 @@ namespace System.Runtime.InteropServices
                }
                
        }
+#endif
 }
index b7ce95e27e0a5d9ca3a6112f9a3b9a9571d868d8..9cd6736cf8dbc6071dfd9ec28b2974812cdfb268 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -69,3 +70,4 @@ namespace System.Runtime.InteropServices
                }       
        }
 }
+#endif
index 393090753519b99594d6ced46624df8e1a5f0f5a..957e6892f2d98f18c6cb6ee64af48931e0b78243 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [ComVisible(true)]
@@ -43,3 +44,4 @@ namespace System.Runtime.InteropServices
                ExportAs64Bit = 32
        }
 }
+#endif
index 29fcc7289978fb2906f7b7a74975cebad0d923db..215efa65d5337a1f4266fafddcf0b2ee5fa39bba 100644 (file)
@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices {
@@ -54,3 +55,4 @@ namespace System.Runtime.InteropServices {
                }
        }
 }
+#endif
index 6bcabc2b02fd83838a80a074732cee677f286500..b0dddbdbf3bddc1b1bd1dd4c1712f9829e44da14 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices {
 
        [ComVisible(true)]
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
                FImmediateBind = 4096,
        }
 }
+#endif
index 0921e92e8ee14dfc0574d702d284b5ad0e5f1baf..43eb92a47d51e177c2ffe2a7019b6b8f4724d95b 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
                }
        }
 }
+#endif
index fc611887c4a6850de2a724569c93b874b5ada318..e3a9f1a74c5e8a090219e8725e04fad477c94dee 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices
@@ -53,3 +54,4 @@ namespace System.Runtime.InteropServices
 #endif
        }
 }
+#endif
index ecdb10692b650f3b06663adbf15e57b41621a83a..9a8a6a85936212ebf1908eaf7bb281644fc5b6f0 100644 (file)
@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices {
@@ -55,3 +56,4 @@ namespace System.Runtime.InteropServices {
                }
        }
 }
+#endif
index d122ff098d80b9635f88fe5821109aebdc2ff28b..48e141b15ed447f038de6f5574e2d8dd1a78cd59 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices {
        [ComVisible(true)]
        [Flags] [Serializable]
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
                FReverseBind = 8192,
        }
 }
+#endif
index c830910dc89f4a46bbc291290971a17c61b07f73..595f9d85feed048677e0b3e939362dc7252ff1e4 100644 (file)
@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 
 namespace System.Runtime.InteropServices {
@@ -54,3 +55,4 @@ namespace System.Runtime.InteropServices {
                }
        }
 }
+#endif
index 3de9cc553ff528b09b45e9dfa9ced24b80c4dd77..09030d77cff1eb67f959d7b615fbf7f01fec96ac 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices {
        
        [ComVisible(true)]
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
                FImmediateBind = 4096,
        }
 }
+#endif
index c56a2bc96c15785b0ee0d0ef1971696bcb4e0d54..da18ded9121c735b0bd737d46469cce00fd7d4ec 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -46,3 +47,4 @@ namespace System.Runtime.InteropServices
                void RevokeObjectParam ([MarshalAs(UnmanagedType.LPWStr)] string pszKey);
        }
 }
+#endif
index 1e514ab4b72d15439a6336df78418edfb6235065..cd0e84f3fc81d116272581d4771f4e5d0532543b 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -41,3 +42,4 @@ namespace System.Runtime.InteropServices
                void EnumConnections (out UCOMIEnumConnections ppEnum);
        }
 }
+#endif
index 8b192f0d12a0abc5eebf5b1c25f09eca92cf8991..8011610ab7bcf250fc236fa0a56ef2ab359d0523 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -38,3 +39,4 @@ namespace System.Runtime.InteropServices
                void FindConnectionPoint (ref Guid riid, out UCOMIConnectionPoint ppCP);
        }
 }
+#endif
index cfbebd75791598d65d723e5f1fd6fdeb66785075..bb669b78e0d47ed47cdcf9dcd2befe3b6f13b757 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -43,3 +44,4 @@ namespace System.Runtime.InteropServices
                void Clone (out UCOMIEnumConnectionPoints ppenum);
        }
 }
+#endif
index 92ee2ec7afb62e2fbeed4179f95889e5dd9893dd..abfb10c8182f26b3915a57aff8bb3923003b3b72 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -43,3 +44,4 @@ namespace System.Runtime.InteropServices
                void Clone (out UCOMIEnumConnections ppenum);
        }
 }
+#endif
index d24fe2d2882c8018367ba045aec7aaff4295e57b..bb0d59519eab22c455acec615ef90b6033615230 100644 (file)
@@ -26,6 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -43,3 +44,4 @@ namespace System.Runtime.InteropServices
                void Clone (out UCOMIEnumMoniker ppenum);
        }
 }
+#endif
index 55e145af0a2f812244af8ad8314842b7075acaf6..1f0599e28fe91e2aa41049f9b1cecc3453ddfc5c 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -45,3 +46,4 @@ namespace System.Runtime.InteropServices
                void Clone (out UCOMIEnumString ppenum);
        }
 }
+#endif
index cb3b6832158868a32f9ec432bfd8f2cd1880c07f..dbe383e0c8054799af62ad8f27b1e7a145e10ef6 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -45,3 +46,4 @@ namespace System.Runtime.InteropServices
                void Clone (int ppenum);
        }
 }
+#endif
index 70b1f7f518622dc77a4be767dfc256e55e3a13b4..08f7e4d176e6ea3d2576565cf69ccfdbb6e2829e 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -59,3 +60,4 @@ namespace System.Runtime.InteropServices
                void IsSystemMoniker (out int pdwMksys);
        }
 }
+#endif
index f09f6c69f3d891918407a2573e745545b3c0ce9f..16516d7bb7f9b6368e0a412f27e241bff44f295f 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -45,3 +46,4 @@ namespace System.Runtime.InteropServices
                void GetCurFile ([MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName);
        }
 }
+#endif
index fd07c7100946fbf79c894f8faa1231389aca0bc2..c4fc29df1d1390a4599380fd619c30c36af98496 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -45,3 +46,4 @@ namespace System.Runtime.InteropServices
                void EnumRunning (out UCOMIEnumMoniker ppenumMoniker);
        }
 }
+#endif
index 8826673b88505fbae1cc3703b939949d0d01c169..f3bf95b915e4b4255d28a86edf36485856d6cb0a 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -49,3 +50,4 @@ namespace System.Runtime.InteropServices
                void Clone (out UCOMIStream ppstm);
        }
 }
+#endif
index 07942f55cc26189e697f4c7f932b234b1a452ebe..12af145c4cd4ae22756c4f5cbc5eb7823fdc91d3 100644 (file)
@@ -28,6 +28,7 @@
 //
 // (C) 2002 Ximian, Inc.
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -39,3 +40,4 @@ namespace System.Runtime.InteropServices
                void BindType([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, out UCOMITypeInfo ppTInfo, out UCOMITypeComp ppTComp);
        }
 }
+#endif
index 679efcbdde2ab5e39c5ae3c620051155251b5ec0..a8b4a1600b6429d838223683ed21783147f38dd3 100644 (file)
@@ -28,6 +28,7 @@
 //
 // (C) 2002 Ximian, Inc.
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -57,3 +58,4 @@ namespace System.Runtime.InteropServices
        }
 }
 
+#endif
index f2161fe106f4bb7b244066afd8f71f56636eb6a6..2b9c1ccdc0da9ae69006d80cf71dc6e0b45217ec 100644 (file)
@@ -28,6 +28,7 @@
 //
 // (C) 2002 Ximian, Inc.
 
+#if !FULL_AOT_RUNTIME
 namespace System.Runtime.InteropServices
 {
        [Obsolete]
@@ -51,3 +52,4 @@ namespace System.Runtime.InteropServices
        }
 }
 
+#endif
index acabc729d6bcd0fc1f594ff6ea2d0d4449f7e18c..f6936f3075bf7de37a0238131d36847526c3fa5a 100644 (file)
@@ -34,7 +34,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("03973551-57A1-3900-A2B5-9083E3FF2943")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (Activator))]
+#endif
        public interface _Activator {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 29e234bf547cb506fc4f5890bacdbe55b8140fa1..a30e29ce22d696bd8a3b810212421137de6da3de 100644 (file)
@@ -38,7 +38,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsDual)]
        [Guid ("17156360-2F1A-384A-BC52-FDE93C215C5B")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof(Assembly))]
+#endif
        public interface _Assembly
        {
                string ToString ();
index db444ea3008c7c6c18d5436bb35b8b99a26b8841..b86aae8483fdd3b57e6cbea1e0c5abdeb69e526f 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index ab72a0da60be43e8817a1f95f1c2c599fdbcfd49..13f4659d74c15bc8a96662fa1be32ee4f3616f00 100644 (file)
@@ -34,7 +34,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("B42B6AAC-317E-34D5-9FA9-093BB4160C50")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (AssemblyName))]
+#endif
        public interface _AssemblyName {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 46671e3d00ea8a6e2c93f3abbfaebc15354ba047..f36abf3bbe5dbc04da0ca40fb8cf24da2a6490f1 100644 (file)
@@ -33,7 +33,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("917B14D0-2D9E-38B8-92A9-381ACF52F7C0")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (Attribute))]
+#endif
        public interface _Attribute {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index bc8f5fbbf358e7dd9a481055fd32069e3cd7d692..9693bfb7649492ecfdb1fff976d319540c226e58 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index c11dbac76c58bfab7c8a3a9b0c89bdbfaadd753c..7759e5222972b11a1cc4637181017e05ba4e61df 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("E9A19478-9646-3679-9B10-8411AE1FD57D")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (ConstructorInfo))]
+#endif
        [ComVisible (true)]
        public interface _ConstructorInfo
        {
index 18cab408e2ec95a9dc376a471cbc4a9ed681266b..412d7bb5b1f3de012053319aee9207cc53d0d5db 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 94e59f3f67a52d24288a77f49c59f999fda6718f..139ede6c6cce4e0c957ee0c75291a9b8721d24f4 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 06dab05220e4eb902204bf27b1124af51831b8c2..f3450bff76eae8e8f1efd757d64fc743cacecfba 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
        }
 }
 
+#endif
index 5dfbb33b9abf113ebbc395ed8d11869524055377..4b6aae76c3f01a8ea8d2f20a3383c4ab346b81d0 100644 (file)
@@ -13,7 +13,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("9DE59C64-D889-35A1-B897-587D74469E5B")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (EventInfo))]
+#endif
        [ComVisible (true)]
        public interface _EventInfo
        {
index 6b3161aa8608d61449dfe60804900f220e79c1f5..c29f412456e0892f864fd1b3825a6946582c49aa 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
        }
 }
 
+#endif
index d599ee5365929b75298cdf12f40db5cc3dd4f691..4383dca5f6665728ba0a38b213a3477004ae34f5 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("8A7C1442-A9FB-366B-80D8-4939FFA6DBE0")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (FieldInfo))]
+#endif
        [ComVisible (true)]
        public interface _FieldInfo
        {
index c792633fb5dfa2490e6ed29ab7f7699e6097c222..66ae8ce32f48e46b85686a9d422ea000dc027c3a 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 63c337f2abb9b4b0674b60c2474c129b5ae4467c..7d6683b49835f8d870dd00fb31dd3fe0f0fdc0ff 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 0b7e269fbf617710ae615ecfd22836acf90df042..af5cc24b4c5577daf2a757a823dca43af7b24204 100644 (file)
@@ -13,7 +13,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("f7102fa9-cabb-3a74-a6da-b4567ef1b079")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (MemberInfo))]
+#endif
        [ComVisible (true)]
        public interface _MemberInfo
        {
index aed2dee3a1a16128b1268eb96ebd0a87c140d690..ca9013200cc740e38920929a4d9e535430b63928 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("6240837A-707F-3181-8E98-A36AE086766B")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (MethodBase))]
+#endif
        [ComVisible (true)]
        public interface _MethodBase
        {
index bd9e3995c0b8775fca7cc8a9892c4b20b52928a4..62abe9048b04e06d976fb4ec3cc83aca1051bb98 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 14f6b7195657e4f0d8fdb304ece4d7522c820646..e8180ad7bf1a8a16094f89a7ed56dd74133f0e87 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("FFCC1B5D-ECB8-38DD-9B01-3DC8ABC2AA5F")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (MethodInfo))]
+#endif
        [ComVisible (true)]
        public interface _MethodInfo
        {
index 64c4745bd71199de2f0a5c0d40a131be47a5befc..fb51ec6688915b7c29c096648c53d0c1d7250ea7 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 
 namespace System.Runtime.InteropServices {
        [ComVisible (true)]
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("C2323C25-F57F-3880-8A4D-12EBEA7A5852")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (MethodRental))]
+#endif
        public interface _MethodRental {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 3dd2f8220f3beb54839d411cfaed497752d5df24..53097c635fbb8b531e229cb2e2dafc877013749f 100644 (file)
@@ -34,7 +34,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("D002E9BA-D9E3-3749-B1D3-D565A08B13E7")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (Module))]
+#endif
        public interface _Module {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index c029747044f84186908c9f5cbc178b6087f8ef26..9e6fbe973fe366e6f7db16e7cc11e5d316c1d7a5 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
        }
 }
 
+#endif
index 60c0ef2c160748c51f7e50ebc059bec9f515afda..c574f3b0f659624ffd64a5716d9a09e26c400b63 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index 28412992aab21e40a84384600e62f029437cc064..ae4ed29dce0a7103f7d46f02cd79cf502c12c8f4 100644 (file)
@@ -34,7 +34,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("993634C4-E47A-32CC-BE08-85F567DC27D6")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (ParameterInfo))]
+#endif
        public interface _ParameterInfo {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 82206fc69073a11efc211d9660a7e750184eafc2..0d45f6e33018cbef507033fed81b93ca9531b942 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -47,3 +48,4 @@ namespace System.Runtime.InteropServices {
                        IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
        }
 }
+#endif
index e3041e9e1f5eb1a633883b0f83029a1dac6a24a0..12855f7862f822f3cbadda0a11e9606b4a03c378 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("F59ED4E4-E68F-3218-BD77-061AA82824BF")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (PropertyInfo))]
+#endif
        [ComVisible (true)]
        public interface _PropertyInfo
        {
index b639e4796356192c396409f3258b15c9f33991e6..0e0b941a4316af4ba23e18aa061d9bedc97a3adf 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 
 namespace System.Runtime.InteropServices {
        [ComVisible (true)]
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("7D13DD37-5A04-393C-BBCA-A5FEA802893D")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (SignatureHelper))]
+#endif
        public interface _SignatureHelper {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 701dccf5b1a4b15afb22e1a5c9f84f91fb77ffdc..68e647ba6553fa2d7128818c4c541ea053dfedae 100644 (file)
@@ -34,7 +34,9 @@ namespace System.Runtime.InteropServices {
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("C281C7F1-4AA9-3517-961A-463CFED57E75")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (Thread))]
+#endif
        public interface _Thread {
 
                void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
index 2fcc9682c76d6b7b159e291e3ab1fce96addf5d4..1565230a30d9159823227bac74ee6bec7e56d667 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.InteropServices
        [CLSCompliant (false)]
        [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [Guid ("BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2")]
+#if !FULL_AOT_RUNTIME
        [TypeLibImportClass (typeof (Type))]
+#endif
        [ComVisible (true)]
        public interface _Type
        {
index cc55bb2f1a0f33b2befa047eb09831f3c577cb3c..b92f0b40ba8ffb3d7cde8aeb66a8ea42076f2baa 100644 (file)
@@ -27,6 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
 
 namespace System.Runtime.InteropServices {
@@ -48,3 +49,4 @@ namespace System.Runtime.InteropServices {
        }
 }
 
+#endif
index 322d815efad196ee81439720df4b0b5a2bf7dffe..4d4756e150d5a16689db6d7109feaaad950c38eb 100644 (file)
@@ -37,7 +37,11 @@ using System.Security.Permissions;
 namespace System.Runtime.Serialization.Formatters.Binary {
 
        [ComVisible (true)]
-       public sealed class BinaryFormatter : IRemotingFormatter, IFormatter 
+       public sealed class BinaryFormatter :
+#if !FULL_AOT_RUNTIME
+                                               IRemotingFormatter,
+#endif
+                                               IFormatter
        {
                private FormatterAssemblyStyle assembly_format = FormatterAssemblyStyle.Simple;
                private SerializationBinder binder;
index feb8ffa6d4e48eab5239b2c317fe9b1e20d87844..fd38471644b2d7ec9f2e23c0e5273b920ceb9dac 100644 (file)
@@ -28,6 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.IO;
 using System.Collections;
@@ -401,3 +402,4 @@ namespace System.Runtime.Serialization.Formatters.Binary
        }
  }
  
+#endif
index d39348bd38d98f02fd1d1a66b024953a461ed0cd..9d3c42bbd19d6e3c85134a0c2639f20adc501bcc 100644 (file)
@@ -469,11 +469,13 @@ namespace System.Runtime.Serialization.Formatters.Binary
                
                TypeMetadata CreateMemberTypeMetadata (Type type)
                {
+#if !FULL_AOT_RUNTIME
                        if (!BinaryCommon.UseReflectionSerialization) {
                                Type metaType = CodeGenerator.GenerateMetadataType (type, _context);
                                return (TypeMetadata) Activator.CreateInstance (metaType);
                        }
                        else
+#endif
                                return new MemberTypeMetadata (type, _context);
                }
 
index 5109910cb1e13e469e0ffaa45577f18965d0e105..47ce386ebd8ff0ab3653ad6a5f97adf12c4af9f9 100644 (file)
@@ -93,7 +93,11 @@ namespace System.Security.Cryptography {
                
                public static AsymmetricAlgorithm Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new RSACryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.AsymmetricAlgorithm");
+#endif
                }
        
                public static AsymmetricAlgorithm Create (string algName) 
index bb3a7399759f5c88eb7507547346ede9a848dd26..7720549e95b3a51cbc7b73235eebc8d16ab31ba3 100644 (file)
@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !MOONLIGHT
+#if !MOONLIGHT && !FULL_AOT_RUNTIME
 
 using System.Collections;
 using System.Collections.Generic;
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs
new file mode 100755 (executable)
index 0000000..4d05e06
--- /dev/null
@@ -0,0 +1,220 @@
+//
+// CryptoConfig.cs: Handles cryptographic implementations and OIDs mappings.
+//
+// Authors:
+//     Sebastien Pouliot (sebastien@xamarin.com)
+//     Tim Coleman (tim@timcoleman.com)
+//
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) Tim Coleman, 2004
+// Copyright (C) 2004-2007,2011 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin, Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if FULL_AOT_RUNTIME
+
+// This is a special version of CryptoConfig that is not configurable and
+// every "choice" is statiscally compiled. As long as CreateFromName is not
+// used the linker will be able to eliminate the crypto code from the applications
+
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace System.Security.Cryptography {
+
+       [ComVisible (true)]
+       public partial class CryptoConfig {
+
+               // try to avoid hitting the CreateFromName overloads to help the linker
+
+               public static object CreateFromName (string name)
+               {
+                       return CreateFromName (name, null);
+               }
+
+               [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+               public static object CreateFromName (string name, params object[] args)
+               {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+
+                       switch (name.ToLowerInvariant ()) {
+                       case "system.security.cryptography.dsacryptoserviceprovider":
+                       case "system.security.cryptography.dsa":
+                       case "dsa":
+                               return new DSACryptoServiceProvider ();
+                       case "system.security.cryptography.dsasignaturedeformatter":
+                               return new DSASignatureDeformatter ();
+                       case "system.security.cryptography.dsasignatureformatter":
+                               return new DSASignatureFormatter ();
+                       case "system.security.cryptography.dsasignaturedescription":
+                       case "http://www.w3.org/2000/09/xmldsig#dsa-sha1":
+                               return new DSASignatureDescription ();
+                       case "system.security.cryptography.descryptoserviceprovider":
+                       case "system.security.cryptography.des":
+                       case "des":
+                               return new DESCryptoServiceProvider ();
+                       case "system.security.cryptography.hmacmd5":
+                       case "hmacmd5":
+                               return new HMACMD5 ();
+                       case "system.security.cryptography.hmacripemd160":
+                       case "hmacripemd160":
+                       case "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160":
+                               return new HMACRIPEMD160 ();
+                       case "system.security.cryptography.keyedhashalgorithm":
+                       case "system.security.cryptography.hmac":
+                       case "system.security.cryptography.hmacsha1":
+                       case "hmacsha1":
+                               return new HMACSHA1 ();
+                       case "system.security.cryptography.hmacsha256":
+                       case "hmacsha256":
+                       case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256":
+                               return new HMACSHA256 ();
+                       case "system.security.cryptography.hmacsha384":
+                       case "hmacsha384":
+                       case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384":
+                               return new HMACSHA384 ();
+                       case "system.security.cryptography.hmacsha512":
+                       case "hmacsha512":
+                       case "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512":
+                               return new HMACSHA512 ();
+                       case "system.security.cryptography.mactripledes":
+                       case "mactripledes":
+                               return new MACTripleDES ();
+                       case "system.security.cryptography.md5cryptoserviceprovider":
+                       case "system.security.cryptography.md5":
+                       case "md5":
+                               return new MD5CryptoServiceProvider ();
+                       case "system.security.cryptography.rc2cryptoserviceprovider":
+                       case "system.security.cryptography.rc2":
+                       case "rc2":
+                               return new RC2CryptoServiceProvider ();
+                       case "system.security.cryptography.symmetricalgorithm":
+                       case "system.security.cryptography.rijndaelmanaged":
+                       case "system.security.cryptography.rijndael":
+                       case "rijndael":
+                               return new RijndaelManaged ();
+                       case "system.security.cryptography.ripemd160managed":
+                       case "system.security.cryptography.ripemd160":
+                       case "ripemd-160":
+                       case "ripemd160":
+                               return new RIPEMD160Managed ();
+                       case "system.security.cryptography.rngcryptoserviceprovider":
+                       case "system.security.cryptography.randomnumbergenerator":
+                       case "randomnumbergenerator":
+                               return new RNGCryptoServiceProvider ();
+                       case "system.security.cryptography.asymmetricalgorithm":
+                       case "system.security.cryptography.rsa":
+                       case "rsa":
+                               return new RSACryptoServiceProvider ();
+                       case "system.security.cryptography.rsapkcs1signaturedeformatter":
+                               return new RSAPKCS1SignatureDeformatter ();
+                       case "system.security.cryptography.rsapkcs1signatureformatter":
+                               return new RSAPKCS1SignatureFormatter ();
+                       case "system.security.cryptography.rsapkcs1sha1signaturedescription":
+                       case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
+                               return new RSAPKCS1SHA1SignatureDescription ();
+                       case "system.security.cryptography.hashalgorithm":
+                       case "system.security.cryptography.sha1":
+                       case "system.security.cryptography.sha1cryptoserviceprovider":
+                       case "sha1":
+                       case "sha":
+                       case "http://www.w3.org/2000/09/xmldsig#sha1":
+                               return new SHA1CryptoServiceProvider ();
+                       case "system.security.cryptography.sha1managed":
+                               return new SHA1Managed ();
+                       case "system.security.cryptography.sha256managed":
+                       case "system.security.cryptography.sha256":
+                       case "sha256":
+                       case "sha-256":
+                       case "http://www.w3.org/2001/04/xmlenc#sha256":
+                               return new SHA256Managed ();
+                       case "system.security.cryptography.sha384managed":
+                       case "system.security.cryptography.sha384":
+                       case "sha384":
+                       case "sha-384":
+                               return new SHA384Managed ();
+                       case "system.security.cryptography.sha512managed":
+                       case "system.security.cryptography.sha512":
+                       case "sha512":
+                       case "sha-512":
+                       case "http://www.w3.org/2001/04/xmlenc#sha512":
+                               return new SHA512Managed ();
+                       case "system.security.cryptography.tripledescryptoserviceprovider":
+                       case "system.security.cryptography.tripledes":
+                       case "triple des":
+                       case "tripledes":
+                       case "3des":
+                               return new TripleDESCryptoServiceProvider ();
+                       default:
+                               // method doesn't throw any exception
+                               return null;
+                       }
+               }
+
+               public static string MapNameToOID (string name)
+               {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+
+                       switch (name.ToLowerInvariant ()) {
+                       case "system.security.cryptography.sha1cryptoserviceprovider":
+                       case "system.security.cryptography.sha1managed":
+                       case "system.security.cryptography.sha1":
+                       case "sha1":
+                               return "1.3.14.3.2.26";
+                       case "system.security.cryptography.md5cryptoserviceprovider":
+                       case "system.security.cryptography.md5":
+                       case "md5":
+                               return "1.2.840.113549.2.5";
+                       case "system.security.cryptography.sha256managed":
+                       case "system.security.cryptography.sha256":
+                       case "sha256":
+                               return "2.16.840.1.101.3.4.2.1";
+                       case "system.security.cryptography.sha384managed":
+                       case "system.security.cryptography.sha384":
+                       case "sha384":
+                               return "2.16.840.1.101.3.4.2.2";
+                       case "system.security.cryptography.sha512managed":
+                       case "system.security.cryptography.sha512":
+                       case "sha512":
+                               return "2.16.840.1.101.3.4.2.3";
+                       case "system.security.cryptography.ripemd160managed":
+                       case "system.security.cryptography.ripemd160":
+                       case "ripemd160":
+                               return "1.3.36.3.2.1";
+                       case "tripledeskeywrap":
+                               return "1.2.840.113549.1.9.16.3.6";
+                       case "des":
+                               return "1.3.14.3.2.7";
+                       case "tripledes":
+                               return "1.2.840.113549.3.7";
+                       case "rc2":
+                               return "1.2.840.113549.3.2";
+                       default:
+                               return null;
+                       }
+               }
+       }
+}
+
+#endif
index ba69f162a3cd592b6ce20d55876a014d59583630..7c042cd9dddb1ed82c122cebc12b99792324b368 100644 (file)
@@ -57,7 +57,11 @@ public abstract class DES : SymmetricAlgorithm {
 
        public static new DES Create () 
        {
+#if FULL_AOT_RUNTIME
+               return new System.Security.Cryptography.DESCryptoServiceProvider ();
+#else
                return Create ("System.Security.Cryptography.DES");
+#endif
        }
 
        public static new DES Create (string algName) 
index 458abe92bcd1dc75e7ae3f10608adf12a94d5be9..73abc4d4c4f5fbe6f00ca6862487e4cce8612ba7 100644 (file)
@@ -51,7 +51,11 @@ namespace System.Security.Cryptography {
 
                public static new DSA Create ()
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.DSACryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.DSA");
+#endif
                }
 
                public static new DSA Create (string algName) 
index f3c5293e57676ff97fb263cba6b8e0c13396e682..e2c20e29e1cd2fb33a287d65c6b4251b6e304d6b 100644 (file)
@@ -171,7 +171,11 @@ namespace System.Security.Cryptography {
 
                public static new HMAC Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.HMACSHA1 ();
+#else
                        return Create ("System.Security.Cryptography.HMAC");
+#endif
                }
 
                public static new HMAC Create (string algorithmName) 
index 8d76956973635893607057d86d32164345d2a5d8..07074f8aef3ee6b3be94a8203be37ffd3759ca31 100644 (file)
@@ -112,7 +112,11 @@ namespace System.Security.Cryptography {
        
                public static HashAlgorithm Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.SHA1CryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.HashAlgorithm");
+#endif
                }
        
                public static HashAlgorithm Create (string hashName)
index 616a8131654b64eaa2d78043d21ada8d827b5c19..abab189b2499ff7c21879d5c64764944279b25a8 100644 (file)
@@ -79,7 +79,11 @@ public abstract class KeyedHashAlgorithm : HashAlgorithm {
 
        public static new KeyedHashAlgorithm Create ()
        {
+#if FULL_AOT_RUNTIME
+               return new System.Security.Cryptography.HMACSHA1 ();
+#else
                return Create ("System.Security.Cryptography.KeyedHashAlgorithm");
+#endif
        }
 
        public static new KeyedHashAlgorithm Create (string algName)
index 4871d2bc17b80dd961b6c29041685e73412cd015..4d41fc7a2114ec5cda3d0cd38d58537f2579551a 100644 (file)
@@ -44,7 +44,11 @@ namespace System.Security.Cryptography {
        \r
                public static new MD5 Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.MD5CryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.MD5");\r
+#endif
                }\r
 \r
                public static new MD5 Create (string algName) \r
index 46b3780cc4f2ceafa697741de7f5cde2d93e7e9a..5b6fc547f75dd39f1055dacfd7637abe3a234490 100644 (file)
@@ -40,7 +40,11 @@ namespace System.Security.Cryptography {
 
                public static new RC2 Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RC2CryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.RC2");
+#endif
                }
                
                public static new RC2 Create (string AlgName) 
index 2102a480c0f391a341bc99820d8f5494848ab6e2..4d67a691ec3cac2ffd467984ae52e38b1f96b7ed 100644 (file)
@@ -51,7 +51,11 @@ namespace System.Security.Cryptography {
                /// <returns>A new instance of the RIPEMD160 hash algorithm.</returns>
                public static new RIPEMD160 Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RIPEMD160Managed ();
+#else
                        return Create ("System.Security.Cryptography.RIPEMD160");
+#endif
                }
 
                /// <summary>
index 35a4b4bffe7abfd6994ee98cd921176ab7bb6d23..1a575931845239bfd6082d76cbeb07ac6556b2bf 100644 (file)
@@ -42,7 +42,11 @@ namespace System.Security.Cryptography {
 
                public static new RSA Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RSACryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.RSA");
+#endif
                }
 
                public static new RSA Create (string algName)
index c8160ad4b72da23c02340976becca6fb2125aaa7..0988ca548091ac846da7a7de5c66df0a0f04e867 100644 (file)
@@ -46,8 +46,12 @@ namespace System.Security.Cryptography {
 
                public static RandomNumberGenerator Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RNGCryptoServiceProvider ();
+#else
                        // create the default random number generator
                        return Create ("System.Security.Cryptography.RandomNumberGenerator");
+#endif
                }
 
                public static RandomNumberGenerator Create (string rngName) 
index a1343db1b853fd960c93c0fa61b8840c34cd0cb6..bf4a7e95ae914a51de0e3ffaed4f76bcda0961da 100644 (file)
@@ -42,7 +42,11 @@ namespace System.Security.Cryptography {
 \r
                public static new Rijndael Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RijndaelManaged ();
+#else
                        return Create ("System.Security.Cryptography.Rijndael");\r
+#endif
                }\r
 \r
                public static new Rijndael Create (string algName) \r
index 56eddff59ae892127cafa7896a6b1d603af8bc2c..9cc0ca7e64a394528c0a8a22a5ed09e0becaf8b1 100644 (file)
@@ -43,7 +43,11 @@ namespace System.Security.Cryptography {
        \r
                public static new SHA1 Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.SHA1CryptoServiceProvider ();
+#else
                        return Create ("System.Security.Cryptography.SHA1");\r
+#endif
                }\r
 \r
                public static new SHA1 Create (string hashName) \r
index 842a615e0cfdd1affe43e7a46b3c58b278c73ed3..1af226c03e95cbeff03231db9cfeccd7db74249c 100644 (file)
@@ -43,7 +43,11 @@ namespace System.Security.Cryptography {
        \r
                public static new SHA256 Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.SHA256Managed ();
+#else
                        return Create ("System.Security.Cryptography.SHA256");\r
+#endif
                }\r
        \r
                public static new SHA256 Create (string hashName) \r
index 2daff34a694ddd48475813c9f7cd2f334d293162..93b6f7f64de27d2cc387e47da57632b015c2b75b 100644 (file)
@@ -45,7 +45,11 @@ namespace System.Security.Cryptography {
 \r
                public static new SHA384 Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.SHA384Managed ();
+#else
                        return Create ("System.Security.Cryptography.SHA384");\r
+#endif
                }\r
        \r
                public static new SHA384 Create (string hashName) \r
index 00baef00d084cc62d6143499109c145893b2798c..ccded95bfd39e968df2af31b7b2e1546356392fb 100644 (file)
@@ -45,7 +45,11 @@ namespace System.Security.Cryptography {
 \r
                public static new SHA512 Create () \r
                {\r
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.SHA512Managed ();
+#else
                        return Create ("System.Security.Cryptography.SHA512");\r
+#endif
                }\r
        \r
                public static new SHA512 Create (string hashName) \r
index 1a331415c2f44e0c7047cbfee9a6469c93734c75..60b57e7e7536b33dd99ebfab6ab36f4be80bae13 100644 (file)
@@ -229,7 +229,11 @@ namespace System.Security.Cryptography {
                // LAMESPEC: Default is Rijndael - not TripleDES
                public static SymmetricAlgorithm Create () 
                {
+#if FULL_AOT_RUNTIME
+                       return new System.Security.Cryptography.RijndaelManaged ();
+#else
                        return Create ("System.Security.Cryptography.SymmetricAlgorithm");
+#endif
                }
 
                public static SymmetricAlgorithm Create (string algName) 
index 0bc887a15a3f825c2d09959a8c289aea98ab706b..3fa0800cdffb20ff46bd18a26d3ecfaf5dea2d3e 100644 (file)
@@ -121,7 +121,11 @@ public abstract class TripleDES : SymmetricAlgorithm {
 
        public static new TripleDES Create ()
        {
+#if FULL_AOT_RUNTIME
+               return new System.Security.Cryptography.TripleDESCryptoServiceProvider ();
+#else
                return Create ("System.Security.Cryptography.TripleDES");
+#endif
        }
 
        public static new TripleDES Create (string str)
index 4e89bdc1d7113697f4701f7eaa0e7372791d1bcd..5714862cbde0d9bf3f13786374eed5cf4479fb8a 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index 6d579b30ed364452c928f01dc4fdf1eadeca8a8e..9a20872424b1240b7b4db6b678fac80adf0a4a87 100644 (file)
@@ -35,7 +35,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index 9891c25f6b88d158638c7fea762c86e44e84d0a4..f871175e42343fac9e03d12149d9de093440a049 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index 8b45709549a287b33713b8f2d03087382724dade..cf37722731b90a1ab9e544a9127439ba5ba5a9f5 100644 (file)
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index 78afc430071ab27cfb2a6276ee903b7b372ae530..9e5517bd40662763d02a2f7f7de91cca26b98687 100644 (file)
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_1
+#if NET_2_1 && !MONOTOUCH
        [Obsolete ("CAS support is not available with Silverlight applications.")]
 #endif
        [ComVisible (true)]
index ebda6ccbe7df10bd8d2811f5dab16e25329d3655..69b7e7fd4d0fdc314702818d241acca3aebd4b4e 100644 (file)
@@ -59,13 +59,13 @@ namespace System.Security {
                [Obsolete]
 #endif
                public static bool CheckExecutionRights {
-                       get { return true; }
+                       get { return false; }
                        set { ; }
                }
 
                [Obsolete ("The security manager cannot be turned off on MS runtime")]
                public static bool SecurityEnabled {
-                       get { return true; }
+                       get { return false; }
                        set { ; }
                }
                
index d3bcc94e917c479646fbc3f0f0d078bcf389760f..cc79daf734fe90a1ad0e9882da1d84eaa271cbb4 100644 (file)
@@ -46,14 +46,14 @@ namespace System.Threading.Tasks
 
                internal static int GetBestWorkerNumber (TaskScheduler scheduler)
                {
-                       return scheduler.MaximumConcurrencyLevel;
+                       return Math.Min (Environment.ProcessorCount, (scheduler ?? TaskScheduler.Current).MaximumConcurrencyLevel);
                }
 
                static int GetBestWorkerNumber (int from, int to, ParallelOptions options, out int step)
                {
                        int num = GetBestWorkerNumber(options.TaskScheduler);
                        if (options != null && options.MaxDegreeOfParallelism != -1)
-                               num = options.MaxDegreeOfParallelism;
+                               num = Math.Min (options.MaxDegreeOfParallelism, num);
                        // Integer range that each task process
                        if ((step = (to - from) / num) < 5) {
                                step = 5;
@@ -343,7 +343,7 @@ namespace System.Threading.Tasks
                        if (destruct == null)
                                throw new ArgumentNullException ("destruct");
 
-                       int num = Math.Min (GetBestWorkerNumber (),
+                       int num = Math.Min (GetBestWorkerNumber (options.TaskScheduler),
                                            options != null && options.MaxDegreeOfParallelism != -1 ? options.MaxDegreeOfParallelism : int.MaxValue);
 
                        Task[] tasks = new Task[num];
index fdf85a5c6679d9295a9d16390e661b6eff5eb971..2542ad63b0dca4002da70bad8c64df4bb980a162 100644 (file)
@@ -461,6 +461,15 @@ namespace System.Threading.Tasks
                        return true;
                }
 
+               internal bool TrySetExceptionObserved ()
+               {
+                       if (exSlot != null) {
+                               exSlot.Observed = true;
+                               return true;
+                       }
+                       return false;
+               }
+
                internal void Execute ()
                {
                        ThreadStart ();
index 40907671bffcd227ef2ca2bacbfc30117d7cffd9..88746381daa1636bfb44282ca66f905eea85b330 100644 (file)
@@ -132,6 +132,7 @@ namespace System.Threading.Tasks
 
                        public override void Invoke (Task owner, object state, Task context)
                        {
+                               owner.TrySetExceptionObserved ();
                                action (tasks);
                        }
                }
@@ -281,6 +282,7 @@ namespace System.Threading.Tasks
 
                        public override void Invoke (Task owner, object state, Task context)
                        {
+                               owner.TrySetExceptionObserved ();
                                ((Task<TResult>) context).Result = action (tasks);
                        }
                }
@@ -469,6 +471,8 @@ namespace System.Threading.Tasks
                        return new FuncTaskObjectInvoke<TResult, TNewResult> (action);
                }
 
+               #region Used by ContinueWhenAll
+
                public static TaskActionInvoker Create (Action<Task[]> action, Task[] tasks)
                {
                        return new ActionTasksInvoke (action, tasks);
@@ -479,7 +483,9 @@ namespace System.Threading.Tasks
                        return new FuncTasksInvoke<TResult> (action, tasks);
                }
 
-               #region Used by WhenAny
+               #endregion
+
+               #region Used by ContinueWhenAny
 
                public static TaskActionInvoker CreateSelected (Action<Task> action)
                {
index 0c4ba2a09263a74e61af5ef1db8b4d973f6d10f7..0ac088c9058160dc52cc14bbc0d73ca6d066ea2c 100644 (file)
@@ -339,14 +339,13 @@ namespace System.Threading.Tasks
                                throw new ArgumentOutOfRangeException ("creationOptions");
 
                        var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
-                       var alreadyInvoked = false;
+                       var alreadyInvoked = new AtomicBoolean ();
                        var iar = beginMethod (l => {
-                               alreadyInvoked = true;
-                               InnerInvoke (tcs, endMethod, l);
+                               if (alreadyInvoked.TryRelaxedSet ())
+                                       InnerInvoke (tcs, endMethod, l);
                        }, state);
-                       if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+                       if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
                                InnerInvoke (tcs, endMethod, iar);
-                       }
 
                        return tcs.Task;
                }
@@ -377,14 +376,13 @@ namespace System.Threading.Tasks
                                throw new ArgumentOutOfRangeException ("creationOptions");
 
                        var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
-                       var alreadyInvoked = false;
+                       var alreadyInvoked = new AtomicBoolean ();
                        var iar = beginMethod (arg1, l => {
-                               alreadyInvoked = true;
-                               InnerInvoke (tcs, endMethod, l);
+                               if (alreadyInvoked.TryRelaxedSet ())
+                                       InnerInvoke (tcs, endMethod, l);
                        }, state);
-                       if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+                       if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
                                InnerInvoke (tcs, endMethod, iar);
-                       }
 
                        return tcs.Task;
                }
@@ -414,14 +412,13 @@ namespace System.Threading.Tasks
                                throw new ArgumentOutOfRangeException ("creationOptions");
 
                        var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
-                       var alreadyInvoked = false;
+                       var alreadyInvoked = new AtomicBoolean ();
                        var iar = beginMethod (arg1, arg2, l => {
-                               alreadyInvoked = true;
-                               InnerInvoke (tcs, endMethod, l);
+                               if (alreadyInvoked.TryRelaxedSet ())
+                                       InnerInvoke (tcs, endMethod, l);
                        }, state);
-                       if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+                       if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
                                InnerInvoke (tcs, endMethod, iar);
-                       }
 
                        return tcs.Task;
                }
@@ -452,14 +449,13 @@ namespace System.Threading.Tasks
                                throw new ArgumentOutOfRangeException ("creationOptions");
 
                        var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
-                       bool alreadyInvoked = false;
+                       var alreadyInvoked = new AtomicBoolean ();
                        var iar = beginMethod (arg1, arg2, arg3, l => {
-                               alreadyInvoked = true;
-                               InnerInvoke (tcs, endMethod, l);
+                               if (alreadyInvoked.TryRelaxedSet ())
+                                       InnerInvoke (tcs, endMethod, l);
                        }, state);
-                       if (iar != null && !alreadyInvoked && iar.CompletedSynchronously) {
+                       if (iar != null && iar.CompletedSynchronously && alreadyInvoked.TryRelaxedSet ())
                                InnerInvoke (tcs, endMethod, iar);
-                       }
 
                        return tcs.Task;
                }
index 71abd1c75bb34141280249c4b587a60a09956695..ad3ce1f4ec86a6e18c124537cf32f1582d283583 100644 (file)
@@ -103,7 +103,7 @@ namespace System.Threading.Tasks
                
                public virtual int MaximumConcurrencyLevel {
                        get {
-                               return Environment.ProcessorCount;
+                               return int.MaxValue;
                        }
                }
 
index 3d999538ee26119bcd475db3f2e7813f06b4f30b..161a2ad0a9dd0589350e52b4c7b3c4ddf3e34803 100644 (file)
@@ -1,14 +1,13 @@
 //
 // System.Threading.NativeOverlapped.cs
 //
-// Author:
+// Authors:
 //   Dick Porter (dick@ximian.com)
+//   Marek Safar (marek.safar@gmail.com)
 //
 // (C) Ximian, Inc.  http://www.ximian.com
-//
-
-//
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright 2012 Xamarin Inc.
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -35,27 +34,13 @@ using System.Runtime.InteropServices;
 namespace System.Threading
 {
        [ComVisible (true)]
-       public struct NativeOverlapped {
-               public IntPtr EventHandle;
-               public IntPtr InternalHigh;
+       public struct NativeOverlapped
+       {
                public IntPtr InternalLow;
-               public int OffsetHigh;
+               public IntPtr InternalHigh;
                public int OffsetLow;
-
-               // (fields disappeared beta2 -> 1.0)
-               // public GCHandle ReservedClassLib;
-               // public int ReservedCOR1;
-               // public GCHandle ReservedCOR2;
-
-               // P.S. (Gonzalo): try this:
-                //     Console.WriteLine (Marshal.SizeOf (typeof (NativeOverlapped)));
-               //
-               // And you'll get a nice 36. So probably those fields are out there but are not public.
-               // So I'm adding some internal fields that are used in the runtime
-#pragma warning disable 649
-               internal int Handle1;
-               internal int Handle2;
-#pragma warning restore 649
+               public int OffsetHigh;
+               public IntPtr EventHandle;
        }
 }
 
index 1cb3be10c3b1f38d18927ba40542778ddb35b3a2..7032f7054f55087f31adcfc2bd611a1c760c7a4c 100644 (file)
@@ -37,7 +37,9 @@ using System.Collections;
 using System.Globalization;
 using System.IO;
 using System.Reflection;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Threading;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
@@ -314,6 +316,7 @@ namespace System {
                {
                        return Activator.CreateComInstanceFrom (assemblyFile, typeName, hashValue ,hashAlgorithm);
                }
+#endif
 #endif
 
                public ObjectHandle CreateInstance (string assemblyName, string typeName)
@@ -467,8 +470,7 @@ namespace System {
                        return (oh != null) ? oh.Unwrap () : null;
                }
 
-#endif // !NET_2_1
-
+#if !FULL_AOT_RUNTIME
                public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
                {
                        return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
@@ -606,6 +608,7 @@ namespace System {
                {
                        return new AssemblyBuilder (name, null, access, true);
                }
+#endif
 
                //
                // AppDomain.DoCallBack works because AppDomain is a MarshalByRefObject
@@ -1297,9 +1300,11 @@ namespace System {
 
                        string name;
 
+#if !FULL_AOT_RUNTIME
                        if (name_or_tb is TypeBuilder)
                                name = ((TypeBuilder) name_or_tb).FullName;
                        else
+#endif
                                name = (string) name_or_tb;
 
                        /* Prevent infinite recursion */
index 48e51d267e938645289b20cb9947aec257722aee..de132242a43b6d2e06d1023b77ea274eda6a6bb5 100644 (file)
@@ -40,7 +40,9 @@ using System.Runtime.InteropServices;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Runtime.ConstrainedExecution;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 
 namespace System
 {
@@ -673,8 +675,10 @@ namespace System
                                throw new NotSupportedException ("Array type can not be void");
                        if (elementType.ContainsGenericParameters)
                                throw new NotSupportedException ("Array type can not be an open generic type");
+#if !FULL_AOT_RUNTIME
                        if ((elementType is TypeBuilder) && !(elementType as TypeBuilder).IsCreated ())
                                throw new NotSupportedException ("Can't create an array of the unfinished type '" + elementType + "'.");
+#endif
                        
                        return CreateInstanceImpl (elementType, lengths, bounds);
                }
@@ -1711,7 +1715,7 @@ namespace System
                        if (index + length > array.Length)
                                throw new ArgumentException ();
                                
-                       SortImpl<T, T> (array, null, index, length, comparer);
+                       SortImpl<T> (array, index, length, comparer);
                }
 
                [ReliabilityContractAttribute (Consistency.MayCorruptInstance, Cer.MayFail)]
@@ -1749,6 +1753,8 @@ namespace System
                        // Check for value types which can be sorted without Compare () method
                        //
                        if (comparer == null) {
+                               /* Avoid this when using full-aot to prevent the generation of many unused qsort<K,T> instantiations */
+#if FULL_AOT_RUNTIME
 #if !BOOTSTRAP_BASIC
                                switch (Type.GetTypeCode (typeof (TKey))) {
                                case TypeCode.Int32:
@@ -1791,6 +1797,7 @@ namespace System
                                        qsort (keys as UInt64[], items, low, high);
                                        return;
                                }
+#endif
 #endif
                                // Using Comparer<TKey> adds a small overload, but with value types it
                                // helps us to not box them.
@@ -2660,6 +2667,7 @@ namespace System
                        }
                }
 
+               [MethodImpl ((MethodImplOptions)256)]
                private static void swap<K, V> (K [] keys, V [] items, int i, int j)
                {
                        K tmp;
@@ -2676,6 +2684,7 @@ namespace System
                        }
                }
 
+               [MethodImpl ((MethodImplOptions)256)]
                private static void swap<T> (T [] array, int i, int j)
                {
                        T tmp = array [i];
index 45b721a0c5ab9732d68d004340c523df2ca80388..71963cdc8c3b4c9500020f3bc386337b3c0a4057 100644 (file)
@@ -158,12 +158,21 @@ namespace System
                                stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
                        } else {
 #endif
+#if FULL_AOT_RUNTIME
+                               Type nslogwriter = Type.GetType ("MonoTouch.Foundation.NSLogWriter, monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
+                               stdout = (TextWriter) Activator.CreateInstance (nslogwriter);
+#else
                                stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding);
                                ((StreamWriter)stdout).AutoFlush = true;
+#endif
                                stdout = TextWriter.Synchronized (stdout, true);
 
+#if FULL_AOT_RUNTIME
+                               stderr = (TextWriter) Activator.CreateInstance (nslogwriter);
+#else
                                stderr = new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding); 
                                ((StreamWriter)stderr).AutoFlush = true;
+#endif
                                stderr = TextWriter.Synchronized (stderr, true);
 
                                stdin = new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding);
@@ -208,26 +217,6 @@ namespace System
                        }
                }
 
-#if NET_4_5
-               public static bool IsErrorRedirected {
-                       get {
-                               return stderr != console_stderr || ConsoleDriver.IsErrorRedirected;
-                       }
-               }
-
-               public static bool IsOutputRedirected {
-                       get {
-                               return stdout != console_stdout || ConsoleDriver.IsOutputRedirected;
-                       }
-               }
-
-               public static bool IsInputRedirected {
-                       get {
-                               return stdin != console_stdin || ConsoleDriver.IsInputRedirected;
-                       }
-               }
-#endif
-
                private static Stream Open (IntPtr handle, FileAccess access, int bufferSize)
                {
 #if MOONLIGHT
@@ -686,6 +675,26 @@ namespace System
                        set { ConsoleDriver.WindowWidth = value; }
                }
 
+#if NET_4_5
+               public static bool IsErrorRedirected {
+                       get {
+                               return stderr != console_stderr || ConsoleDriver.IsErrorRedirected;
+                       }
+               }
+
+               public static bool IsOutputRedirected {
+                       get {
+                               return stdout != console_stdout || ConsoleDriver.IsOutputRedirected;
+                       }
+               }
+
+               public static bool IsInputRedirected {
+                       get {
+                               return stdin != console_stdin || ConsoleDriver.IsInputRedirected;
+                       }
+               }
+#endif
+
                public static void Beep ()
                {
                        Beep (1000, 500);
index cfb8fdf171da11fa13b8643e243454b65c992883..0ca565e9ab96c3cf24dd9f46aa21b99f8c6b041b 100644 (file)
@@ -565,7 +565,11 @@ namespace System
 
                internal bool IsTransparentProxy ()
                {
+#if MONOTOUCH
+                       return false;
+#else
                        return RemotingServices.IsTransparentProxy (m_target);
+#endif
                }
        }
 }
index 85af5b1cd3700f0af8a4f6f0b77eb688973e1558..e8dd2247d519a77d125f8c604331daba6b6a593d 100644 (file)
@@ -464,12 +464,17 @@ namespace System {
                }
 
                private static object _rngAccess = new object ();
+#if !FULL_AOT_RUNTIME
                private static RandomNumberGenerator _rng;
                private static RandomNumberGenerator _fastRng;
+#else
+               private static object _fastRng;
+#endif
 
                // generated as per section 3.4 of the specification
                public static Guid NewGuid ()
                {
+#if !FULL_AOT_RUNTIME
                        byte[] b = new byte [16];
 
                        // thread-safe access to the prng
@@ -478,6 +483,10 @@ namespace System {
                                        _rng = RandomNumberGenerator.Create ();
                                _rng.GetBytes (b);
                        }
+#else
+                       byte[] b = FastNewGuidArray ();
+#endif
+
 
                        Guid res = new Guid (b);
                        // Mask in Variant 1-0 in Bit[7..6]
@@ -497,12 +506,18 @@ namespace System {
                        // thread-safe access to the prng
                        lock (_rngAccess) {
                                // if known, use preferred RNG
+#if FULL_AOT_RUNTIME
+                               if (_fastRng == null)
+                                       _fastRng = new RNGCryptoServiceProvider ();
+                               (_fastRng as RNGCryptoServiceProvider).GetBytes (guid);
+#else
                                if (_rng != null)
                                        _fastRng = _rng;
                                // else use hardcoded default RNG (bypassing CryptoConfig)
                                if (_fastRng == null)
                                        _fastRng = new RNGCryptoServiceProvider ();
                                _fastRng.GetBytes (guid);
+#endif
                        }
 
                        // Mask in Variant 1-0 in Bit[7..6]
index 15a58c0be476810863fec276206bb608c540a00e..14641fbe66119662e4a5a903a73eb3316fc13627 100644 (file)
@@ -35,7 +35,10 @@ using System;
 using System.Reflection;
 using System.Collections;
 using System.Runtime.CompilerServices;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
+
 using System.Collections.Generic;
 
 namespace System
@@ -48,7 +51,11 @@ namespace System
                static bool IsUserCattrProvider (object obj)
                {
                        Type type = obj as Type;
+#if !FULL_AOT_RUNTIME
                        if ((type is MonoType) || (type is TypeBuilder))
+#else
+                       if (type is MonoType)
+#endif
                                return false;
                        if ((obj is Type))
                                return true;
index 91f24fb835f0dff7817a4c20e1dbdedd3beec437..fb595c643b2cfb57d40564f9e698aca689b0c24c 100644 (file)
@@ -769,16 +769,30 @@ namespace System
 
                public static int CompareOrdinal (String strA, int indexA, String strB, int indexB, int length)
                {
-                       if ((indexA > strA.Length) || (indexB > strB.Length) || (indexA < 0) || (indexB < 0) || (length < 0))
-                               throw new ArgumentOutOfRangeException ();
+                       if (strA != null && strB != null)
+                       {
+                               if (indexA > strA.Length || indexA < 0)
+                                       throw new ArgumentOutOfRangeException ("indexA");
+                               if (indexB > strB.Length || indexB < 0)
+                                       throw new ArgumentOutOfRangeException ("indexB");
+                               if (length < 0)
+                                       throw new ArgumentOutOfRangeException ("length");
+                       }
 
                        return CompareOrdinalUnchecked (strA, indexA, length, strB, indexB, length);
                }
 
                internal static int CompareOrdinalCaseInsensitive (String strA, int indexA, String strB, int indexB, int length)
                {
-                       if ((indexA > strA.Length) || (indexB > strB.Length) || (indexA < 0) || (indexB < 0) || (length < 0))
-                               throw new ArgumentOutOfRangeException ();
+                       if (strA != null && strB != null)
+                       {
+                               if (indexA > strA.Length || indexA < 0)
+                                       throw new ArgumentOutOfRangeException ("indexA");
+                               if (indexB > strB.Length || indexB < 0)
+                                       throw new ArgumentOutOfRangeException ("indexB");
+                               if (length < 0)
+                                       throw new ArgumentOutOfRangeException ("length");
+                       }
 
                        return CompareOrdinalCaseInsensitiveUnchecked (strA, indexA, length, strB, indexB, length);
                }
@@ -815,11 +829,9 @@ namespace System
                {
                        // Same as above, but checks versus uppercase characters
                        if (strA == null) {
-                               if (strB == null)
-                                       return 0;
-                               else
-                                       return -1;
-                       } else if (strB == null) {
+                               return strB == null ? 0 : -1;
+                       }
+                       if (strB == null) {
                                return 1;
                        }
                        int lengthA = Math.Min (lenA, strA.Length - indexA);
index 327c15b889c1931bbc867328b65c7407ef185284..8371a43b4f53fcec221cab9c2597bc707a746abd 100644 (file)
@@ -33,7 +33,9 @@
 
 using System.Diagnostics;
 using System.Reflection;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Collections;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
@@ -708,8 +710,10 @@ namespace System {
                        Type type = this;
                        if (type is MonoType)
                                return GetTypeCodeInternal (type);
+#if !FULL_AOT_RUNTIME
                        if (type is TypeBuilder)
                                return ((TypeBuilder)type).GetTypeCodeInternal ();
+#endif
 
                        type = type.UnderlyingSystemType;
 
@@ -876,8 +880,10 @@ namespace System {
                        if (Equals (c))
                                return true;
 
+#if !FULL_AOT_RUNTIME
                        if (c is TypeBuilder)
                                return ((TypeBuilder)c).IsAssignableTo (this);
+#endif
 
                        /* Handle user defined type classes */
                        if (!IsSystemType) {
@@ -1436,9 +1442,11 @@ namespace System {
                                systemTypes [i] = t;
                        }
 
+#if !FULL_AOT_RUNTIME
                        if (hasUserType) {
                                return new MonoGenericClass (this, typeArguments);
                        }
+#endif
 
                        Type res = MakeGenericType (this, systemTypes);
                        if (res == null)
index 6f95b81f651d22206b700ad479da07e42b580ca1..b531d1725f59f34e35104740d76c30af3669fb15 100644 (file)
@@ -168,6 +168,7 @@ namespace System
                                vt = (short)VarEnum.VT_BSTR;
                                bstrVal = Marshal.StringToBSTR(((BStrWrapper)obj).WrappedObject);
                        }
+#if !FULL_AOT_RUNTIME
                        else if (t == typeof (UnknownWrapper))
                        {
                                vt = (short)VarEnum.VT_UNKNOWN;
@@ -178,8 +179,12 @@ namespace System
                                vt = (short)VarEnum.VT_DISPATCH;
                                pdispVal = Marshal.GetIDispatchForObject(((DispatchWrapper)obj).WrappedObject);
                        }
+#endif
                        else
                        {
+#if FULL_AOT_RUNTIME
+                               throw new NotImplementedException(string.Format("Variant couldn't handle object of type {0}", obj.GetType()));
+#else
                                try 
                                {
                                        pdispVal = Marshal.GetIDispatchForObject(obj);
@@ -196,6 +201,7 @@ namespace System
                                {
                                        throw new NotImplementedException(string.Format("Variant couldn't handle object of type {0}", obj.GetType()), ex);
                                }
+#endif
                        }
                }
 
@@ -239,11 +245,13 @@ namespace System
                        case VarEnum.VT_BSTR:
                                obj = Marshal.PtrToStringBSTR(bstrVal);
                                break;
+#if !FULL_AOT_RUNTIME
                        case VarEnum.VT_UNKNOWN:
                        case VarEnum.VT_DISPATCH:
                                if (pdispVal != IntPtr.Zero)
                                        obj = Marshal.GetObjectForIUnknown(pdispVal);
                                break;
+#endif
                        }
                        return obj;
                }
index 5dd7257c4a0dbf9ac7ef3f75022dc084b4037ca5..de5103a639a4280d37a955c9435e8feb4e252013 100644 (file)
@@ -31,7 +31,9 @@ using System.Security.Permissions;
 using System.Security.Policy;
 using System.Security.Principal;
 using System.Reflection;
+#if !FULL_AOT_RUNTIME
 using System.Reflection.Emit;
+#endif
 using System.Globalization;
 using System.Runtime.Remoting;
 using System.Runtime.InteropServices;
@@ -77,6 +79,8 @@ namespace System
                        BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
                        object[] activationAttributes, Evidence securityAttributes);
 #endif
+
+#if !FULL_AOT_RUNTIME
                AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access);
                AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence);
                AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir);
@@ -94,6 +98,7 @@ namespace System
                AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
                        Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
                        PermissionSet refusedPermissions, bool isSynchronized);
+#endif
 
                void DoCallBack (CrossAppDomainDelegate theDelegate);
                bool Equals (object other);
index be73062900224765b90a0b3a58279a0aa14c8edf..18f0c43ec49761d5097b6a32b97c2910c4031816 100644 (file)
@@ -32,6 +32,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using Mono.Interop;
 using System.Collections;
 using System.Runtime.InteropServices;
@@ -229,3 +230,4 @@ namespace System
                        out IntPtr pUnk);
        }
 }
+#endif
index 055ccb9485fe7afec2f819501ec6722fa632a1de..e1d7796e44b5099299ef9d0e0d10ba0570bd4372 100644 (file)
@@ -236,6 +236,20 @@ namespace MonoTests.System.Threading.Tasks
                        }
                }
 
+               [Test]
+               public void ContinueWhenAll_WithExceptions ()
+               {
+                       var t1 = Task.Factory.StartNew (() => { throw new ApplicationException ("Foo"); });
+                       var t2 = Task.Factory.StartNew (() => { throw new ApplicationException ("Bar"); });
+
+                       var cont = Task.Factory.ContinueWhenAll (new[] { t1, t2 }, delegate {});
+                       cont.Wait (200);
+
+                       Assert.IsTrue (t1.IsFaulted);
+                       Assert.IsTrue (t2.IsFaulted);
+                       Assert.AreEqual (TaskStatus.RanToCompletion, cont.Status);
+               }
+
                [Test]
                public void ContinueWhenAny_Simple ()
                {
index 47289d77d01136ca36a77cfd432b9f44b6b920b8..0e515c2b7cfdce634320ff8f0520346d6f4437ee 100644 (file)
@@ -315,6 +315,87 @@ namespace MonoTests.System.Threading {
                        WaitHandle.WaitAny (new WaitHandle [0]);
                }
 
+               [Test]
+               public void InterrupedWaitAny ()
+               {
+                       using (var m1 = new Mutex (true)) {
+                               using (var m2 = new Mutex (true)) {
+                                       using (var done = new ManualResetEvent (false)) {
+                                               var thread = new Thread (() =>
+                                               {
+                                                       try {
+                                                               WaitHandle.WaitAny (new WaitHandle [] { m1, m2 });
+                                                       } catch (ThreadInterruptedException) {
+                                                               done.Set ();
+                                                       }
+                                               });
+                                               thread.Start ();
+                                               Thread.Sleep (100); // wait a bit so the thread can enter its wait
+                                               thread.Interrupt ();
+
+                                               Assert.IsTrue (thread.Join (1000), "Join");
+                                               Assert.IsTrue (done.WaitOne (1000), "done");
+
+                                               m1.ReleaseMutex ();
+                                               m2.ReleaseMutex ();
+                                       }
+                               }
+                       }
+               }
+               
+               [Test]
+               public void InterrupedWaitAll ()
+               {
+                       using (var m1 = new Mutex (true)) {
+                               using (var m2 = new Mutex (true)) {
+                                       using (var done = new ManualResetEvent (false)) {
+                                               var thread = new Thread (() =>
+                                                                        {
+                                                       try {
+                                                               WaitHandle.WaitAll (new WaitHandle [] { m1, m2 });
+                                                       } catch (ThreadInterruptedException) {
+                                                               done.Set ();
+                                                       }
+                                               });
+                                               thread.Start ();
+                                               Thread.Sleep (100); // wait a bit so the thread can enter its wait
+                                               thread.Interrupt ();
+
+                                               Assert.IsTrue (thread.Join (1000), "Join");
+                                               Assert.IsTrue (done.WaitOne (1000), "done");
+
+                                               m1.ReleaseMutex ();
+                                               m2.ReleaseMutex ();
+                                       }
+                               }
+                       }
+               }
+               
+               [Test]
+               public void InterrupedWaitOne ()
+               {
+                       using (var m1 = new Mutex (true)) {
+                               using (var done = new ManualResetEvent (false)) {
+                                       var thread = new Thread (() =>
+                                                                {
+                                               try {
+                                                       m1.WaitOne ();
+                                               } catch (ThreadInterruptedException) {
+                                                       done.Set ();
+                                               }
+                                       });
+                                       thread.Start ();
+                                       Thread.Sleep (100); // wait a bit so the thread can enter its wait
+                                       thread.Interrupt ();
+
+                                       Assert.IsTrue (thread.Join (1000), "Join");
+                                       Assert.IsTrue (done.WaitOne (1000), "done");
+
+                                       m1.ReleaseMutex ();
+                               }
+                       }
+               }
+
        }
 }
 
index ab1ba7080b6ee93469d6dabc502db37aaf91f005..ffa822b6aee77c2aeed275d59cd5888868fa3233 100644 (file)
@@ -658,6 +658,23 @@ public class StringTest
                Assert.IsTrue (string.CompareOrdinal (ab2, 0, ab1, 1, 1) < 0, "#2");
        }
 
+       [Test]
+       public void CompareOrdinalSubstringWithNull ()
+       {
+               string lesser = "abc";
+               string greater = "xyz";
+
+               Assert.AreEqual (0, string.CompareOrdinal (null, 0, null, 0, 0), "substring both null");
+               Assert.AreEqual (-1, string.CompareOrdinal (null, 0, greater, 0, 0), "substring strA null");
+               Assert.AreEqual (-1, string.CompareOrdinal (null, 4, greater, 0, 0), "substring strA null; indexA greater than strA.Length");
+               Assert.AreEqual (-1, string.CompareOrdinal (null, 0, greater, 4, 0), "substring strA null; indexB greater than strB.Length");
+               Assert.AreEqual (-1, string.CompareOrdinal (null, -1, greater, -1, -1), "substring strA null; indexA, indexB, length negative");
+               Assert.AreEqual (1, string.CompareOrdinal (lesser, 0, null, 0, 0), "substring strB null");
+               Assert.AreEqual (1, string.CompareOrdinal (lesser, 4, null, 0, 0), "substring strB null; indexA greater than strA.Length");
+               Assert.AreEqual (1, string.CompareOrdinal (lesser, 0, null, 4, 0), "substring strB null; indexB greater than strB.Length");
+               Assert.AreEqual (1, string.CompareOrdinal (lesser, -1, null, -1, -1), "substring strB null; indexA, indexB, length negative");
+       }
+
        [Test]
        public void CompareTo ()
        {
index e1b8ba133d29f70369bfc3cbbaa5268671407365..26fe3bb955497215a39c5359367cc85fb21ba7cf 100644 (file)
@@ -1272,6 +1272,7 @@ System.Security.Cryptography/CipherMode.cs
 System.Security.Cryptography/CryptoAPITransform.cs
 System.Security.Cryptography/CryptoConfig.cs
 System.Security.Cryptography/CryptoConfig_2_1.cs
+System.Security.Cryptography/CryptoConfig.fullaot.cs
 System.Security.Cryptography/CryptographicException.cs
 System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
 System.Security.Cryptography/CryptoStream.cs
diff --git a/mcs/class/reactive.pub b/mcs/class/reactive.pub
new file mode 100644 (file)
index 0000000..695f1b3
Binary files /dev/null and b/mcs/class/reactive.pub differ
index 3b653ccd692602e55f5a5a34adc42f756a7a567f..79ad235c4e0c75094c9372a08ce8140e15ed0c50 100644 (file)
@@ -130,21 +130,21 @@ NUNIT_DIRS = \
 
 netdocs.zip : netdocs.tree
 netdocs.tree: Makefile
-       $(MDOC) assemble -o netdocs $(NETDOCS_DIRS)
+       $(MDOC) --debug assemble -o netdocs $(NETDOCS_DIRS)
 
 Mono.zip : Mono.tree
 Mono.tree: Makefile
-       $(MDOC) assemble -o Mono $(MONO_DIRS)
+       $(MDOC) --debug assemble -o Mono $(MONO_DIRS)
 
 Novell.zip : Novell.tree
 Novell.tree: Makefile
-       $(MDOC) assemble -o Novell $(NOVELL_DIRS)
+       $(MDOC) --debug assemble -o Novell $(NOVELL_DIRS)
 
 cs-errors.zip : cs-errors.tree
 cs-errors.tree: cs-errors.config Makefile
-       $(MDOC) assemble -o cs-errors -f error $<
+       $(MDOC) --debug assemble -o cs-errors -f error $<
 
 ecma334.zip : ecma334.tree
 ecma334.tree: Makefile
-       $(MDOC) assemble -o ecma334 -f ecmaspec ecma334
+       $(MDOC) --debug assemble -o ecma334 -f ecmaspec ecma334
 
diff --git a/mcs/errors/CS0012-17-lib.il b/mcs/errors/CS0012-17-lib.il
new file mode 100644 (file)
index 0000000..3dc2f90
--- /dev/null
@@ -0,0 +1,31 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS0012-lib-missing'
+{
+}
+
+.assembly 'CS0012-17-lib'
+{
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+
+.module 'CS0012-17-lib.dll'
+
+.class public auto ansi beforefieldinit B
+       extends [mscorlib]System.Object
+{
+  .method public hidebysig static void  Foo<(class ['CS0012-lib-missing']AA`1<!!T>) T>() cil managed
+  {
+    ret
+  }
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    ret
+  }
+
+}
diff --git a/mcs/errors/CS0012-18-lib.il b/mcs/errors/CS0012-18-lib.il
new file mode 100644 (file)
index 0000000..7305e5e
--- /dev/null
@@ -0,0 +1,30 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS0012-lib-missing'
+{
+}
+
+.assembly 'CS0012-18-lib'
+{
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+
+.module 'CS0012-18-lib.dll'
+
+
+.class public auto ansi beforefieldinit B
+       extends [mscorlib]System.Object
+{
+  .field public static literal valuetype ['CS0012-lib-missing']E e = int32(0x00000001)
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    ret
+  }
+
+}
+
diff --git a/mcs/errors/CS1070-lib.il b/mcs/errors/CS1070-lib.il
new file mode 100644 (file)
index 0000000..d4487ff
--- /dev/null
@@ -0,0 +1,26 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'CS1070-lib-missing'
+{
+}
+
+.assembly 'CS1070-lib'
+{
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+
+.module 'CS1070-lib.dll'
+
+.class extern forwarder E
+{
+  .assembly extern 'CS1070-lib-missing'
+}
+
+.class extern forwarder C
+{
+  .assembly extern 'CS1070-lib-missing'
+}
+
index 96085dde45b66682c3804a8fee69b59d0533f1b6..fccf2d93aa3d1102d3899a2e6e020c1c72acf50e 100644 (file)
@@ -21,7 +21,7 @@ DISTFILES = \
        $(wildcard dlls/second/*.cs)
 
 TEST_SUPPORT_FILES = \
-       CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0029-26-lib.dll \
+       CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0029-26-lib.dll \
        CS0103-2-lib.dll CS0118-2-lib.dll CS0122-8-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0122-19-lib.dll CS0122-35-lib.dll CS0122-36-lib.dll CS0143-lib.dll CS0144-3-lib.dll CS0165-19-lib.dll \
        CS0205-3-lib.dll CS0229-3-lib.dll CS0229-4-lib.dll CS0266-25-lib.dll \
        CS0315-2-lib.dll \
@@ -30,6 +30,7 @@ TEST_SUPPORT_FILES = \
        CS0612-2-lib.dll CS0618-2-lib.dll CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll CS0619-42-lib.dll \
        CS0619-43-lib.dll CS1546-lib.dll CS0619-51-lib.dll CS1509-module.dll CS1681-2-lib.dll \
        CS0730-lib.dll \
+       CS1070-lib.dll \
        CS1540-15-lib.dll CS1540-17-lib.dll CS1542-lib.dll CS1577-lib.dll \
        CS1607-3-lib.dll CS1683-lib.dll CS1684-lib.dll CS1685-2-lib.dll \
        dlls/first/CS1701-lib.dll dlls/second/CS1701-lib.dll CS1701-lib.dll dlls/first/CS1702-lib.dll dlls/second/CS1702-lib.dll CS1702-lib.dll dlls/first/CS1705-lib.dll dlls/second/CS1705-lib.dll CS1705-lib.dll \
diff --git a/mcs/errors/cs0012-17.cs b/mcs/errors/cs0012-17.cs
new file mode 100644 (file)
index 0000000..a5df8bd
--- /dev/null
@@ -0,0 +1,11 @@
+// CS0012: The type `AA`1<T>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 9
+// Compiler options: -r:CS0012-17-lib.dll
+
+class Test
+{
+       public static void Main ()
+       {
+               B.Foo<long> ();
+       }
+}
diff --git a/mcs/errors/cs0012-18.cs b/mcs/errors/cs0012-18.cs
new file mode 100644 (file)
index 0000000..71395f3
--- /dev/null
@@ -0,0 +1,11 @@
+// CS0012: The type `E' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 9
+// Compiler options: -r:CS0012-18-lib.dll
+
+class Test
+{
+       public static void Main ()
+       {
+               var c = B.e;
+       }
+}
diff --git a/mcs/errors/cs0135-7.cs b/mcs/errors/cs0135-7.cs
new file mode 100644 (file)
index 0000000..4a61197
--- /dev/null
@@ -0,0 +1,22 @@
+// CS0135: `x' conflicts with a declaration in a child block
+// Line: 18
+
+public class Test
+{
+       Test x;
+
+       void Foo ()
+       {
+               {
+                       string x = "dd";
+               }
+
+               {
+                       x = null;
+               }
+
+               x = new Test ();
+       }
+
+       public static void Main () { }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0214-16.cs b/mcs/errors/cs0214-16.cs
new file mode 100644 (file)
index 0000000..8d4a664
--- /dev/null
@@ -0,0 +1,9 @@
+// CS0214: Pointers and fixed size buffers may only be used in an unsafe context
+// Line: 8 
+
+public class G<T> {}
+
+abstract class A
+{
+       public abstract G<int*[]> Foo1 ();
+}
diff --git a/mcs/errors/cs0411-23.cs b/mcs/errors/cs0411-23.cs
new file mode 100644 (file)
index 0000000..f12aaf9
--- /dev/null
@@ -0,0 +1,22 @@
+// CS0411: The type arguments for method `System.Linq.Enumerable.OrderBy<TSource,TKey>(this System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TKey>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+// Line: 20
+
+using System.Collections.Generic;
+using System.Linq;
+
+public class C
+{
+       public string Name ()
+       {
+               return "aa";
+       }
+}
+
+class Z
+{
+       void Test ()
+       {
+               List<C> l = null;
+               var r = l.OrderBy (f => f.Name).ToList ();
+       }
+}
\ No newline at end of file
index f420cd9c8a75ff8f8c2504d0cfbca56be632a27d..cf09dfcaa37403a037c597d1a88b89b2b18b1b84 100644 (file)
@@ -1,4 +1,4 @@
-// CS0572: `meth': cannot reference a type through an expression; try `test.meth' instead
+// CS0572: `meth': cannot reference a type through an expression. Consider using `test.meth' instead
 // Line: 8
 
 class test2 : test {
diff --git a/mcs/errors/cs0572-3.cs b/mcs/errors/cs0572-3.cs
new file mode 100644 (file)
index 0000000..675fd7d
--- /dev/null
@@ -0,0 +1,20 @@
+// CS0572: `Inner': cannot reference a type through an expression. Consider using `Outer.Inner' instead
+// Line: 18
+
+public class Outer
+{
+       public enum Inner
+       {
+               ONE,
+               TWO
+       }
+}
+
+public class C
+{
+       public static bool Test ()
+       {
+               Outer outer = null;
+               return 0 == outer.Inner.ONE;
+       }
+}
\ No newline at end of file
index 01e7a62691f81496096b44a09f8fb939acafd05d..a40ddfbddbbf8d274fa9aed9cec9ceeed10f9e9c 100644 (file)
@@ -1,4 +1,4 @@
-// CS0572: `Foo': cannot reference a type through an expression; try `Y.Foo' instead
+// CS0572: `Foo': cannot reference a type through an expression. Consider using `Y.Foo' instead
 // Line: 13
 using System;
 
diff --git a/mcs/errors/cs1070.cs b/mcs/errors/cs1070.cs
new file mode 100644 (file)
index 0000000..30a51e4
--- /dev/null
@@ -0,0 +1,7 @@
+// CS1070: The type `C' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `CS1070-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 5
+// Compiler options: -r:CS1070-lib.dll
+
+public class D : C
+{
+}
\ No newline at end of file
index 91a3a612e54ec861b334f5feee12b1885bb1724f..45b8d5e5874f0e7cc4cb97b28b76baa9dd92b083 100644 (file)
@@ -1,3 +1,3 @@
 // CS2002: Source file `cs2002.cs' specified multiple times
 // Line: 0
-// Compiler options: cs2002.cs /warnaserror
+// Compiler options:  /warnaserror cs2002.cs
index ff0237d8398ed474598ec644d8e61e436bfe10ac..25a46efbf3180a5898d536eb0b2224a4bc0132f8 100644 (file)
@@ -9,9 +9,11 @@
 
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.Reflection;
 using System.Security;
 using System.Globalization;
+using PEAPI;
 
 namespace Mono.ILASM {
 
@@ -247,11 +249,34 @@ namespace Mono.ILASM {
 
         }
 
+        public class ExternClass
+        {
+            string name;
+            TypeAttr ta;
+            string assemblyReference;
+
+            public ExternClass (string name, TypeAttr ta, string assemblyReference)
+            {
+                this.name = name;
+                this.ta = ta;
+                this.assemblyReference = assemblyReference;
+            }
+
+            public void Resolve (CodeGen code_gen, ExternTable table)
+            {
+                var ar = table.GetAssemblyRef (assemblyReference);
+                if (ar != null)
+                    code_gen.PEFile.AddExternClass (name, ta, ar.AssemblyRef);
+            }
+        }
+
         
         public class ExternTable {
 
                 Hashtable assembly_table;
                 Hashtable module_table;
+                List<ExternClass> class_table;
+
                 bool is_resolved;
                 
                 public void AddCorlib ()
@@ -305,6 +330,14 @@ namespace Mono.ILASM {
                         return em;
                 }
 
+                public void AddClass (string name, TypeAttr ta, string assemblyReference)
+                {
+                    if (class_table == null)
+                        class_table = new List<ExternClass> ();
+
+                    class_table.Add (new ExternClass (name, ta, assemblyReference));
+                }
+
                 public void Resolve (CodeGen code_gen)
                 {
                         if (is_resolved)
@@ -313,12 +346,16 @@ namespace Mono.ILASM {
                         if (assembly_table != null)
                                 foreach (ExternAssembly ext in assembly_table.Values)
                                         ext.Resolve (code_gen);
-                        if (module_table == null)
-                                return;
-                        foreach (ExternModule ext in module_table.Values)
-                                ext.Resolve (code_gen);
 
-                       is_resolved = true;     
+                        if (module_table != null)
+                            foreach (ExternModule ext in module_table.Values)
+                                    ext.Resolve (code_gen);
+
+                        if (class_table != null)
+                            foreach (var entry in class_table)
+                                entry.Resolve (code_gen, this);
+
+                        is_resolved = true;    
                 }
 
                 public ExternTypeRef GetTypeRef (string asmb_name, string full_name, bool is_valuetype)
@@ -356,6 +393,18 @@ namespace Mono.ILASM {
                         return mod.GetTypeRef (full_name, is_valuetype);
                 }
 
+                public ExternAssembly GetAssemblyRef (string assembly_name)
+                {
+                        ExternAssembly ass = null;
+                        if (assembly_table != null)
+                                ass = assembly_table [assembly_name] as ExternAssembly;
+
+                        if (ass == null)
+                                Report.Error ("Assembly " + assembly_name + " is not defined.");
+
+                        return ass;
+                }
+
                 public static void GetNameAndNamespace (string full_name,
                         out string name_space, out string name) {
 
index 523c5ffe1a236bcd21cfa40e6ab7fa0d7f998cb4..19a567e0ca5c2ea659d14cc67d8fbace0e18e35a 100644 (file)
@@ -10,6 +10,7 @@ using PEAPI;
 using System;\r
 using System.IO;\r
 using System.Collections;\r
+using System.Collections.Generic;\r
 using System.Globalization;\r
 using System.Reflection;\r
 using System.Security;\r
@@ -32,6 +33,7 @@ namespace Mono.ILASM {
                 private PEAPI.PInvokeAttr pinvoke_attr;\r
                 private ILTokenizer tokenizer;\r
                static int yacc_verbose_flag;\r
+               KeyValuePair<string, TypeAttr> current_extern;\r
 \r
                 class NameValuePair {\r
                         public string Name;\r
@@ -476,6 +478,7 @@ namespace Mono.ILASM {
 %token K_IS\r
 %token K_ON\r
 %token K_OFF\r
+%token K_FORWARDER\r
 %token K_CHARMAPERROR\r
 \r
 /* end generated */\r
@@ -3201,17 +3204,21 @@ exptype_all             : exptype_head OPEN_BRACE exptype_decls CLOSE_BRACE
                        ;\r
 \r
 exptype_head           : D_CLASS K_EXTERN expt_attr comp_name\r
+                                       {\r
+                                               current_extern = new KeyValuePair<string, TypeAttr> ((string) $4, (TypeAttr) $3);\r
+                                       }\r
                        ;\r
 \r
 expt_attr              : /* EMPTY */\r
-                       | expt_attr K_PRIVATE\r
-                       | expt_attr K_PUBLIC \r
-                       | expt_attr K_NESTED K_PUBLIC\r
-                       | expt_attr K_NESTED K_PRIVATE\r
-                       | expt_attr K_NESTED K_FAMILY\r
-                       | expt_attr K_NESTED K_ASSEMBLY\r
-                       | expt_attr K_NESTED K_FAMANDASSEM\r
-                       | expt_attr K_NESTED K_FAMORASSEM\r
+                       | expt_attr K_PRIVATE                   { $$ = (TypeAttr)$1 | TypeAttr.Private; }\r
+                       | expt_attr K_PUBLIC                    { $$ = (TypeAttr)$1 | TypeAttr.Public; }\r
+                       | expt_attr K_NESTED K_PUBLIC           { $$ = (TypeAttr)$1 | TypeAttr.NestedPublic; }\r
+                       | expt_attr K_NESTED K_PRIVATE          { $$ = (TypeAttr)$1 | TypeAttr.NestedPrivate; }\r
+                       | expt_attr K_NESTED K_FAMILY           { $$ = (TypeAttr)$1 | TypeAttr.NestedFamily; }\r
+                       | expt_attr K_NESTED K_ASSEMBLY         { $$ = (TypeAttr)$1 | TypeAttr.NestedAssembly;}\r
+                       | expt_attr K_NESTED K_FAMANDASSEM      { $$ = (TypeAttr)$1 | TypeAttr.NestedFamAndAssem; }\r
+                       | expt_attr K_NESTED K_FAMORASSEM       { $$ = (TypeAttr)$1 | TypeAttr.NestedFamOrAssem; }\r
+                       | K_FORWARDER                           { $$ = TypeAttr.Forwarder; }\r
                        ;\r
 \r
 exptype_decls          : /* EMPTY */\r
@@ -3220,8 +3227,11 @@ exptype_decls            : /* EMPTY */
 \r
 exptype_decl           : D_FILE comp_name\r
                        | D_CLASS K_EXTERN comp_name\r
-                       | D_CLASS int32\r
                        | customattr_decl\r
+                       | D_ASSEMBLY K_EXTERN comp_name\r
+                         {\r
+                               codegen.ExternTable.AddClass (current_extern.Key, current_extern.Value, (string) $3);\r
+                         }\r
                        ;\r
 \r
 manifestres_all                : manifestres_head OPEN_BRACE manifestres_decls CLOSE_BRACE\r
index 42f2d1aa8c79256528bb5c90955ef43ccbecbb06..deb2f3a7ba3aead60ad4e3f253d91ef52a707d35 100644 (file)
@@ -318,6 +318,7 @@ namespace Mono.ILASM {
                                 keywords ["on"] = new ILToken (Token.K_ON, "on");\r
                                 keywords ["off"] = new ILToken (Token.K_OFF, "off");\r
                                keywords ["strict"] = new ILToken (Token.K_STRICT, "strict");\r
+                               keywords ["forwarder"] = new ILToken (Token.K_FORWARDER, "forwarder");\r
 \r
                                 return keywords;\r
                         }\r
index e45aeb008f90fbd847861b39c29c82458cf97233..bc52a7bcdeb6fb23474dee7348813afd7d85f5ed 100644 (file)
@@ -22,7 +22,7 @@ the_libdir = $(topdir)/class/lib/build/
 LOCAL_MCS_FLAGS += -lib:$(topdir)/class/lib/build -debug
 endif
 
-LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER
+LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
 
 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
 
index f95a4d3cfa1877216e49734098a7b11478d86226..0124ce9164140869395e6687439c899ce24a7145 100644 (file)
@@ -36,7 +36,6 @@ namespace Mono.CSharp
        public interface IAssemblyDefinition
        {
                string FullName { get; }
-               bool HasExtensionMethod { get; }
                bool IsCLSCompliant { get; }
                bool IsMissing { get; }
                string Name { get; }
@@ -132,12 +131,6 @@ namespace Mono.CSharp
                        }
                }
 
-               public bool HasExtensionMethod {
-                       get {
-                               return module.HasExtensionMethod;
-                       }
-               }
-
                public bool HasCLSCompliantAttribute {
                        get {
                                return cls_attribute != null;
index 95a628e102d0cf8e9d97e4f1f0401aa00b6f24fc..b335e09f34876e5ec54f4816ffae55649efc3d35 100644 (file)
@@ -670,6 +670,12 @@ namespace Mono.CSharp
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+                               return false;
+                       }
+               }
+
                //
                // Returns true for secondary partial containers
                //
index 7fee671c12d37a98a5eaca59eb9764fb8f3d04ea..189bdea6f55fb10a4a461ae39811604c18e8aefa 100644 (file)
@@ -1251,6 +1251,7 @@ namespace Mono.CSharp
                        case Token.OPEN_BRACKET:
                        case Token.OP_GENERICS_GT:
                        case Token.INTERR:
+                       case Token.OP_COALESCING:
                                next_token = Token.INTERR_NULLABLE;
                                break;
                                
index 47d4971197cca5b7c4126b782cf7abac8d554b3a..f035ba655259d02cfc7f8583ecf75a3769d45890 100644 (file)
@@ -966,7 +966,10 @@ namespace Mono.CSharp {
                        this.definition = definition;
                        this.modifiers = modifiers;
 
-                       state = StateFlags.Obsolete_Undetected | StateFlags.CLSCompliant_Undetected | StateFlags.MissingDependency_Undetected;
+                       if (kind == MemberKind.MissingType)
+                               state = StateFlags.MissingDependency;
+                       else
+                               state = StateFlags.Obsolete_Undetected | StateFlags.CLSCompliant_Undetected | StateFlags.MissingDependency_Undetected;
                }
 
                #region Properties
index 2c434e3a08234f4ad6cd0cf2346df6e101557ada..e990acb244ea9586af2c472696b8c2061f6c75b2 100644 (file)
@@ -360,6 +360,27 @@ namespace Mono.CSharp {
                        }
                }
 
+               //
+               // Implements identical simple name and type-name resolution
+               //
+               public Expression ProbeIdenticalTypeName (ResolveContext rc, Expression left, SimpleName name)
+               {
+                       var t = left.Type;
+                       if (t.Kind == MemberKind.InternalCompilerType || t is ElementTypeSpec || t.Arity > 0)
+                               return left;
+
+                       // In a member access of the form E.I, if E is a single identifier, and if the meaning of E as a simple-name is
+                       // a constant, field, property, local variable, or parameter with the same type as the meaning of E as a type-name
+
+                       if (left is MemberExpr || left is VariableReference) {
+                               var identical_type = rc.LookupNamespaceOrType (name.Name, 0, LookupMode.Probing, loc) as TypeExpr;
+                               if (identical_type != null && identical_type.Type == left.Type)
+                                       return identical_type;
+                       }
+
+                       return left;
+               }
+
                public virtual string GetSignatureForError ()
                {
                        return type.GetDefinition ().GetSignatureForError ();
@@ -2783,7 +2804,7 @@ namespace Mono.CSharp {
                                //
                                TypeSpec[] targs = null;
                                if (method.DeclaringType != InstanceExpression.Type) {
-                                       var base_override = MemberCache.FindMember (InstanceExpression.Type, new MemberFilter (method), BindingRestriction.InstanceOnly) as MethodSpec;
+                                       var base_override = MemberCache.FindMember (InstanceExpression.Type, new MemberFilter (method), BindingRestriction.InstanceOnly | BindingRestriction.OverrideOnly) as MethodSpec;
                                        if (base_override != null && base_override.DeclaringType != method.DeclaringType) {
                                                if (base_override.IsGeneric)
                                                        targs = method.TypeArguments;
@@ -2928,27 +2949,6 @@ namespace Mono.CSharp {
                                member.GetSignatureForError (), qualifier.GetSignatureForError (), rc.CurrentType.GetSignatureForError ());
                }
 
-               //
-               // Implements identicial simple name and type-name
-               //
-               public Expression ProbeIdenticalTypeName (ResolveContext rc, Expression left, SimpleName name)
-               {
-                       var t = left.Type;
-                       if (t.Kind == MemberKind.InternalCompilerType || t is ElementTypeSpec || t.Arity > 0)
-                               return left;
-
-                       // In a member access of the form E.I, if E is a single identifier, and if the meaning of E as a simple-name is
-                       // a constant, field, property, local variable, or parameter with the same type as the meaning of E as a type-name
-
-                       if (left is MemberExpr || left is VariableReference) {
-                               var identical_type = rc.LookupNamespaceOrType (name.Name, 0, LookupMode.Probing, loc) as TypeExpr;
-                               if (identical_type != null && identical_type.Type == left.Type)
-                                       return identical_type;
-                       }
-
-                       return left;
-               }
-
                public bool ResolveInstanceExpression (ResolveContext rc, Expression rhs)
                {
                        if (!ResolveInstanceExpressionCore (rc, rhs))
@@ -3822,11 +3822,7 @@ namespace Mono.CSharp {
                                // better conversion is performed between underlying types Y1 and Y2
                                //
                                if (p.IsGenericTask || q.IsGenericTask) {
-                                       if (am.Block.IsAsync) {
-                                               if (p.IsGenericTask != q.IsGenericTask) {
-                                                       return 0;
-                                               }
-
+                                       if (am.Block.IsAsync && p.IsGenericTask && q.IsGenericTask) {
                                                q = q.TypeArguments[0];
                                                p = p.TypeArguments[0];
                                        }
@@ -4200,6 +4196,9 @@ namespace Mono.CSharp {
                                        } else if (arg_count > param_count) {
                                                int args_gap = System.Math.Abs (arg_count - param_count);
                                                return int.MaxValue - 10000 + args_gap;
+                                       } else if (arg_count < param_count - optional_count) {
+                                               int args_gap = System.Math.Abs (param_count - optional_count - arg_count);
+                                               return int.MaxValue - 10000 + args_gap;
                                        }
                                } else if (arg_count != param_count) {
                                        int args_gap = System.Math.Abs (arg_count - param_count);
@@ -4402,34 +4401,8 @@ namespace Mono.CSharp {
                                        // if the type matches
                                        //
                                        Expression e = fp.DefaultValue;
-                                       if (!(e is Constant) || e.Type != ptypes [i]) {
-                                               //
-                                               // LAMESPEC: No idea what the exact rules are for System.Reflection.Missing.Value instead of null
-                                               //
-                                               var ptype = ptypes [i];
-                                               if (e == EmptyExpression.MissingValue && ptype.BuiltinType == BuiltinTypeSpec.Type.Object || ptype.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
-                                                       e = new MemberAccess (new MemberAccess (new MemberAccess (
-                                                               new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Reflection", loc), "Missing", loc), "Value", loc);
-                                               } else if (e is Constant) {
-                                                       //
-                                                       // Handles int to int? conversions
-                                                       //
-                                                       e = Convert.ImplicitConversionStandard (ec, e, ptype, loc);
-                                                       
-                                                       //
-                                                       // When constant type paramter contains type argument
-                                                       //
-                                                       // Foo (T[] arg = null)
-                                                       //
-                                                       if (e == null) {
-                                                               e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
-                                                       }
-                                               } else {
-                                                       e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
-                                               }
-                                       
-
-                                               e = e.Resolve (ec);
+                                       if (e != null) {
+                                               e = ResolveDefaultValueArgument (ec, ptypes[i], e, loc);
                                        }
 
                                        if ((fp.ModFlags & Parameter.Modifier.CallerMask) != 0) {
@@ -4522,6 +4495,39 @@ namespace Mono.CSharp {
                        return 0;
                }
 
+               public static Expression ResolveDefaultValueArgument (ResolveContext ec, TypeSpec ptype, Expression e, Location loc)
+               {
+                       if (e is Constant && e.Type == ptype)
+                               return e;
+
+                       //
+                       // LAMESPEC: No idea what the exact rules are for System.Reflection.Missing.Value instead of null
+                       //
+                       if (e == EmptyExpression.MissingValue && ptype.BuiltinType == BuiltinTypeSpec.Type.Object || ptype.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
+                               e = new MemberAccess (new MemberAccess (new MemberAccess (
+                                       new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Reflection", loc), "Missing", loc), "Value", loc);
+                       } else if (e is Constant) {
+                               //
+                               // Handles int to int? conversions
+                               //
+                               e = Convert.ImplicitConversionStandard (ec, e, ptype, loc);
+
+                               //
+                               // When constant type paramter contains type argument
+                               //
+                               // Foo (T[] arg = null)
+                               //
+                               if (e == null) {
+                                       e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
+                               }
+                       } else {
+                               e = new DefaultValueExpression (new TypeExpression (ptype, loc), loc);
+                       }
+
+
+                       return e.Resolve (ec);
+               }
+
                //
                // Tests argument compatibility with the parameter
                // The possible return values are
@@ -5812,6 +5818,8 @@ namespace Mono.CSharp {
        //
        sealed class PropertyExpr : PropertyOrIndexerExpr<PropertySpec>
        {
+               Arguments arguments;
+
                public PropertyExpr (PropertySpec spec, Location l)
                        : base (l)
                {
@@ -5823,9 +5831,10 @@ namespace Mono.CSharp {
 
                protected override Arguments Arguments {
                        get {
-                               return null;
+                               return arguments;
                        }
                        set {
+                               arguments = value;
                        }
                }
 
@@ -5982,7 +5991,7 @@ namespace Mono.CSharp {
                                        }
                                }
                        } else {
-                               args = new Arguments (1);
+                               args = arguments == null ? new Arguments (1) : arguments;
 
                                if (leave_copy) {
                                        source.Emit (ec);
@@ -6032,6 +6041,22 @@ namespace Mono.CSharp {
                        }
 
                        DoBestMemberChecks (rc, best_candidate);
+
+                       // Handling of com-imported properties with any number of default property parameters
+                       if (best_candidate.HasGet && !best_candidate.Get.Parameters.IsEmpty) {
+                               var p = best_candidate.Get.Parameters;
+                               arguments = new Arguments (p.Count);
+                               for (int i = 0; i < p.Count; ++i) {
+                                       arguments.Add (new Argument (OverloadResolver.ResolveDefaultValueArgument (rc, p.Types [i], p.FixedParameters [i].DefaultValue, loc)));
+                               }
+                       } else if (best_candidate.HasSet && best_candidate.Set.Parameters.Count > 1) {
+                               var p = best_candidate.Set.Parameters;
+                               arguments = new Arguments (p.Count - 1);
+                               for (int i = 0; i < p.Count - 1; ++i) {
+                                       arguments.Add (new Argument (OverloadResolver.ResolveDefaultValueArgument (rc, p.Types [i], p.FixedParameters [i].DefaultValue, loc)));
+                               }
+                       }
+
                        return this;
                }
 
index 9001763a2682f611440058e7d8cc7aae36f5a379..fd501dff6337c8b6d3e2ab1b2b4f02c79fb45f3b 100644 (file)
@@ -4643,7 +4643,7 @@ namespace Mono.CSharp
                                                // ambiguous because 1 literal can be converted to short.
                                                //
                                                if (conv_false_expr != null) {
-                                                       if (conv_false_expr is IntConstant && conv is Constant) {
+                                                       if (conv_false_expr.Type.BuiltinType == BuiltinTypeSpec.Type.Int && conv is Constant) {
                                                                type = true_type;
                                                                conv_false_expr = null;
                                                        } else if (type.BuiltinType == BuiltinTypeSpec.Type.Int && conv_false_expr is Constant) {
@@ -8064,13 +8064,9 @@ namespace Mono.CSharp
 
                        TypeExpr texpr = member_lookup as TypeExpr;
                        if (texpr != null) {
-                               if (!(expr is TypeExpr)) {
-                                       me = expr as MemberExpr;
-                                       if (me == null || me.ProbeIdenticalTypeName (rc, expr, sn) == expr) {
-                                               rc.Report.Error (572, loc, "`{0}': cannot reference a type through an expression; try `{1}' instead",
-                                                       Name, member_lookup.GetSignatureForError ());
-                                               return null;
-                                       }
+                               if (!(expr is TypeExpr) && (sn == null || expr.ProbeIdenticalTypeName (rc, expr, sn) == expr)) {
+                                       rc.Report.Error (572, loc, "`{0}': cannot reference a type through an expression. Consider using `{1}' instead",
+                                               Name, texpr.GetSignatureForError ());
                                }
 
                                if (!texpr.Type.IsAccessible (rc)) {
index 57c7ac96cd7bcb0d5395af27125bb06e19ce729c..91eeadc751550b1cd0eb1639a57a0549737efc1c 100644 (file)
@@ -416,6 +416,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               bool ITypeDefinition.IsComImport {
+                       get {
+                               return false;
+                       }
+               }
+
                bool ITypeDefinition.IsPartial {
                        get {
                                return false;
@@ -428,6 +434,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+                               return false;
+                       }
+               }
+
                public string Name {
                        get {
                                return MemberName.Name;
@@ -1250,6 +1262,22 @@ namespace Mono.CSharp {
                        return false;
                }
 
+               public bool HasDependencyOn (TypeSpec type)
+               {
+                       if (TypeArguments != null) {
+                               foreach (var targ in TypeArguments) {
+                                       if (TypeSpecComparer.Override.IsEqual (targ, type))
+                                               return true;
+
+                                       var tps = targ as TypeParameterSpec;
+                                       if (tps != null && tps.HasDependencyOn (type))
+                                               return true;
+                               }
+                       }
+
+                       return false;
+               }
+
                public override TypeSpec Mutate (TypeParameterMutator mutator)
                {
                        return mutator.Mutate (this);
@@ -2422,12 +2450,8 @@ namespace Mono.CSharp {
 
                        if (atype.IsGenericParameter) {
                                var tps = (TypeParameterSpec) atype;
-                               if (tps.TypeArguments != null) {
-                                       foreach (var targ in tps.TypeArguments) {
-                                               if (TypeSpecComparer.Override.IsEqual (targ, ttype))
-                                                       return true;
-                                       }
-                               }
+                               if (tps.HasDependencyOn (ttype))
+                                       return true;
 
                                if (Convert.ImplicitTypeParameterConversion (null, tps, ttype) != null)
                                        return true;
index 55b66a589c51af021c5a3a8de66b830c379d8bf1..7aed47394189f3150401b8424039ea9391c36f3f 100644 (file)
@@ -93,10 +93,15 @@ namespace Mono.CSharp
                {
                        // It can be used more than once when importing same assembly
                        // into 2 or more global aliases
-                       var definition = GetAssemblyDefinition (assembly);
+                       // TODO: Should be just Add
+                       GetAssemblyDefinition (assembly);
 
                        var all_types = assembly.GetTypes ();
-                       ImportTypes (all_types, targetNamespace, definition.HasExtensionMethod);
+                       ImportTypes (all_types, targetNamespace, true);
+
+                       all_types = assembly.ManifestModule.__GetExportedTypes ();
+                       if (all_types.Length != 0)
+                               ImportForwardedTypes (all_types, targetNamespace);
                }
 
                public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
@@ -110,6 +115,31 @@ namespace Mono.CSharp
                        return module_definition;
                }
 
+               void ImportForwardedTypes (MetaType[] types, Namespace targetNamespace)
+               {
+                       Namespace ns = targetNamespace;
+                       string prev_namespace = null;
+                       foreach (var t in types) {
+                               // IsMissing tells us the type has been forwarded and target assembly is missing 
+                               if (!t.__IsMissing)
+                                       continue;
+
+                               if (t.Name[0] == '<')
+                                       continue;
+
+                               var it = CreateType (t, null, new DynamicTypeReader (t), true);
+                               if (it == null)
+                                       continue;
+
+                               if (prev_namespace != t.Namespace) {
+                                       ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
+                                       prev_namespace = t.Namespace;
+                               }
+
+                               ns.AddType (module, it);
+                       }
+               }
+
                public void InitializeBuiltinTypes (BuiltinTypes builtin, Assembly corlib)
                {
                        //
@@ -207,7 +237,7 @@ namespace Mono.CSharp
                        : base (compiler)
                {
                        this.importer = importer;
-                       domain = new Universe ();
+                       domain = new Universe (UniverseOptions.MetadataOnly);
                        domain.EnableMissingMemberResolution ();
                        domain.AssemblyResolve += AssemblyReferenceResolver;
                        loaded_names = new List<Tuple<AssemblyName, string, Assembly>> ();
@@ -387,54 +417,59 @@ namespace Mono.CSharp
                                }
 
                                try {
-                                       using (RawModule module = domain.OpenRawModule (file)) {
-                                               if (!module.IsManifestModule) {
-                                                       Error_AssemblyIsModule (fileName);
-                                                       return null;
-                                               }
-
-                                               //
-                                               // check whether the assembly can be actually imported without
-                                               // collision
-                                               //
-                                               var an = module.GetAssemblyName ();
-                                               foreach (var entry in loaded_names) {
-                                                       var loaded_name = entry.Item1;
-                                                       if (an.Name != loaded_name.Name)
-                                                               continue;
-
-                                                       if (module.ModuleVersionId == entry.Item3.ManifestModule.ModuleVersionId)
-                                                               return entry.Item3;
-                                                       
-                                                       if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
-                                                               compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
-                                                               compiler.Report.SymbolRelatedToPreviousError (fileName);
-                                                               compiler.Report.Error (1704,
-                                                                       "An assembly with the same name `{0}' has already been imported. Consider removing one of the references or sign the assembly",
-                                                                       an.Name);
+                                       using (var stream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read)) {
+                                               using (RawModule module = domain.OpenRawModule (stream, file)) {
+                                                       if (!module.IsManifestModule) {
+                                                               Error_AssemblyIsModule (fileName);
                                                                return null;
                                                        }
 
-                                                       if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey) && an.Version.Equals (loaded_name.Version)) {
-                                                               compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
-                                                               compiler.Report.SymbolRelatedToPreviousError (fileName);
-                                                               compiler.Report.Error (1703,
-                                                                       "An assembly with the same identity `{0}' has already been imported. Consider removing one of the references",
-                                                                       an.FullName);
-                                                               return null;
+                                                       //
+                                                       // check whether the assembly can be actually imported without
+                                                       // collision
+                                                       //
+                                                       var an = module.GetAssemblyName ();
+                                                       foreach (var entry in loaded_names) {
+                                                               var loaded_name = entry.Item1;
+                                                               if (an.Name != loaded_name.Name)
+                                                                       continue;
+
+                                                               if (module.ModuleVersionId == entry.Item3.ManifestModule.ModuleVersionId)
+                                                                       return entry.Item3;
+                                                       
+                                                               if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
+                                                                       compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+                                                                       compiler.Report.SymbolRelatedToPreviousError (fileName);
+                                                                       compiler.Report.Error (1704,
+                                                                               "An assembly with the same name `{0}' has already been imported. Consider removing one of the references or sign the assembly",
+                                                                               an.Name);
+                                                                       return null;
+                                                               }
+
+                                                               if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & AssemblyNameFlags.PublicKey) && an.Version.Equals (loaded_name.Version)) {
+                                                                       compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+                                                                       compiler.Report.SymbolRelatedToPreviousError (fileName);
+                                                                       compiler.Report.Error (1703,
+                                                                               "An assembly with the same identity `{0}' has already been imported. Consider removing one of the references",
+                                                                               an.FullName);
+                                                                       return null;
+                                                               }
                                                        }
-                                               }
 
-                                               if (compiler.Settings.DebugFlags > 0)
-                                                       Console.WriteLine ("Loading assembly `{0}'", fileName);
+                                                       if (compiler.Settings.DebugFlags > 0)
+                                                               Console.WriteLine ("Loading assembly `{0}'", fileName);
 
-                                               var assembly = domain.LoadAssembly (module);
-                                               if (assembly != null)
-                                                       loaded_names.Add (Tuple.Create (an, fileName, assembly));
+                                                       var assembly = domain.LoadAssembly (module);
+                                                       if (assembly != null)
+                                                               loaded_names.Add (Tuple.Create (an, fileName, assembly));
 
-                                               return assembly;
+                                                       return assembly;
+                                               }
                                        }
-                               } catch {
+                               } catch (Exception e) {
+                                       if (compiler.Settings.DebugFlags > 0)
+                                               Console.WriteLine ("Exception during loading: {0}'", e.ToString ());
+
                                        if (!isImplicitReference)
                                                Error_FileCorrupted (file);
 
@@ -545,7 +580,7 @@ namespace Mono.CSharp
 
                public override void SetFlags (uint flags, Location loc)
                {
-                       builder.__SetAssemblyFlags ((AssemblyNameFlags) flags);
+                       builder.__AssemblyFlags = (AssemblyNameFlags) flags;
                }
 
                public override void SetVersion (Version version, Location loc)
@@ -553,4 +588,4 @@ namespace Mono.CSharp
                        builder.__SetAssemblyVersion (version);
                }
        }
-}
\ No newline at end of file
+}
index f8c7bb8bf55a31fd6c6e6c4db0547d67f7737824..8474e29a5b44c1467bd04008a1afdc3dbb9169dd 100644 (file)
@@ -6,7 +6,7 @@
 // Dual licensed under the terms of the MIT X11 or GNU GPL
 //
 // Copyright 2009-2011 Novell, Inc
-// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+// Copyright 2011-2012 Xamarin, Inc (http://www.xamarin.com)
 //
 
 using System;
@@ -32,7 +32,7 @@ namespace Mono.CSharp
                // Dynamic types reader with additional logic to reconstruct a dynamic
                // type using DynamicAttribute values
                //
-               struct DynamicTypeReader
+               protected struct DynamicTypeReader
                {
                        static readonly bool[] single_attribute = { true };
 
@@ -120,7 +120,7 @@ namespace Mono.CSharp
                protected readonly Dictionary<MetaType, TypeSpec> import_cache;
                protected readonly Dictionary<MetaType, TypeSpec> compiled_types;
                protected readonly Dictionary<Assembly, IAssemblyDefinition> assembly_2_definition;
-               readonly ModuleContainer module;
+               protected readonly ModuleContainer module;
 
                public static readonly string CompilerServicesNamespace = "System.Runtime.CompilerServices";
 
@@ -191,7 +191,9 @@ namespace Mono.CSharp
                        var definition = new ImportedMemberDefinition (fi, field_type, this);
 
                        if ((fa & FieldAttributes.Literal) != 0) {
-                               var c = Constant.CreateConstantFromValue (field_type, fi.GetRawConstantValue (), Location.Null);
+                               Constant c = field_type.Kind == MemberKind.MissingType ?
+                                       new NullConstant (InternalType.ErrorType, Location.Null) :
+                                       Constant.CreateConstantFromValue (field_type, fi.GetRawConstantValue (), Location.Null);
                                return new ConstSpec (declaringType, definition, field_type, fi, mod, c);
                        }
 
@@ -489,7 +491,7 @@ namespace Mono.CSharp
                                        //
                                        var el = p.ParameterType.GetElementType ();
                                        types[i] = ImportType (el, new DynamicTypeReader (p));  // TODO: 1-based positio to be csc compatible
-                               } else if (i == 0 && method.IsStatic && parent.IsStatic && parent.MemberDefinition.DeclaringAssembly.HasExtensionMethod &&
+                               } else if (i == 0 && method.IsStatic && (parent.Modifiers & Modifiers.METHOD_EXTENSION) != 0 &&
                                        HasAttribute (CustomAttributeData.GetCustomAttributes (method), "ExtensionAttribute", CompilerServicesNamespace)) {
                                        mod = Parameter.Modifier.This;
                                        types[i] = ImportType (p.ParameterType);
@@ -618,26 +620,41 @@ namespace Mono.CSharp
 
                        PropertySpec spec = null;
                        if (!param.IsEmpty) {
-                               var index_name = declaringType.MemberDefinition.GetAttributeDefaultMember ();
-                               if (index_name == null) {
-                                       is_valid_property = false;
-                               } else {
-                                       if (get != null) {
-                                               if (get.IsStatic)
-                                                       is_valid_property = false;
-                                               if (get.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
-                                                       is_valid_property = false;
+                               if (is_valid_property) {
+                                       var index_name = declaringType.MemberDefinition.GetAttributeDefaultMember ();
+                                       if (index_name == null) {
+                                               is_valid_property = false;
+                                       } else {
+                                               if (get != null) {
+                                                       if (get.IsStatic)
+                                                               is_valid_property = false;
+                                                       if (get.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
+                                                               is_valid_property = false;
+                                               }
+                                               if (set != null) {
+                                                       if (set.IsStatic)
+                                                               is_valid_property = false;
+                                                       if (set.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
+                                                               is_valid_property = false;
+                                               }
                                        }
-                                       if (set != null) {
-                                               if (set.IsStatic)
-                                                       is_valid_property = false;
-                                               if (set.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
-                                                       is_valid_property = false;
+
+                                       if (is_valid_property) {
+                                               spec = new IndexerSpec (declaringType, new ImportedParameterMemberDefinition (pi, type, param, this), type, param, pi, mod);
+                                       } else if (declaringType.MemberDefinition.IsComImport && param.FixedParameters[0].HasDefaultValue) {
+                                               //
+                                               // Enables support for properties with parameters (must have default value) of COM-imported types
+                                               //
+                                               is_valid_property = true;
+
+                                               for (int i = 0; i < param.FixedParameters.Length; ++i) {
+                                                       if (!param.FixedParameters[i].HasDefaultValue) {
+                                                               is_valid_property = false;
+                                                               break;
+                                                       }
+                                               }
                                        }
                                }
-
-                               if (is_valid_property)
-                                       spec = new IndexerSpec (declaringType, new ImportedParameterMemberDefinition (pi, type, param, this), type, param, pi, mod);
                        }
 
                        if (spec == null)
@@ -677,7 +694,7 @@ namespace Mono.CSharp
                        return CreateType (type, declaring_type, dtype, canImportBaseType);
                }
 
-               TypeSpec CreateType (MetaType type, TypeSpec declaringType, DynamicTypeReader dtype, bool canImportBaseType)
+               protected TypeSpec CreateType (MetaType type, TypeSpec declaringType, DynamicTypeReader dtype, bool canImportBaseType)
                {
                        TypeSpec spec;
                        if (import_cache.TryGetValue (type, out spec)) {
@@ -1028,7 +1045,7 @@ namespace Mono.CSharp
                        }
                }
 
-               protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool hasExtensionTypes)
+               protected void ImportTypes (MetaType[] types, Namespace targetNamespace, bool importExtensionTypes)
                {
                        Namespace ns = targetNamespace;
                        string prev_namespace = null;
@@ -1052,12 +1069,14 @@ namespace Mono.CSharp
                                        prev_namespace = t.Namespace;
                                }
 
-                               ns.AddType (module, it);
-
-                               if (it.IsStatic && hasExtensionTypes &&
+                               // Cannot rely on assembly level Extension attribute or static modifier because they
+                               // are not followed by other compilers (e.g. F#).
+                               if (it.IsClass && it.Arity == 0 && importExtensionTypes &&
                                        HasAttribute (CustomAttributeData.GetCustomAttributes (t), "ExtensionAttribute", CompilerServicesNamespace)) {
                                        it.SetExtensionMethodContainer ();
                                }
+
+                               ns.AddType (module, it);
                        }
                }
 
@@ -1074,12 +1093,13 @@ namespace Mono.CSharp
                                        continue;
                                }
 
-                               if (!IsMissingType (ct) && ct.IsClass) {
-                                       spec.BaseType = CreateType (ct);
+                               var constraint_type = CreateType (ct);
+                               if (constraint_type.IsClass) {
+                                       spec.BaseType = constraint_type;
                                        continue;
                                }
 
-                               spec.AddInterface (CreateType (ct));
+                               spec.AddInterface (constraint_type);
                        }
 
                        if (spec.BaseType == null)
@@ -1520,7 +1540,6 @@ namespace Mono.CSharp
                readonly Assembly assembly;
                readonly AssemblyName aname;
                bool cls_compliant;
-               bool contains_extension_methods;
 
                List<AssemblyName> internals_visible_to;
                Dictionary<IAssemblyDefinition, AssemblyName> internals_visible_to_cache;
@@ -1545,12 +1564,6 @@ namespace Mono.CSharp
                        }
                }
 
-               public bool HasExtensionMethod {
-                       get {
-                               return contains_extension_methods;
-                       }
-               }
-
                public bool HasStrongName {
                        get {
                                return aname.GetPublicKey ().Length != 0;
@@ -1668,13 +1681,6 @@ namespace Mono.CSharp
                                        internals_visible_to.Add (an);
                                        continue;
                                }
-
-                               if (name == "ExtensionAttribute") {
-                                       if (dt.Namespace == MetadataImporter.CompilerServicesNamespace)
-                                               contains_extension_methods = true;
-
-                                       continue;
-                               }
                        }
                }
 
@@ -1777,12 +1783,29 @@ namespace Mono.CSharp
                        }
                }
 
+               bool ITypeDefinition.IsComImport {
+                       get {
+                               return ((MetaType) provider).IsImport;
+                       }
+               }
+
+
                bool ITypeDefinition.IsPartial {
                        get {
                                return false;
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+#if STATIC
+                               return ((MetaType) provider).__IsTypeForwarder;
+#else
+                               return false;
+#endif
+                       }
+               }
+
                public override string Name {
                        get {
                                if (name == null) {
@@ -1845,9 +1868,15 @@ namespace Mono.CSharp
                                                "Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules",
                                                name);
                                } else if (t.MemberDefinition.DeclaringAssembly.IsMissing) {
-                                       ctx.Module.Compiler.Report.Error (12, loc,
-                                               "The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
-                                               name, t.MemberDefinition.DeclaringAssembly.FullName);
+                                       if (t.MemberDefinition.IsTypeForwarder) {
+                                               ctx.Module.Compiler.Report.Error (1070, loc,
+                                                       "The type `{0}' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
+                                                       name, t.MemberDefinition.DeclaringAssembly.FullName);
+                                       } else {
+                                               ctx.Module.Compiler.Report.Error (12, loc,
+                                                       "The type `{0}' is defined in an assembly that is not referenced. Consider adding a reference to assembly `{1}'",
+                                                       name, t.MemberDefinition.DeclaringAssembly.FullName);
+                                       }
                                } else {
                                        ctx.Module.Compiler.Report.Error (1684, loc,
                                                "Reference to type `{0}' claims it is defined assembly `{1}', but it could not be found",
@@ -2122,12 +2151,24 @@ namespace Mono.CSharp
                        }
                }
 
+               bool ITypeDefinition.IsComImport {
+                       get {
+                               return false;
+                       }
+               }
+
                bool ITypeDefinition.IsPartial {
                        get {
                                return false;
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+                               return false;
+                       }
+               }
+
                public string Namespace {
                        get {
                                return null;
index 9f9d00e4a07703ceb4c5954332894c0ea035c8d0..74609d1947ee3bac08d5cf63e13e562eb34942d4 100644 (file)
@@ -18,7 +18,7 @@
     <DebugType>full</DebugType>\r
     <Optimize>False</Optimize>\r
     <OutputPath>.</OutputPath>\r
-    <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER</DefineConstants>\r
+    <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <UseVSHostingProcess>false</UseVSHostingProcess>\r
@@ -26,7 +26,7 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
     <Optimize>True</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;STATIC;NO_SYMBOL_WRITER</DefineConstants>\r
+    <DefineConstants>TRACE;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
@@ -35,7 +35,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug - AST|AnyCPU'">\r
     <DebugSymbols>True</DebugSymbols>\r
     <OutputPath>.</OutputPath>\r
-    <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;FULL_AST</DefineConstants>\r
+    <DefineConstants>TRACE;DEBUG;NET_4_0;STATIC;NO_SYMBOL_WRITER;NO_AUTHENTICODE;FULL_AST</DefineConstants>\r
     <DebugType>full</DebugType>\r
     <CodeAnalysisLogFile>mcs.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>\r
     <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>\r
     <Compile Include="visit.cs" />\r
   </ItemGroup>\r
   <ItemGroup Label="IKVM.Reflection">\r
-    <Compile Include="..\class\IKVM.Reflection\*.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\*.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Emit\*.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Emit\*.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Metadata\*.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Metadata\*.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Reader\*.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Reader\*.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Writer\*.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Writer\*.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Impl\ITypeOwner.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Impl\ITypeOwner.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
-    <Compile Include="..\class\IKVM.Reflection\Impl\SymbolSupport.cs">\r
+    <Compile Include="..\..\external\ikvm\reflect\Impl\SymbolSupport.cs">\r
       <Visible>False</Visible>\r
     </Compile>\r
   </ItemGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
+       Other similar extension points exist, see Microsoft.Common.targets.\r
+  <Target Name="BeforeBuild">\r
+  </Target>\r
+  <Target Name="AfterBuild">\r
+  </Target>\r
   -->\r
 </Project>
\ No newline at end of file
index 7acf63aeff243704e2a7bfbb4e14e23654d27010..9ac9cb1c1ad4ebef8b45365433abaeaa7ff092cb 100644 (file)
@@ -57,10 +57,10 @@ visit.cs
 ../build/common/Consts.cs
 ../tools/monop/outline.cs
 
-../class/IKVM.Reflection/*.cs
-../class/IKVM.Reflection/Emit/*.cs
-../class/IKVM.Reflection/Metadata/*.cs
-../class/IKVM.Reflection/Reader/*.cs
-../class/IKVM.Reflection/Writer/*.cs
-../class/IKVM.Reflection/Impl/ITypeOwner.cs
-../class/IKVM.Reflection/Impl/SymbolSupport.cs
+../../external/ikvm/reflect/*.cs
+../../external/ikvm/reflect/Emit/*.cs
+../../external/ikvm/reflect/Metadata/*.cs
+../../external/ikvm/reflect/Reader/*.cs
+../../external/ikvm/reflect/Writer/*.cs
+../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../external/ikvm/reflect/Impl/SymbolSupport.cs
index 9ff3168869e9dd2f532086793c8d03a9f2755ef9..c2d9a630a3aa1324bb790cd19fe42e7ebef21d60 100644 (file)
@@ -302,7 +302,7 @@ namespace Mono.CSharp {
                                // rules (e.g. binary operators) by not setting the flag we hide them for
                                // user conversions
                                //
-                               if (!BuiltinTypeSpec.IsPrimitiveType (dt)) {
+                               if (!BuiltinTypeSpec.IsPrimitiveType (dt) || dt.BuiltinType == BuiltinTypeSpec.Type.Char) {
                                        switch (dt.BuiltinType) {
                                        case BuiltinTypeSpec.Type.String:
                                        case BuiltinTypeSpec.Type.Delegate:
index 8e3e8d1da7ca3e632c4dc9de0ee702af70f1585c..c0fe77b268e9abfc22e31960b1db27070000fefe 100644 (file)
@@ -1779,7 +1779,7 @@ namespace Mono.CSharp {
                        var token = ConstructorBuilder.GetToken ();
                        int t = token.Token;
 #if STATIC
-                       if (token.IsPseudoToken)
+                       if (ModuleBuilder.IsPseudoToken (t))
                                t = Module.Builder.ResolvePseudoToken (t);
 #endif
 
@@ -2120,7 +2120,7 @@ namespace Mono.CSharp {
                        var token = builder.GetToken ();
                        int t = token.Token;
 #if STATIC
-                       if (token.IsPseudoToken)
+                       if (ModuleBuilder.IsPseudoToken (t))
                                t = member.Module.Builder.ResolvePseudoToken (t);
 #endif
 
index e87d59521c4c6fa173baba0f8ad11d1c37f10da7..7dd44807f6810e358d40b258aed1bbce65ddb369 100644 (file)
@@ -498,12 +498,14 @@ namespace Mono.CSharp {
                                types = new Dictionary<string, IList<TypeSpec>> (64);
                        }
 
-                       if ((ts.IsStatic || ts.MemberDefinition.IsPartial) && ts.Arity == 0 &&
-                               (ts.MemberDefinition.DeclaringAssembly == null || ts.MemberDefinition.DeclaringAssembly.HasExtensionMethod)) {
-                               if (extension_method_types == null)
-                                       extension_method_types = new List<TypeSpec> ();
+                       if (ts.IsClass && ts.Arity == 0) {
+                               var extension_method_allowed = ts.MemberDefinition.IsImported ? (ts.Modifiers & Modifiers.METHOD_EXTENSION) != 0 : (ts.IsStatic || ts.MemberDefinition.IsPartial);
+                               if (extension_method_allowed) {
+                                       if (extension_method_types == null)
+                                               extension_method_types = new List<TypeSpec> ();
 
-                               extension_method_types.Add (ts);
+                                       extension_method_types.Add (ts);
+                               }
                        }
 
                        var name = ts.Name;
@@ -648,6 +650,11 @@ namespace Mono.CSharp {
                                        "Identifier `{0}' differing only in case is not CLS-compliant", compiled.GetSignatureForError ());
                        }
                }
+
+               public override string ToString ()
+               {
+                       return Name;
+               }
        }
 
        public class CompilationSourceFile : NamespaceContainer
@@ -1385,6 +1392,11 @@ namespace Mono.CSharp {
                                }
                        }
                }
+
+               public override string ToString()
+               {
+                       return resolved.ToString();
+               }
        }
 
        public class UsingExternAlias : UsingAliasNamespace
index fb59f1d016e93c1e9997b6c3e183695429c7de0f..7684c117c04c0c346ed7b96f59d261dbcc1a572b 100644 (file)
@@ -548,7 +548,7 @@ namespace Mono.CSharp {
                                                continue;
 
                                        var candidate_param = ((MethodSpec) candidate).Parameters;
-                                       if (!TypeSpecComparer.Override.IsSame (parameters.Types, candidate_param.Types))
+                                       if (!TypeSpecComparer.Override.IsEqual (parameters.Types, candidate_param.Types))
                                                continue;
 
                                        bool modifiers_match = true;
@@ -587,7 +587,7 @@ namespace Mono.CSharp {
                                                continue;
 
                                        //
-                                       // From this point on the candidate is used for detailed error reporting
+                                       // From this point the candidate is used for detailed error reporting
                                        // because it's very close match to what we are looking for
                                        //
                                        base_method = (MethodSpec) candidate;
index 2de023c18fe48f52955aa3aa95993c9820562791..411416712ad368e275b30ec310760b553b0b872f 100644 (file)
@@ -83,7 +83,7 @@ namespace Mono.CSharp
                {
                        // It can be used more than once when importing same assembly
                        // into 2 or more global aliases
-                       var definition = GetAssemblyDefinition (assembly);
+               GetAssemblyDefinition (assembly);
 
                        //
                        // This part tries to simulate loading of top-level
@@ -98,7 +98,7 @@ namespace Mono.CSharp
                                all_types = e.Types;
                        }
 
-                       ImportTypes (all_types, targetNamespace, definition.HasExtensionMethod);
+                       ImportTypes (all_types, targetNamespace, true);
                }
 
                public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
@@ -547,4 +547,4 @@ namespace Mono.CSharp
                        }
                }
        }
-}
\ No newline at end of file
+}
index 1556b5ca5fa9810e8b64554982fc1d4d21fd9677..af8512ae255ba0b32113699c45637a19c1444be8 100644 (file)
@@ -600,24 +600,7 @@ namespace Mono.CSharp {
 
                static bool IsExternAliasValid (string identifier)
                {
-                       if (identifier.Length == 0)
-                               return false;
-                       if (identifier[0] != '_' && !char.IsLetter (identifier[0]))
-                               return false;
-
-                       for (int i = 1; i < identifier.Length; i++) {
-                               char c = identifier[i];
-                               if (char.IsLetter (c) || char.IsDigit (c))
-                                       continue;
-
-                               UnicodeCategory category = char.GetUnicodeCategory (c);
-                               if (category != UnicodeCategory.Format || category != UnicodeCategory.NonSpacingMark ||
-                                               category != UnicodeCategory.SpacingCombiningMark ||
-                                               category != UnicodeCategory.ConnectorPunctuation)
-                                       return false;
-                       }
-
-                       return true;
+                       return Tokenizer.IsValidIdentifier (identifier);
                }
 
                static string[] LoadArgs (string file)
index 8337ce59b8d91eb89391baa3908d53184c1b6659..d1e1b709d1d17027443723e76bd265ae80133350 100644 (file)
@@ -1056,6 +1056,23 @@ namespace Mono.CSharp
                                return true;
                        }
 
+                       public static bool IsEqual (TypeSpec[] a, TypeSpec[] b)
+                       {
+                               if (a == b)
+                                       return true;
+
+                               if (a.Length != b.Length)
+                                       return false;
+
+                               for (int i = 0; i < a.Length; ++i) {
+                                       if (!IsEqual (a[i], b[i]))
+                                               return false;
+                               }
+
+                               return true;
+                       }
+
+
                        //
                        // Compares unordered arrays
                        //
@@ -1337,6 +1354,8 @@ namespace Mono.CSharp
                IAssemblyDefinition DeclaringAssembly { get; }
                string Namespace { get; }
                bool IsPartial { get; }
+               bool IsComImport { get; }
+               bool IsTypeForwarder { get; }
                int TypeParametersCount { get; }
                TypeParameterSpec[] TypeParameters { get; }
 
@@ -1384,6 +1403,12 @@ namespace Mono.CSharp
                        }
                }
 
+               bool ITypeDefinition.IsComImport {
+                       get {
+                               return false;
+                       }
+               }
+
                bool IMemberDefinition.IsImported {
                        get {
                                return false;
@@ -1396,6 +1421,12 @@ namespace Mono.CSharp
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+                               return false;
+                       }
+               }
+
                public override string Name {
                        get {
                                return name;
@@ -1508,12 +1539,24 @@ namespace Mono.CSharp
 
                public TypeSpec Element { get; private set; }
 
+               bool ITypeDefinition.IsComImport {
+                       get {
+                               return false;
+                       }
+               }
+
                bool ITypeDefinition.IsPartial {
                        get {
                                return false;
                        }
                }
 
+               bool ITypeDefinition.IsTypeForwarder {
+                       get {
+                               return false;
+                       }
+               }
+
                public override string Name {
                        get {
                                throw new NotSupportedException ();
index 2f967c8a0d2c9f769e8b43e209fbabc75f95a491..da3feccac41e925f0fbf9afe46ab7c0925e0002b 100644 (file)
@@ -65,6 +65,9 @@ qcheck: build-compiler-lib qcheck2
 qcheck2:
        $(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(PROFILE) -log:$(PROFILE).log -il:ver-il-$(PROFILE).xml $(DEFINES) $(TOPTIONS)
 
+gen-mt-tests:
+       $(TESTER) -mode:nunit -files:'v2' -compiler:$(COMPILER) -issues:known-issues-mt -compiler-options:"-lib:$(topdir)/class/lib/monotouch projects/MonoTouch/ivt.cs"
+
 test-local:
        @:
 
@@ -91,9 +94,5 @@ csproj-local:
        $(ILASM) /dll /out:$@ $<
 
 setup:
-       $(ILASM) /dll property-il.il
-       $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
-       $(TEST_RUNTIME) property-main.exe
-
        $(CSCOMPILE) -t:library dlls/test-679-2/test-679-lib-2.cs
        $(CSCOMPILE) -t:library dlls/test-679-1/test-679-lib.cs -r:dlls/test-679-2/test-679-lib-2.dll
index 39e78ead2d1281d11918334becbb38f717bf82cf..6f5da8464be15c9e4d7fa971ae319917b1aa746b 100644 (file)
@@ -34,7 +34,7 @@ class C
                foo_static (d);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                new C ().test ();
                
index 0cf2afabf996e257d30e72d8d520f103c6d957ba..e193c2f4e67b4e6c3e5e67bec593badfc1c7e63e 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                dynamic d = new Program ();
                var p = d as int?;
index cee584654934c40cea91963c1e12e8a9ee155e7e..4ad76120c013dc11e06a8b7ea57442ecc868cc53 100644 (file)
@@ -89,7 +89,7 @@ class Program
                c.Method_B (d); 
        }
 
-       static int Main ()
+       public static int Main ()
        {
                object o;
                DynOut (out o);
index 90a9ba4252b6fadaa842bebedb3c48a3abe836a3..4bff54677f0217004c8ec39f211b93dcb4f7448b 100644 (file)
@@ -29,7 +29,7 @@ class DynamicAssignments
        {
        }
        
-       static int Main ()
+       public static int Main ()
        {
                dynamic d1 = null;
                dynamic d2 = null;
index d56cccee9758f2bae27f4e208799c86344e69ea7..b452bf138074924ed8a7362335563a95c756a7eb 100644 (file)
@@ -7,7 +7,7 @@ class A
 {
        public dynamic X = new XValue ();
        
-       static int Main()
+       public static int Main()
        {
                var v = new A { X = { Y = 467 } };
                if (v.X.Y != 467)
index 327dd1e05c0bbb8b694ba58270aba30efefec5de..bc4eca9083754683acb3667c1348e97b360a7265 100644 (file)
@@ -13,7 +13,7 @@ class C
                return 2;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                dynamic d = 1;
                if (Test (1, d) != 1)
index 30d9c0720e3e9b4090a32c5d76738edcfb103c21..712fd61d89914e841d5fb88efbebf98a7b3e12c9 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                dynamic index = (uint) int.MaxValue + 1;
                dynamic array = new int[] { 1, 2 };
index 6cd4dbeb199a2baaa22cebe07888918896264377..30a09f53eb31e7b25516d412bec73e1da70373ed 100644 (file)
@@ -14,7 +14,7 @@ class Program
                return 2;
        }
        
-       static int Main()
+       public static int Main()
        {
                if (Test (() => (dynamic) 1) != 1)
                        return 1;
index 55bbbb7d2bcd642fd93fd52ab1aa393fdacd72c2..2816af20e7622e728099a75501c0ed4d2017ca2c 100644 (file)
@@ -15,7 +15,7 @@ public class Test
                }
        }
        
-       static int Main ()
+       public static int Main ()
        {
                var a = new Wrap () {
                        Numbers =  { 3, 9 }
index 6ce2a46bb4f2b16e781d636a67657a6e3af413c5..0de564d8f2794e05c29c9e9ac7657a30de409f66 100644 (file)
@@ -13,7 +13,7 @@ static class Program
                yield break;
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
\ No newline at end of file
index d1f9531d2f11d37492957b210c8a9b31f00e0a33..f8df506b1114b1ec46d8566943ad37bab3f553a3 100644 (file)
@@ -66,7 +66,7 @@ class Stress {
 
        static void generate_main ()
        {
-               wl ("\tstatic void Main ()\n\t{");
+               wl ("\tpublic static void Main ()\n\t{");
 
                foreach (string t in types){
                        w ("\t\tprobe_" + t + " ();\n");
@@ -74,7 +74,7 @@ class Stress {
                wl ("\t}");
        }
        
-       static void Main (string [] args)
+       public static void Main (string [] args)
        {
                foreach (string arg in args){
                        if (arg == "-h" || arg == "--help"){
index 9077b141a7438766fa9e81c31a4a72501631b73c..c68fc71ab62ba2bd206a3c567218dafc4b869ef5 100644 (file)
@@ -56,7 +56,7 @@ class Stress {
        
        static void generate_main ()
        {
-               wl ("\tstatic void Main ()\n\t{");
+               wl ("\tpublic static void Main ()\n\t{");
 
                foreach (string t in types){
                        w ("\t\tprobe_" + t + " ();\n");
@@ -64,7 +64,7 @@ class Stress {
                wl ("\t}");
        }
 
-       static void Main (string [] args)
+       public static void Main (string [] args)
        {
                wl ("using System;\nclass Test {\n");
 
index fc54c2a3dbeb8f87dca6378440ed6ff2740f5173..73a41da8ae9c012bcc9fd027873c9b6bf792781e 100644 (file)
@@ -3,7 +3,7 @@ class Stack < type > {
 }
 
 class Boot {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index d2ea790320e9e7bd5485cf9ae155e656f8b834c3..5c0ff2fdfe56ee93d150f85cfe397a4455a440c8 100644 (file)
@@ -4,7 +4,7 @@ class Cell <X> {
 }
 
 class D {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 8a2e5377c492e4f808ebed6ae0ff9da6269fb932..40588783b275b32fc6e9c943707d78a0ce9ed02d 100644 (file)
@@ -7,7 +7,7 @@ class Test {
 class T {
        Stack<Test> a;
 
-       static void Main()
+       public static void Main()
        {
        }
 }
index 238c461246d907514a84f75358e1ef60797d8538..3cd09cb0adbbc874653d6e8b1e90c1178fbe4b29 100644 (file)
@@ -8,7 +8,7 @@ class T {
        public void Foo (Stack<Test> a)
        { }
 
-       static void Main()
+       public static void Main()
        {
        }
 }
index b3ecdeb70faddc52f281b1ff93533eddef0d0f89..59f43740726f0f3bd180ab2cbf3f93ed06117140 100644 (file)
@@ -5,7 +5,7 @@ class Test {
 }
 
 class T {
-       static void Main()
+       public static void Main()
        {
                Stack<Test> a;
        }
index 5faf6e91ebc6dff007ac0143c3faf65ec1ce2d47..5985fa6da29981edbe5d32263bc998ec3246f12d 100644 (file)
@@ -28,7 +28,7 @@ class Stack<T>
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index d4f537da1bb35f9a550a17808cb4fb92d12a4dc6..fe0da21ec185a77757ef558540446906b50beb03 100644 (file)
@@ -8,7 +8,7 @@ class Test
 
 class X
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
index 5665e12d404a93f134760bbd50ca639fed21cc0c..b581332bb9777d003c93bc4d2ed8ebdc4adae00f 100644 (file)
@@ -14,7 +14,7 @@ class Test
 
 class X
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
index 533b522694dbcbc9cb91d9195fe588fd85a3aa42..2279fe8aa190f862ca83c0bd8b6a1c9434fb4c43 100644 (file)
@@ -20,7 +20,7 @@ class Test
 
 class X
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
index 26b88153a5153eac5eaade8e69331921f2462e66..178f81fc0d3f35d5ec167d79a410db51a0a11ef4 100644 (file)
@@ -32,7 +32,7 @@ class Test
 
 class X
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
index 1dbda38aef00a85abe96ea714827acce09ac61d0..8a4c09d3fe9dc0250faf0c0d93424b264be12a50 100644 (file)
@@ -13,6 +13,6 @@ class X
                stack.Hello (3);
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 4ef97c77356942ebfe17f722ebe14a3849dadff5..a7cc66f1ee2d7854953c68f30df2efacedeea940 100644 (file)
@@ -23,6 +23,6 @@ class X
                test.Hello (3);
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 3a248e61a67581fc861978530e3e5b127d72641e..92edda18f0ddb7ad32afbbda9daf4c1d585fa373 100644 (file)
@@ -9,6 +9,6 @@ public class X
                stack.Hello (3);
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 69b232d21fd2dbc042e0fc45492d9c740140ace5..e03d31a56da4c142786b8cfd01e0c74abd1cc4a7 100644 (file)
@@ -9,7 +9,7 @@ public class Stack<S>
 
 public class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Stack<int> s1 = new Stack<int> (3);
                s1.Push (4);
index 8f4e089e27dfb4438431d05282bbb0af4661b623..5194b666e26a24cb825d4113e127c6f6155d3a63 100644 (file)
@@ -10,7 +10,7 @@ class Stack<S>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index bf6b51bedd775506d0566f105557c53dfa301aac..113291154f3ec59caf92fadcde8b649f02c4a1d5 100644 (file)
@@ -11,7 +11,7 @@ class X
 {
        Stack<int> stack;
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index b04dc471140dedad6fb0381ed1612c358f3da02e..2537df03a2db2fa151def555f35ccdb7e0916d68 100644 (file)
@@ -7,7 +7,7 @@ public class X
                stack.Hello<string> ("Hello World");
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Stack stack = new Stack ();
                Foo (stack);
index 92f38ce86cf00b08f94d4be4505a08808493e9ed..7a9ae513a58c951cfc535752991e820f41578cb7 100644 (file)
@@ -14,7 +14,7 @@ public class X
                stack.Hello<string> ("Hello World");
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Stack stack = new Stack ();
                Foo (stack);
index 89bfba5004a94ac8440312aee07aabd7dd57c105..b0903dea144f22e09c85acc43b11f542d6eb85ee 100644 (file)
@@ -8,6 +8,6 @@ public interface IEnumerator<T> {
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index d8f4992d5efd121fc8b9cf2807cf89dce0d15ed7..d1a0ee0f0d43f4d41ab267ac9bb1aa5706ef8b7b 100644 (file)
@@ -13,6 +13,6 @@ class X
                stack.Hello (3);
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index c57b3df11245a1e55a96445a38c96b0ef8cf5a84..16f4d6d86de11722af72432f64ee8043fb46973b 100644 (file)
@@ -55,7 +55,7 @@ class X
                        Console.WriteLine ("OBJECT: {0} {1}", obj, obj.GetType ());
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<string> a = new Foo<string> (4);
                a.Test ();
index 1a7df651723ceae8803eb425baa664deb2b5324a..8b9cdfd52e2dbd2b459e702241949aaebc605e5c 100644 (file)
@@ -22,7 +22,7 @@ class Bar : Foo<int>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Bar bar = new Bar ();
                bar.Test ();
index c4c8b6a03ebc693688bf6fbf51a0aae758098b73..35ca063f6590acc76207fff484a550e795b10aea 100644 (file)
@@ -30,6 +30,6 @@ class Bar : Foo<Bar>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index af7f93f37c5712f9d84feb38443f3fd14f955e98..a8b6e7f4779edcc0bbd0b8e2b3b96b7656078549 100644 (file)
@@ -22,7 +22,7 @@ class X
                foo.Hello (4);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<int> foo = new Foo<int> ();
                Test (foo);
index f4e7b42bcd71edc6b446d6279456ec787c425e99..3ec8745220acd6ef3c83b39ad2434f0785efe0f9 100644 (file)
@@ -22,7 +22,7 @@ class X
                foo.Hello<int> (531);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo ();
                Test (foo);
index 039708680d487e8907b3748896fae720d4d0644d..a044d97ca801e369315ddb08e1333f47d4096be2 100644 (file)
@@ -10,7 +10,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<int> foo = new Foo<int> ();
                foo.Hello = 9;
index 4fdf4fd24c123350d196d29d67b279f04ebff61d..cb2650e682a23918074f4fbcfd1c1211240df382 100644 (file)
@@ -29,6 +29,6 @@ class X
                test.BaseFunc ();
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index f603b9bffc246ca32c22ef67d2202a77b7046eb6..3a7083131ab30719d74e0a227cf4788d395022f6 100644 (file)
@@ -21,7 +21,7 @@ class X
                return stack.Test ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Stack<int> stack = new Stack<int> (9);
                System.Console.WriteLine (Test (stack));
index 6194603a4fb9e673840e875b42a5ea91c771c900..d52eee7ffa13210a6ed5ce4f935226f1c16bc8c7 100644 (file)
@@ -17,7 +17,7 @@ class Stack<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Stack<int> stack = new Stack<int> (5);
                System.Console.WriteLine (stack.Test ());
index 29f1082bc67744175c72dff3f24ce03144a12cd2..bdf73bf270e8a6cb596e8271b9ce8347a24993d5 100644 (file)
@@ -27,7 +27,7 @@ class X
                bar.Test (7, "Hello");
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Bar<int,string> bar = new Bar<int,string> ();
                Test (bar);
index b5acef437a40be41929058c49a73785172f245db..28184e613ac887f227bb2cd6dc860cd641071b67 100644 (file)
@@ -8,6 +8,6 @@ public class X
                bar.Test (7, "Hello");
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 1b554a5f5fcee648dc93899286d26c9c10ae03bd..39624edea10f0aa97b18569199a81c6925a5d70f 100644 (file)
@@ -18,6 +18,6 @@ class X
                bar.Test (7, "Hello");
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index b64d72f261717ad75cc2c29be003904f1bc87d2d..90be979974c04904429621d403e8f76733cee34e 100644 (file)
@@ -18,6 +18,6 @@ class X
                bar.Test (512, 7, "Hello");
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 7df2d55f3d00026d2e4bf4f52b2f55920c7e9241..81aa51ad9c6b512617be88575b3185cb86cb500a 100644 (file)
@@ -14,6 +14,6 @@ class Bar<T> : Foo<Stack<T>>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 06f1a69081a4229f7797700e8554ed4a0492d337..73febabcdc80b17b2f712daee9fbdc3dc80e0a97 100644 (file)
@@ -9,7 +9,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 1cf8e8b0e3fc441a36e2c8c1f869af62b952606e..8e224e260452b6695310f9cdb1c6064138f39da1 100644 (file)
@@ -24,6 +24,6 @@ class Stack<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 88eba8e1a1efa586d7428f8dc4728f3cd767a9a9..a722372709f3564e791d49b59ce2cd3af13614c0 100644 (file)
@@ -36,6 +36,6 @@ public class Baz<T> : Foo<T,string>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index c39eb3db6781ea75ce2884d0c58b21f188837911..1b54dc54995286e8f7711a1940a6516acd716b65 100644 (file)
@@ -53,7 +53,7 @@ class Queue<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Queue<int> queue = new Queue<int> (5, 9);
                queue.Test ();
index 24d3d62f668be3c572a7e32680f7f32232d1b3b1..7c94c8acfa3a5c0846da93cc186e71e6a1a4df92 100644 (file)
@@ -49,7 +49,7 @@ class Zoo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Zoo<string> zoo = new Zoo<string> ("Boston");
                IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
index defa47999f6a1e1434a2d8e5a2b366a0d76d67e6..06e74297db27b3e976c1ed5d0a2b3a4104048b6e 100644 (file)
@@ -122,7 +122,7 @@ class A<U>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Stack<int> stack = new Stack<int> (1);
                INode<int> node = stack.GetNode ();
index 1f778a5264185084b4868e6f14b1204f395f6d0a..d30a2d9a3ee10fce9ed1c0151771af2e0aa7a2f3 100644 (file)
@@ -8,7 +8,7 @@ class Stack<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Stack<string> stack = new Stack<string> ();
                stack.Hello (1, "Hello", "World");
index 7862bacd3d8b51527efe2a6a70a7d3b4693426c1..51e5a4ee3cb01675594a6d57735881a35cf5cd21 100644 (file)
@@ -57,6 +57,6 @@ namespace C
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 4d3c9180be2e8f7a0bad60702e6bbe544a35098f..aee576cab93b4ddc17e04ed5bef97e3178a7b51a 100644 (file)
@@ -47,7 +47,7 @@ class X
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int result = DoTheTest<int> ();
                if (result != 0)
index 679bbb1339bcc3228df120dc0467bae7fe93f223..5c1fdd1e73742f51637d0c83889b269b34c7437a 100644 (file)
@@ -18,7 +18,7 @@ class X<T>
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                X<long> x = new X<long> (5);
                Console.WriteLine (x.Count);
index 2036017109d0f7f3bd799f900b32a632270d86de..36d4b2d9977c655998e58ba27f220e03f5e0371c 100644 (file)
@@ -17,7 +17,7 @@ class Test<A,B>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<float,int> test = new Test<float,int> ();
                test.Foo ("Hello World");
index 40f01434d901503813554adceedcebc39d3d2cc4..466c04f4908b9cec5245f51bdf3fb53758884e00 100644 (file)
@@ -22,7 +22,7 @@ class X
                Console.WriteLine ("Hello: {0}", hello);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<string> foo = new Foo<string> ();
                foo.MyEvent += new Test<string> (do_hello);
index 71af6d5f2ad34db4c4c859c1b86d73080255fd52..9a251b28daef8f10918a78519b1cb06414f7a41a 100644 (file)
@@ -10,7 +10,7 @@ using Bar;
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                List<int> list = new List<int> ();
        }
index b1335e2a2bd59733d38c9bd87eb4359bf371d9b8..99f3b27595501c03a51ca7eca6b218ba7ab47ab6 100644 (file)
@@ -22,7 +22,7 @@ struct Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo ();
                Stack<Foo> stack = new Stack<Foo> ();
index e5e8699d292727dc42e80d550f97945252d188b9..1cbe951de61001e78cd9c6e180dacbfc787895e8 100644 (file)
@@ -38,6 +38,6 @@ class X<T>
 
 class Foo
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 641ac26429370313a3b5acf98170a8cb7edabff6..1a1fe6462677b08891b746a3d53b483b07ecd538 100644 (file)
@@ -18,7 +18,7 @@ class X
                throw new ArgumentException ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                D d1 = new D (F<int>);
                D d2 = new D (F);
index 5fc94f7c6e895fe9c375b0d5cfb4e1d07a116445..bd0e7eb2dabd0c73583db6820f794242d1603e46 100644 (file)
@@ -25,7 +25,7 @@ public class B : A
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<B> foo = new Foo<B> ();
                foo.Test (new B ());
index f2a8441ba6f6fce27ae77d0b4dd6f541eef3beae..f513eeeb03358f4bc6aa7a50716d3bd326c54390 100644 (file)
@@ -20,7 +20,7 @@ class X
                Console.WriteLine ("Hello World");
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<X> foo = new Foo<X> ();
                foo.Create ().Hello ();
index 1feda3b96c47292d8692319215b736c2f14940ee..53480d1214c0da74c0469031dfedbbd75b8366e2 100644 (file)
@@ -154,7 +154,7 @@ namespace Test
 
        public class X
        {
-               static void Main ()
+               public static void Main ()
                {
                        Test<V.SimpleCounter>.Foo (new V.SimpleCounter ());
                        Test<V.PrintingCounter>.Foo (new V.PrintingCounter ());
index 7080a2d417a3fb8e9307e0a0e0331df671556e48..03459441e59e57090c61e0861a91678c24317d34 100644 (file)
@@ -70,6 +70,6 @@ class Test
                t = (T []) a;
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 586196d45d8712394c5bf763da914d53b75f3885..9e344904c30b4d8812b90a6b654a12fb266ab446 100644 (file)
@@ -18,7 +18,7 @@ namespace N2
 
        class X
        {
-               static void Main ()
+               public static void Main ()
                {
                        Y y = new Y ();
                        Y.B b = new Y.B ();
index 8080c0ab75f0b0f22ecc6fc9153756dde9772acc..3def77b61f5ee55e19b15150322edb380c95d996 100644 (file)
@@ -37,7 +37,6 @@ public class Log<T> {
 }
 
 class TestLog {
-  class MyTest {
     public static void Main(String[] args) {
       Log<String> log1 = new Log<String>();
       log1.Add("Reboot");
@@ -53,6 +52,5 @@ class TestLog {
       foreach (DateTime dt in dts) 
        Console.Write("{0}   ", dt);
       Console.WriteLine();
-    }
   }
 }
index e3ba73bbf992f2fa03763b69359e58f7fd04d903..603d348bc4f54f7610841a9e9611824ba5e2eeb1 100644 (file)
@@ -25,7 +25,7 @@ class Hello<T> : IHello<T>, Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Hello<int> hello = new Hello<int> ();
                hello.Print (5);
index 63a213bb9ad37824ddd813f2a905b48874b8b6a7..50e7329270c4bd5fb4dc184f6c887117a8a4e879 100644 (file)
@@ -1,5 +1,5 @@
 class Foo {
-       static void Main () {}
+       public static void Main () {}
 }
 
 class Foo <T> {
index f65d1ae475bd66727cd84f0014d6ec5e13b20529..20863fb1a8ea127e2c5059c1943864eff7b9ff0e 100644 (file)
@@ -5,5 +5,5 @@ namespace N {
 class X <T> : N.A <T> {
 }
 class Foo {
-       static void Main () {}
+       public static void Main () {}
 }
index 446d87b3eb58fdaee066c82140dfd73a84e7cd88..4cc08a08b4a02a0b2758a87f0da0397d52043f8c 100644 (file)
@@ -23,7 +23,7 @@ class Foo : IFoo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo ();
                MyList<int> list = foo.Map<int> ();
index a7486896238227e46060138d75965ec608f18df7..d034e23c63d97b84050f353245b51435a968305b 100644 (file)
@@ -19,7 +19,7 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<double,int> test = new Test<double,int> (Math.Sign);
 
index 2822e169f93ed0068837ed7253a17492a97927e7..0e4a54d4479d1cd0b0cb4856cdf573677a59dd3a 100644 (file)
@@ -10,7 +10,7 @@ class X
                }
         }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                int sum = 0;
index cb57c5146555981b1adcb0e89b27f0143bf2f6d0..70486e88bb8e2b79498f878091197d7eaeeb5918 100644 (file)
@@ -21,7 +21,7 @@ public class Test
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Test test = new Test ();
                string[] array = new string [] { "Hello" };
index 8df837934c57a85a26855e0a541a30c64d7f81a2..9737245d92bdfb056276c1bc9e6d1de13f61e74a 100644 (file)
@@ -36,6 +36,6 @@ public class Foo<T> : IBar<T>, IFoo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 995879e35399001ac1f07037dfed3376e329230b..37a169a4ea2a29bfd39dbc6bb588de88309cc3df 100644 (file)
@@ -15,7 +15,7 @@ namespace Test
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Console.WriteLine (typeof (Foo<>));
                Console.WriteLine (typeof (Foo<>.Bar<>));
index 43df27f9fa217447a60e2b52486261aa7a962d48..8d1a09f67f0970fd4c19483caf4ef86dcfe54759 100644 (file)
@@ -13,7 +13,7 @@ class X
                return a + b;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Test test = new Test ();
                test.Hello<int> (new Test.Foo<int> (Add), 5);
index 22d032b0a6781306a3c7a2e257580b86192fb068..1d60f7d3928525a3688b8d0ed556515e857260a4 100644 (file)
@@ -10,7 +10,7 @@ namespace Baulig
 
        class X
        {
-               static void Main ()
+               public static void Main ()
                {
                        M.Foo<int> foo;
                }
index 3305f2e940805c9e03098f2dc7423f9d5f237a93..0411196dc6980707b6a7db88f411e20191a06901 100644 (file)
@@ -23,6 +23,6 @@ public class Test<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 9b2184402dfa1a81b2c3a29057b3b1d4ab0ecfc3..fe575f44b77ae811b729ca565e1270aae95e8b5a 100644 (file)
@@ -21,7 +21,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index b0a7857de69c3dc3a9bd339b6db9a5f861b7c9f6..8352a2b2862c60950b581f89d3b48930c6eebd77 100644 (file)
@@ -11,7 +11,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<X> foo = new Foo<X> ();
 
index 70a346b584f52f0247495ce1717a8d061e85c536..8325cecb0610c108dd30271b21f5c35feeda5271 100644 (file)
@@ -37,7 +37,6 @@ public class Log<T> {
 }
 
 class TestLog {
-  class MyTest {
     public static void Main(String[] args) {
       Log<String> log1 = new Log<String>();
       log1.Add("Reboot");
@@ -65,7 +64,6 @@ class TestLog {
       foreach (Pair<DateTime,String> p in allMsgs) 
        Console.WriteLine("At {0}: {1}", p.Fst, p.Snd);
     }
-  }
 }
 
 public struct Pair<T,U> {
index aa7165c727108de88895a28b72437fd26862ce0d..91331454e3b981a865f1b4ad0fd36ac211bebc91 100644 (file)
@@ -27,7 +27,7 @@ struct Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                MyList<Foo<int>> list = new MyList <Foo<int>> ();
                foreach (Foo<int> foo in list)
index dae2000a3a9bec3c6fa434ea9fd527ef6a8fd872..b89e1c0ae0f34e7ece88023a9dd8192753920203 100644 (file)
@@ -24,7 +24,7 @@ public class Test<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo<long> foo = new Foo<long> (3, 5);
                if (foo.Data != 3)
index 9c7c61b95a121f4a97a217a9ba65457d3349d49c..18f623ed494a25d23817e9f961d135ea99ef75e2 100644 (file)
@@ -12,6 +12,6 @@ public class ArrayList<T> : IExtensible<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 57d0676166db21f7a959b750b53d8a07789e7f53..699cf327c56f5fe0f2b8927300b7f620d14b4e35 100644 (file)
@@ -20,7 +20,7 @@ class Test<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Test<long> test = new Test<long> ();
                Foo<long> foo = test.GetFoo (0x800);
index 2df3c2fcf8fb3ca841cec94ceb8c76a31b115e25..f08200eaa66d5a04a7a12697a9e2cfeecb080789 100644 (file)
@@ -65,6 +65,6 @@ namespace C
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 57931e1bb9566457374f6ac4c0ccb8a767c57095..0961d2418ed60974b9db1283531d4ddde1ce88ae 100644 (file)
@@ -14,6 +14,6 @@ public class Test
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index abb55d120c10fd4d801f7754a233e95ae1af9f4e..b96232ce2bd0a3a0a31f5e6619dd4d7d15739f40 100644 (file)
@@ -12,6 +12,6 @@ public class ArrayList<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 0e3fa9bedba58337afcdda729273ce534ec09ccb..c5673acbdb766b2a1113b8cb1e81d4f5890da7e9 100644 (file)
@@ -15,6 +15,6 @@ public class Queue<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index e9a83523ccd4af6c067dbb05d2da23a9c9c803de..48d5672094f462e7b47d3d280a7d397abf069bb8 100644 (file)
@@ -24,6 +24,6 @@ public class ArrayBase<T>: SequencedBase<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index c0449b220535fd7e22dbce81dc4ca2185cc74e63..f491a24dfff50460233a9a245ac7dde88bcea7de 100644 (file)
@@ -23,7 +23,7 @@ public class ArrayList<U>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index 02987da2916188e2a10c0cb07f700d5a97099986..76f0767a124377430b109c5672badbb346d37797 100644 (file)
@@ -24,7 +24,7 @@ public class ArrayList<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                ArrayList<int> list = new ArrayList<int> ();
                return list.AddAll (null);
index 34f094223d4084700a1b63e0a50e2f5bfdff80a5..d830261179ba31fdc2c81b2e350fdbe9cc08c983 100644 (file)
@@ -22,6 +22,6 @@ public class ArrayList<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index ab253043357c7ee8ebf37a1b556e65fb99773d6f..dea552fb3ee0f1a542557476dd6867f101a527d8 100644 (file)
@@ -29,6 +29,6 @@ namespace C5
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index c95c6b50dbbe9831cbf67d45244bcef76e3b3504..94eaa875c5aaff4af8247d18bdb9f53b5eeb1234 100644 (file)
@@ -11,7 +11,7 @@ public struct KeyValuePair<K,V>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                new KeyValuePair<int,long> ();
        }
index 9b379d8b47e214f1d96a737145dd0d5b6ff4db40..63ebc9598a0b5a9a3d69864ecba9c20597b0fb68 100644 (file)
@@ -17,6 +17,6 @@ class Test<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 8ba94c1427edbf0427fb071d754d72471500c79b..884f15b3ffc2342e3a358b87ea1a1c9aa0bc703a 100644 (file)
@@ -19,6 +19,6 @@ public class Bar<T> : Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 574520fbb7063a0c97206f2e2ef47f1f4bddaa89..c8469d4551fc8495950f744598672f3e7ad0026b 100644 (file)
@@ -15,6 +15,6 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 19a596476d8aaf6c143345e94ee81b27c65d6388..1e83b5c1152df7593ed067ac94291dde2b9e1044 100644 (file)
@@ -42,6 +42,6 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index b9f4b614e7368af67624c3ee7eff78e89fd3d039..a8758251f88d2542796d50824fabd2877fbc563c 100644 (file)
@@ -26,6 +26,6 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 8f1cdcef27746879e97af1fc6bda4df215438777..0ea2b7b6cf6c8e2c45530cded65e97ec86b38e3a 100644 (file)
@@ -11,6 +11,6 @@ public class HashedLinkedList<T> : LinkedList<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 74f501f289e47f2b35b504e8b8736c85e05de222..0e69640fac97eb0e1cf0bdd25ccd824cf265c506 100644 (file)
@@ -39,6 +39,6 @@ public class GuardedSequenced<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 262511bd9ae655d93089a31981f187699947a12a..12407dc5dbadf9e7b7fd0a77dc4798eec9e4c796 100644 (file)
@@ -18,7 +18,7 @@ class Test
                Hello<U> (arr, 1);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<int>[] foo = new Foo<int> [1];
                foo [0] = new Foo<int> ();
index cc748cd4a9e6cd69ecf67f1cf3ec8b9efae0b24a..63ead2583e150b9b9dd2cbb8b0a6c2244cdfc31e 100644 (file)
@@ -35,6 +35,6 @@ public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 5dc31331426d19de1600a187149e1d1fbc1b7d43..8833383d7fccba81bced1edc41e4c7c1fea39ac7 100644 (file)
@@ -19,6 +19,6 @@ public class Bar<X,Y,Z> : IBar<X>, IBar<Y,Z>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 1132720ceba72ea1152752e659eb6af8933187ff..c82e5907e89ca8a80bfe8771ed6f4f455c032302 100644 (file)
@@ -21,7 +21,7 @@ namespace C5
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                C5.ArrayList<int> array = new C5.ArrayList<int> ();
        }
index a9fc10676e58abc48f086cf07bd586b489cc0e7e..8d1ca1a992f53fce8973accfeeb7b303160b7e15 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                SimpleStruct <string> s = new SimpleStruct <string> ();
        }
index 71993f0c825adee4f3cefaec7329133b04e65012..16345f709e9db57a74e0ae3b412c7adf0e129323 100644 (file)
@@ -21,7 +21,7 @@ public class Hello
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index e027bead6dfd0fff714d69a2686bfe78c01fe7f7..e9d5d2a1b7975c590c17e7010e42cd50f96642ec 100644 (file)
@@ -10,7 +10,7 @@ class MainClass
         {
         }
 
-        static void Main ()
+        public static void Main ()
         {
                object o = new Der ();
                 Gen<int> b = (Gen<int>) o;
index fd674725bb8156915e8f12f9518d8fda4577e484..e4e544ed91731d44d60a1fc677d9bdc902fd7e76 100644 (file)
@@ -96,7 +96,7 @@ namespace B
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                A.X.Test ();
                B.X.Test ();
index daa454c8f68b2e7fb6a9aac1ab4def68bfaf9af2..b56bed969b2efe4eb8868ba65d7931df2725ccd5 100644 (file)
@@ -35,7 +35,7 @@ class X
                tree.Map (new Mapper<int,string> (themap));
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test ();
index a7546e589a6ad57b397a21b7530dc611bd14ba53..6465742175ce6f4f8f6e45d150ae587233420643 100644 (file)
@@ -18,7 +18,7 @@ public class Test<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<int> test = new Test<int> (3);
                foreach (int a in test)
index 7666b4fef7da8acc335a2ed627e3be5b7efb9ec8..ec3ff5280dc1e5692207d691d1a8d7f16881d930 100644 (file)
@@ -1,7 +1,7 @@
 using System;
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                int [] foo = null;
                Array.Resize (ref foo, 10);
index 012bc2eb2fd7a1405c92f05bff52796d153106c0..b7f3b9c0561892aec6c750cdefa09901806deee8 100644 (file)
@@ -23,7 +23,7 @@ public class SpecialList<V> : IList<V>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                IList<int> list = new List<int> ();
                int result = list.Map ("Hello");
index 847799ee504277f872f37f61827fcbc5ad3adb2f..867d00518546d8a1a66f1c9683c0e1745c95adad 100644 (file)
@@ -27,7 +27,7 @@ public class Collection<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
                KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);
index 47ebf9ebeef4451d4b0baa4bc32260b76e7f1452..afe6808a8a6ec35fab6134c4a745ba444a2f98c9 100644 (file)
@@ -57,7 +57,7 @@ public class Sorting
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                List<Foo<int>> list = new List<Foo<int>> ();
                Foo<int> foo = new Foo<int> (3);
index 93215c288dd5fc55ae3562a5241f028b00a2f3a2..d300d420d656933a2cd391030a81ac9b84a94f86 100644 (file)
@@ -10,7 +10,7 @@ public class List<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                List<int> list = new List<int> ();
                list.Map (new Mapper<int,double> (delegate (int i) { return i/10.0; }));
index 49b0026cc25664e2fb92a7b44be8e4dd640037df..01fcf1e56ab5248a975321cba8622017a272c67a 100644 (file)
@@ -25,7 +25,7 @@ public class X
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                IComparer<Test> cmp = new NaturalComparer<Test> ();
                Test a = new Test ();
index 4fe091b2b6fa7291e571ad3713c73a91a99bd459..5397915181ac445bd4b2abce9ff08ea5c3eb6974 100644 (file)
@@ -19,7 +19,7 @@ namespace Slow
 
        class Program
        {
-               static void Main(string[] args)
+               public static void Main(string[] args)
                {
                        const int iterations = 10000;
 
index b4d21c9746aa6c932d277675efce0dfcc347ce9f..e1e54267b8e7f454420a630b289282625daf0a98 100644 (file)
@@ -68,7 +68,7 @@ class X
                return e is T;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if (Foo<int>.Test (3))
                        return 1;
index 38beb2b90b90d71fc6391477e289f279d827dfd9..d3cc47c45aa5c3a436277d7608ae7ef93fb592b7 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Tests {
 
-       public unsafe static void Main () {
+       unsafe public static void Main () {
                Console.WriteLine (typeof (void).Name);
                Console.WriteLine (typeof (void*).Name);
                Console.WriteLine (typeof (void**).Name);
index 3dec350d0fc8ee092ef4bb6eb410f1c917c242c5..ef81950d7c31247ac93271e78d9fac0445bfb08a 100644 (file)
@@ -24,7 +24,7 @@ public class Sequenced<T> : ISequenced<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Sequenced<int> s = new Sequenced<int> ();
                SequencedHasher<Sequenced<int>,int> hasher = new SequencedHasher<Sequenced<int>,int> ();
index 2ec8725936fad8e9ca901a937c59c15774edb7d9..62473f2de94d64bf728860e96143e2f959925fa0 100644 (file)
@@ -1,6 +1,6 @@
     class Test
     {
-        static void Main(string[] args)
+        public static void Main(string[] args)
         {
             A<int> a = new A<int>(new A<int>.B(D), 3);
             a.Run();
index 571d5a119e68f55e1b24d250068a505cc6e41aaa..9936dc83e5a1ac76b5163851ecc0477b0bffd4e8 100644 (file)
@@ -6,6 +6,6 @@ class A<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index b678b148ce22c8d703c98477a24478bef789a4d5..c8f06ac46dc7c5a415890f68a4debb540de76728 100644 (file)
@@ -20,7 +20,7 @@ public class FooCollection <T> : IFoo <T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                IFoo<int> foo = new FooCollection<int> ();
                int a = foo [3];
index 9a38f032eabd1d025d6433967167b9221c9c9716..aae93a86ad18454eb35e9d6c7954e805a91dc060 100644 (file)
@@ -34,7 +34,7 @@ class M {
     return result;
   }
  
-  static void Main () {
+  public static void Main () {
        MyFilter m = new MyFilter ();
         System.Console.WriteLine (foo1 <K> (m).Count);
         MyBFilter mb = new MyBFilter ();
index 216628ace28d18830959852ab749fa243e125bfe..2f2545eec6ac43a59dd47250dc938d52cb4bc192 100644 (file)
@@ -22,7 +22,7 @@ namespace B
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index 46b304a961931924de7659a5395205d30688386b..7456f7b63cae55e23b91035414b26140fbab4801 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                int? a = null;
                int b = 3;
index fbef3ced10b28139d88cb82e6094adba25554b15..5e1ed6a32a568ff1d727d7553ce49b455fbc4982 100644 (file)
@@ -33,7 +33,7 @@ namespace Martin {
 
        class X
        {
-               static void Main ()
+               public static void Main ()
                {
                        B? b = new B (5);
                        A? a = b;
index 1065205b7ce7765c3f72295c1f2817258243cf00..c89a291ae69e101e389c32ade00b6a594c1d6c6d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                int? a = 4;
                long b = 5;
index 1b8b5549ad6204ec32e6c5348269736e4c433f25..cd5198fb6101a42e57a193e9ae7f780307d97176 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                int?[] bvals = new int?[] { null, 3, 4 };
                foreach (long? x in bvals) 
index d94be3e0103971e62906ca118bd31d9365b170ea..ade3f51e42442eaa184b854ea6160625378bf73d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                int?[] bvals = new int? [] { null, 3, 4 };
                foreach (int? x in bvals) 
index c9a1b60b78fd8d6093da06cfd1370ebd744a91c3..ce98c1637a68482aa2771fb4fc6a6bd8707662b6 100644 (file)
@@ -55,7 +55,7 @@ public static class Assert
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                bool? a = null, b = false, c = true;
                bool? d = null, e = false, f = true;
index 338a6ea813cc180122701f929a120f20a4569139..808bbca599d36185126d52dca65aa2877efdc39c 100644 (file)
@@ -87,7 +87,7 @@ class X
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int result = Test ();
                if (result != 0)
index 667d19d4e39c3a45fc5c6860a0da0b5b6ba55f7e..56b3850a96e1f634cab7a97d640d56e68c57c73f 100644 (file)
@@ -22,6 +22,6 @@ class SortedList<U> : MyLinkedList<U>
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        { }
 }
index e16a86a033bccf8d62d7330c6e21355c4334eebe..cc85965df4e2cf998e51af08d3be565610406ac6 100644 (file)
@@ -29,7 +29,7 @@ class Y { }
 
 class X
 {
-    static void Main ()
+    public static void Main ()
     { }
 }
 
index be06afa96a2473a840f166dbed4575b9f755c3ac..55dcf267595346f5b056fee3da70b7c472892da3 100644 (file)
@@ -12,6 +12,6 @@ static class Test2 {
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index be06afa96a2473a840f166dbed4575b9f755c3ac..55dcf267595346f5b056fee3da70b7c472892da3 100644 (file)
@@ -12,6 +12,6 @@ static class Test2 {
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index b14f73fc584c172042c61bca06f1e7a8b25fb833..247b330c224aa7d13378e204abce2c6cd85d31cb 100644 (file)
@@ -6,7 +6,7 @@ class Test<T> where T: struct{
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                new Test<bool> ();
                return 0;
index 35f062870bb7f24b0189cf4b8d8b51dd88a095d5..8c0b32188cea0e8fb3d6b20c5df2115b71f0ca11 100644 (file)
@@ -41,7 +41,7 @@ public class HashBag<T>: CollectionBase<T>, ICollection<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 7b615431c2ab94c93dbb2b5a6527de653dd1aa3a..a6a77d3d38c8c481d6460fdff55148ca9b06770d 100644 (file)
@@ -19,6 +19,6 @@ public class MyClass<T> where T: IExtended, new()
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 7b615431c2ab94c93dbb2b5a6527de653dd1aa3a..a6a77d3d38c8c481d6460fdff55148ca9b06770d 100644 (file)
@@ -19,6 +19,6 @@ public class MyClass<T> where T: IExtended, new()
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index f314b01af4a8ea47481aa43173be8fee758a2e5e..3e13010ea97632b44e0d0c66e800d4d6214f5473 100644 (file)
@@ -16,6 +16,6 @@ class m <k,v> : c <k,v>,
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 5f547f9df716f516ef98a430329003be4f983a17..098848936f3cc651ae1ba1055b8b9b0878cf5022 100644 (file)
@@ -11,7 +11,7 @@ public class Test : Moo<Test>.Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Moo<Test> moo = new Moo<Test> ();
        }
index 9b2b69ae2ea199a428cef7cc6e6a96bc47a83eaa..5a99caaf8c41626a0b1511ab064f59ac21be7536 100644 (file)
@@ -15,6 +15,6 @@ class List<T> {
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index b7a739b7124d9629c5efdbe9e10352107090d7b6..bbf59b47b8a92f4eabb9a893530ff91b8effe368 100644 (file)
@@ -8,7 +8,7 @@ public class Generic<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Type t = typeof (Generic<bool>);
                MemberInfo[] mi = t.FindMembers (MemberTypes.NestedType,
index 5352bb455ae37602a252c4d390b11ea48c99486d..e26d41b015418f18976c61ccaa96f2a11bf3213b 100644 (file)
@@ -22,6 +22,6 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 5863084801c5bb856459e1b49c7ece6f1605cf81..f0f7bd531f366e1c5a3dbde52583edac6c64c612 100644 (file)
@@ -22,6 +22,6 @@ public class FunEnumerable
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index a2c6d31d46a37d8ca9cc4294e87b884f8344f8f0..aa64dc9115db6059b94b879cc651d50171e3bd7a 100644 (file)
@@ -15,6 +15,6 @@ public class M {
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 7c0dcd6c22f23c01fa927417624e1a00b4f96c72..1d3b467dd3433219be0c174c7a4633afa5e8af3f 100644 (file)
@@ -13,7 +13,7 @@ class C {
 }
 
 class M {
-       static void Main () { 
+       public static void Main () { 
                C.Rev (new list<object>.Cons <string> ());
                C.Rev (new list<object>.Nil <string> ());
         }
index 9d119526c0b1e4313535a43dd00d42b2211d1894..13ca9e89142a439330bf76871fdf7efdf819b4e6 100644 (file)
@@ -1,6 +1,6 @@
 // Compiler options: /r:gtest-172-lib.dll
 class M {
-  static void Main () {
+  public static void Main () {
     A <int> x = A<int>.Nil._N_constant_object; 
   }
 }
index 0fdf185734f90793abbf7c4ed1027f36315010a8..ebae0d8f1a7fd1584492817dfe9458940551d1d5 100644 (file)
@@ -9,7 +9,7 @@ class D {}
 
 
 class M {
-  static void Main () {
+  public static void Main () {
     List <D> x = new List<D> ();
     x.foo <C> (x);
     List <string> y = new List<string> ();
index 9d3cae447b4509889901146ef5a80365974c9f6c..24d9fd575226bf23f93e658c7338b9fff3975222 100644 (file)
@@ -4,7 +4,7 @@ public class B<T> {
 }
 
 class M {
-       static void Main () {
+       public static void Main () {
                A<int> x = A<int>._N_constant_object;
                B<int> y = B<int>._N_constant_object;
        }
index 7ff47a93bfacd0be06a91396f12273eb5ef9e0af..05f921ddbcc47558a84887311f6c870e411270a1 100644 (file)
@@ -5,7 +5,7 @@ class X
 {
        static int[] x = new int[] {100, 200};
 
-       static int Main ()
+       public static int Main ()
        {
                IEnumerator<int> enumerator = X<int>.Y (x);
                int sum = 0;
index c75d9feff80c69d980d8cb506b7a63ea705caa46..8b2e05dff4a865447de7edd02cc40e4c4dff6eb2 100644 (file)
@@ -6,6 +6,6 @@ public interface Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index abb4a79a66a0fbb194c797074412f352224ac79e..b8a170fe72e16663ad232804bfeda6bec4c8cfcb 100644 (file)
@@ -9,7 +9,7 @@ public class X<T> {
        }
 }
 public class Y {
-       static int Main ()
+       public static int Main ()
        {
                return X<Y>.myMain ();
        }
index b323b62317229711a5604df43bc2e699f2bd9ed6..1001a86d96d396ffc0148a6facd6066b891053b6 100644 (file)
@@ -32,7 +32,7 @@ class Program
        [DllImport ("bah")]
        public static extern void test ();
 
-       static int Main ()
+       public static int Main ()
        {
                DllImportAttribute dia = Attribute.GetCustomAttribute (typeof (Program).GetMethod ("test"), typeof (DllImportAttribute)) as DllImportAttribute;
                if (dia == null)
index b2ad3c8bf78fd043e819db751128c406e03699e1..95f8cd4129aff2cb72591d224e1ca08ea2fef9e1 100644 (file)
@@ -26,7 +26,7 @@ class X {
            }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                IEnumerator e = GetIt;
                int total = 0;
index d6ee9533a681ef90100d5beee46b9f4ffcd3ee7a..8068e346e23ec15a225640e47c99c0a95b10fae0 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-      static void Main ()
+      public static void Main ()
       {
        string [] s = { "a", "b", "a" };
        System.Array.FindAll (s, delegate (string str) { return str == "a"; });
index 94fbb7b776affa62807212cb693d7d8cb1c20300..cbdb2e5f5db5c06e2d57326b123e00e26c084faf 100644 (file)
@@ -23,7 +23,7 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<int> foo = new Foo<int> ();
                Foo<int>.Node root = foo.GetRoot ();
index 3417cef9eac8a4e4f43215357bad591a42eed71b..da58b6153ec191a5706ce633cd9d93b3d14282b3 100644 (file)
@@ -84,6 +84,6 @@ namespace Test7
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 779fe94f72dad3e3fd7995ccd08391518dee7c76..80f7ad42a99503c6634fe1670726afaab8c00bf9 100644 (file)
@@ -12,5 +12,5 @@ public enum X {
 }
 
 class xX {
-       static void Main () {}
+       public static void Main () {}
 }
index 457b63e6c76f0b40c093ffe64e23376baccfcd10..ffa5b70d8dc7216a5c2a95fc0bcf68e5180bbac9 100644 (file)
@@ -24,6 +24,6 @@ internal class RedBlackTree<S>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index a8b4e1744f54276ffd8ddf46965cba1da97fc2fc..fdc99eb180eb922ec8d29190b1585340ade0b5dc 100644 (file)
@@ -24,6 +24,6 @@ public class OrderedMultiDictionary<T,U>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 81a7e7624695a2794aef28f280c618e9e574db55..77098ff1e261658acb973ddbee1ef20d5ed1afe0 100644 (file)
@@ -22,6 +22,6 @@ internal class RedBlackTree<S>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index ce9cf0884fb6deed07a03ba2ff52defa72bc7a98..e1ce88fcb34c7421651cb10820007e400b176302 100644 (file)
@@ -67,7 +67,7 @@ namespace Martin.Collections.Generic {
 
        class X
        {
-               static void Main ()
+               public static void Main ()
                { }
        }
 }
index 5c4f2ae7a4166f7806223759f8ac3d6bfa0b1ea5..01d46339f3cba212ea8c8240f0dddf8d90ba52c2 100644 (file)
@@ -23,7 +23,7 @@ public class HashSet<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                HashSet<int> hb = new HashSet<int> (12345678);
 
index d3904fa2ecee62d1e5a30363146f1034d91ba368..6044c7193ce62e74bfab75aa1ac30bf3f8578583 100644 (file)
@@ -26,7 +26,7 @@ public class LocalContext
 }
 
 class M {
-  static void Main () {
+  public static void Main () {
      LocalContext x = new LocalContext ();
      x.Fold ("a" );
   }
index f4bcaa23e3e9aaa4b6364f021e5ef20f50fd7bde..1ddabb055aefd7c38c43f910aef0b75318e92ad1 100644 (file)
@@ -23,7 +23,7 @@ class X
                mi.Invoke (null, new object[] { arg });
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Test (typeof (Test<Foo<int>>), new Foo<int> ());
                Test (typeof (Test<Bar<int>>), new Bar<int> ());
index a718af57290a98719d9ff1b4887a187243f73132..3848d9542a90911e24b00a041045ac8133069eeb 100644 (file)
@@ -5,7 +5,7 @@ class M {
     System.Console.WriteLine (x);
   }
 
-  static void Main () {
+  public static void Main () {
     string[] arr = new string[] { "a", "b", "c" };
     System.Array.ForEach (arr, p);
   }
index e827dc8efd78f47ece58023da019c1b86d89d976..d5d0ee230c489911fc6f6ac9aab95cba5b255ffe 100644 (file)
@@ -6,7 +6,7 @@ public class Foo<T> where T : class {
 }
 
 class Driver {
-       static void Main ()
+       public static void Main ()
        {
                Foo<SomeClass> f = new Foo<SomeClass> ();
                f.Do ("something");
index d06292c53f1e55d394a1803040a0afee34513854..897179280424af855da378678476731293226c41 100644 (file)
@@ -9,7 +9,7 @@ namespace ClassLibrary3
 
        public class Test
        {
-               static void Main ()
+               public static void Main ()
                {
                        Dictionary1<Guid, String> _D = new Dictionary1<Guid, string>();
                        _D.Add(Guid.NewGuid(), "foo");
index d8ba07d4b061a018dbd8fce062556fdc728559f0..099cc330fd211362635e9a9f42cfc8efcd2b33de 100644 (file)
@@ -18,7 +18,7 @@ public class Test
     bool a = t.Valid;
   }
 
-  static void Main()
+  public static void Main()
   {
     Fun(new SomeStruct());
   }
index ac49ea85feddce252909a4f77bc20a46e60c24d9..2bd707f3892fcd2122e16db86f4b9b70103d370d 100644 (file)
@@ -23,7 +23,7 @@ public class Test
                        throw new System.Exception ("didn't update 't'");
        }
 
-       static void Main()
+       public static void Main()
        {
                Fun (new SomeStruct ());
        }
index 01bc6f32200d238680cac48bc874dac7c3ed178e..a82f7161967a866128832b9d81ebfc48ede9e24d 100644 (file)
@@ -7,7 +7,7 @@ using System.Reflection;
 using System.Runtime.CompilerServices;
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                object [] attrs = typeof (X).Assembly.GetCustomAttributes (true);
 
index 73b6cc1baf88fdf6ab7abaf27c06f75db0668fa6..0f52e819fb2666d6e330d5f3f9c5a26365ab5fe1 100644 (file)
@@ -6,6 +6,6 @@ class Foo : IFoo<Foo>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 40c9344682ea1c50bcbe1cb72473c68b8b606428..abedaa08b1aea098ad99dccfdcd1d2fe0ec91214 100644 (file)
@@ -15,7 +15,7 @@ public class A<T1>
 
 class PopQuiz
 {
-       static int Main()
+       public static int Main()
        {
                A<int>.B<char>.C<bool> o = new A<int>.B<char>.C<bool>();
                string s = o.a.GetType().FullName;
index 44186740e7cb1ce0c61251e5d1f8b078983274e0..47c0eaf394cd777ffdedc0ac101a3b3707507b40 100644 (file)
@@ -17,6 +17,6 @@ class C3 : C2
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index ac72b83fbbfa18ee11e7faa3def3ba48eafa9dc5..dee948265b2dc47182d4386fc8ffede2d86c5c67 100644 (file)
@@ -23,7 +23,7 @@ public class Set<Element>
 
 static class SetTest
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index a02073fa986f69f3807c5491cf3e9fe8a6ebb08d..5a5233cde9ef6548233f7f5922ab1d7803784a25 100644 (file)
@@ -25,6 +25,6 @@ public class Foo<G>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 2006e12c854126a4fbb6268c3800a8208afbc35a..e32e26a3ca61c901eb969224038f9f3a70328c7f 100644 (file)
@@ -11,7 +11,7 @@ public class B : IComparable<B> {
 
 public class Tester
 {
-       static int Main ()
+       public static int Main ()
        {
                B b = new B ();
 
index dd2851bc453d9256dd759cc2e968685a2bbde47b..092dc99da25cbc855a3acabccde8747d90d321d7 100644 (file)
@@ -15,7 +15,7 @@ public class B {
 
   public void Add (object x) { }
 
-  static void Main () {
+  public static void Main () {
     int A = 4;
     int goo1 = 3;
     foo (goo <A, A, A, A, A> (1));
index fed3cb78d41a7108ba2d3ab51a308bf2e694145f..9a11ca1d8d649df1fdf559d170e2688fdd8c0383 100644 (file)
@@ -4,7 +4,7 @@
 class X {
        static int stored_offset, stored_len, opt_len;
 
-       static void Main ()
+       public static void Main ()
        {
        if (stored_offset >= 0 && (stored_len+4) < (opt_len >> 3))  {}
 
index 8a52828d0703a0452985e4186ced31b563160a8e..11f4c476fbfb9c51d2327173c4ae3d7efd686bf5 100644 (file)
@@ -6,7 +6,7 @@ using System.ComponentModel;
 
 class Program
 {
-       static void Main (string[] args)
+       public static void Main (string[] args)
        {
                MyClass<int> list = new MyClass<int>();
 
index 28fb7d73182e32956596280db11d952ac1bbf55f..d1f0d8857b62ed364b8afc92a2d0c760f05c608e 100644 (file)
@@ -7,7 +7,7 @@ public class Test
 
         public IFoo<T> GetFooGeneric<T> () { return default (IFoo<T>); }
 
-       static void Main ()
+       public static void Main ()
        {
                Test test = new Test ();
                test.GetFoo ();
index cce3049305d10cef90d3c6fe9c484de73ec2063f..37acdefe68e281042feda27128585ff97bdb093f 100644 (file)
@@ -15,7 +15,7 @@ class Foo<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo<long> foo = new Foo<long> ();
                Foo<int> bar = new Foo<int> ();
index 0dce169e6d99111c64e14244930831db30e2cd13..3ee1c78c957d5b66a080495fb44078c104b77753 100644 (file)
@@ -15,7 +15,7 @@ class Foo<T>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo<long> foo = new Foo<long> ();
                Foo<int> bar = new Foo<int> ();
index 24e48d34dcc17529b3b07a15e23ee5389b941fe3..177c8d1641d91d71dfb4de5bb943296769ce7e5f 100644 (file)
@@ -2,7 +2,7 @@
 // Dependencies: gtest-238-lib.cs
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo<long> foo = new Foo<long> ();
                if (foo.Test (3) != 1)
index 6add5879654e47895a7399060ec3239c8ba65365..f5baaf00d9d33ad295f21c42ace4415de014dabe 100644 (file)
@@ -25,7 +25,7 @@ class Foo<T,U>
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo<long,float> a = new Foo<long,float> ();
                if (a.Test (3L, 3.14F) != 3)
index 35fd4057f2c3f37758421829fd33d7f9b9a73b0f..a1f01791d35304b7254e92280dd81014c491d5dd 100644 (file)
@@ -23,6 +23,6 @@ public class MyClass: IMyInterface<string>, IMyInterface<int>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index e0f57182f5b21b7607286ed8f25cb0feeee97e25..9a8858440cc599deecc9551be0c02c60fc68037c 100644 (file)
@@ -9,5 +9,5 @@ abstract public class a
      }
   }
 class main {
-       static void Main () {}
+       public static void Main () {}
 }
index dbd6d28a41e80610670fd14e340f61b0a146f7f2..84286b042f22396b72970dc5d9995c7d748fbf80 100644 (file)
@@ -17,7 +17,7 @@ abstract class BaseClass
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 1e7ca4bd69e09918ada4e7e733101706af098928..34718b6e1b69c88ca5cf42a9afddf54c0285fc93 100644 (file)
@@ -8,7 +8,7 @@ namespace TestCase
 
        class CTest : ITest
        {
-               static void Main()
+               public static void Main()
                {
                }
 
index 28260d85112ad0646ad7dde163d76aef9b973f33..acd4b99e773f7a43cac588ae8654930c8fa63cc8 100644 (file)
@@ -65,6 +65,6 @@ public class HashSet<T> : CollectionValueBase<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 4f9389f565d39db7ffb8e5aab261c7867da93a11..b1a229e569d95deff1c9b6431fd9d92fcff2c1c6 100644 (file)
@@ -10,6 +10,6 @@ class X
                return o is Foo<int> ? true : false;
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 003bc5ff640bd5c65fc935c06bdf51175c19de27..ec8621d4f50c493f50fc0a8f0c59559abdf3bf92 100644 (file)
@@ -30,6 +30,6 @@ public class HashedArrayList<T> : ArrayBase<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index c57295c1fea284e35dbc51a4162bf5464828a084..33b51cb598250b0a9c43390b45c1da0adcd331b8 100644 (file)
@@ -20,6 +20,6 @@ public class GuardedIndexedSorted<T> : IIndexedSorted<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index be977692803e025e9f4b8f1b5c80eeb7041b044f..57d07564960634aa38ed6073281aff18f9dd01eb 100644 (file)
@@ -17,6 +17,6 @@ public class SortedIndexedTester<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index ddfb29f932fca24863f263c46c85a3f3c010d6fe..83703697ce1bce7d863b7fcdb1f2e2c8714c6350 100644 (file)
@@ -13,7 +13,7 @@ public class SequencedEqualityComparer<T,W>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                EqualityComparer<int>.Test ();
        }
index 658dea9cbad8cc34289f78bc6d5565245602a517..84cf74295189ceb346f95aae24de3a4b4a975f8e 100644 (file)
@@ -36,7 +36,7 @@ public class Extensible<V> : IExtensible<V>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Extensible<int> ext = new Extensible<int> ();
                ExtensibleTester<Extensible<int>> tester = new ExtensibleTester<Extensible<int>> (ext);
index 0a78b9bc97d6770e0e7f4377514d8b985c8d4bb3..c32c6ff6d8b66472d1cbf8afb9c1c17453c5944b 100644 (file)
@@ -22,7 +22,7 @@ public class HashedLinkedList<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                HashedLinkedList<int>.Test (5);
                HashedLinkedList<long> list = new HashedLinkedList<long> ();
index 5a0036bd790b53121edee58edc5112c9ccccf4a6..cdd324599e4ee5a4f789442b2b88a19124f4861d 100644 (file)
@@ -15,6 +15,6 @@ public abstract class B : A
 
 public class C : B
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index a2f17d62df3ba1daa6400e3d71376829a623a62d..4676674576a217c299024df6f70359e399e1e1ce 100644 (file)
@@ -14,7 +14,7 @@ public class Test
                yield return "TEST2";
        }
 
-       static void Main ()
+       public static void Main ()
        {
                new Test ().Run ();
        }
index 714a1a7851a438a6c0e70ccb22882165cb83d3ac..1c7bca8e3f5cb246d126a6e129dbe1c39d314e36 100644 (file)
@@ -15,7 +15,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<A> foo = new Foo<A> ();
        }
index 8f84a53b9028ffb8bb793637ba41ac5e8d3d75d4..d27b51e1b88a3c9c0ddca021a76c6265202063e4 100644 (file)
@@ -23,6 +23,6 @@ public abstract class MyBaseType
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index e94f3f46efa22908e0c1b5e93ea51c6a7585d8c3..7ec1ed9edaa0a2f49f32e8a0ba7bf678f1df0b05 100644 (file)
@@ -2,5 +2,5 @@ class A<T> where T : class {}
 class B<T> : A<T> where T : class {}
 class Test {
        internal static A<Test> x = new B<Test> ();
-       static void Main () { }
+       public static void Main () { }
 }
index 9a71d8b6accb4c03b7e0d239b99cfd4e907f9ad5..f92c60fcd0b6ea892487805be290e84342b65867 100644 (file)
@@ -16,7 +16,7 @@ public class Test {
        public void f5 ([System.Runtime.InteropServices.DefaultParameterValue ((short) 1)] short x) {}
        public void f6 ([DefaultParameterValue (ParamEnum.Foo)] ParamEnum n) {}
 
-       static void Main ()
+       public static void Main ()
        {
                string problems = "";
                Type t = typeof (Test);
index 4911dcd8798a724b8d899c69e38c6580bcde75a9..ff7870fc29331ffb22e2f0bd041f1cfea7047441 100644 (file)
@@ -17,6 +17,6 @@ public static class ConvertHelper
                yield return (T) s;
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 384f8aefb4121a7220023aec5bef0b61cfd017f5..aadc2db64d1a230e9b157216519c8ac344a8d404 100644 (file)
@@ -11,4 +11,4 @@ class Test<T>
         }
 }
 
-class Test { static void Main () { } }
+class Test { public static void Main () { } }
index 61947b79a9768ae5a60e09475df93f96c532ea3f..811d25e92af4d9018dc973acf8caaf1862dcca9e 100644 (file)
@@ -11,7 +11,7 @@ public class T {
 
         void Response <T> (Handler <T> handler) {}
 
-       static void Main ()
+       public static void Main ()
        { }
 } 
 
index 106fb364ec48a02c38a671408fe7920d8c82f3e1..4f402ed83090c37f75be5940ffca2607cc9e9a3e 100644 (file)
@@ -11,6 +11,6 @@ public class Test
                 public static G<T> Instance;
         }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index b8da9a5b893961212831f54ee8c1a527ac7a6dbc..9c7dc6438740539f8275d81d33d36214e9b06064 100644 (file)
@@ -104,7 +104,7 @@ class X
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                IrishPub pub = new IrishPub (IrishBeer.Guinness);
                if (PubToLong (pub) != 0x1001)
index 8b1093d26362d78457f2b5bc5aa09365861b4b19..d8b9d56791d743cf0f91eab036f6198df32b6207 100644 (file)
@@ -15,7 +15,7 @@ class X
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Test (null) != -1)
                        return 1;
index e29a4e8251d81f4b3c5292a9e15bc519a0cc6dde..db287e839078e86e38b5f73e2d20513c04c75f5c 100644 (file)
@@ -31,7 +31,7 @@ public class Test<T> : IComparable<Test<T>>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<X,Test<X>> foo = new Foo<X,Test<X>> ();
                foreach (Test<X> test in foo)
index 318de1af3bd8f31badcbac5f9de5a731d1380a94..f1981026c9b5f5fbc3706b263af394b43d449911 100644 (file)
@@ -16,7 +16,7 @@ public static class X
        static void Test<T> (T t)
        { }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo<long> (Test);
        }
index a2bbd6117f5533e2140f676af6204e8364196889..ff7a0c3efed030f3dec19b5a485fa4bf4095c583 100644 (file)
@@ -32,6 +32,6 @@ public class ThatClass: ThatClass<ThatClass, ThisClass, object>
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index baa4e39536d05d44bf9663031e049dbd811df01f..5522a499f888e435e74308951483cd73b37c2020 100644 (file)
@@ -47,7 +47,7 @@ public struct Baz
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                int a = 3;
                int? b = a;
index dbfb9d209aef927161180abf23eb3e9ed2cd5914..d667177431ae804117ccee64435fb62732ffb159 100644 (file)
@@ -42,6 +42,6 @@ public interface IAVLNode<K, C> : IBSTNode<K, C>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 555128eee31b36ed30080636010365802bb5fd9a..5f6eceb12a7bddc01eb666992bf71ecdf8c6691e 100644 (file)
@@ -23,7 +23,7 @@ class Foo : IFoo
 
 class BugReport
 {
-       static void Main(string[] args)
+       public static void Main(string[] args)
        {
                Foo f = new Foo();
                f.Bar();
index 36a0217cb37cf8c5300f0159eb9a5c574b3d873e..945419cc23b731a6ebe5334042c03c119564fa56 100644 (file)
@@ -5,5 +5,5 @@ class C<T> {}
 
 class Test {
        static Foo f = new Foo ();
-       static void Main () { System.Console.WriteLine (f.GetType ().BaseType); }
+       public static void Main () { System.Console.WriteLine (f.GetType ().BaseType); }
 }
index e5aac17e1a4a32f7dbeaf68b1b0f7de3221c4067..a2a0100ce6b6aeb356330a70cd720034119f5135 100644 (file)
@@ -288,7 +288,7 @@ class Z
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int result = Test ();
                if (result == 0)
index 211e8175a9e1d92ceaf869edbf7a68d980ad884e..5a84c95bc51f9696279b960844b0cb7a2f9e023d 100644 (file)
@@ -7,7 +7,7 @@ interface I {
 
 class X : I
 {
-        static void Main ()
+        public static void Main ()
         {
                List<object> l = new List<object> ();
                List<I> i = new List<I> ();
index 2d29e0f8895213b31ad6d5d3e843d2d57335c2e3..c0fb1927613b74fad65387e2ebbb12a73897ee28 100644 (file)
@@ -26,6 +26,6 @@ public class B : A
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index dc43d414d048f8c3a3021f89c867e59ce0f34164..96304364b52f75621a5500ebbe5d31f0905b1805 100644 (file)
@@ -46,7 +46,7 @@ class Consts
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                ConstructorInfo mi = typeof(C).GetConstructors ()[0];
         MethodBody mb = mi.GetMethodBody();
index 81319315e8720a4c40cd548e55fe62ac8edf6323..65d90c8a1a815e2ecb609745d0232c6ce05d5938 100644 (file)
@@ -1,7 +1,7 @@
 using System;
 
 class Global {
-       static void Main() {
+       public static void Main() {
                Console.Write(Test2((int?)2));
        }
        static string Test2(decimal? value) {
index 0f0d0ed4148b682ad6167b079d23d4636d79c6d0..13dce4ed3fd5bf176906832dee04f82ab671e02f 100644 (file)
@@ -10,6 +10,6 @@ namespace Test
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 1bb7fc8303e03eb6a84aa589b05405cffb30eb8a..b0d9fd5b1538a44ad47f910f4fe50cda4f9b83f4 100644 (file)
@@ -15,6 +15,6 @@ public class Test<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index d66c6e2f3b5c79df2d4fa318cd0b13604cadce28..59a58f3292c0cd56ab2a97a53843dba4138defc4 100644 (file)
@@ -8,7 +8,7 @@ class X
                return b ?? a;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                A a = new A ();
                B b = new B ();
index 09a98cd338743b913a0248667b1cbe5a14c75fa7..45a6cb3d3fe842d9bc07357e7d533ba33d2e5ab6 100644 (file)
@@ -9,5 +9,5 @@ namespace Test {
         Cache<T> _cache;   // CS0452
     }
 
-    class Foo { static void Main () { object foo = new MyType<Base> (); } }
+    class Foo { public static void Main () { object foo = new MyType<Base> (); } }
 }
index 3b95662e983ec0eb4a33ed8efd733bfb0deba767..3406337d4b98aaeced95b761d5ba6bb120b56493 100644 (file)
@@ -7,7 +7,7 @@ using System.Runtime.CompilerServices;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                try {
                } catch (Exception) {
index a0aa6ed622729eb34ca0988102b2fbc01199acc8..05dee4de4f6e7161104d4a0075c5f365b86ab104 100644 (file)
@@ -13,7 +13,7 @@ class TestClass
        static int i = 1;
        static readonly A a = new A(delegate(int a) { i = a; });
 
-       static int Main ()
+       public static int Main ()
        {
                return i;
        }
index fbaa9c4f03b149a915f829c92cde68778d70b8a7..951b1621eef2eb1524779897d55fe283ee1e5f06 100644 (file)
@@ -4,7 +4,7 @@ namespace N { class A {} }
 class B<T> { }
 class Test {
        static public B<X::A> q;
-       static void Main ()
+       public static void Main ()
        {
                q = new B<N.A> ();
                if (typeof (B<X::A>) != typeof (B<X.A>))
index ecf70bd6d4ea1b626e5841616836ba35c0c101e8..fd3f6f93bb2fcc6a634979e16242cd9c49e7348d 100644 (file)
@@ -11,7 +11,7 @@ class Test : ITest {
 }
 
 class M {
-       static void Main ()
+       public static void Main ()
        {
                ITest foo = new Test ();
                foreach (int i in foo)
index 86bc1fd28bfa08b4d910b00959e0e042a0ea876c..552b7dbc0a1bfd68f90dfdd5af7fd11af8fbb660 100644 (file)
@@ -5,7 +5,7 @@ partial class Foo<T> {
 
 class Bar {
        static int g () { return 0; }
-       static int Main ()
+       public static int Main ()
        {
                Foo<int>.F f = g;
                return f ();
index ce8ffec8a4837d3832f2f812d55d18b97a04b201..8f2ac9d56c921e977496eaaab7a511d362ba2e5b 100644 (file)
@@ -23,7 +23,7 @@ public class Foo {
                if (i != 0)
                        throw new Exception (""+i);
        }
-       static void Main ()
+       public static void Main ()
        {
                Comparison<int> ci = Test.WrapComparison<int> (compare);
                Comparison<string> cs = Test.WrapComparison<string> (compare);
index 34aec07b0cfd63069edf5071fb357127d5894283..83e7b8b30bb55cd60e13dc59a3095df961b38ba2 100644 (file)
@@ -6,7 +6,7 @@ class Test<A,B>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<float,int> test = new Test<float,int> ();
                test.Foo (test, test);
index e7a3f69340b4fe7153991e0f2a65dd49801378d0..d9792d578a08f1489fab987a792b255888613745 100644 (file)
@@ -11,7 +11,7 @@ class A
        [DllImport ("Dingus")]
        extern static void Do2<T> ();
 
-       static void Main ()
+       public static void Main ()
        {
 
        }
index 8ffb85f6debe754eb69ac39b995b895ca1b00ec2..92a36ba7a35ef95bd263502f5f6244c445a5721f 100644 (file)
@@ -14,7 +14,7 @@ class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<int>.TestEnum e = Foo<int>.TestEnum.One;
                Console.WriteLine (e);
index 3d4afe45372e876885481a40b9355f25ae66ba97..b0de4e866b470ae71ed5d9f4b0883bc1661a278e 100644 (file)
@@ -11,7 +11,7 @@ public partial class A<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                A<int> a = new A<int> ();
                a.Test = new A<int>.B ();
index b2139bf8546735816c3416569440203b849a96b2..a5ff84112643c1cac8c90b68aef0a7ee6f4a1ded 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                new Derived ().Method<Foo> ();
                return 0;
index 6b956657c185e2595bf8ef0c7a3dc5982afdc95f..b92d096caa41127f6756ad360781cd5c77d7089c 100644 (file)
@@ -12,7 +12,7 @@ public class Bar<Q> : Foo<Bar<Q>.Baz>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Bar<int> bar = new Bar<int> ();
                System.Console.WriteLine (bar);
index 7e8d071a895d54ee18be1ffb201f604562232fe1..b443fff1a33b846cf03cf1a87b98009e5a4389dc 100644 (file)
@@ -16,7 +16,7 @@ public class Goo<Q> : Foo<Bar<Q>.Baz>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Bar<int> bar = new Bar<int> ();
                System.Console.WriteLine (bar);
index 769b4152250d9bf6772c1f724550088456b5a74b..714e32c4f89c795cac8646334c2df74f821e018b 100644 (file)
@@ -19,6 +19,6 @@ public class Temp<T> : IEnumerable<Temp<T>.Foo>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index c003aa788ef539ded2638ad4bbc8300f5e267b1d..edacc47180c09c02b05480cadff3dbf1d700d376 100644 (file)
@@ -14,6 +14,6 @@ partial class B : Foo<B.C>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index ebfb74a60441a2819898295586c4abe3425d06f1..29e0f47bfef9122e756caa1fb3a06e0ad3b02898 100644 (file)
@@ -12,6 +12,6 @@ public class X : MyBase<string, int>
                : base (cb)
        { }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index a8b1b8bb50d96764226bc37e0c37098f0c9605d8..c7563ce00ad9b10f5feafcad0a1caed3731f9e09 100644 (file)
@@ -17,6 +17,6 @@ public class X : MyBase<string, int>
                Hello (cb);
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index c077524cb31503df8a807b560e8d42f180914e9f..56a1ff746c841ced3ef0f2b09705c52002ae05f5 100644 (file)
@@ -24,7 +24,7 @@ class B
        {
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index d6bfe8eb072bc0a8e8916692546fe3b3ec3a3a45..318b904c46b393e521775c7399b9bd90539a5607 100644 (file)
@@ -5,7 +5,7 @@ public class SomeClass<T> where T : new() {
 }
 
 class Foo {
-       static void Main ()
+       public static void Main ()
        {
                SomeClass<object> x = new SomeClass<object> ();
                x.Foo ();
index 2a3969950391047129d6be4e511a209457e6dda6..551f0655e5642cb7456228a18efd201d930b590a 100644 (file)
@@ -6,7 +6,7 @@ public class A : C5.ArrayList<int>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                A x = new A ();
                foreach (int i in x) {
index e7c8196d049661059367ac775d769a8c10b3e628..af3b6b7837838b05e8358d01313a9428ea100e88 100644 (file)
@@ -27,7 +27,7 @@ struct Value : ITest
 
 class C
 {
-       static void Main ()
+       public static void Main ()
        {
                new Tester<Reference> ().Do ();
                new Tester<Value> ().Do ();
index a242223743f9e46c1cae92f79fc54364a2a18da8..dc107d02d06bdc000f1ea1281a65474d1a18693c 100644 (file)
@@ -17,7 +17,7 @@ public class Foo<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo<double> a = new Foo<double> ();
                a.Map<string> ("Hello World");
index e9f6455ad3e811f50e1e0a64c5725c220e3d89f8..df5d39544f578eae8c0f2c117c3257eadbe5a88d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 public static class Program
 {
-       private static void Main ()
+       public static void Main ()
        {
                Exception ex1 = null ?? new Exception ();
                Exception ex2 = new Exception() ?? null;
index d9a77f397dff6b9feed14f281c6fbcddceb2cef3..7c3dd26c7c179c9b74ee98584a76e7b9385f2ed7 100644 (file)
@@ -7,7 +7,7 @@ class X {
         {
         }
 
-        static void Main ()
+        public static void Main ()
         {
                 object o = null;
                 double [] d = null;
index 869c07b378ba7db4be2501a120b77b398d88c2e0..112d6ec835d3a83170c441c9aca0a54cb7160c32 100644 (file)
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 class Test {
 
-       static void Main ()
+       public static void Main ()
        {
                FooList<string> l = new FooList<string> ();
                Foo<string> (l);
index 6165a10b7bde758ffc64c494bed229601167687c..4a199dcdd10b1c8ff6c951188a72d777b2484f6e 100644 (file)
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
                SerializeDictionary (new SerializerLazyDictionary ());
        }
index c001f85980c1cb527e18220dfff4d66870ba3de7..70ab2380b9fb1f4ba5d9d47b4759e332fd186581 100644 (file)
@@ -19,7 +19,7 @@ class X
                throw new NotImplementedException();
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
\ No newline at end of file
index 68200850a22d3fb2982d382542d0fd295ca77ca6..8d25d7fdca5a7eb6a4f923bfd4c80834dc5e7213 100644 (file)
@@ -6,7 +6,7 @@ class X
 {
        public delegate R Function<T1, T2, R>(T1 arg1, T2 arg2);
 
-       static int Main ()
+       public static int Main ()
        {
                Delegate [] e = new Delegate [] {
                        new Function<IList,IList,int> (f2),
index 3142b3cbe1b8d5855a55175b84cea5d264bd4853..12af0893809383ef12eb66c773b29da5d572fa7c 100644 (file)
@@ -16,7 +16,7 @@ struct D
 
 class T
 {
-       static int Main ()
+       public static int Main ()
        {
                ConstructorInfo mi = typeof(D).GetConstructors (BindingFlags.Instance | BindingFlags.Public)[0];
         MethodBody mb = mi.GetMethodBody();
index 42d0603a1ae8a11bbede128cfe01264b659b08ff..c36c8d58e9c20bc88a0dd4982f90531e048b6407 100644 (file)
@@ -20,7 +20,7 @@ class C : B<string>
 
 public class Program
 {
-       static void Main ()
+       public static void Main ()
        {
                new C ().Foo<string> ();
        }
index dac6c5f3e6244b05ce9ccc359d3cd78feca9b3a6..4a70dc6dda429763787d7c59011b49f108409746 100644 (file)
@@ -8,7 +8,7 @@ class D <U> : C<U> where U : struct
 
 class X
 {
-       static void Main ()
+       public static void Main ()
         {
         }
 }
index 746ed8f4392695524f89da1aba98c5f72a2a8683..c927dc465b979917e5057b1df84286735d8fb1ef 100644 (file)
@@ -49,7 +49,7 @@ class Concrete_2 : BaseGeneric_1<bool>
 
 class Program
 {
-    static void Main ()
+    public static void Main ()
     {
                new Concrete_B.InnerDerived ("abc");
                new Concrete_A.InnerDerived (11);
index 4b9662e22749a3e9a350e6ed5bdca2b790180c70..23d4f984d868485288f6e054d896b03976052a58 100644 (file)
@@ -4,7 +4,7 @@ namespace BugReport
 {
        class Program
        {
-               static int Main()
+               public static int Main()
                {
                        A a = new A();
                        a.Counter++;
index 7c5b9f0ae9db4d72d9cde3842610d4968ca15dc7..ccd0d915fa2ae0fb2b40558f97e1ec1c53d7be64 100644 (file)
@@ -4,7 +4,7 @@ namespace B
 {
        class Program
        {
-               static int Main()
+               public static int Main()
                {
                        int? i = 0;
                        bool b = i == (int?)null;
index beeee1e2af22df1d1a003842a3efb214b4c87668..db450282b353d86ae2093d83f6e4022ba2ac3593 100644 (file)
@@ -20,7 +20,7 @@ class Tester
        {
        }
        
-       static void Main ()
+       public static void Main ()
        {
                Assert (10, new MyType (10));
        }
index 00572042fcec5bff5e980daa0c43d9eabdb134e3..6fa68ce75ef664440b58ca9e532a46b81bbe2cdb 100644 (file)
@@ -4,7 +4,7 @@ class Foo {}
 
 class Repro {
 
-       static void Main ()
+       public static void Main ()
        {
        }
 
index a3e48c56cb411a0e953209f4eb32817b6ae09840..12675368d7b7bf0f827bf87a5b8dcb156e28780d 100644 (file)
@@ -4,7 +4,7 @@
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<float,int> test = new Test<float,int> ();
                test.Foo ("Hello World");
index acaa58929ae45673bc8493a4d0c64dfaef5ee2ba..b4ed67f0829d73034c3f4152be26f4c9b3bb4c63 100644 (file)
@@ -14,7 +14,7 @@ public class TestClass2<T> where T : C
 
 public class X
 {
-       static int Main ()
+       public static int Main ()
        {
                new TestClass<object> ().Check (null, null);
                new TestClass2<C> ().Check (null, null);
index 2060c6056bdeaf21282558a0f71094132418af8f..f2a43b9228507eeea87d935bed1b4b1d1bb5cd98 100644 (file)
@@ -11,7 +11,7 @@ public class X {
                return x != null;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if (Compute (1) != false)
                        return 1;
index 0a6275d27a78084e8a34f220951af6ab97232347..04e80fe7439806beb86350db607b11b4ae327902 100644 (file)
@@ -4,7 +4,7 @@ class TestGoto
 {
   static int x = 2;
 
-  static void Main(string[] args)
+  public static void Main(string[] args)
     {
       foreach (bool b in test())
        ;
index 0f73b5e429ddd61c226b99a5d3aff8813cdc852a..4706ec63d43ce0656bb4a4e93f90fa4a087d9413 100644 (file)
@@ -77,7 +77,7 @@ struct MyTypeB
 
 class C
 {
-       static int Main ()
+       public static int Main ()
        {
                MyTypeA? mt = null;
                mt = null + mt;
index e28d37fd21255e0543301684175a9e3068857a04..a46e877ddc538a36e71db2678ca6b02fa1ac1126 100644 (file)
@@ -11,7 +11,7 @@ class Foo {
       throw new Exception ();
   }
 
-  static void Main ()
+  public static void Main ()
   {
     Data d;
     f (d = new Data () { Value = 5 });
index d5dc82bc0b7dead1392fb2e5123ddb67454d4716..1aa66bde21bb24dbddeb7ece7209192fcced2cb3 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Error error = Error.FILE_NOT_FOUND;
                return (error == null) ? 1 : 0;
index 89eed95540f693afc429dfaf17c5015679faad11..6109d62b2b65845d4a1ce9648e5220236c696f57 100644 (file)
@@ -16,7 +16,7 @@ public class DieSubrangeType
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                DieSubrangeType subrange = new DieSubrangeType ();
                Console.WriteLine (subrange.UpperBound != null);
index 29a061018f97cc8818d9767d3596224c16a16639..1db10567a7a64cfc37b96b99fda434f6c28c567c 100644 (file)
@@ -11,7 +11,7 @@ public class RubyMethod : IDynamicObject {
 }
 
 public class T {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 6d18d6e27ad3f7ab3b52c7561b389be0e61378e3..352bb1ac786bc4157a9b4afed1d73dc99be96f1a 100644 (file)
@@ -11,7 +11,7 @@ public class Test
                return null;
        }
 
-       static void Main()
+       public static void Main()
        {
                Invoke(Method, "one", 1);
        }
index a3478f6cb3e6a09b75c3eb472e2151837241b3af..cd27013b5ff77c178883e9d169ef43a12a712864 100644 (file)
@@ -59,7 +59,7 @@ class Test
                return -b;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (NegateFooNullable (null).Value != 42)
                        return 1;
index 584cb5adae749d887b890647050d65695c135f9e..e6e0895862683235175866c22b31df1776680890 100644 (file)
@@ -13,7 +13,7 @@ namespace TestIssue
 
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        try {
                                IEnumerable<Derived> e1 = (IEnumerable<Derived>) (new Base [] { });
index af7b38b9829cf6c616c9bb5d19bf864aa3c3ae50..90a82add53a3a2d513d274d1c70a8129f3af3739 100644 (file)
@@ -16,7 +16,7 @@ class Program
                return o is T;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if (Foo<bool> ())
                        return 1;
index 61d2b9f99c12dec95e1dcf6e9a127c9f559312b4..d6d6f5c7e003ef5f620f00f48fbaf101ece86561 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-        static void Main ()
+        public static void Main ()
         {
                 int h = 1, o = 2;
 
index 53fac0e78603dc288cf891f5f79a97c6b0598a5f..64e21f452548c4ed114d6afb7c976de824b50ab3 100644 (file)
@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
 
 public class Test
 {
-       static public int Main ()
+       public static int Main ()
        {
                object [] o = typeof (IFoo).GetMethod ("get_Item").GetParameters () [0].GetCustomAttributes (false);
                if (o.Length != 1)
index a17f9c284ff1b1823c39a3fc2ace622f8389947e..12f979cff36922a86263d237275ec73ec3ad6990 100644 (file)
@@ -106,6 +106,11 @@ public class ConditionalParsing
                return 1;
        }
 
+       void Test_13 (object param)
+       {
+               if (param as bool? ?? false) {} else {}
+       }
+
        public static void Main ()
        {
        }
index 9731ac3532924750deea7fb0ff97e1fe9902abd3..3d02271dab6075e77a0f4a326a9cff538871c268 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 class Program
 {
-       static void Main()
+       public static void Main()
        {
                unsafe {
                        int* a = (int*)null;
index 50d9c256b824766c8da2a420678de8c4ef50a9fb..8b3045220f8c719f45c9b091f2952ddc3f68e1e5 100644 (file)
@@ -3,7 +3,7 @@ using System.Reflection;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Type type = typeof (Foo<>);
                Type [] gargs = type.GetGenericArguments ();
index 4b85aae0d823eac2ccb53421d0ef74d28c97d80e..5031c108eda151850aa37175d606133ce1b546b7 100644 (file)
@@ -10,7 +10,7 @@ struct S
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                int? n = 1;
                S f = new S ();
index c8f32bc6acff8a2c341b71c3ae0f00c75d3ee584..4cfcd92e98f5ee9e5c2ace03ed718c5c1a68ab79 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Foo
 {
-       static int Main ()
+       public static int Main ()
        {
                if (Bar (1))
                        return 1;
index c91f9595627c3bf2d8abd6117c13af0f25d5113c..f2c7e2a45c96eacbf51512e129ccddccbafc9cbc 100644 (file)
@@ -19,7 +19,7 @@ public class TestCase
 {
        public static GlobalMonitoredCharacterCollection MonitoredCharacters;
        
-       static int Main ()
+       public static int Main ()
        {
                MonitoredCharacters = new GlobalMonitoredCharacterCollection();
                foreach (var character in MonitoredCharacters)
index 386b17df8baf6c210b82833046a49b6318aed819..4d20d23d6bd8bf73543b358a58bf84e300eda67b 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                int? i = ((int?) -4);
                int? i2 = (int?) +4;
index bb92b705f1d6f7605e3c592ea69851ab9a599569..a4feb91829cd23863b97c0ddadaae68870b5c91e 100644 (file)
@@ -17,7 +17,7 @@ class TestClass
                return 1;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                C c = new C ();
                Test (c, c, new object [0]);
index c8e6ddc479d27f5e76acef218cb93f79367f6e13..ef32033691855444b99bf4f55b45f446d4f627a6 100644 (file)
@@ -24,7 +24,7 @@ namespace MonoTest
 
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
                }
        }
index ccbb5621d3dafba6e22430f38b44ea94de2f947d..cf1d40d0ca55071c17c238a275d38921094f6205 100644 (file)
@@ -12,7 +12,7 @@ public class Driver
                get { return tmp != null ? tmp.stuff : (int?)null; }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int? r = new Driver().Prop;
                Console.WriteLine (r);
index 5e886e970cf24a7d49e1887a3036a2cba7d72c29..2f3ee03ac95ec75174288aab82392d7834d2ea1e 100644 (file)
@@ -6,7 +6,7 @@ using Library;
 
 class Program {
 
-       static void Main ()
+       public static void Main ()
        {
                var foo = new Foo ();
                foo.Bar ();
index dd7ac8f0ba2d71768e365652253249db20413920..80e1141213d52d17d76f1c8cd8633dc4be137438 100644 (file)
@@ -6,7 +6,7 @@ using Cit = Blah.Class2.Citrus;
 
 public class M 
 {
-    static void Main() 
+    public static void Main() 
     {
         // access an internal type
         C1 a = new C1();
index deb6ea3f5759c3f3ab9bf60c72a62bc60fb5ce53..34bd65919440f96eb6344e069054e9cf6de94514 100644 (file)
@@ -11,7 +11,7 @@ namespace testcase
 
        public class Program
        {
-               private static int Main ()
+               public static int Main ()
                {
                        var t = typeof (Init);
                        var m = t.GetMethod ("testcase.IInitializationExpression.AddRegistry", BindingFlags.NonPublic | BindingFlags.Instance);
index 87fd579353703601fa049245640eb1da863a2b6f..c9c9e1c65b92fb964cfe7e774e89610109392e68 100644 (file)
@@ -4,7 +4,7 @@ namespace testcase
 {
        public class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        DateTime? a = default (DateTime?);
                        DateTime? b = default (DateTime?);
index a66f1917d9b45b3cc1f1e863c04857ce6013d98a..d894a726f485519f1122347e7bd89411f269fa77 100644 (file)
@@ -16,5 +16,5 @@ public abstract class GenericBase<T> : NonGenericBase
 
 public class EntryPoint
 {
-       static void Main () { }
+       public static void Main () { }
 }
index d68111c20ec4d15ae56cf7ea7b7e87868a7e013b..bd84a22b5b52872ec584665fc6c32ea26b152b37 100644 (file)
@@ -1,6 +1,6 @@
 class Test
 {
-       static void Main () { }
+       public static void Main () { }
 
        static void Foo<T> (ref T t) { }
        static void Foo<T> (T[] t) { }
index 6baeecf137a80cda805980e223bcfad570e6e613..73fbbcd56629f92ff3ec994fa8b49fb3a3b65afa 100644 (file)
@@ -5,7 +5,7 @@ using System.Reflection;
 
 class Program {
 
-       static int Main ()
+       public static int Main ()
        {
                PortableExecutableKinds pekind;
                ImageFileMachine machine;
index 5f78ba0533f990c58bb47836ccfb3fd57075746d..8c1d9c8fd200783fd10d2848acc2b5168ed9ab67 100644 (file)
@@ -5,7 +5,7 @@ using System.Reflection;
 
 class Program {
 
-       static int Main ()
+       public static int Main ()
        {
                PortableExecutableKinds pekind;
                ImageFileMachine machine;
index 2ba10df342890bc3467fb1d819d654c4aee8899a..18da8ef051d698924e57220dc54a09218904a627 100644 (file)
@@ -4,7 +4,7 @@ namespace ConsoleApplication1
 {
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
                        object o = new object ();
                        Inner<object>.Compare (o, o);
index 99509e8a359bcb571d7b67b0eba1c63663158ea3..365df4339a1b0f924d37eedca485598075df2e59 100644 (file)
@@ -10,7 +10,7 @@ class Program
        {
        }
 
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index 53ce0c91038171c44e17d6564753633a92163b30..297915e3007e6176f3da2f4cc37ec919a26cb4bd 100644 (file)
@@ -15,7 +15,7 @@ namespace GenericTest
 
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        string typeNames = OuterGeneric<int>.InnerGeneric<long>.GetTypeNames ();
                        Console.WriteLine (typeNames);
index 32b9c1596021e16790ee105667901f4d0b18300b..74bd6b743fd81c7e080844c03f4145003754babd 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Tester<int> t = new Tester<int> ();
                int r = t.Get (333);
index 8da755dff9e55f8e1a6701ef5a56e00c2ae9aec3..dd801aac62c24cdfab32d103c3b05f4e25997d7b 100644 (file)
@@ -7,7 +7,7 @@ class Program
                return t == this;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                var p = new Program ();
 
index 11f9c5ccd139dac43596c5236c21843ce360e7a2..d7b293e75d5aa79e04f5354cdc3d8905686b72f4 100644 (file)
@@ -11,7 +11,7 @@ class Foo<T1, T2> where T2 : I<I<T1>>
 
 class Bar : I<I<string>>
 {
-       static int Main ()
+       public static int Main ()
        {
                var foo = new Foo<string, Bar> (new Bar ());
                return 0;
index 2f1a8cb0b1a58b8824524dfff8b54589e6f8e4b8..ba8a361a7ef51199201c7243708fae7562b14c88 100644 (file)
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Int32Collection src = new Int32Collection ();
                Int32Collection dest = new Int32Collection ();
index af85e248bc7c892513f63631af9b96a22ff8c586..49aa06247ea8c9735ce9dd2358b5b9852ee99181 100644 (file)
@@ -18,7 +18,7 @@ class FooProcessor<T> where T : IFooDef {
 }
 
 class Program {
-    static void Main ()
+    public static void Main ()
     {
     }
 }
index 1afac22d30b2954ad6eeed01e90f73a73e36402a..c5f2ce12d13403d256fa3c8e1a4b536355299555 100644 (file)
@@ -7,7 +7,7 @@ class Repro
                        public static T[] Values;
                }
        }
-       static void Main ()
+       public static void Main ()
        {
                Outer.Inner<string>.Values = new string[0];
        }
index d8d283d209b1a310dbbfe1ba5eecb846278b08fd..b9660338c6b075dbb0bb8675736544b87cd8aa22 100644 (file)
@@ -18,7 +18,7 @@ class Derived : Base
 
 class a
 {
-       static int Main ()
+       public static int Main ()
        {
                Derived.EndExecute<Derived> (null, "something");
                return 0;
index 2cc549e402417ebfe504bb900d52bd28db06158c..5d879d43fbf9386f12ec4cb6149866ccfad02748 100644 (file)
@@ -11,7 +11,7 @@ class ItemCollection<T> where T : Item
 
 class a
 {
-       static void Main ()
+       public static void Main ()
        {
                var ic = new ItemCollection<Item> ();
                ic.Bind (ic);
index 58e16c959e5cbbfca99309060e7a32dd479b282f..f44834f18070a5aea981ecaec81305253a540b5e 100644 (file)
@@ -10,7 +10,7 @@ struct S : I
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                int? a = 5;
                int? b = 5;
index 62a281aaf95f5e9430611ea16c8d6dd20c2ba35c..a078ac053671f070a5e9c778f39e4eb15af4e372 100644 (file)
@@ -22,7 +22,7 @@ namespace test2
                {
                }
 
-               static void Main ()
+               public static void Main ()
                {
                        new Test<MainClass, MainClass, MainClass> ().Method ();
                }
index 66a151ba1ddebf3506f76c093109909a1fbd2895..b0c420f4c1a3e9be5e9e5e5ef25113c61676c9ed 100644 (file)
@@ -10,7 +10,7 @@ class A
        {
        }
 
-       class C
+       public class C
        {
                Func<int> MA;
                int F;
index b4493870ba44f0746bfc20ceccc278e576201b0f..4e3b2558556551b177476ab81c41a7982c60053a 100644 (file)
@@ -12,7 +12,7 @@ public static class CoalescingWithGenericsBug
                return null;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                Provide<Service> ().Foo ();
                return 0;
index 3cf23b52455911818b921653a494f682500eb273..e27fb1824f7f4c801cb7bad2458739dee2591a40 100644 (file)
@@ -35,7 +35,7 @@ interface IC
 
 class M
 {
-       static int Main ()
+       public static int Main ()
        {
                new ATop<short>().Test ();
                return 0;
index 64c54cd6740e17b014627260d9bc755b1f4d419f..6808be527913dd5559f3ea4448bca9eb7cc65e3e 100644 (file)
@@ -14,7 +14,7 @@ public class Test
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Expression.Test ();
        }
index 77370007bb20d986c4bb507428b941f8f7c3eb55..d4bce6ee9d9020638c15576f95f6fa60d89ec134 100644 (file)
@@ -13,7 +13,7 @@ abstract class A<T>
 
 class C
 {
-       static int Main ()
+       public static int Main ()
        {
                var r = new A<short>.B ();
                if (r.getT () != r)
index 7e31531c8c8fa01e51fc31dcd8af4661a4cb827d..af6ac673c0e861834dbed11cdd424e5928890235 100644 (file)
@@ -19,7 +19,7 @@ class A
                return f (t1, t2);
        }
        
-       static void Main ()
+       public static void Main ()
        {
                var r = Test ("a", "b", Factory.Create);
        }
index b56cfe8609be52ddda3cf5be6b133518120768b1..6de449eb1e798ef14ba4896f613f2c456f73ef73 100644 (file)
@@ -5,7 +5,7 @@ namespace Mono.Test
 {
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        Type t = typeof (B);
                        InterfaceMapping map = t.GetInterfaceMap (typeof (ITest));
index 2c9eb057d6275e47a5fd8005c6bf19b1594e8955..1c85a6d4c069f2b7b49f68502416f7e602a756ec 100644 (file)
@@ -15,7 +15,7 @@ class A2
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                A2.N<short> b1 = A2.N<short>.Method ();
                A.N<byte> b2 = A.N<byte>.Method ();
index 9bd9796a7fd19d9969c64971203482f32d4d9852..494526b537b4b3520773140c126441a1cd31038f 100644 (file)
@@ -18,7 +18,7 @@ class Test
                t = default (T);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                foreach (var e in Foo<string, object> (new string[] { "as" })) {
                }
index 9fb73a47ff3e4acb78a07dfe6949b4ed08799b2d..7a6bc0fdb0a050d635dc64681253f2455d9a6c38 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                object o = 10;
                int? x = 3;
diff --git a/mcs/tests/gtest-571.cs b/mcs/tests/gtest-571.cs
new file mode 100644 (file)
index 0000000..75cd9a2
--- /dev/null
@@ -0,0 +1,37 @@
+using System;
+
+public abstract class A<T>
+{
+       public abstract A<MM> For<MM> () where MM : T;
+}
+
+public class B<U, X, V> : A<V>
+       where V : X
+       where X : U
+{
+       readonly A<U> _inner;
+
+       public B (A<U> inner)
+       {
+               _inner = inner;
+       }
+
+       public override A<PP> For<PP> () // base constraint is copied as PP : V
+       {
+               return _inner.For<PP> ();
+       }
+}
+
+public class Test : A<Test>
+{
+       public static void Main ()
+       {
+               var t = new Test ();
+               new B<Test, Test, Test> (t).For<Test> ();
+       }
+
+       public override A<QQ> For<QQ> ()
+       {
+               return null;
+       }
+}
index baae8c9817bdd25577a463ad2a8ade22d0b51634..93fd29bf8aaec785cadd10d949354f4dc2fc3185 100644 (file)
@@ -5,7 +5,7 @@ using System.Collections;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var v = new { Foo = "Bar", Baz = 42 };
                
index 99779fa8cb78a89e4a4d47cdd288bc68ffa5cc55..d2404d9f7514d3cdba4d26008351871c3f98e4c8 100644 (file)
@@ -10,7 +10,7 @@ public class Test
                return new { s };
        }
        
-       static int Main ()
+       public static int Main ()
        {
                string Foo = "Bar";
                int Baz = 42;
index 088ddc07043996aaaf0aa962a2f69c7de998b7a0..030c110f11a229efc20a72d0cd138b964e19deec 100644 (file)
@@ -13,7 +13,7 @@ public class MyClass
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                MyClass mc = new MyClass();
                var v = new { mc.Foo, mc.Baz };
index fa80a02777edf04713a9a991dcf7a24d05708453..8d37e4782da3309cf0f059be293d8a371212da9a 100644 (file)
@@ -13,7 +13,7 @@ public class MyClass
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string Hello = "World";
                MyClass mc = new MyClass();
index bda008c2fafc0e48b18b3f6370fcc66c306edb96..478c1de03ef9793658498b2d89704b27105b174e 100644 (file)
@@ -11,7 +11,7 @@ public class Test
                return null;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                var v1 = new { Name = "Scott", Age = 21 };
                var v2 = new { Age = 20, Name = "Sam" };
index cacb85a73140f9a3304128cbeac3b8de4bf146a0..c7183acc0d6607f23c93b6137801e2b3334b4b59 100644 (file)
@@ -4,7 +4,7 @@
 
 class CastByExample
 {
-       static void Main()
+       public static void Main()
        {
                object o = new { Foo = "Data" };
                // Cast object to anonymous type
index 1470ecb18962c1546286967ff3b6ba3a6d6af38c..2015ee4ec28ed945990a7ad10797195a5fbba32e 100644 (file)
@@ -5,7 +5,7 @@ using System.Collections;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var v1 = new {  };
                var v2 = new {  };
index a3c7e505d45a194a71e10e4772198cfb5bd4cf32..a0045f2dd51551d717bd9f96aa261d8c54490bd9 100644 (file)
@@ -34,7 +34,7 @@ internal sealed class Beta
 
 internal static class Program
 {
-       private static int Main ()
+       public static int Main ()
        {
                var a = new { First = new Alpha ("joe bob"), Second = new Beta ("main street") };
                Console.WriteLine ("hash = {0}", a.GetHashCode ());
index bbebfdde73baca0c4eb7798c7673b835006e3877..0aa1ecbdfca9d7d541a953476e77605d2a12188c 100644 (file)
@@ -11,7 +11,7 @@ static class Test
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Type type = typeof (int);
                IEnumerable<string> properties = new[] { "x" };
index 84361aba69ab3b4f1e9f84a4b95c18568b5a3d5a..f994cd9c09b75879fdafecc890b077254c277536 100644 (file)
@@ -17,7 +17,7 @@ public class Test
                Answer = 42;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                Test t = new Test ();
                t.Foo = "Bar";
index a7b89ede74cd346e7e7b4031478ee6e4c630796c..64dddbddb4d0e7be8fac068bc3881f6932bff4f7 100644 (file)
@@ -17,7 +17,7 @@ public class Test
        public static string Foo { get; set; }
        public static int Answer { get; private set; }
        
-       static int Main ()
+       public static int Main ()
        {
                Foo = "Bar";
                if (Foo != "Bar")
index e0787572cce018b9e702b378332d8c9017efb4f7..a18c4ea86f279c91a715045305759a8a6b307837 100644 (file)
@@ -8,7 +8,7 @@ public class Test
 {
        public string Foo { get; set; }
        
-       static int Main ()
+       public static int Main ()
        {
                FieldInfo [] fields = typeof (Test).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
                if (!(fields.Length > 0))
index 9bf1e946220757ae2053b34cb4d8b03bcf93410a..fc3cb244a725b6d39c36b900ba9d0bd5ebc00b42 100644 (file)
@@ -14,7 +14,7 @@ class C : I<A>, I<B>
 
 class Program
 {
-       static void Main (string[] args)
+       public static void Main (string[] args)
        {
                C c = new C ();
        }
index 6db1c3778c8e7bf0154c261e2659a2a6cda0e770..a39aa33b1fb2e81455d6937482814db87d037bd0 100644 (file)
@@ -39,7 +39,7 @@ public class Test
                        Console.WriteLine (i);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                ArrayList collection = new ArrayList { "Foo", null, 1 };
                if (collection.Count != 3)
index 52c654cdb430545c94b289fd8f5223f7440e33ac..2fb0cfe5256a5f149f23799848b24248fd81d035 100644 (file)
@@ -2,7 +2,7 @@ using System.Collections;
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                object x = null;
                R (ref x);
index e6562cc1f35a76cd7fe9c00f627501287bf135e5..de9266c23faa679792dff4f4beedf650f818b5db 100644 (file)
@@ -19,7 +19,7 @@ struct S<T> where T : struct
 
 class C
 {
-       static int Main()
+       public static int Main()
        {
                return S<int>.Test ();
        }
index 76bbfcc1a9d173652433f88b22e5182dd0c2b0cd..94a2f29f94c3facb31ef346cf4d9338dfffa16bb 100644 (file)
@@ -26,7 +26,7 @@ struct Foo
 
 class C
 {
-       static int Main()
+       public static int Main()
        {
                Foo f;
                Expression<Func<bool>> e = () => f > null;
index 2045e07d99fd5d86f6619e3e59f9ff69deaac463..9dac2a9be308d6f60f7ff9a2ea3e518fefa046cd 100644 (file)
@@ -18,7 +18,7 @@ class C
                }
        }
        
-       static int Main()
+       public static int Main()
        {
                // It also tests constant boxing
                Expression<Func<ArrayList>> e1 = () => new ArrayList { null, "Hello", "World", 5 };
index 6102c200b8d02b3ef33f405930953cd4b1428496..c0a9a07c8bdf53fcddf469ea7f22ae445547ad4c 100644 (file)
@@ -23,7 +23,7 @@ class Foo<T>
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                var x = new Foo<int> ();
                return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
index 328f3c1d58e5891d90eb65adda73af4a9c238ed0..1cad1a67e9fd1139532da92f2476f47440b42d3f 100644 (file)
@@ -3,7 +3,7 @@ using System.Linq.Expressions;
 
 class C
 {
-       static void Main ()
+       public static void Main ()
        {
                new Test ().Invalid (4);
        }
index c639766a89fbc1813bcb759aaea0460b7fc31789..5e2cdc3d579ec17a11cc8492b2eb3cda26208344 100644 (file)
@@ -5,7 +5,7 @@ using System.Linq.Expressions;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                foreach (int o in Test<bool> (1)) {
                }
index 79d474ded04d69206b3d31250fab34f2ba4ce90e..056df5b91e2d0bf14e665a112dce00aa704b0ac8 100644 (file)
@@ -10,7 +10,7 @@ class Person
 
 class Repro
 {
-       static int Main ()
+       public static int Main ()
        {
                var persons = GetPersons (new [] { new Person { Age = 25 }, new Person { Age = 21 } }, 25);
                return persons.Count () - 1;
index b02f344487f0038a7914c9cbe2002d891753623c..8bf2bcd7d57a8b33a6948ea61deab9fad1396856 100644 (file)
@@ -3,7 +3,7 @@ using System.Linq.Expressions;
 
 public class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Expression<Action<IHelper>> e = (helper => helper.DoIt (null));
                var mce = e.Body as MethodCallExpression;
index 502618f4e3059da549eb2f0717724330ffe2a2ef..091cc88b3637e5b8f46e523f398824157d82dc12 100644 (file)
@@ -11,7 +11,7 @@ public interface IHelper
 
 public class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Expression<Action<IHelper>> e = (helper => helper.DoIt (new Foo ()));
                var mce = e.Body as MethodCallExpression;
index 40ffe66ca2799f066cff95369a268537c4219997..dd4089569ce4ab317dcd7faf78619a8c17c92d69 100644 (file)
@@ -24,7 +24,7 @@ class C : IBar
                action (null);
        }
        
-    static int Main ()
+    public static int Main ()
     {
                var foo = new Foo ();
 
index ecf50638f4817cac286e45794b851c18c5bfc5b4..2c45e4c8701e53854db8f0e9e5b234aa99facd30 100644 (file)
@@ -22,7 +22,7 @@ class A<TA>
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                A<int>.B<ulong>.foo ();
                return 0;
index 3962299261ce4029aad6fe899dc0fdd4f154aabe..b8f1cdd354548a7ae635c9be1c06d3197c7770e7 100644 (file)
@@ -5,7 +5,7 @@ using System.Collections.Specialized;
 
 class Program
 {
-       static void Main(string[] args)
+       public static void Main(string[] args)
        {
                var chat = new ChatClient();
                var lines = new StringCollection() { "a", "b", "c" };
index 1f07db46b72eb59be20e9b000620b2180feb7266..8558bc6feb7f6c8121478dac939b074b4e775783 100644 (file)
@@ -27,7 +27,7 @@ class Program
                get { return "a"; }
        }
        
-       static void Main (string [] args)
+       public static void Main (string [] args)
        {
                Program p = new Program ();
                p [0].Extension ();
index 0a47011a81defc699db0f4dac9430b620bcd1f74..d4cc4a5bed1f5f71eba43f1a504003680bed9e3e 100644 (file)
@@ -16,7 +16,7 @@ static class FooExt {
 
 class Repro {
 
-       static void Main ()
+       public static void Main ()
        {
                var f = new Foo ();
                Console.WriteLine (f.IsBar ());
index 0a0a1802e9f00436cd5acc63326273e44ef4201c..278cf2461744f78956b34ba8c05b0a5962a069da 100644 (file)
@@ -18,7 +18,7 @@ public class Test
 {
        delegate string D ();
 
-       static int Main ()
+       public static int Main ()
        {
                string s = "jaj";
 
index 6a26af3c70175a4694e1306074a16b949ff5fe66..9c825184c554f3456949c690713baa57e2be91ff 100644 (file)
@@ -13,7 +13,7 @@ namespace Outer.Inner
                        list.AddRange(new Test[0]);
                }
                
-               static void Main()
+               public static void Main()
                {
                }
        }
index 6a9cba9f24de3b7d1daf1123df7315ab68581be8..38b23e5aa6101de00edc356a3b3f0987524d7500 100644 (file)
@@ -13,7 +13,7 @@ namespace Outer.Inner
                        list.AddRange();
                }
                
-               static void Main()
+               public static void Main()
                {
                }
        }
index 1220220cf4bcf5f40e5f14da4f9ded86ffe9c453..6351c628653a31ed95e950336064f956ac395c0a 100644 (file)
@@ -26,7 +26,7 @@ namespace Bar
        class Program
        {
 
-               static void Main ()
+               public static void Main ()
                {
                        Console.WriteLine (Pan (new byte[0]));
                }
index 00dd1e565ed0bc662a1ad96541fec10989f8678f..012068204ae939b3d38dcc042bc6c9add6c64912 100644 (file)
@@ -22,7 +22,7 @@ partial class Extensions
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 970902f5223a2913403fd81b2da19eb9a34547b5..3586a730934441012fff166b70395949b3db5331 100644 (file)
@@ -14,7 +14,7 @@ namespace UnusedFieldWarningTest2
                        Console.Write (a.FirstOrDefault ());
                }
 
-               static void Main ()
+               public static void Main ()
                {
                }
        }
diff --git a/mcs/tests/gtest-exmethod-45-lib.il b/mcs/tests/gtest-exmethod-45-lib.il
new file mode 100644 (file)
index 0000000..c98948f
--- /dev/null
@@ -0,0 +1,30 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly 'gtest-exmethod-45-lib'
+{
+  .hash algorithm 0x00008004
+}
+
+.module 'gtest-exmethod-45-lib.dll'
+
+.class public abstract auto F
+{
+  .custom instance void class [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::'.ctor'() =  (01 00 00 00 )  
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    ldarg.0
+    call       instance void [mscorlib]System.Object::.ctor()
+    ret
+  }
+
+  .method public hidebysig static void TestExt(string s) cil managed
+  {
+    .custom instance void class [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::'.ctor'() =  (01 00 00 00 )  
+    
+    ret
+  }
+}
diff --git a/mcs/tests/gtest-exmethod-45.cs b/mcs/tests/gtest-exmethod-45.cs
new file mode 100644 (file)
index 0000000..d11ab64
--- /dev/null
@@ -0,0 +1,10 @@
+// Compiler options: -r:gtest-exmethod-45-lib.dll
+
+public class C
+{
+       public static void Main ()
+       {
+               string s = null;
+               s.TestExt ();
+       }
+}
\ No newline at end of file
index 29df8ffa7c6e19d305d35c91d882548b19fa1ce2..3c5c1763c2d3149e83ef6f5c779dade3f3133784 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 9d791f3b926dca30b02e6de91921cb55d6e0dd3e..114666981ebb3eac2040d09a609dac3671bef095 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 19879d921a70830f2024c7d6a91bfe7809b86526..e40be8bbb95d86e1db2e621554aed90bceb8deff 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index c53619622c5f3ef314e4d7483273f803588b7426..4cd3673faf5e28f1c74ba58eda22059848ab8609 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                // We should be able to access them
                new InternalFriendClass ();
index 80f070a038008ee7766c54e335b4ef90890c8b49..ce6a1a648dff7e308b832b45f9e2527a940bdb74 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 05190455052a326e31b06bc76e8a984274ecfd9e..2e673e7943eef58b7622a7436287cebd1cd7e140 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index a32955c7781a0c03918c5e36bee10059bb37a0a2..a3af89d68eb83570454467110ae2adf733c23941 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 7bebf34575b734e6dad2ed9c43c06eb3aae1b779..4c65b071139813b1118e8de9dd6699b1513ea9f6 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                // We should be able to access them
                new InternalFriendClass ();
index 1d592c816ba211be083e9a227ca164fa307bde28..a7f9532aa5f3139f03e9dc342c37367436f12733 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index df9f529a6baf41805dde97b874bef70128e40121..9adb771fb272319a58330a595441897f926fced3 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 1d592c816ba211be083e9a227ca164fa307bde28..a7f9532aa5f3139f03e9dc342c37367436f12733 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                FriendClass fc = new FriendClass ();
                
index 8232dbb74a26a4d134f523236235756a89c63ab9..ceb9dc1bc95f9c47841e9a74bc905d195f5de15d 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                // We should be able to access them
                new InternalFriendClass ();
index afebc5226e441aa8ec7c5efd051ec04fb0351c2d..1cd8b593dd6d4bff07d73995bcd25326ab517e11 100644 (file)
@@ -16,7 +16,7 @@ public class B : FriendClass
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                var b = new B ();
                b.Test_2 ();
index d2e115b05e798b30d6672bc871a691436d98efb1..8716fe1fa418053e9f8ffe6a15e531c4c8e89c25 100644 (file)
@@ -3,7 +3,7 @@
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string[] array = new [] { "Foo", "Bar", "Baz" };
                foreach (string s in array)
index 15eb48e8f64b63a8500bdf6082fd04111aec4c07..ef70f82490dd5aedfcadfb169ca5feefc77534df 100644 (file)
@@ -8,7 +8,7 @@ class MyString
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var v = new [] { new MyString (), "a" };
                if (v [0] != "ggtt")
index da4fc1747ab8407beab281c85e2ac10b73b2e0f3..a203d528306db77fa627b69a66bca736bd768c7c 100644 (file)
@@ -15,7 +15,7 @@ public class MyClass
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                MyClass mc = new MyClass() { Foo = "Baz", Answer = 42 };
                if (mc.Foo != "Baz")
index a647a4bb344bfb10d186f739fda18bd4c7bd2da7..c175cd5cb21c9d7ed19ac2ee5c96eeb739795b28 100644 (file)
@@ -42,7 +42,7 @@ public class Test
                public Thing Thing1;
                public Thing Thing2;
        }
-       static int Main ()
+       public static int Main ()
        {
                Thing thing1 = new Thing() { Number = 1, Name = "Bob" };
                
index bc85cdfbc3ea0bdc5affc6a26f1f901bf24e7150..34b022094fbd1b7f80ba9b8ef87cc7751512b241 100644 (file)
@@ -20,7 +20,7 @@ public class Test
                return new Data () { Value = 3 };
        }
        
-       static void Main ()
+       public static void Main ()
        {
                Prop = new Data () { Value = 3 };
                Data data = new Data () { Value = 6 };
index 3cf41c54996bf16e6e4cd48d3f9087b5f5fcca6b..e4810d3277637144d0322f1edc841830890ce6a7 100644 (file)
@@ -7,7 +7,7 @@ class Foo
 
 class Y
 {
-       static int Main ()
+       public static int Main ()
        {
                Foo foo = new Foo ();
                foo.P = 1;
index 24b2b307cfeb90cce00f5aa0dcc7c0ad892fc188..6d0bd57375f91cbdab1a0408360f777afc5f6bbc 100644 (file)
@@ -20,7 +20,7 @@ public class Test {
                                yield return o;
        }
        
-       static void Main ()
+       public static void Main ()
        {
                var test = new Test ();
                test.Annotations<Test> ();
index 68c4f7dcdd7fdba4c3781d2bc7d3f5343f85d17e..6c25baa84a07068cb80154442d5060d0dd550e1c 100644 (file)
@@ -8,7 +8,7 @@ class Test
                while (from <= to) yield return from++;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                IEnumerable<int> e = FromTo (1, 10);
 
index 7ec5010916e92774e99fe74f24557db996223acf..b3cbabe5160d155c835d41544dee50b284f35a46 100644 (file)
@@ -32,7 +32,7 @@ class BarCollection : Collection<Bar> {}
 
 class Program {
 
-       static int Main ()
+       public static int Main ()
        {
                var collection = new BarCollection () {
                        new Bar { Name = "a" },
index e5ef2e22499f470d8062d6706b6b080ca6d6ebf4..326f0f5446e02463f2f79d6e302b63414d6e9d3f 100644 (file)
@@ -45,7 +45,7 @@ class X : B
                yield return base.BaseM++;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                foreach (var v in new X ().GetIt ())
                        Console.WriteLine (v);
index d626cfec323d283d04dfae0d49b2b585dfe9fac5..07acbbdb10ec349c4dbb765b99e237fa7dbdd61a 100644 (file)
@@ -13,7 +13,7 @@ public class Test
                yield break;
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 152af06cf967b2b01488916ec36168a9fc35f1ea..4b6b63db5b997d8aee37e8fd72447e391359e6b6 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections;
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                foreach (var i in GetAll ()) {
                }
index 202964dd3e310616d1edc6816d6d1d753eb745dc..ea4b4c41dd80f47d554de70c19ff6e282d936742 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 public class CompilerBug
 {
-       static void Main ()
+       public static void Main ()
        {
                foreach (string message in Foo ())
                        Console.WriteLine (message);
index eb4a5e3e51344fa9adb7d2ff361e9b82bd09cc1c..bda0a3584c43b608450955b7eb25df0ddb41bc9c 100644 (file)
@@ -12,7 +12,7 @@ class X {
        static IntFunc func, increment;
        static VoidFunc nothing;
        
-       static int Main ()
+       public static int Main ()
        {
                int y = 0;
                int r;
index bb32cc18ab86b4dde42889cf04c64056ed3695a7..819573ced0da22ff0377717769a8224d70507f9f 100644 (file)
@@ -20,7 +20,7 @@ class X {
                Console.WriteLine (res);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Foo (x => x + "dingus");
        }
index 831a4a216be4db462be8fd2cf0f4e83ca3976fe1..ba9a2b4576c0527639cf7dbd89c474f4a8d05d07 100644 (file)
@@ -10,7 +10,7 @@ class Demo
        {
                return f1 (value);
        }
-       static int Main ()
+       public static int Main ()
        {
                object o = F (1, "1:15:30", s => TimeSpan.Parse (s));
                Console.WriteLine (o);
index fb310efb61d5f587dfb71f44b7afb2c5200592bb..faa9df5f5c8b096a2224b46d911fee657358b0eb 100644 (file)
@@ -20,7 +20,7 @@ class Demo {
        {
                return f2 (f1(value));
        }
-       static int Main ()
+       public static int Main ()
        {
                double d = F("1:15:30", s => TimeSpan.Parse(s), t => t.TotalSeconds);
                if (d < 4529 || d > 4531)
index 4cf18079c1373f063df807a9d75db3088fb94b61..494ca7e9498c313d0b1d50cd06b1834e8619a55d 100644 (file)
@@ -38,7 +38,7 @@ class TestClass
        
        static void StopTrue (T t) { }
 
-       static int Main ()
+       public static int Main ()
        {
                // Test that we encode (!v3) & ((!v1) & ((v1 | v2) & (v2 | v3)))
                P (v1 => P (v2 => P (v3 => StopTrue (
index 6a7ea775323628968db9d692321029c5dfc34b82..fd47109dddb897430e08748fc2fe90fd94a4d610 100644 (file)
@@ -13,7 +13,7 @@ class Demo
                Console.WriteLine (values [0]);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int[] a = new int [] { 10 };
                F (a, 5, i => a [0] = i);
index 817a698daef9e0ac8f30794f9f59a3241bc037e4..1ce58399689d7bcaa219867afc821bce6b87e836 100644 (file)
@@ -30,7 +30,7 @@ class Program
                return Foo (str => str.ToLower ());
        }
 
-       static void Main ()
+       public static void Main ()
        {
                var str = Foo (s => s);
                Console.WriteLine (str);
index f4177514107618a8398763e69376e2b0df129007..d4844153b315e1f283eab75b876a601f2fa5fcf9 100644 (file)
@@ -34,7 +34,7 @@ static class Enumerable
 class Repro
 {
 
-       static int Main ()
+       public static int Main ()
        {
                var sum = new [] { "1", "2", "3", "4", "5", "6", "7" }.Sum ((s) => int.Parse (s));
                if (sum != 28)
index a03f76c4f9652d1983595e593aa0d8fe62406c31..c3b86300b487d0da5d2318017c58c14eceacc090 100644 (file)
@@ -15,7 +15,7 @@ class Repro
                }, 42);
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 9a3f4912d46dc51389b67503ed19b06578349932..b189087756794fe5ecf0996b0907b621c941540e 100644 (file)
@@ -17,7 +17,7 @@ class Program
                return Foo (str => str.ToLower ());
        }
 
-       static int Main ()
+       public static int Main ()
        {
                var str = Foo (s => s);
                Console.WriteLine (str);
index 450430d99f5e0d7df5ba755a83674e981adade84..30d56ba8f580d4058e44bed10fbf08689a72ad80 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class C
 {
-       static void Main ()
+       public static void Main ()
        {
                Execute (() => {
                          int a, b;
index 273145002235e95ffe54a81ffb7768f66178bed9..ca1897e84f35cae310ef92542f91845313bfc5fb 100644 (file)
@@ -30,7 +30,7 @@ static class TestB
 
 public class CustomQueryExpressionPattern
 {
-       static int Main ()
+       public static int Main ()
        {
                var v = new TestA ("Oh yes");
                string foo = from a in v select a;
index c1af92703d2f1572178cce0a63df110da89415fd..3e2cf76d5bba94b042883795fe08240ac53f37a7 100644 (file)
@@ -5,7 +5,7 @@ using System.Linq;
 
 class Program {
 
-       static void Main ()
+       public static void Main ()
        {
        }
 
index e0213b73bf4eb592c87302b0dbc78dbd06f5930a..f477874ddf896554724cbdae38a6e7a19a3345a9 100644 (file)
@@ -30,7 +30,7 @@ public interface IMarker<T> : IEnumerable<T> {}
 
 public class Program {
 
-       static void Main ()
+       public static void Main ()
        {
        }
        
index dee1013737e5f1720e9586e053fe880dcfd1c312..e10b5e6fa8e723d7c630ad536370536e975574ab 100644 (file)
@@ -15,7 +15,7 @@ public class C
                return false;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                var x = new int [] { 'a', 'b', 'c' };
                
index ff6ae67b30c928219229576497a03a05e10a9776..28ae921fe4de96ca5d4ac12fff641d865dce4183 100644 (file)
@@ -3,7 +3,7 @@ using System.Linq;
 
 static class Program
 {
-       static int Main()
+       public static int Main()
        {
                int i = 0;
                var input = new int[] { 1 };
index 5a6b7796b413f736d96a9078776d60b8d5fcb01d..f4e18fea2781f9202f901910e3f5d38de01b4d7a 100644 (file)
@@ -29,7 +29,7 @@ namespace Test
        
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
                        var value = new S<int> ();
                        var e = from item in value
index 17cb06b71ec46ed26d22fbeea462d626192b856c..213d809f472121b29b747b7ca71ec780dd413193 100644 (file)
@@ -16,7 +16,7 @@ class Test
        {
        }
 
-       static int Main ()
+       public static int Main ()
        {
                V = "";
                m (f (1), b: f (2), c: f (3));
index 6b7df25980ad36b7ff70f6161fdf3b702ef490a6..cfbe860a7dc9e52dc174bc43b2879ecf1843a62c 100644 (file)
@@ -77,7 +77,7 @@ public class Program
                return 1;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Test_1 (5) != 0)
                        return 1;
index bd0e645258be5b768c2d798859632052a1c076fd..2311184da68e5cc7e32e1c071b694829efc5590e 100644 (file)
@@ -1,6 +1,6 @@
 public class Program
 {      
-       static void Main()
+       public static void Main()
        {
                new Program<object>();
        }
index e5636ba337cb8ee768fb94bde00b041dabcdb5af..54d726f5858ecb4778d418070d1ed14f6df3bf07 100644 (file)
@@ -11,7 +11,7 @@ class Program
        {
        }
 
-       static int Main ()
+       public static int Main ()
        {
                var t = typeof (Program).GetMethod ("Test");
                var p = t.GetParameters ()[0];
index 6f00046efe77ad31e176cc8163e5cd8d5bb60d99..04be4cff2cd4710dbfa1baea3e62125c0648f004 100644 (file)
@@ -5,7 +5,7 @@ using System.Collections.Generic;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string[] strings = new string[] { "Foo", "Bar", "Baz" };
                
index 37bd0daaaedb4d5df32c32dd119d601551cccf6a..036d38fbdef6c6065b70a320689d377eed515982 100644 (file)
@@ -15,7 +15,7 @@ class Foo : IFoo<string>
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string bar = "Who is John Galt?";
                IFoo<string> foo = new Foo(bar);
index ce45408caafead924031d6a03b1ce058a709ae25..8c66d99528482b423d6eaaad79201ebc7c7baf84 100644 (file)
@@ -22,7 +22,7 @@ public class Test : I<string>, I<Foo>
 
 public static class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                var col = new Test();
 
index d36e305f1269b06341c449084996e4eaea13ea1d..3691c59b6a76fb68d215ab86bc206b5bd805bfd3 100644 (file)
@@ -8,7 +8,7 @@ struct S : IFoo<string>
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                S s = new S ();
                IFoo<object> o = s;
index a261ea6fa23f98f7bd3f301b136e2effdffa38b3..c4ba1eef30009e2f7cd7e4d17c07e876f9c844b2 100644 (file)
@@ -10,7 +10,7 @@ public class Test
                IEnumerable<U> itu = ita;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Bla<string, object> ();
        }
index bae3d196b9f624fe5c49f99b541e9d2d8fd0024e..64d701fef6351f067a6300cfbc774967d15155f0 100644 (file)
@@ -13,7 +13,7 @@ class Foo : IFoo<object>
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                IFoo<object> foo = new Foo ();
                IFoo<string> foo2 = foo;
index 142055eab15e2a71d3dfb135419e52610ae333f6..4af8a27d82a224b3bb763173c884f18dcbabd80d 100644 (file)
@@ -2,7 +2,7 @@ delegate T Foo<out T> ();
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string message = "Hello World!";
                Foo<string> foo = () => message;
index a2618d0bec5d51369b01ec00af5a56f80d5b97fc..b0c4cebdfd97a42514bbb9c84b78abf87872d749 100644 (file)
@@ -2,7 +2,7 @@ delegate int Foo<in T> (T t);
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string message = "Hello World!";
                Foo<object> foo = (o) => o.GetHashCode ();
index c8e6744f39e3b14f75bf7dbaeea7f61093d71c51..ca587ae189c84cf849097958e293cb9a0b60061c 100644 (file)
@@ -58,7 +58,7 @@ class C : B
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var b = new B ();
                var c = new C ();
index 841849b8d7904757152c5846c1f57764825ac36c..ebf61cac3457e34997cb9d9980097588a89cbc40 100644 (file)
@@ -24,7 +24,7 @@ interface ITest_2<in T>
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
diff --git a/mcs/tests/known-issues-mt b/mcs/tests/known-issues-mt
new file mode 100644 (file)
index 0000000..7a38e7a
--- /dev/null
@@ -0,0 +1,44 @@
+# This file contains test files which cause any type of error.
+
+# This file supports extended syntax
+# csXXXX.cs            : test case causes error
+# csXXXX.cs IGNORE     : adds test to ignore list
+
+gtest-230.cs
+
+# exluded (tricky to build, extra dependency or hitting MT restrictions)
+gtest-444.cs SKIP
+gtest-exmethod-23.cs SKIP
+test-74.cs SKIP
+test-468.cs SKIP
+test-513.cs SKIP
+test-616.cs SKIP
+test-695.cs SKIP
+test-707.cs SKIP
+test-814.cs SKIP
+test-com-01.cs SKIP
+
+#reflection
+test-295.cs SKIP
+test-555.cs SKIP
+
+
+# MT bugs
+
+# Modules loading
+test-416.cs SKIP
+test-418.cs SKIP
+test-715.cs SKIP
+
+# Aggressive references loading
+test-760.cs SKIP
+test-792.cs SKIP
+
+# __arglist support
+test-269.cs SKIP
+test-270.cs SKIP
+test-399.cs SKIP
+test-482.cs SKIP
+test-562.cs SKIP
+test-704.cs SKIP
+test-811.cs SKIP
\ No newline at end of file
diff --git a/mcs/tests/projects/MonoTouch/AppDelegate.cs b/mcs/tests/projects/MonoTouch/AppDelegate.cs
new file mode 100644 (file)
index 0000000..bcc65f2
--- /dev/null
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+using MonoTouch.NUnit.UI;
+
+namespace TestMcs
+{
+       // The UIApplicationDelegate for the application. This class is responsible for launching the 
+       // User Interface of the application, as well as listening (and optionally responding) to 
+       // application events from iOS.
+       [Register ("AppDelegate")]
+       public partial class AppDelegate : UIApplicationDelegate
+       {
+               // class-level declarations
+               UIWindow window;
+               TouchRunner runner;
+
+               //
+               // This method is invoked when the application has loaded and is ready to run. In this 
+               // method you should instantiate the window, load the UI into it and then make the window
+               // visible.
+               //
+               // You have 17 seconds to return from this method, or iOS will terminate your application.
+               //
+               public override bool FinishedLaunching (UIApplication app, NSDictionary options)
+               {
+                       // create a new window instance based on the screen size
+                       window = new UIWindow (UIScreen.MainScreen.Bounds);
+                       runner = new TouchRunner (window);
+
+                       // register every tests included in the main application/assembly
+                       runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
+
+                       window.RootViewController = new UINavigationController (runner.GetViewController ());
+                       
+                       // make the window visible
+                       window.MakeKeyAndVisible ();
+                       
+                       return true;
+               }
+       }
+}
+
diff --git a/mcs/tests/projects/MonoTouch/Info.plist b/mcs/tests/projects/MonoTouch/Info.plist
new file mode 100644 (file)
index 0000000..8653860
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>UIDeviceFamily</key>
+       <array>
+               <integer>1</integer>
+               <integer>2</integer>
+       </array>
+       <key>UISupportedInterfaceOrientations</key>
+       <array>
+               <string>UIInterfaceOrientationPortrait</string>
+               <string>UIInterfaceOrientationLandscapeLeft</string>
+               <string>UIInterfaceOrientationLandscapeRight</string>
+       </array>
+       <key>UISupportedInterfaceOrientations~ipad</key>
+       <array>
+               <string>UIInterfaceOrientationPortrait</string>
+               <string>UIInterfaceOrientationPortraitUpsideDown</string>
+               <string>UIInterfaceOrientationLandscapeLeft</string>
+               <string>UIInterfaceOrientationLandscapeRight</string>
+       </array>
+       <key>MinimumOSVersion</key>
+       <string>3.2</string>
+</dict>
+</plist>
diff --git a/mcs/tests/projects/MonoTouch/Main.cs b/mcs/tests/projects/MonoTouch/Main.cs
new file mode 100644 (file)
index 0000000..4048e27
--- /dev/null
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using MonoTouch.Foundation;
+using MonoTouch.UIKit;
+
+namespace TestMcs
+{
+       public class Application
+       {
+               // This is the main entry point of the application.
+               static void Main (string[] args)
+               {
+                       // if you want to use a different Application Delegate class from "AppDelegate"
+                       // you can specify it here.
+                       UIApplication.Main (args, null, "AppDelegate");
+               }
+       }
+}
diff --git a/mcs/tests/projects/MonoTouch/MonoTouch.csproj.template b/mcs/tests/projects/MonoTouch/MonoTouch.csproj.template
new file mode 100644 (file)
index 0000000..779080f
--- /dev/null
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}</ProjectGuid>
+    <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>TestMcs</RootNamespace>
+    <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
+    <AssemblyName>TestMcs</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>False</Optimize>
+    <OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+    <MtouchLink>None</MtouchLink>
+    <MtouchDebug>True</MtouchDebug>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\iPhoneSimulator\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+    <MtouchLink>None</MtouchLink>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>False</Optimize>
+    <OutputPath>bin\iPhone\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+    <MtouchDebug>True</MtouchDebug>
+    <CodesignKey>iPhone Developer</CodesignKey>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\iPhone\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+    <CodesignKey>iPhone Developer</CodesignKey>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <BuildIpa>True</BuildIpa>
+    <ConsolePause>False</ConsolePause>
+    <CodesignProvision>Automatic:AdHoc</CodesignProvision>
+    <CodesignKey>iPhone Distribution</CodesignKey>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
+    <DebugType>none</DebugType>
+    <Optimize>True</Optimize>
+    <OutputPath>bin\iPhone\AppStore</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>False</ConsolePause>
+    <CodesignKey>iPhone Distribution</CodesignKey>
+    <CodesignProvision>Automatic:AppStore</CodesignProvision>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Core" />
+    <Reference Include="monotouch" />
+    <Reference Include="MonoTouch.NUnitLite" />
+@GENERATED_REFERENCES
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Resources\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Info.plist" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Main.cs" />
+    <Compile Include="AppDelegate.cs" />
+    <Compile Include="@TEST_SOURCEFILE" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
diff --git a/mcs/tests/projects/MonoTouch/MonoTouch.sln b/mcs/tests/projects/MonoTouch/MonoTouch.sln
new file mode 100644 (file)
index 0000000..cbffbd9
--- /dev/null
@@ -0,0 +1,32 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 11.00\r
+# Visual Studio 2010\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch", "MonoTouch.csproj", "{00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|iPhoneSimulator = Debug|iPhoneSimulator\r
+               Release|iPhoneSimulator = Release|iPhoneSimulator\r
+               Debug|iPhone = Debug|iPhone\r
+               Release|iPhone = Release|iPhone\r
+               Ad-Hoc|iPhone = Ad-Hoc|iPhone\r
+               AppStore|iPhone = AppStore|iPhone\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.AppStore|iPhone.ActiveCfg = AppStore|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.AppStore|iPhone.Build.0 = AppStore|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhone.ActiveCfg = Debug|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhone.Build.0 = Debug|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhone.ActiveCfg = Release|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhone.Build.0 = Release|iPhone\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator\r
+               {00C88FC7-0FAA-4E5F-A9E6-C4343F1F30D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator\r
+       EndGlobalSection\r
+       GlobalSection(MonoDevelopProperties) = preSolution\r
+               StartupItem = MonoTouch.csproj\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/mcs/tests/projects/MonoTouch/ivt.cs b/mcs/tests/projects/MonoTouch/ivt.cs
new file mode 100644 (file)
index 0000000..f7b4a48
--- /dev/null
@@ -0,0 +1,3 @@
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo ("TestMcs")]
diff --git a/mcs/tests/property-il.il b/mcs/tests/property-il.il
deleted file mode 100644 (file)
index 7115547..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-.assembly extern mscorlib
-{
-  .ver 1:0:5000:0
-}
-.assembly 'property-il'
-{
-  .hash algorithm 0x00008004
-  .ver  0:0:0:0
-}
-.module 'property-il.dll' // GUID = {CACC88BA-6ED4-45E0-8E59-C3ABEBA9753A}
-
-
-  .class public auto ansi beforefieldinit 'Foo'
-       extends [mscorlib]System.Object
-  {
-
-    // method line 1
-    .method public hidebysig  specialname  rtspecialname 
-           instance default void .ctor ()  cil managed 
-    {
-        // Method begins at RVA 0x20ec
-       // Code size 7 (0x7)
-       .maxstack 8
-       IL_0000:  ldarg.0 
-       IL_0001:  call instance void valuetype [mscorlib]'System.Object'::.ctor()
-       IL_0006:  ret 
-    } // end of method Foo::instance default void .ctor () 
-
-    // method line 2
-    .method public virtual  hidebysig  newslot  specialname 
-           instance default string 'Monkey_Jump' ()  cil managed 
-    {
-        // Method begins at RVA 0x20f4
-       // Code size 6 (0x6)
-       .maxstack 8
-       IL_0000:  ldstr "foo"
-       IL_0005:  ret 
-    } // end of method Foo::instance default string 'Monkey_Jump' () 
-
-       .property specialname rtspecialname string Message ()
-       {
-               .get instance default string 'Foo'::'Monkey_Jump' () 
-       }
-  } // end of type Foo
-
-  .class public auto ansi beforefieldinit 'Bar'
-       extends Foo
-  {
-
-    // method line 3
-    .method public hidebysig  specialname  rtspecialname 
-           instance default void .ctor ()  cil managed 
-    {
-        // Method begins at RVA 0x20fb
-       // Code size 7 (0x7)
-       .maxstack 8
-       IL_0000:  ldarg.0 
-       IL_0001:  call instance void class 'Foo'::.ctor()
-       IL_0006:  ret 
-    } // end of method Bar::instance default void .ctor () 
-
-    // method line 4
-    .method public virtual  hidebysig  specialname 
-           instance default string 'Boston' ()  cil managed 
-    {
-        // Method begins at RVA 0x2103
-       // Code size 6 (0x6)
-       .maxstack 8
-       IL_0000:  ldstr "bar"
-       IL_0005:  ret 
-    } // end of method Bar::instance default string 'Boston' () 
-
-       .property specialname rtspecialname string Message ()
-       {
-               .get instance default string 'Bar'::'Boston' () 
-       }
-  } // end of type Bar
-  
-.class public auto ansi beforefieldinit C
-       extends [mscorlib]System.Object
-{
-  .method public hidebysig specialname instance int32 
-          get_Value() cil managed
-  {
-    .maxstack  1
-    .locals init (int32 V_0)
-    IL_0000:  ldc.i4.3
-    IL_0001:  stloc.0
-    IL_0002:  br.s       IL_0004
-
-    IL_0004:  ldloc.0
-    IL_0005:  ret
-  }
-
-  .method public hidebysig specialname instance void 
-          add_Arg(bool arg) cil managed
-  {
-    .maxstack  0
-    IL_0000:  ret
-  }
-
-  .method public hidebysig specialname rtspecialname 
-          instance void  .ctor() cil managed
-  {
-    .maxstack  1
-    IL_0000:  ldarg.0
-    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
-    IL_0006:  ret
-  }
-
-}
-  
diff --git a/mcs/tests/property-main.cs b/mcs/tests/property-main.cs
deleted file mode 100644 (file)
index a6cd8a0..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-
-class X
-{
-       static int Main ()
-       {
-               Bar bar = new Bar ();
-               if (bar.Message != "bar")
-                       return 1;
-
-               Foo foo = new Foo ();
-               if (foo.Message != "foo")
-                       return 2;
-
-                C c = new C ();
-                c.get_Value ();
-                c.add_Arg (false);                
-                
-               Console.WriteLine ("Test ok");
-               return 0;
-       }
-}
index adb1dd88a92798149629456d8f5ef4aa5b8834f6..29e46214b9208cfa32ef18299c2e02966a33428c 100644 (file)
@@ -1,7 +1,7 @@
 using System;
 
 class X {
-       static int Main (string [] args)
+       public static int Main (string [] args)
        {
                Console.WriteLine ("Hello, World!");
                return 0;
index b81ec78c2c4994ee1456b94ff7608d20bba58f43..27857a922c6f1224a4ddf847c02c426ced6de8b8 100644 (file)
@@ -149,7 +149,7 @@ checked (                   (ulong) a), checked ((char) a), checked ((float) a), (decimal) a);
                decimal dec2 = (decimal)dec;
        }
        
-       static void Main ()
+       public static void Main ()
        {
 
        }
index da77cf3cdda2faf007fd7c12c3fd7e484a3d671c..5e9bc06854da4c675999245f12c3d641fd5e13b9 100644 (file)
@@ -23,7 +23,7 @@ namespace GLib {
                        g_object_get (Raw);
                }
 
-               static int Main ()
+               public static int Main ()
                {
                        return 0;
                }
index 5ed02f537e6e7224c8ed40e94694bb0ef8029d14..38bd565edac1fad2b0ff7b14877a05c7f5f5c613 100644 (file)
@@ -27,7 +27,7 @@ namespace Test {
        [My("testclass")]
        [My2("testclass", 22)]
        public class Test {
-               static public int Main() {
+               public static int Main() {
                        System.Reflection.MemberInfo info = typeof (Test);
                        object[] attributes = info.GetCustomAttributes (false);
                        for (int i = 0; i < attributes.Length; i ++) {
index ddfc2dbc05b39cd1427a57e0c4588acf99dd7f18..b88d09578b3aa4e8205ce8ef45c4d9e1b5cff488 100644 (file)
@@ -16,7 +16,7 @@ class Test {
                Console.WriteLine ("Async Callback " + ar.AsyncState);
        }
        
-       static int Main () {
+       public static int Main () {
                SimpleDelegate d = new SimpleDelegate (F);
                AsyncCallback ac = new AsyncCallback (async_callback);
                string state1 = "STATE1";
index a5639efa8f067c6283f5df91e24bf4b72043d15c..fbd8af43606f0b941efeb458711ddde5542ade26 100644 (file)
@@ -28,7 +28,7 @@ class Test {
                //throw new NotImplementedException ();
        }
        
-       static int Main () {
+       public static int Main () {
                SimpleDelegate d = new SimpleDelegate (F);
                AsyncCallback ac = new AsyncCallback (async_callback);
                
index 2edc56d94574748dc605a3868aa5cd8b27a49cf7..291843bc309e4ec19c4200d3c6d4b42fbe03382e 100644 (file)
@@ -1,6 +1,6 @@
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                int i = 0;
                
index 740155886cd534830789de545f5a0158783cb878..23944e161cddac39336e3a6f0bd262aef4649717 100644 (file)
@@ -1,7 +1,7 @@
 using System;
 
 class T {
-        static int Main ()
+        public static int Main ()
        {
                //
                // Just a test to compile the following:
index 4af5997bef9b2bd00fb6ad9fc9bdd85a236c34b8..f2eff4b6a6faa82e3dfa0e506c51119b94d41ce8 100644 (file)
@@ -2,7 +2,7 @@ class T {
         static object get_obj() {
                 return new object ();
         }
-        static int Main() {
+        public static int Main() {
                 object o = get_obj ();
                 if (o == "string")
                         return 1;
index c1c285479916c7aad2735ef676927f680f8a3a07..552cc0a6901347f36fced13b5ee4c17837695ce4 100644 (file)
@@ -10,7 +10,7 @@ class X {
                return x;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (g () [1] == 10)
                                return 0;
index c5690ba62f1c8fae860cef577fee997c586481ac..108cb31eef0edc71c92deab6502d9bcb764e902b 100644 (file)
@@ -3,7 +3,7 @@
 //
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                double d = 1.4e-4;
                // add more ;-)
index 7e814876687517af22a315d65c07a9e5db180b08..e5b1140be59e12ec96d22f7131935632ac5f4fbc 100644 (file)
@@ -8,7 +8,7 @@ class Container {
        // and LoaderOptimization is also the abbreviation for
        // LoaderOptimizationAttribute
        [LoaderOptimization (LoaderOptimization.SingleDomain)]
-       static int Main (string[] args) {
+       public static int Main (string[] args) {
                return 0;
        }
 }
index be7d7695a226769d66e653e436fe9df06406ad3a..29d5e008c0f0baf996e232b9f0607bfd302036e2 100644 (file)
@@ -31,7 +31,7 @@ class Derived : MyObject {
 }
 
 class Test {
-       static int Main ()
+       public static int Main ()
        {
                Value v = new Value ();
 
index d820033b966dbb715f0f91a6b98e68893a12d09e..245a18149813a61056c78ebb31ee8e403b2c2402 100644 (file)
@@ -4,7 +4,7 @@
 
 using System;
 class X {
-       static int Main (string [] args)
+       public static int Main (string [] args)
        {
                string a = "hello";
                string b = "1";
index c525c386bb1c1d8e470afec7596f4bfb7c9267f6..52322d37a55ae76f32ef29f7a49b340f3074c4df 100644 (file)
@@ -29,7 +29,7 @@ struct MyAuto
 class test
 {
        
-       static int Main ()
+       public static int Main ()
        {
                int errors = 0;
                Type t = typeof (MyUnicode);
index 21e96bc967f287e551894ca4c66e2c1e9a127422..5fa9778d6dc1ca48733cd754f5b44ca48742daea 100644 (file)
@@ -12,7 +12,7 @@ class X {
        }
 
        
-       static int Main ()
+       public static int Main ()
        {
                int [] a = new int [10];
                int i = 0;
index a27c805c3c4bdfc11ff27bac1cf3e22ff6186859..bd793f9f1a6bec4464774000c91c054c9650b6ad 100644 (file)
@@ -10,7 +10,7 @@ class X {
                return null;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int a = 5;
                object o;
index 26ed4190a206e8f9dedd72e06833525f2cafbb1b..fd3f6d11ad46473bf978c1811d30b2a5182eaa6c 100644 (file)
@@ -11,7 +11,7 @@ class X : Iface {
 
        void Iface.Method () {} 
        
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                Iface f = x;
index 1ca2bed744955a4a01d565dddc69cc520bfc1841..6d8495fa73a896b3d10b8176ba39d7cfce7ce2c5 100644 (file)
@@ -11,7 +11,7 @@ enum Test {
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                Test test = Test.A;
 
index 92fd6914b4518969ea02a0da30d313bafaebd5a5..4628f153711fb17221e356b1859c70baff8ada56 100644 (file)
@@ -5,7 +5,7 @@ using System;
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                short a = -32768;
                int b = -2147483648;
index 6403fbcdfbd8af22c8a1288125f8467c0abeb001..34936d62dc7ef4910e43398fd4d768852ca9ee0a 100644 (file)
@@ -22,7 +22,7 @@ class X {
 
        public const short s2 = (short) c;
        public IntPtr p = (IntPtr) null;
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index 0ac9a986ce42b2234604ab71825f797bcbbee424..d72dd97632df89e274eb6d936ced83f09af48dca 100644 (file)
@@ -2,7 +2,7 @@ using System.Reflection;
 
 class T {
        protected internal string s;
-       static int Main() {
+       public static int Main() {
                FieldInfo f = typeof(T).GetField ("s", BindingFlags.NonPublic|BindingFlags.Instance);
                if (f == null)
                        return 2;
index 1e27fc406314772cd2c2e462cd97de828daf7255..f8dfe335cc0cb84b335bf12df9755cd11c9a162d 100644 (file)
@@ -17,7 +17,7 @@ class T {
                ss.b = 2;
                s = ss;
        }
-       static int Main() {
+       public static int Main() {
                OpCode op;
                OpFlags flags;
                S s;
index 35cb5c0c15b247f15bed502d5d651adb8af31940..14c117ff342b5fc54b2e34f713057c9ff3be2c52 100644 (file)
@@ -47,7 +47,7 @@ class T: IB {
         public void A () {}
         public void B () {}
 
-        static int Main() {
+        public static int Main() {
 
                BB bb = new BB ();
                bb.A ();
index 5d1092efa7f32e7c5b6f0545344de1fb92acccb4..9b3cdf70badb574df64983291720bebd9524ce71 100644 (file)
@@ -19,7 +19,7 @@ class T : IB {
         public A Prop {
                 get { return new A(); }
         }
-        static int Main() {
+        public static int Main() {
                PropertyInfo[] p = typeof (T).GetProperties (BindingFlags.Public| BindingFlags.NonPublic|BindingFlags.Instance);
                if (p == null || p.Length != 2)
                        return 1;
index 562cdbee956c3d32014f014772f0e07d2cf00db8..b9e8216d8d3d2b0104b9e3364fb16f0441365022 100644 (file)
@@ -37,7 +37,7 @@ public class MyCar: IAutomobile, IDiagnostic {
 }
 
 class TestConflict {
-       static int Main ()
+       public static int Main ()
        {
                MyCar car1 = new MyCar();
                car1.Stop(); // calls the IAutomobile.Stop implementation
index ba11bb7fc393a4db8b24aeefbf07e76939829927..277a92944f177ccd157154c64e63633006d53c11 100644 (file)
@@ -19,7 +19,7 @@ class C : A, B {
                var++;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                C c = new C ();
 
index 1581d2f99ec9aec9932132b2893cd0bd4d73bafe..d44aa35387c3ccf19ee19a87770cfaa35576328c 100644 (file)
@@ -1,6 +1,6 @@
 // ensure the argument to newarr is converted to int32 or native int
 class T {
-       static int Main() {
+       public static int Main() {
                char[] a;
                long len = 10;
                a = new char [len];
index be84d94fc987a76ef3a65ed9006d2147411fdd95..716fae37182f3b1ebb540eb482c2b343fb8fb1ee 100644 (file)
@@ -29,7 +29,7 @@ struct T {
                 return val.GetHashCode();
         }
 
-        static int  Main()     
+        public static int Main()       
        {
                T t = new T ();
 
index dac824b6028f87e6ad2f7763b2643f722f5deaa5..803b9376cb0a9c9135a04581be34bc44f84e7602 100644 (file)
@@ -15,7 +15,7 @@ namespace Obj {
                public new int H () {return 11;}
        }
        class Test {
-               static public int Main () {
+               public static int Main () {
                        int result = 0;
                        B b = new B ();
                        A a = b;
index 3fb5ec2db83926b82b0c8744aa33699c4bfdd8f2..431393f5c05d3b33140e78c2a5f17b214ae8ac68 100644 (file)
@@ -11,7 +11,7 @@ struct MonoEnumInfo {
                 return info.val;
         }
 
-        static int Main()
+        public static int Main()
        {
                MonoEnumInfo m;
 
index 2ee08a7e6f5102dc904423d612e80121f84f6a75..4dc7d1cee22b4d30e2ce60cdc613bbc5fed464d9 100644 (file)
@@ -17,7 +17,7 @@ struct StructImplementor : Iface {
 }
 class Run {
 
-       static int Main ()
+       public static int Main ()
        {
                Iface iface;
                Implementor i = new Implementor ();
index 29419075afb157d05dc422c3294f15e15ddb0edd..a5ce7f474d8430d8af1ae549389ed5135d90d4cf 100644 (file)
@@ -14,7 +14,7 @@ class Z
                Test2 (message, args);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                Test ("TEST");
                Test ("Foo", 8);
index 43545820720ab64a4556d913bc316fe7eaf9853e..ce0a2683b55d2f23c70a6cc7edb211db5c2c3083 100644 (file)
@@ -14,7 +14,7 @@ class X
 
        private class NestedPrivate { }
 
-       static void Main () { }
+       public static void Main () { }
 }
 
 public class A : Public { }
index 32943211e3578051d5040b6eea80386edee6ed90..109942fedef49fa5ac0466b9fd36603dcbbcd423 100644 (file)
@@ -19,7 +19,7 @@ namespace Test {
        
        [My("testclass")]
        public class Test {
-               static public int Main () {
+               public static int Main () {
                        System.Reflection.MemberInfo info = typeof (Test);
                        object[] attributes = info.GetCustomAttributes (false);
                        for (int i = 0; i < attributes.Length; i ++) {
index 80b26d88ed0daf86a1d699d39010e6e814c7e2c4..cdb8d45d54b1bc6d32f328cdf93b3c1e4c84db2e 100644 (file)
@@ -11,7 +11,7 @@ public class My : Attribute {
        
        [My(TypeCode.Empty)]
        public class Test {
-               static public int Main() {
+               public static int Main() {
                        System.Reflection.MemberInfo info = typeof (Test);
                        object[] attributes = info.GetCustomAttributes (false);
                        for (int i = 0; i < attributes.Length; i ++) {
index c2083dd68c8914d3c0c64043e52adebfc0ed3cd4..6f2c7b51ca08ab557be4d865e0631a5d3e7398bc 100644 (file)
@@ -14,7 +14,7 @@ class T {
                 return look.s.a;
         }
 
-        static int Main() {
+        public static int Main() {
                // Compilation only test;
                return 0;
        }
index 9c4e7ade77ef65060faf8e4e07fad9b7ac60345c..7877bdea6394a32de70e93febf31b6bae14c1b91 100644 (file)
@@ -18,7 +18,7 @@ public class ZipEntry
                }
        }
 
-       static int Main () {
+       public static int Main () {
                // Compilation only test.
                return 0;
        }
index 24b4ec924e9be5fb48148175d67f5997f4fe938f..9f08f01d10612eab98372fbcd343f12dcd934857 100644 (file)
@@ -32,7 +32,7 @@ class Y : X
                return foo ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Y y = new Y ();
                int result = y.Hello ();
index ba956b51d02f570c46822b44511f1a3167b1c877..083dca8453984b7d9e2c3f4d90596525324ceff7 100644 (file)
@@ -44,7 +44,7 @@ class D : IInferior
                return inferior.TargetIntegerSize;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                D d = new D ();
 
index b86e49df66834680488a708983296fc0e9dd5e03..38ffaf187dd34aa4f3b1ffafe09817f4f0b9ecd2 100644 (file)
@@ -21,7 +21,7 @@ class X
                 A, B
         }
 
-        static int Main ()
+        public static int Main ()
         {
                 int v = Test (Foo.A);
                if (v != 0)
index 328e299bf82770d18614253e0db1f2f54b20ad32..b96a60bb190d9e87d394edef0f05326f11739f41 100644 (file)
@@ -10,7 +10,7 @@ struct X {
 
 class Test { 
 
-       static public int Main ()
+       public static int Main ()
        {
                X x = new X ();
                Console.WriteLine (x);
index 703c3148085cc168142dbc9bc62d78d3ebf6ee0d..2051287e49570098ba23ab34c1256a62865f5bf1 100644 (file)
@@ -40,7 +40,7 @@ class Derived : Base {
 
 class D {
 
-       static int Main ()
+       public static int Main ()
        {
                //
                // These tests just are compilation tests, the new property code
index 8413f5c97a835ac2bd1c023bfad55513a90b11bc..e74720723e67067ac753432c1c94cea5591c61fb 100644 (file)
@@ -46,7 +46,7 @@ class Y : X {
        }
 
 
-       static int Main ()
+       public static int Main ()
        {
                Y y = new Y ();
 
index 21fc85915a4cf5b00530e4d15f1238aa6f00ac64..cd1202aecb761fdd69e38d7d566afab5947b7931 100644 (file)
@@ -15,7 +15,7 @@ namespace IntPtr_Conv
 
        class Class1 {
                
-               static int Main(string[] args)
+               public static int Main(string[] args)
                {
                        IntPtr p = IntPtr.Zero;
 
index 091b2d44cdcd8b42730cdafa71977b42d4ff50df..52b70df777d13a396c4ce8e1744fd4b603bf8522 100644 (file)
@@ -198,7 +198,7 @@ class X {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int v;
                object o = null;
index 0484578d1dc219c7f989f0fb5ad2ad207f04f8bc..77684ddd57125646406ffed766063026f4322ce4 100644 (file)
@@ -167,7 +167,7 @@ class X
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int result = Test ();
                Console.WriteLine ("RESULT: {0}", result);
index 2abcaaf1433527e26da92331cfeeffbb6365795a..779adb845fe27fff3df14b4ca8253e4f012ae23c 100644 (file)
@@ -21,7 +21,7 @@ class ProtectedAccessToPropertyOnChild : Hashtable {
                comparer = null;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                TestAccessToProtectedOnChildInstanceFromParent t = new TestAccessToProtectedOnChildInstanceFromParent ();
 
index 2a2ea42ad10efe715d01f59ecc3f79ab545d9d8a..4c304582bb820d3c24d360bfb2ef7e9fe4abc435 100644 (file)
@@ -21,7 +21,7 @@ struct RVA {
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                RVA a = 10;
                RVA b = 20;
index de83474486ecb3068792a93929e80de7125249c6..454b65c3378b153fa2f3d5a3ff1a3a14fb4bdef0 100644 (file)
@@ -6,7 +6,7 @@ using System;
 class X {
        const byte b = 0x0f;
        
-       static int Main ()
+       public static int Main ()
        {
                int x = ~b;
                byte bb = 0xf;
index eb2a02c003327bea4500efd4d29c4b73d3847c00..97c25bfca23e7a6c372ff7ce8889dc0f3e0e002a 100644 (file)
@@ -32,7 +32,7 @@ class X {
                }
        }
        
-       static int Main ()
+       public static int Main ()
        {
                m ();
                if (i != 1)
index a2d5de1d680bf3c9ba0bc9416bec6204c8e430d9..c63250e13d554268818c7594ba9758ba8cb25ffc 100644 (file)
@@ -14,7 +14,7 @@ class Test
        {
        }
 
-       static public int Main ()
+       public static int Main ()
        {
                MethodImplAttributes iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
                return ((iflags & MethodImplAttributes.Synchronized) != 0 ? 0 : 1);
index 08fe6448dcea4029372e0d69c220ae9d26304a1a..476e222ec0d976037c11688c0fcd54e7c45f5aa0 100644 (file)
@@ -16,7 +16,7 @@ struct DT {
 }
 
 class T {
-       static int Main () {
+       public static int Main () {
                DT t = new DT ();
                if (t.Ticks != 1)
                        return 1;
index 6d81e446f4a758c06c3304eae8b598d5a5c3b053..7b28aa7d9b1041db65fc6c76cd440d9a0c9b18c2 100644 (file)
@@ -15,7 +15,7 @@ class Test
                return ++x;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int x = 1;
                int y = 0;
index d925d951ca1d0232281be4a5bc887424fd5b414a..0888f1e2ac4d1fa6eca20fa0d84a93925f97eda3 100644 (file)
@@ -30,7 +30,7 @@ public class Test
        //
        User t2=new User(new Struct(251));
 
-       static int Main ()
+       public static int Main ()
        {
                Test tt = new Test ();
 
index 6f06b22be695247aed3514bb7ea4922da91f2c5f..b9dc49336f9f63015cbe6e92124684912e3f9adc 100644 (file)
@@ -14,7 +14,7 @@ class X
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Test (1) != 0)
                        return 1;
index e4c28b5b37d52e6566c2106e1496514b210380f2..eb9aa63045abc312a6e14a7e25c89413a08810d2 100644 (file)
@@ -14,7 +14,7 @@ namespace TestBUG
        public class Test
        {
 
-               static int Main  ()
+               public static int Main  ()
                {
                        return 0;
                }
index ece3a82d4ef40ee89c42f05282d482abadf52cf6..e5ce893eb424ca2f7c4fa943d17661032fe468f3 100644 (file)
@@ -42,7 +42,7 @@ class D {
         }
 
        
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index 4a8f6bea780303c81a611860f1f2e46a0be4f452..e44ea79c2a8c1adc36eb884c7ac365cacc814f13 100644 (file)
@@ -18,6 +18,6 @@ class A
                }
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index a85eac8c2a7c91166c9a57c95f56163ac31f3afb..b15203e5ab06c790fb7ffd261cfc8a5e1150413f 100644 (file)
@@ -28,7 +28,7 @@ class Y {
 }
 
 class R {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 7ba8ea13922f5c1b057079985419650a1b1d001a..498dbd125a4c59a6510859045e304bdfd635bdd8 100644 (file)
@@ -2,7 +2,7 @@
 // Tests that we validate the unchecked state during constatn resolution
 //
 class X {
-       static void Main ()
+       public static void Main ()
        {
                unchecked {
                        const int val = (int)0x800B0109;
index 01d8b150d3c8bcd1c5e82c7f769fc2d5174d85d0..c137318c02ccd1f30c8a433b71ca40d52896217b 100644 (file)
@@ -22,7 +22,7 @@ class A
                return 1;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                return Test (1);
        }
index ec8c963c331c38fba200134bf8573c7853d0fd5d..95ee942562e3e6d4e49ef423bd067c4918a6791d 100644 (file)
@@ -22,7 +22,7 @@ class X {
        X (int a) {
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
        }
index 2721b2d8cb4a99933484435f137242331e54f4e9..98ea4e5db4e6f297c009e76d91a292f53005fe3b 100644 (file)
@@ -16,7 +16,7 @@ class X {
                long ll = (b & (l << r));
        }
        
-       static int Main ()
+       public static int Main ()
        {
                const byte b = 255;
                const int i = b << int.MaxValue;
index e7afe125779bc6f8922f29f5fee470351eda4916..0f038d36ec590247b6ee20d34c37f93b400c14a9 100644 (file)
@@ -84,7 +84,7 @@ namespace P1
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                // Compilation-only test.
                return 0;
index 0a18d50767b5f7ccb8249bbdb0b3a4be7bed8f25..3f2b00953161473793d12866e50f8e5dbedc1549 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static int Main (string [] args)
+       public static int Main (string [] args)
        {
                System.Console.WriteLine ("Hello, World");
                return 0;
index 006bd45075e274947002ddef33df6462e86e4eac..0093632dad76e61815bb612978cffe9c445641a4 100644 (file)
@@ -49,7 +49,7 @@ class Bx : Ax {
        }
 }
 class Test {
-       static int Main ()
+       public static int Main ()
        {
                B b = new B ();
 
index 859aac63ae70e8842659c31037a64406a8b34a1a..84352b447f36bd121d1e356cb909b8b5d2dddfa4 100644 (file)
@@ -4,7 +4,7 @@ namespace N2
 {
        class Test : T1
        {
-               static int Main()
+               public static int Main()
                {
                        // Compilation-only test.
                        Foo ();
index 2edf452e9769a9462e544e1e89a7f1c0da5da0ce..9c9f5f1a9f5d18a6f8295cbfb756d837d779ce4e 100644 (file)
@@ -25,7 +25,7 @@ class cls
 
 class MonoEmbed 
 {
-       static void Main() 
+       public static void Main() 
        {
                cls c = new cls();
                c.OnWhatever += new OnWhateverDelegate( Whatever );
index b685e067146cf8bd3ab4cc22ed251019d310a858..16edaf9723c5e4d69a68b9595101c58f5828ba14 100644 (file)
@@ -1,6 +1,6 @@
 using System;
 public class Test {
-    static int Main () {
+    public static int Main () {
         object val1  = compare_gte(0, 0);
         object val2  = compare_gte(1, 0);
         object val3  = compare_gte(0, 1);
index 0086efe3c77d398f8fd7adb4165932462402ded8..816728fe54cc0621634b0fc79b0dfd73577606cc 100644 (file)
@@ -1,6 +1,6 @@
 class T
 {
-       static void Main()
+       public static void Main()
        {}
         delegate void foo (object o);
 
index 2e662494ddde01ae39abf3dd7d5cf37ba99fcdb0..1d8f3f314dbe1d18ac1199102249c492d41c29ca 100644 (file)
@@ -28,7 +28,7 @@ struct S {
 }
 
 class M {
-       static int Main ()
+       public static int Main ()
        {
                S s = new S ();
 
index ae8ff2ac0325dded50652de19559cd0f91bc1626..acfbc534646d4596ccf5590782f4ca36a4fd15d9 100644 (file)
@@ -75,7 +75,7 @@ class F : IBlah {
 }
 
 class Driver {
-       static int Main ()
+       public static int Main ()
        {
                if (! B.Test ()) return 1;
                if (! E.Test ()) return 2;
index e9d424d40a464334680cbd5aab6429676d9ff487..822dc5c762fed269b3804222654e1d0c1371e4e9 100644 (file)
@@ -6,7 +6,7 @@
 
 enum Foo { Bar }
 class T {
-       static int Main ()
+       public static int Main ()
        {
                System.Enum e = Foo.Bar;
                System.ValueType vt1 = Foo.Bar, vt2 = 1;
index 485f940da5fd17d7a54f8f754a68e38d95f3f612..34fec7933f57bf3718459b5cf92dcafff24f57e0 100644 (file)
@@ -10,7 +10,7 @@ class B : A {
                return 1;
        }
        
-       static void Main ()
+       public static void Main ()
        {
                B b = new B ();
                Console.WriteLine (b.foo ());
index 0723c667d95ef96a5ff9e7ae746dc33a763bbfc3..a1cbcef1125e24440f68deefd8331c07e841b1a3 100644 (file)
@@ -21,7 +21,7 @@ class X {
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Value != 10)
                        return 1;
index 5b29a497e68aadd28bbb53c3385971afbf1d68c9..55fe02dcb8254958b9d6ad6d6c03b7b61a0318ac 100644 (file)
@@ -5,7 +5,7 @@ using System.Diagnostics;
 [module: DebuggableAttribute (false, false)] 
 
 class TestClass {
-        static int Main()
+        public static int Main()
         {
             Module[] moduleArray;
             moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
index 07e217a26620dcbec0a9b84e0cd727ab8f1cb45b..61c9a0684ac2e5e2359e147682dc35af46d32999 100644 (file)
@@ -1,7 +1,7 @@
 class T {
        static int ret_code = 0;
     
-       static int Main ()
+       public static int Main ()
        {
                try {
                        T t = null;
index 94dda70a7120d54dfcae3d411108a039ca0d4be1..fe3124f232495e488f2e2a2ce34a24399de37463 100644 (file)
@@ -3,7 +3,7 @@ using System.Reflection;
 
 class Tests {
 
-       static int Main () {
+       public static int Main () {
                return TestDriver.RunTests (typeof (Tests));
        }
        
index e2ce76ddbcd6398e252217e70a031178beb7c02a..099d774eafbb877008b279878ae1c6ab1cebddfb 100644 (file)
@@ -36,7 +36,7 @@ class T {
                e30 = 1 << 30,
                e31 = 1 << 31,
        }
-       static void Main ()
+       public static void Main ()
        {
                E e = E.e1;
                string s;
index def44e87b7c4d6ce46e3d340866fd5c12e7664fd..a760b5117f4586ec70265bcc004c2eb5b0eefcac 100644 (file)
@@ -8,7 +8,7 @@ class TestClass {
             Environment.Exit (1);
         }
     
-        static int Main()
+        public static int Main()
         {
             ConditionalMethod ();
             Console.WriteLine ("Succeeded");
index f6a74875fc31ee65bbd3df0a29d74c5e0fc29b9b..9053080fed8d1faf44c64dcf0416d7ed4550f858 100644 (file)
@@ -21,7 +21,7 @@ class TestClass: BaseClass
 
 class MainClass
 {
-        static int Main()
+        public static int Main()
         {
             TestClass ts = new TestClass ();
             ts.ConditionalMethod ();
index e69a844c93d838be0c3fc274adece02d5703c0fa..622f5dcbf9686bb000aaae7bfdf96ca6abeaccc4 100644 (file)
@@ -19,7 +19,7 @@ class X {
 
        static string x, b;
        
-       static int Main ()
+       public static int Main ()
        {
 
                x = S = b = "hlo";
index 219e70b7328ce586e3b06ad86d72d8d5494b8ccd..feffcff430e6037efbe7a8bb88c9e5f2cfec9a60 100644 (file)
@@ -13,7 +13,7 @@ class TestClass {
             return_code = 0;
         }
     
-        static int Main()
+        public static int Main()
         {
             ConditionalMethod ();
             return return_code;
index b8c9e9a826c8de1427b2f38cc22a553679df1db0..d2731a9791d6149913c3736186b27f8ba05b07b1 100644 (file)
@@ -14,7 +14,7 @@ public class X {
                return Address;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Resolve (Address);
        }
index 401b4af1f308280f8946316756ceab16cf71a88b..c4838dfe43506cd4659935e4d9e34b0c1f7a889a 100644 (file)
@@ -3,7 +3,7 @@ using System;
 class Foo {
        static int t_count = 0, f_count = 0;
 
-       static int Main ()
+       public static int Main ()
        {
                Console.WriteLine (t && f);
                if (t_count != 1)
index b8506ee4fce19e252019d40a7d503e2130d0f331..1143a9dca561e3fa4429fe6cf5a894cc4a9af951 100644 (file)
@@ -8,7 +8,7 @@ public class Class2
                }
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index 3afd2529cbfeccc57dd44582059c26a6a1c99955..1caf43e5187d227b3dcb7dd94212bff0364b54c6 100644 (file)
@@ -7,7 +7,7 @@ struct Blah : System.IDisposable {
 }
 
 class B  {
-       static void Main () {
+       public static void Main () {
                using (Blah b = new Blah ()) {
                        Console.WriteLine ("...");
                }
index 32a09f2f9a66ce26e1fa0f100f5726e072a97ab6..bba0e071ffa7de08fa86604f88f8ad3538ddc3bf 100644 (file)
@@ -8,7 +8,7 @@ struct Blah : IEnumerable {
 }
 
 class B  {
-       static void Main () {
+       public static void Main () {
                foreach (object o in new Blah ())
                        ;
        }
index 9b2e3057b5820bc8cb42a0bf7f439b87c8f5e43f..f3f093d4dfce552add1d28b64740344744d2613c 100644 (file)
@@ -3,7 +3,7 @@ using System;
 class T {
        static Foo GetFoo () { return new Foo (); }
 
-       static void Main ()
+       public static void Main ()
        {
                string s = GetFoo ().i.ToString ();
                Console.WriteLine (s);
index d93ff9234e9df51da462485c31e1e4322bf70533..c1bfae13bf09b6c4a0b65d4d6d633e0572dc804f 100644 (file)
@@ -11,6 +11,6 @@ struct Bar
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index a01a8daa4f1af6420161e71c82e37529a29ccef0..08ac21c8b65b82a265a9239db2013adce082b25f 100644 (file)
@@ -7,7 +7,7 @@ using System;
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                int i, j, t, k;
                
index 156de30c80ff81df53fb4e34abd1896a88cb2bbb..7878999c1d1404f1be43865809a6a95156b8913c 100644 (file)
@@ -27,5 +27,5 @@ class X {
        volatile IntPtr ip;
        volatile UIntPtr uip;
 
-       static void Main () {}
+       public static void Main () {}
 }
index be48f7d2b40a35ba1f055c7703a41473cc7844ed..d095550c1f60faea2997d8550b59977ca5258b4b 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-        static void Main ()
+        public static void Main ()
         {
                 int a;
 
index 5685b07acfec89ef589aa5d9f280ffea74fbd21c..ff0e78ca2649e23c63bbb7fde282e25c1e728a42 100644 (file)
@@ -18,7 +18,7 @@ namespace MyTest
                 {
                 }
 
-               static void Main ()
+               public static void Main ()
                { }
         }
 }
index 014f2e05f07e4f71e4cd20819815c1fa02e35308..b6ca39ff3b99bfd8d1002dcf05f54bc3d2bed39c 100644 (file)
@@ -20,7 +20,7 @@ class T {
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                T t = new T ();
                int result = Test (t);
index 9fba86f55777e57318f8504de483fca35cf2e0d6..628f5cb1a8abf4ea5a4bc8c664a5c7a57ccb4b57 100644 (file)
@@ -12,7 +12,7 @@ namespace n3 {
                {
                        Attribute ();
                }
-               static void Main () {
+               public static void Main () {
                        new A ().X ();
                }
        }
index d58107ebb6e4b50049bbb3648d92c181d360fa60..b4836c5b94d72a4d64b095d14a7d408a3eaa1f15 100644 (file)
@@ -6,7 +6,7 @@ internal class ClassFormatError
        {
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index 145c2d86bdffd4bcf94813cef02030b102ae3ee6..95c52e89b6b09101dda13a216aaf6ea8b8195022 100644 (file)
@@ -8,7 +8,7 @@ class X {
                }
        }
        
-       static int Main () {
+       public static int Main () {
                Nested n = new Nested ();
                return n.D() == MyEnum.V ? 0 : 1;
        }
index 3b4eca845134fb7bc1265296c7ce1c7a22f2cb06..2720cbb8fc8c844f4c386683c64b3379e6a4956d 100644 (file)
@@ -135,7 +135,7 @@ class Class1
                return new Result (result);
        }
 
-       static int Main (string[] args)
+       public static int Main (string[] args)
        {
                int result = AddABunchOfInts (__arglist ( 2, 3, 4 ));
                Console.WriteLine ("Answer: {0}", result);
index 83de9898a169683768c5e2b9d15280a2249de120..ccc46c45597b31fe95708ac0824fc2db5ba56038 100644 (file)
@@ -12,7 +12,7 @@ class X
                return 2;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Test ("Hello", 1, 2, "World") != 1)
                        return 1;
index 0ace0dc57f051a2b5a9e5db3595ea76a3a2676ba..e75addd2a1112709c21ccaef52486d1bd389dfcd 100644 (file)
@@ -14,7 +14,7 @@ class T {
                return new C ();
        }
        
-       static void Main ()
+       public static void Main ()
        {
                foreach (object o in X ())
                        ;
index ea06b69faa2a824f1a29eab72e1e9fd26e8b4944..3afbfe5f95db20417ed500688ff4b8b30e4f6644 100644 (file)
@@ -14,5 +14,5 @@ class Test
        [Baz ((Foo) 1)]        void f1() {}
        [Baz (foo2 = (Foo) 2)] void f2() {}
        [Baz (foo3 = (Foo) 3)] void f3() {}
-       static void Main() { }
+       public static void Main() { }
 }
index 75d9047b48dec6aca05658f3bbcabdb78cd33261..720b787fb1a582dbb2c5ab01e24b8ba3d55822bb 100644 (file)
@@ -1,7 +1,7 @@
 // test for bug #56774
 
 class T {
-       static int Main () {
+       public static int Main () {
                return X (1);
        }
   
index 1a6fa7e49d37a5c469d837d2da5b390c3448169f..9cbd6129b97ff4191402e0d12bbea3bdfb0c9fa2 100644 (file)
@@ -7,7 +7,7 @@ struct Rect {
 }
 
 class X {
-        static int Main ()
+        public static int Main ()
         {
                 Rect rect = new Rect ();
                 rect.X += 20;
index be1d7fba81fc9a35a02caaa365e259171b607958..37376db0a3c31865726dd5cb5b4c078d2275228e 100644 (file)
@@ -12,7 +12,7 @@ class FlagsAttributeDemo
         Blue = 4
     };
 
-    static int Main( )
+    public static int Main( )
     {
         string s = ((MultiHue)7).ToString ();
         
index ee1c7e5675745e113c0d702ab813a31f6f1e914c..529f6ab123839164abdef07ab8978588dc1c196f 100644 (file)
@@ -36,7 +36,7 @@ class X {
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
 
index aff2fbb5994586140c993b85faf6c83707cfd751..a428ea931d60f78ed59d4073d2d512457897e6fb 100644 (file)
@@ -17,7 +17,7 @@ namespace AppFramework.Util
            return false;
        }
 
-       static void Main () {}
+       public static void Main () {}
    }
 }
  
index 880e602930f7abc4e1d4eb433b12b12b00430396..5d1f93e1c43c54408e4a7c96d8d8ab575eb2961c 100644 (file)
@@ -42,7 +42,7 @@ namespace Test
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                if (Test.Test1.World () != 8)
                        return 1;
index f455d86580b8305ab96e1691cb56fb7d2f6a1620..d08521ac9bde3213fa655b4dc479377286c30d19 100644 (file)
@@ -35,7 +35,7 @@ class X
                throw new InvalidOperationException ();
        }
 
-       static int Main ()
+       public static int Main ()
        {
                integer i = new integer (3);
                double d = 4.0;
index f4b0bc8d06f476ab4ee56e52b36ae4ce42f466ac..7d7a1faa211436888672654fd6e53063ef909553 100644 (file)
@@ -21,7 +21,7 @@ class Y : X {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if (new Y ().GetIt () () == 1 && new Y ().GetIt2 () () == 1) {
                        System.Console.WriteLine ("good");
index 133f9daf1388711d771727e3bbd2e76bc1756936..fe9b37174e837bc68eae74c2956985b7fbc5a76b 100644 (file)
@@ -1,5 +1,5 @@
 class T {
-       static int Main ()
+       public static int Main ()
        {
                switch (1) {
                case 1:
index 6183126d277214af91462a9d74d95deb15acdc92..3c41e432f1f8fd9980eb4776118cc31bfde0c285 100644 (file)
@@ -24,7 +24,7 @@ class Derived : Base {
 
 class Demo {
 
-       static int Main ()
+       public static int Main ()
        {
                Derived d = new Derived ();
 
index 905fc6a706f6b9c0c98b34a36f9226b424f65c05..76c7d2c1e7dcca3ebc175fed6f1872b4f2582cd4 100644 (file)
@@ -6,7 +6,7 @@ class EntryPoint {
        delegate void EventHandler (object sender);
        static event EventHandler FooEvent;
        static void bar_f (object sender) {}
-       static void Main () {
+       public static void Main () {
                if (FooEvent != null)
                        FooEvent (null);
                object bar = new EventHandler (bar_f);
index c67fec01e2955a5df322b69014016d1db8c29180..34bd458024bb951ea574fd615fec67572eaafb32 100644 (file)
@@ -3,7 +3,7 @@
 
 unsafe class X {
        static int x = 0;
-       static void Main () {
+       public static void Main () {
                fixed (void* p = &x) {}
                fixed (void* p = &x) {}
        }
index b5954434b1827528c66b5c368d8b924e4fc27e91..56018d8bab09c71e26ccbdaf82d5ba684c13340c 100644 (file)
@@ -1,7 +1,7 @@
 using System;
 
 public class GetElementTypeTest {
-       static int Main (string[] args) {
+       public static int Main (string[] args) {
                GetElementTypeTest me = new GetElementTypeTest ();
                Type t = me.GetType ();
                Type elementt = t.GetElementType ();
index 26a487a17a559640031387c928648384c0878eb6..6d9f82d12dcabc8030d945fdd31708c79b68be9f 100644 (file)
@@ -4,7 +4,7 @@ using System;
 [My(TypeCode.Empty)]
 [My(typeof(System.Enum))]
 class T {
-       static int Main() {
+       public static int Main() {
                object[] a = Attribute.GetCustomAttributes (typeof (T), false);
                if (a.Length != 3)
                        return 1;
index 56c8308c02b914f60ea5be8367adccf214700b29..340aeddf0fce24aaa24531f6f6613f64f821282c 100644 (file)
@@ -29,7 +29,7 @@ class X : IA, IB {
 
 class test {
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
 
index c7c31fed25ee2bdf562807ef01d28704886b744e..7ede0c338a45e76e67d60f36aeebf901c8d1fb47 100644 (file)
@@ -21,7 +21,7 @@ class Derived :Base {
 }
 
 class Test {
-       static int Main ()
+       public static int Main ()
        {
                Derived d = new Derived ();
 
index 54c60fbf8a5b580ea0bb1cfa66a4fbab13b34826..1db5487ecaf086f907d0f478fae8d40dce3b43c3 100644 (file)
@@ -55,7 +55,7 @@ public class Program {
        
        [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlEvidence, UnmanagedCode=true)]
        [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.AllFlags, UnmanagedCode=true)]
-       static public int Main (string[] args)
+       public static int Main (string[] args)
        {
                // TODO: this will not be working for .NET 2.0 as attributes are decoded back
                Type program = typeof (Program);
index 37f366f02f8de001bc6483f4060a5159d9da7df7..8575bc78b85e094fd7974785c9bdb4d5644e2726 100644 (file)
@@ -83,7 +83,7 @@ class X {
                return 0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int t = T ();
                if (t != 0)
index 09f0d98ad6681ba2d9284327b97193c56a7205f0..2c72adefa6ddcacb825ff1c0da8538a180221213 100644 (file)
@@ -14,7 +14,7 @@ class D : B {
        {
        }
 
-       static int Main ()
+       public static int Main ()
        {
                MethodInfo [] mi = typeof (D).GetMethods (BindingFlags.Instance | BindingFlags.NonPublic);
                MethodInfo m = null;
index 83ecc8112a261cb82969dab2b193caa0932d227c..3d2fab33e6071750b91b160b82d130da2bd0e44f 100644 (file)
@@ -5,7 +5,7 @@ class X {
        X () {}
        X (int x) {}
        
-       static int Main () {
+       public static int Main () {
                if (new X ().b != "static stringstring")
                        return 1;
                
index 954285f0c8c78e44bcce1174c33eefd83c891b19..fdfaa1fd4bfc228302328e97aaabc6070cdae93b 100644 (file)
@@ -39,6 +39,6 @@ public class GuardedSequenced
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index d5c6e25a4bac3fc7b08d584bfd087c81fbfa1631..9294a043b7809349e65fd2ac9a3a02c072f0f4ae 100644 (file)
@@ -69,7 +69,7 @@ class C
                ie.Dispose ();
        }
 
-       static int Main()
+       public static int Main()
        {
                D d = new D();
                E e = new E();
index 1dc8feec269f0c218c93f46a8c5e982c66d4bbe6..84676a46ff0f6f3db29f4ab6e4fc4d19ee957f1d 100644 (file)
@@ -11,6 +11,6 @@ interface IBar : IFoo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index 6361e7a5d6217cd375cfd234923a27baf4e3f669..76d8765b87aa72a5ca7069e60f861aa12fa69eb8 100644 (file)
@@ -18,7 +18,7 @@ public class ConstFields
        static decimal DecimalValue = -90;
        const decimal SmallConstValue = .02M;
 
-       static int Main ()
+       public static int Main ()
        {
                Type t = typeof (ConstFields);
                DecimalConstantAttribute a = (DecimalConstantAttribute) t.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute), false)[0];
index 6665cd723b4e37a0bfbe9ed73300f1465156d4ed..57981fb8f751a884bb8acd54a0f33fb9c643e68d 100644 (file)
@@ -8,7 +8,7 @@ unsafe class X {
        unsafe public X (sbyte *value, int startIndex, int length) {
        }
 
-       static void Main ()
+       public static void Main ()
        {
                new X ((sbyte*)null, 0, 10);
        }
index d3890b813bd330e744d0358f1e4e8597925c1fbb..e3dc808dc3e768c8633b960372c02bbff0f7e9f6 100644 (file)
@@ -5,7 +5,7 @@ struct X : IDisposable {
         {
         }
  
-        static void Main ()
+        public static void Main ()
         {
                 X x = new X ();
                 using (x)
index 47b4aebddc6d1af971138a22a40847cea369d6aa..702fb62c4a2f6b895100a23827faa84fb96c6eb3 100644 (file)
@@ -20,7 +20,7 @@ class Y {
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                Y y = new Y (1);
 
index 76f32c90674105de462b2df16bd630241914a8a0..d0ce8685a222a95a33beaea90d613fc3f916512e 100644 (file)
@@ -4,7 +4,7 @@ class X {
        }
        const A foo = A.x | A.y;
        
-       static void Main () {}
+       public static void Main () {}
 }
 
 
index 5bb9a0f525d58976199605ec2a303509f2386dad..31220ac9856c857fd4652749fa71e5470b7f316d 100644 (file)
@@ -6,7 +6,7 @@ public delegate double Mapper (int item);
 
 class X
 {
-        static int Main ()
+        public static int Main ()
         {
                 Mapper mapper = new Mapper (delegate (int i){
                        return i * 12; });
index 91df691e6387bc0a01e3d937d42db61603f3272e..c2ebc9ac00079fbf05c5cab6adbecf54e7a91f1e 100644 (file)
@@ -9,6 +9,6 @@ namespace A.B {
        class Tester {
                internal static Y1 y1 = Y1.x1;
                internal static Y2 y2 = Y2.x2;
-               static void Main() { }
+               public static void Main() { }
        }
 }
index f0bc4c42924095b47f4ec0d4a721acbd935e6121..b9a27b299174486ff4fb0b1ac694cd6a672e77fb 100644 (file)
@@ -7,7 +7,7 @@ namespace A {
                using Y;
                class Tester {
                        internal static Z z = Z.x;
-                       static void Main() { }
+                       public static void Main() { }
                }
        }
 }
index 3ef16470b75db94b78b5d0badd1b3268bbc202ca..b63f4a2447721bc3971d1f42bfcb379ae52c2d0d 100644 (file)
@@ -10,7 +10,7 @@ class X : Attribute {
                        ID = 55;
        }
        
-       static int Main () {
+       public static int Main () {
                object[] attrs = typeof(X).GetCustomAttributes(typeof (X),false);
                if (attrs.Length != 1)
                        return 2;
index 0c28ce2795b1e79f5008925a1b03180b66bed93f..96f32bdb0e4e6f673d9aec13f737ce7b792619b3 100644 (file)
@@ -31,7 +31,7 @@ public class Fifth : FirstOuter.FirstInner.First {}
 
 class Application
 {
-       static int Main(string[] args)
+       public static int Main(string[] args)
        {
                FirstOuter.FirstInner.First V1 = new FirstOuter.FirstInner.First();
                FirstOuter.Second V2 = new FirstOuter.Second();
index 15c1698560fe5d930c8cc8096b2261e7dfccdf17..3a3fa67661a4a6805b309e7059bd8b97f99514fe 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static void Main ()
+       public static void Main ()
        {
                System.IFormattable foo = -1;
        }
index 20cc507fd9ffe7853d2509ae4040a4bd8a247a07..e8fdbb929024103db47f8b419cebd0594d64db9f 100644 (file)
@@ -3,7 +3,7 @@ namespace Test {
        namespace Foo {
                namespace Index {
                        public class CompoundFileReader : Bar {
-                               static void Main () { }
+                               public static void Main () { }
                        }
                }
        }
index 2b128cc13e3fcbd87ca56ec932a1cd2abf36f2f0..03f5225a31999acadf5253b6e1d7e2e41e4180e4 100644 (file)
@@ -5,7 +5,7 @@ class X {
        delegate void D (out int a);
        static void C (out int a) { a = 5; }
        
-       static void Main()
+       public static void Main()
        {
                (new B (A)) (1, 2);
 
index a180d5f011dcc9e3de750e0db598f37e81147657..ed2c6f337f7e3e8c4e9165dfcfeefe58db1a9314 100644 (file)
@@ -14,7 +14,7 @@ class X
        static void Test ()
        { }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X (Test);
        }
index 1055cf4250c90fc6f654a9aa2beff599b6057a66..f8e44c319491e7bdeab5e4681c7c6424669187d6 100644 (file)
@@ -10,7 +10,7 @@ public class C
 {
        public static int[] field = new int [] { 66 };
 
-       static int Main()
+       public static int Main()
        {
                unsafe {
                        SS* ss = stackalloc SS [10];
index 794b941ffff2168e30f3948e09ee218f3b6910c1..77e96f8bbf800cc14f3f671e61470641cdcf2bd0 100644 (file)
@@ -5,5 +5,5 @@ class X {
        static void Concat (params string [] ss) {
                throw new Exception ("Overload resolution failed");
        }
-       static void Main () { Concat ("a", "b", "c"); }
+       public static void Main () { Concat ("a", "b", "c"); }
 }
index 82c015c0ce9f25772414a1e7839de3a723673186..320c85f608c9a74dcd05b521a2e74ccb78976218 100644 (file)
@@ -4,7 +4,7 @@ delegate void Y ();
 
 class X {
        public event Y y;
-       static void Main (string [] args)
+       public static void Main (string [] args)
        {
                X x = new X ();
                x.Foo ();
index df36d1bd40f6f10ca3babd964ab6f442cc367a3f..e974e6dec7ae941ad93d1d8daadf58bda1d2ab98 100644 (file)
@@ -4,7 +4,7 @@ namespace TestMethods
 {
        class Class1
        {
-               static int Main()
+               public static int Main()
                {
                        int test_int = 1;
                        TestClass testClass = new TestClass();
index 040c6c3e87f5c5fc06f0a0dce015219fd55d1d91..c19e0657245e5a1d3862f85b654e0489e918bdfa 100644 (file)
@@ -46,7 +46,7 @@ class Test
        static int a = b = 5;
        static int b = 0;
                
-       static int Main ()
+       public static int Main ()
        {
                if (a != 5 || b != 0)
                        return 1;
index d9bc1d8338e92bf0e57d25bd53587e9ea35e0cef..c6ed09797de6717ee5ce3947645b1ad48d470ae0 100644 (file)
@@ -18,7 +18,7 @@ class X {
                System.Console.WriteLine (" " + x);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int ok = 0, error = 0;
                
index 1daf45a672cb943454702e7cd08aba1aa9191b94..88eb62de1be32c7f0108aeebe2fab113a2653818 100644 (file)
@@ -12,5 +12,5 @@ public class A
 [A.B()]
 public class C
 {
-       static void Main () {}
+       public static void Main () {}
 }
index 3e7e4d820dc1b9020f626b4a345bcfe5616cbd9a..2d2463ee8313c324ee60deca31dd894fd62ccec6 100644 (file)
@@ -2,7 +2,7 @@ namespace Test {
        delegate void Foo (string x, params object [] args);
        class Testee {
                static void Bar (string x, params object [] args) {}
-               static void Main () {
+               public static void Main () {
                        Foo bar = new Foo (Bar);
                        bar ("Hello");
                        bar ("Hello", "world");
index 12e96aa8ada09d7dfca95109de102a6bea4813fe..c648814beb16912bfdf3efefdb90df2f5d4600e7 100644 (file)
@@ -3,7 +3,7 @@ class MYAttr : System.Attribute {
 
 [MYAttr]
 partial class A {
-  static void Main () {
+  public static void Main () {
   }
 }
 
index 15751c19af71e04ab23ecf77cf6c458cfaecc4ca..7700ad63b102ed5f92410cb8de553db0f141ffd4 100644 (file)
@@ -1,5 +1,5 @@
 public class MainClass {
-        static void Main () {
+        public static void Main () {
                 const int size = sizeof(int);
         }
 }
index 214a42566e614ca6610bb909d6996557b59c4ab8..da12b228be7e15c203ff35aa5225c6c4d660aeaa 100644 (file)
@@ -16,7 +16,7 @@ namespace Foo {
        partial class Bar
        {
                public Bar () {}
-               static void Main ()
+               public static void Main ()
                {
                        if (new Bar ().f == null)
                                throw new System.Exception ("Didn't resolve Sd.F?");
index c436c318e776c1fd207e7854a5d78b96fac5428b..dc6fafe434623ae22c6e0fd9837902b10531acc4 100644 (file)
@@ -18,7 +18,7 @@ struct X {
 class Y {
        static X x;
 
-       static int Main ()
+       public static int Main ()
        {
                int total = 0;
                x = new X ();
index c3b712e5c7d2c6e51edc966925034bfeaeee5348..de5855f470c27477fe01d2848c07cc90c7b228ab 100644 (file)
@@ -2,5 +2,5 @@
 
 [X]
 class Test {
-       static void Main () { }
+       public static void Main () { }
 }
index 36fd9b0bcc0bcdb67d3a3cd1f39871aae588724c..1595c5ca8e5e1c2fc6ad298a7d42e11172883333 100644 (file)
@@ -1,6 +1,6 @@
 class C
 {
-       static void Main()
+       public static void Main()
        {       
                try {
                    Test ();
index d27786db7a9fc9e02efe7a287112d6cf6cf27b5e..dbfb6e142eea5cd3dcace2f0b936c0a402abde45 100644 (file)
@@ -9,7 +9,7 @@ class X {
 
        delegate int Foo ();
        
-       static int Main ()
+       public static int Main ()
        {
                int x = t1 (1);
                if (x != 1)
@@ -41,7 +41,7 @@ class X {
        // This is just here to check that it compiles, but the logic is the
        // same as the ones before
        
-       static void Main2 (string[] argv)
+       public static void Main2 (string[] argv)
        {
                Console.WriteLine ("Test");
 
index 26a533b992f8320adfb876191045976129d6dcce..afd0dbfec9f82d1faef635e98eacc0a506812786 100644 (file)
@@ -17,6 +17,6 @@
                                LiteralType.Void
                        };
                        
-               static void Main () {}
+               public static void Main () {}
        }
 
index f3380e9230b7b9621aadbf57d28b5bed3af2cfbf..56ca7a85fafa57874e44867b82cdfbc9f147b5a5 100644 (file)
@@ -12,7 +12,7 @@ struct foo2 {
 
 class C
 {
-       static int Main ()
+       public static int Main ()
        {
                foo2 f = new foo2 ();
 
index 8ad2a80e890510e177b8e37590b74e591604f8f4..8b6766664e946c9cd169956908c88144114afe6c 100644 (file)
@@ -9,7 +9,7 @@ public interface ITest {
 }
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                return typeof (ITest).GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Length;
        }
index b8bc6c916d734b53207f54056ce7cb828037bfa1..db9f694f2879cc2d2d70b2b534a8d47d84c26c6b 100644 (file)
@@ -1,6 +1,6 @@
 class X {
 
-       static void Main ()
+       public static void Main ()
        {
                int n = 0;
                
index c20adfe27ccbfa600c3e533eb9df4941af3311e5..5fa2f9ce434d44644f937fd6edd7d006717250dd 100644 (file)
@@ -13,7 +13,7 @@ class Test {
 
        public override int GetHashCode () { return 0; }
 
-       static void Main ()
+       public static void Main ()
        {
                Test y = new Test ();
                if (y == null)
index 88f2843947c5f10d7234a88c13ab2bdfc196d7af..df19308da57044a1f76e81308705d7d0096093dc 100644 (file)
@@ -102,7 +102,7 @@ class X {
 //               return 0;
 //       }
 
-       static int Main ()
+       public static int Main ()
        {
                int v;
                
index ae7d46df6d6efb14a257a70ea501789bf34ba08a..052c5f352a8f1f118f90b2db01a0b4f0f4ca9d3b 100644 (file)
@@ -5,7 +5,7 @@ public class X
                hello = true;
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index e95a4e713b6860c3f0930a3195b37039f21384c4..f4dfc85b82c17d83709c94e62867d90e44b44ceb 100644 (file)
@@ -6,5 +6,5 @@ internal class Rest
 {
        protected const int foo = Test.foo;
 
-       static void Main () {}
+       public static void Main () {}
 }
index e4d74b1c32c9fa413fa336e9371bd795f8e2e91e..019f48b008a7f632f312ed244aaf3f711442b414 100644 (file)
@@ -14,5 +14,5 @@ class c : a
                b d_var;
        }
 
-       static void Main () {}
+       public static void Main () {}
 }
index 73a388353f2bba0e10504ee157efe64e0315aa8c..24997e8dd06238e703bd86f500e929e7edea5c93 100644 (file)
@@ -70,7 +70,7 @@ class Y {
 
 class Test {
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                Y y = new Y ();
index 1122b48f2d828fce6aa8d131b82b5565faded6f2..23c34d049abd8916ab02584d263b831c9f275452 100644 (file)
@@ -1,7 +1,7 @@
 // Compiler options: -unsafe
 
 class T {
-        static unsafe int Main () {
+        static unsafe public int Main () {
                 int *a = null;
                 int **b = &a;
                 if (*b == null)
index 0ba8af290e57331797034aadc8890815193e8b6d..8ac9678ddf7d02013ba09644a3b406c0c76b1ea8 100644 (file)
@@ -3,7 +3,7 @@ using System.Reflection;
 
 class Dec {
        public const decimal MinValue = -79228162514264337593543950335m;
-       static void Main ()
+       public static void Main ()
        {
                System.Console.WriteLine ("Compiler said value is {0}", MinValue);
                FieldInfo fi = typeof (Dec).GetField ("MinValue");
index 59fb697812dd0a47c9467f5832e8d560c5790964..9a7c0e9c36d51ba5921b93ac966422f3e78b3aff 100644 (file)
@@ -16,7 +16,7 @@ class X
                Foo = 20;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                Test ();
                if (Foo != 20)
index 274070e2921500c7c013178f923a18211cf96f1e..b91c61a52eb2bac31183c17580b0e4b64ed6deef 100644 (file)
@@ -1,5 +1,5 @@
 class Test {
-        static int Main ()
+        public static int Main ()
         {
                 int i = 5;
                 switch (i) {
index 680a35523cd9fa3b7de174ce983da8739e71f8ef..289713505ef9fb0161781ec6c884ea23e5945161 100644 (file)
@@ -16,7 +16,7 @@ public struct ObjectID {
                return new ObjectID (l);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                ObjectID x = new ObjectID (0);
                decimal y = x;
index 9eba405cec4a8c185f93389894da634ac8483eca..fecc935f6d6a835861dcce8cde0041b86c6d061a 100644 (file)
@@ -60,7 +60,7 @@ using System;
                 return new C (name);
         }
 
-        static void Main ()
+        public static void Main ()
         {
                 MethodHandler a = MethodSampleA;
                 MethodHandler b = MethodSampleB;
index d1fd42ed54ab3c2b3e1898da5fa904d104a7d9c4..01c25f351267867e3b025a6d16da85fbeeb670f8 100644 (file)
@@ -70,7 +70,7 @@ using System;
                 return value.Name + " " + value.Value;
         }
 
-        static void Main ()
+        public static void Main ()
         {
                 MethodHandler da = MethodSampleA;
                 MethodHandler db = MethodSampleB;
index e63ebc73d4dc2824a66e11c54f843ded716d0dba..f8c570f5cd12911d8c51f7c984b3533cabe0fbe1 100644 (file)
@@ -62,7 +62,7 @@ using System;
                 Console.WriteLine ("c = {0}, {1}", c.Name, c.Value);
         }
 
-        static void Main ()
+        public static void Main ()
         {
                 MethodHandler mh = MethodSample;
 
index 0826a6f09057c3fc2ee2373eac67bbda399a62ca..d8cc6f02d20be111260e1c4be6b4ca0be0b2f20a 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
  public class Tester {
 
-        static void Main ()
+        public static void Main ()
         {
                 A a = new A (8);
                 B b = new B (9);
index 5a0adf0e893a38afcfe39f61210e48e27650a4c9..d800b4f702ff3e47f98e9debbd002c5edd5ae868 100644 (file)
@@ -14,7 +14,7 @@ class TestVararg
                F (__arglist);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int result = Vararg.AddABunchOfInts (__arglist ( 2, 3, 4 ));
                Console.WriteLine ("Answer: {0}", result);
index 3023f6e9d1b2267955582a688e67a731857f600c..f21cb71a83f6481f92f6910078a3b2b8d48b463e 100644 (file)
@@ -13,7 +13,7 @@ class X {
                int_selected = true;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
 
index aa1f15e100ba92dbfd4dde50248111a57540a5b4..b5369297d11dd74dcbae57ac185bb490f7670f3b 100644 (file)
@@ -157,7 +157,7 @@ unsafe class X {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int v;
 
index 7293b24e93d3dad7cd239f7289e69a16035202fa..bf237ea3cabe09567b1a98ebefb3432863dcfb58 100644 (file)
@@ -6,7 +6,7 @@
 //
 using System;
 unsafe class X {
-       static int Main ()
+       public static int Main ()
        {
                char *ptr = stackalloc char [10];
                char *cptr = ptr;
index ee6fc0c606ab97e9b4f52eb2aced5283e81133e2..918173f01d092e92e5dda005df7e1574f2d0b4b7 100644 (file)
@@ -3,7 +3,7 @@
 using System;
 
 unsafe class X {
-       static int Main () {
+       public static int Main () {
                int y = 20;
                byte* x = (byte*)0;
                x += (long)y;
index cbb1e323ad08b390cffa997379c8cfecc504a4e8..c1fa56f67949c455ddc6742dfa4e79b86bfb1773 100644 (file)
@@ -13,7 +13,7 @@ unsafe class X {
                }
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if ((*get_v ())++ != 0)
                        return 1;
index 926a7fdf7e613363c56122d219e6845c77df08da..ee321936d36b1c2fe281f4badaeb48f0ff0ebd95 100644 (file)
@@ -19,7 +19,7 @@ namespace testapp{
         }
 
         class TestApp{
-                static void Main(string[] args){
+                public static void Main(string[] args){
                         LibTestAPI myapi = new LibTestAPI();
                         myapi.Create();
                 }
index f2aa9c4a43f15b31956a4e0869bd35f3e4ffd767..31a7b10feeee3fad5ac6aecad2013bc602126608 100644 (file)
@@ -7,7 +7,7 @@
 using System;
 namespace TestCase {
        public unsafe class Test {
-               static int Main(string[] args) {
+               public static int Main(string[] args) {
                        uint[] uArr = {0, 200};
                        uint[] uArr2 = {0, 200};
 
index 141e994a634b40ca380490f5e81ed4b38c3182d0..a1649cfd237c31f6b63713d062e349b7f5bedc1e 100644 (file)
@@ -1,7 +1,7 @@
 // Compiler options: -unsafe
 
 unsafe class T {
-       static int Main () {
+       public static int Main () {
                int len = 10;
                int* x = stackalloc int [len];
                for (int i = 0; i < len; i++)
index f35fd3eb78558cca73eea36c4730e61dd5d64c39..44d8b1e097219a8fd1c66a71349919935e244a96 100644 (file)
@@ -11,7 +11,7 @@ using System;
 unsafe struct X {
        int x, y, z;
        
-       static int Main ()
+       public static int Main ()
        {
                X* foo = null;
                
index cdf1fd45f899f73925b7e694cd349479a6c505a5..faf2e19bbf82153436c961ef1d1e904ffb7182aa 100644 (file)
@@ -44,7 +44,7 @@ class X {
                        k = 2.0;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int a = 1;
                uint b = 1;
index 6e993d3950ba30ff8e7f3a1eff746d15662cdcc5..6c69e20054a4f09a16d94d2ba6446d905529f10d 100644 (file)
@@ -1,7 +1,7 @@
 // Compiler options: -r:test-419-2-lib.dll -r:test-419-3-lib.dll
 
 class Test {
-        static void Main () {
+        public static void Main () {
                 Provider p = new Provider ();
         }
 }
index 684324b8f934857bdcbb75ba1c352eba080d022d..1120be6206f1557fdc69c4a32bdca02902dc626d 100644 (file)
@@ -140,7 +140,7 @@ class Y {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                int c;
index 99efeda89be53836bd6537b6d937a65c58be538d..b5b2a9eece84dcf5a9fb881e82ab60a05d730b2f 100644 (file)
@@ -1,7 +1,7 @@
 // Compiler options: -r:test-419-3-lib.dll -r:test-419-2-lib.dll
 
 class Test {
-        static void Main () {
+        public static void Main () {
                 Provider p = new Provider ();
         }
 }
index f50fb72414ec7e62b57ae1827b5a593da50281c5..a19cfc2f20f44fb31a53cf85a614e5b0215624ff 100644 (file)
@@ -10,7 +10,7 @@ unsafe class Test
                        lowLevelCall (pi);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                int i = 0;
                Func (out i);
index 40d7acea3213bdd91fa4385770289b7483e91062..db74ddb25018817db39809437c813cc01c13cdd8 100644 (file)
@@ -1,7 +1,7 @@
 using foo = System;
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                foo::Console.WriteLine ("hello");
        }
index 84d76cdc30cd71eceb7c276840e53660e3b0c94b..95da2cd9284c690976c761858ff82264f51710d8 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static void Main ()
+       public static void Main ()
        {
                global::System.Console.WriteLine ("hello");
        }
index 5a3e131f6862b6b75570a783c813acaeda65fc5f..85d8e37f74b475636d35311651ea44d1a564f277 100644 (file)
@@ -4,7 +4,7 @@ class A { }
 
 class X {
        class A { }
-       static void Main ()
+       public static void Main ()
        {
                globalA a = new global::A ();
                System.Console.WriteLine (a.GetType ());
index 0a137419ba3063bc1572d7deb977988a0861aeee..be9b0a19a75414ee88b01467da337258d2530bd3 100644 (file)
@@ -9,7 +9,7 @@ namespace Foo {
 class A { }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                A a = new global::A ();
                System.Console.WriteLine (a.GetType ());
index e93e1085b2d08d98cb30addc581d9b62fa8549f0..0af13f130c8af3dda77d894fd62fd496ac99f750 100644 (file)
@@ -72,7 +72,7 @@ class X {
                return (total == 46);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int [] a = new int [10];
                int [] b = new int [2];
index cf3014012953e45644f9c709d994e6ebb48fdf64..b4d94871a5284db2a95baa0b6666eb8dd0f2d61a 100644 (file)
@@ -4,7 +4,7 @@ class A { }
 
 class X {
        class A { }
-       static void Main ()
+       public static void Main ()
        {
                global::A a = new globalA ();
                System.Console.WriteLine (a.GetType ());
index 9edd449fea247ad19a5316d02cf0b6d2ab566ee8..3db7321d990fa76058ed95e026ae9d6d32d6e516 100644 (file)
@@ -5,7 +5,7 @@ namespace Foo {
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                foo::A a = new Foo.A ();
                System.Console.WriteLine (a.GetType ());
index cc072697a4b91aac0e4b05a5ee1cf67494b8523e..06fce357280ddecdb2e0010285d1e87aeb134542 100644 (file)
@@ -5,7 +5,7 @@ namespace Foo {
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                Foo.A a = new foo::A ();
                System.Console.WriteLine (a.GetType ());
index 1391b2972629c9a857cc85da4e89040ed3f0ec82..962caea4003248c39a5ab8b0653a1af2fa402390 100644 (file)
@@ -6,7 +6,7 @@ namespace Foo {
 
 class X {
        static foo::A a = new Foo.A ();
-       static void Main ()
+       public static void Main ()
        {
                System.Console.WriteLine (a.GetType ());
        }
index c2e022d8cf39da6921675960f86ee85b16d01e06..bce626aa366f2735439cba0ea5935440c8a969f7 100644 (file)
@@ -6,7 +6,7 @@ namespace Foo {
 
 class X {
        static Foo.A a = new foo::A ();
-       static void Main ()
+       public static void Main ()
        {
                System.Console.WriteLine (a.GetType ());
        }
index b3cfb04caf60492bb71880aa915635813e5dabb6..836eb62129f04e02237908ffca4ea32b1dcf7889 100644 (file)
@@ -2,7 +2,7 @@ using foo = System.Collections;
 
 class X : foo::IEnumerable {
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () { return null; }
-       static void Main ()
+       public static void Main ()
        {
                System.Collections.IEnumerable x = new X ();
        }
index 19130d7ca0e342f939fa7c4f3d13cd428a8b1217..d8f742537d54fda1bc15633a92ad249e81a617b9 100644 (file)
@@ -2,7 +2,7 @@ using foo = System.Collections;
 
 class X : foo::IEnumerable {
        foo::IEnumerator foo::IEnumerable.GetEnumerator () { return null; }
-       static void Main ()
+       public static void Main ()
        {
                System.Collections.IEnumerable x = new X ();
        }
index c1b896a58140acb7237d927dea3fdac7b51f89e4..fa0367ea3c2d12be37b1240884f9fb08fe0f7485 100644 (file)
@@ -31,7 +31,7 @@ class X {
                return total;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int [,] b = new int [10,10];
 
index 44968fe0de1f8ed9cff41b12be3546e6ff090d95..6074e70860f0ecb9424f0e46755aa9e4e3686761 100644 (file)
@@ -4,7 +4,7 @@ using System;
 
 namespace ConsoleApplication1 {
    class Program {
-       static unsafe void Main(string[] args) {
+       unsafe public static void Main(string[] args) {
            int[] i = new int[] { 10 };
            fixed (int* p = i) {
                int*[] q = new int*[] { p };
index 0ac69338044379406f87688fb89cb0c909b0c840..a1fb616c68d1c52156d0baaafafa75a11b94212e 100644 (file)
@@ -25,4 +25,4 @@ namespace System.Web
        }
 }
 
-class Test { static void Main () { } }
+class Test { public static void Main () { } }
index 0b39470d8216596b042bc74587449e022fc5e910..033753cb9554d39cedbe7eaa681845fbb6d5a0d0 100644 (file)
@@ -10,7 +10,7 @@ using System.Threading;
 
 class X {
 
-       static void Main () 
+       public static void Main () 
        {
        }
        
index 64d52f609725e455d03ba099491f66047966acce..b803026fa3cb328ea40a743b0889d9cc33abbc51 100644 (file)
@@ -4,7 +4,7 @@ enum Foo { foo };
 
 public class Test
 {
-        static void Main ()
+        public static void Main ()
         {
                 ValueType vt = (ValueType) 1;
                IComparable ic = (IComparable) 1;
index af82adcf4d6a8fc49786d33b6059c8d12f11db7b..5eac49b5eb773a3ae1a1aabe8764cd9e31b14ad3 100644 (file)
@@ -5,7 +5,7 @@ class Foo
 
 class Test
 {
-        static void Main ()
+        public static void Main ()
         {
                 Foo Foo;
                Foo = Foo.x;
index 754f344ae969d8d147b90d8ed521fb01e9dc4961..617f42d9b07acdffbce842b99a07ce8f04da3e66 100644 (file)
@@ -7,7 +7,7 @@ struct Foo {
 }
 
 class Test {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo ();
                System.Console.WriteLine (foo.GetHashCode ());
index 7d2a243a968a3380b49389f4894073933f9d71c2..17d4d1b6f3288646ce7dc515175baef0f91f02ca 100644 (file)
@@ -12,7 +12,7 @@ struct Foo {
 }
 
 class Test {
-       static void Main ()
+       public static void Main ()
        {
                Foo x = new Foo ();
                x.foo ();
index ca8b4aa92ef82a9abd6ebfbb0aff4079835a17d4..8a902b9c5504be36227809341ba70c02613ccaf4 100644 (file)
@@ -19,7 +19,7 @@ class Number : INumber {
                System.Console.WriteLine ("IInteger.Add (int d)");
        }
        
-       static int Main ()
+       public static int Main ()
        {
                INumber n = new Number ();
                n.Add(1);               
index 6a4aa000a0b3ec4c393326f76543f50904eb8e72..05721c54bfcadee3cf3a6d4101b2f6b73789424e 100644 (file)
@@ -17,7 +17,7 @@ class X {
        static double cast_double (object o) { return (double) o; }
        static bool cast_bool (object o) { return (bool) o; }
 
-       static int Main ()
+       public static int Main ()
        {
                if (cast_int ((object) -1) != -1)
                        return 1;
index c417994c029aba8a652d3db7f52d734d147b84ab..e614bc4c5f6cc34a902a27efed86cabf81b1aefe 100644 (file)
@@ -10,7 +10,7 @@ class X {
                ok = true;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
 
index af85e78a4e2dacf4927a201dfe1aaa918ed9e77b..5224bed390e400d02fe762458de4d975e2c60b69 100644 (file)
@@ -10,5 +10,5 @@ class PathItemBase {
 }
 
 class X {
-       static void Main () {}
+       public static void Main () {}
 }
diff --git a/mcs/tests/test-468.cs b/mcs/tests/test-468.cs
deleted file mode 100644 (file)
index 9d3e0dd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-       [ComImport, GuidAttribute("E5CB7A31-7512-11D2-89CE-0080C792E5D8")]
-       public class CorMetaDataDispenserExClass { }
-
-       [ComImport, GuidAttribute("31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3"),
-       CoClass(typeof(CorMetaDataDispenserExClass))]
-       public interface IMetaDataDispenserEx { }
-
-       
-public class Test
-{
-       public static void XXX ()
-       {
-               IMetaDataDispenserEx o = new IMetaDataDispenserEx();
-       }
-
-       public static void Main()
-       {
-               /* It doesn't work on Mono runtime
-               IMetaDataDispenserEx o = new IMetaDataDispenserEx();
-               if (o.GetType () != typeof (CorMetaDataDispenserExClass))
-                       return 1;
-               Console.WriteLine ("OK");
-               return 0;
-               */
-       }
-}
index 9e22abaa27339990a9eeafe65e146f826593e136..5d62dbf895ce6c906d13851fae6bf57702bf5c4b 100644 (file)
@@ -24,7 +24,7 @@ class Lambda {
                };
        }
   
-       static int Main () { 
+       public static int Main () { 
                Del[] d = Make2(10);
                d[0](10);
                if (v != 20)
index c269d0b6c712a2082c200004db2d2d1679ee211c..85686e1c6ce3e9aae5c1acfb2df7488e138d6c21 100644 (file)
@@ -22,7 +22,7 @@ class X {
                return true;
        }                       
        
-       static int Main ()
+       public static int Main ()
        {
                if (t () && t ()){
                        f_count--;
index 5c5aba149b186c8f95d39a009117f2a3d57b0357..1dc30703d7c6369a56965d9c97c92f244cc15680 100644 (file)
@@ -13,7 +13,7 @@ class X
 }
 
 class Demo {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 839a83c5f22045b8c9a72dcd281ed179bfacb021..1bbdeacd9d34c11f9cfa86fa4e776a4f80047587 100644 (file)
@@ -10,7 +10,7 @@ class Test
 
         int prop = 0;
 
-        static int Main()
+        public static int Main()
         {
                 MethodInfo mi = typeof (Test).GetMethod ("set_Prop");
                 if (mi.GetParameters ().Length != 1)
index 09408fb2a6541e910174ff5af8331559ed4134ef..42357f22e0faa99b815a1e7cfcbd24784d57f5cb 100644 (file)
@@ -2,7 +2,7 @@
 // on captured params.
 
 class Z {
-       static void Main ()
+       public static void Main ()
        {
                TestPreinc (1);
                TestPostinc (1);
index 71d7b7609a14ae877d070e2201d8a17e8da93c68..638e2fa29e0eee4f3eedb137ff5d5cde8dcd4a8d 100644 (file)
@@ -7,6 +7,6 @@ namespace Test{
        public override int GetHashCode(){  
            return 1;  
        }
-       static void Main () {}
+       public static void Main () {}
     }  
 }
index a7eaa98641f004c8852325cee8a2fa829ddc9c3a..935563db6d6b284b4bdb7b0657fca88c2a110914 100644 (file)
@@ -5,7 +5,7 @@ class X {
         public void M4(int arg) { }
         public void M4(int arg, __arglist) { }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index d692ea9b9420eff33e24637705f21ddd8fb8e424..1d37d5e97d0414140d25ce3365fb989b581843dc 100644 (file)
@@ -17,7 +17,7 @@ struct X {
                
                pass = (n == 2);
        }
-       static int Main ()
+       public static int Main ()
        {
                new X (null);
                return pass ? 0 : 1;
index 62794ff50b836ac6fffe5d5a06b2a1b225ca2f73..b0d59895a25f9624c6a35f5ab8b7a2624939a911 100644 (file)
@@ -12,7 +12,7 @@ struct Q {
 class Test {
        static IEnumerable foo () { return null; }
 
-       static void Main ()
+       public static void Main ()
        {
                IEnumerable f = foo ();
                if (f != null)
index 1f36b80aec3050d850bd8742f260b3094e4e1690..866410dc165e17d63e7a369b74c5b2f0f3a0387f 100644 (file)
@@ -7,5 +7,5 @@ FULL::System.Collections.Specialized.NameValueCollection;
 
 public class test
 {
-       static void Main () { }
+       public static void Main () { }
 }
index 6ff0c2cb4332032bc0c41ef1bfc7ea4e6460893c..c9aabd35775024f8e8bef667faa29a0d7a5efb37 100644 (file)
@@ -580,7 +580,7 @@ class X {
                }
        }
        
-       static int Main ()
+       public static int Main ()
        {
                byte b;
 
index 4394a0f4e23e60837819c05a07f4b0539a1f1dc1..61fd1f016c86c687dc5899fba0586356297aadcb 100644 (file)
@@ -1,5 +1,5 @@
 class T {
        static int[] a = {1,2},
                b = {3, 4};
-       static void Main () {}
+       public static void Main () {}
 }
index 45d65cf0f06335882b75381ec444229537d59268..aea7430097c2dc2d1354ea01845d842ac0b14686 100644 (file)
@@ -36,7 +36,7 @@ namespace Test {
        [My1(null)]
        [My2(new string[0])]
        public class Test {
-               static public int Main() {
+               public static int Main() {
                        System.Reflection.MemberInfo info = typeof (Test);
                        object[] attributes = info.GetCustomAttributes (false);
                        
index b427f77f889b0ead2e10929c4778136aaff139bb..ef804e1c5c7e209f751e565c74892faf8dd2f01c 100644 (file)
@@ -7,5 +7,5 @@ class B : A {
    }
    
 class C : B {
-       static void Main () {}
+       public static void Main () {}
 } 
index f788907b6b22be9cf71e6a5d767312400674c1ab..fac65920b954cf04196384c8ecbbf1e15a081cd1 100644 (file)
@@ -3,7 +3,7 @@ using System.Text;
 namespace Agresso.Foundation {
        public class Function
        {
-               static void Main () {}
+               public static void Main () {}
        }
 
        public delegate void Translate(Function callback, 
index 9227036048256edb67afdc8ac6e124d918a8128f..176a1e17cb8ca585b420a3db12701b20272142db 100644 (file)
@@ -23,6 +23,6 @@ namespace plj
        
        public class fromClass
        {
-               static void Main () {}
+               public static void Main () {}
        }
 }
\ No newline at end of file
index 0d2669427bfb182a189387cbab084bc19eef3ad1..6cad8c7c9504f3c9c67ee2ff8a61d3d5b67161a8 100644 (file)
@@ -17,7 +17,7 @@ public class PlotMenuItem
                child.Callback += new EventHandler (callback);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                PlotMenuItem pmi = new PlotMenuItem (new EventHandler (MenuItem_Click));
                pmi.Callback (null, null);
index 3a0a669f50bcb7e85e03b2d3f2f8722a06a25d9b..2615f61d83fe755579ca2c6dc8db079d3c39ab9e 100644 (file)
@@ -14,7 +14,7 @@ struct A
 
 struct C
 {
-       static int Main ()
+       public static int Main ()
        {
                MethodImplAttributes iflags = typeof (A).GetConstructors()[0].GetMethodImplementationFlags ();
                if ((iflags & MethodImplAttributes.InternalCall) == 0)
index 7b3bdbc7924cab966aa73755d088485cbbc0bf4c..431d1944477529e8da2842f882e2b0b48748aba1 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                Console.WriteLine ("From 0 to 9");
                
index 97fbe5d3cfe89b4290be7c8e11ed011ca01458f9..684ecc6824248c5c02212e086fa98ce2d0e85b2d 100644 (file)
@@ -1,7 +1,7 @@
 class Base
 {
     public int Property { get { return 42; } }
-    static void Main () {}
+    public static void Main () {}
 }
 
 // TC #1
index e94e764a3489bb361402953db5164ab1caf58b46..755835e8a753d319032e32feee832a61877fa0e2 100644 (file)
@@ -1,7 +1,7 @@
 // Compiler options: -warnaserror
 
 class Foo {
-       static int Main ()
+       public static int Main ()
        {
                for (;;) {
                        try {
index b6fc7444e781a81c9c6f810ec9146396e7fe0ec6..0ce8deccba553eeaa293271146ef39cdd75d9c2a 100644 (file)
@@ -7,7 +7,7 @@ class T {
                        throw new System.Exception ("...");
                }
        }
-       static void Main ()
+       public static void Main ()
        {
                try {
                        i = f ();
index 640c24d9755b6b23cb0418eb8276972756a55694..5bfa4aac3f7e7638a51eb332323995b27d080d86 100644 (file)
@@ -19,6 +19,6 @@ namespace ProtectedSetter
                        }
                }
                
-               static void Main () {}
+               public static void Main () {}
        }
 }
\ No newline at end of file
index 3a6257747b6f3ee758d1ec77aca3d3c3f54eb3d9..6ff5c9deeb5a1c22d72312324a3a390f16347500 100644 (file)
@@ -81,7 +81,7 @@ class Derived : Base {
 }
 
 class boot {
-       static int Main ()
+       public static int Main ()
        {
                Derived d = new Derived ();
                return d.Test ();
index 6ae3e9f366c40e438e847e1cb27fe8d8e679eb1d..7bb35531a16c65f54c6634e30e88bd2f79358549 100644 (file)
@@ -6,7 +6,7 @@ using System.Reflection;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                Assembly a = Assembly.GetExecutingAssembly ();
                string[] resourceNames = a.GetManifestResourceNames ();
index 9ce875854eb10f6f3bc5a5347b87e4b51c95f88d..a1c1e7b4d7256c73f354a387fdc78b015bf1963f 100644 (file)
@@ -13,7 +13,7 @@ class X {
                throw new Exception ();
        }
 
-        static int Main ()
+        public static int Main ()
        {
                int ret = 1;
                try { HandleConflict (1); }
index ce0178d1b7cf51af68b133e17a882a3148fd47e2..95adf6258b1264148453baa8e247c3a80836f523 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static void Main ()
+       public static void Main ()
        {
                int i = 0;
                goto a;
index dde3fa3ece05e5e9309e58e3022472507da142e5..1e6396ce9787f425e00cf22a3682357828b7a48f 100644 (file)
@@ -3,7 +3,7 @@
 // Same as test-515, but we're checking that there's no "unreachable code" warning either
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                int i = 0;
                goto a;
index d4e4841de7a9e615562b6cbcfe42d8c50db66189..046d7a25184d33a0d5f60a98cf5b65065dde98e7 100644 (file)
@@ -1,5 +1,5 @@
 class Foo {
-       static int Main ()
+       public static int Main ()
        {
                int ret = 1;
                try {
index 1c78dbebe6061860f844837208656a7053453b95..35ca796e054812cb65e8e784fbb6ac37c38c3486 100644 (file)
@@ -1,5 +1,5 @@
 class Foo {
-       static int Main ()
+       public static int Main ()
        {
                try {
                        f ();
index fe5415c1ea7adff079f9b7887d718a9a547680b1..3ba6223a2c0f9c4e5029a618c51518b6760086a6 100644 (file)
@@ -32,7 +32,7 @@ class X {
                return new Y ();
        }
        
-       static int Main ()
+       public static int Main ()
        {
                //
                // String test
index 3d167030d6643a41fbacbb3d3f1f58665c26bdac..06d730a5125494ef48964bdaeed19841140fe0e2 100644 (file)
@@ -42,6 +42,6 @@ class T {
        }
         void stuff_finally () {
         }
-        static void Main() {
+        public static void Main() {
         }
 }
index 81f76806cc1cdafbecbf30da5464dff556e2da02..32d8300a07ec57450bb8b00cbfa123310324762c 100644 (file)
@@ -49,7 +49,7 @@ interface IM2 : IM1
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
        }
        
index 50232d9ef264491c81eb5e833780f9c9950e0be4..fcc8cd918ec5bede3788499a5365cdf0408e644d 100644 (file)
@@ -7,7 +7,7 @@ class Repro
   public int fc;
   private int sp;
 
-  static int Main()
+  public static int Main()
   {
     Repro r = new Repro();
     r.foo();
index ff6b38a909e8e3eacb26b76aa7b3fe6f6d649016..6e921d8bfa5035378c8ac09957a4fa63983a0c9f 100644 (file)
@@ -14,7 +14,7 @@ class MyDispose : IDisposable {
 }
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                MyDispose copy_a, copy_b, copy_c;
 
index a69661c0dadc2d2d76c70694aa8bb27fa0eaf1c0..66fbde75e50afc14aa5873b7b6c1f5c2d4b961c8 100644 (file)
@@ -5,6 +5,6 @@
 class X {
        static void e(params object[] args\u03c4) {
         }
-       static void Main () {
+       public static void Main () {
 }
 }
index e29e2f18736cac60645914975073b76a3a263211..6c85f26db7962a6f2465392499c14f14bc2f8c20 100644 (file)
@@ -5,7 +5,7 @@ class Test {
 
        static void True  (bool b) { False (!b); }
        static void False (bool b) { if (b) throw new System.Exception (); }
-       static void Main ()
+       public static void Main ()
        {
                True  (false == false);
                False (false == true);
index 8c859294e1bb2c412a9af4d7fae4948555c0da02..7985864991f352e94760cd00fd66836ad76deebf 100644 (file)
@@ -4,7 +4,7 @@
 [assembly: System.Reflection.AssemblyCulture("this-culture-does-not-exist")]
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index fabf3707e0924420cf71d4b8d1e3f15c2f158180..294c04e578be8e2588852396496096292d5c9130 100644 (file)
@@ -17,7 +17,7 @@
        
 using System;
 class X {
-       static void Main ()
+       public static void Main ()
        {
                UIntPtr a = (UIntPtr) 1;
 
index e0128cc6819722ecb74780e8b1ef90de5f82946c..cdef3da035a00d5e72c21436b6523295c0922a9a 100644 (file)
@@ -37,7 +37,7 @@ class Derived: Base
 
 class Test
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
\ No newline at end of file
index 2b93801f62e6b04a745d4c3e59ca50cce58ac2b8..ea0070d7616e4093029fa0aef7dfa6f1ca2f52f0 100644 (file)
@@ -3,7 +3,7 @@ using System;
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                //switching to a constant fixes the problem
                double thisIsCausingTheProblem = 5.0;
index 0eb5b69220467659af6badd836ef22f17077045e..c9c5dfcbc345a238dc64dfc1c0a1c1bc04d92dd9 100644 (file)
@@ -16,7 +16,7 @@ class X {
                return true;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }               
index 6b6c80eb4787d4017926ef7740ad965c6cf3f759..6acf8e3df3a36c5dcb1068e6caadb2db75b29d76 100644 (file)
@@ -22,6 +22,6 @@ public struct ARec
        }
 
 class X {
-static void Main () {
+public static void Main () {
 }
 }
index 606b89ad3f1f2304080c8a8d845a9e93185a8826..305dcb74a94497e1527ee81fe1a937e31879c278 100644 (file)
@@ -37,7 +37,7 @@ class MainClass
         }
     }
 
-    static void Main(string[] args)
+    public static void Main(string[] args)
     {
         MainClass t = new MainClass();
         t [2, "foo", "doo"] = 2;
index 5f93ad0dc0f0543382a771c3490c5b9649db873e..d56c5b2354f05532dad1a615399dc17fff9adaed 100644 (file)
@@ -4,7 +4,7 @@ enum ByteEnum : byte {
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                ByteEnum b = ByteEnum.One;
                
index 48ad7e3a139e8646e746754eaec4bfc1900948ec..a9c54ff07027069f408ad5c7e40eafcf2b860baf 100644 (file)
@@ -11,5 +11,5 @@ struct Dingus {
 }
 
 class X {
-       static void Main () {}
+       public static void Main () {}
 }
index c81ef45c8bcd4218338b180b2746d124f05b2679..f98a95235f4de99299966751d502cf2416b495e9 100644 (file)
@@ -23,5 +23,5 @@
        public class C
 #endif
        {
-               static void Main () {}
+               public static void Main () {}
        }
\ No newline at end of file
index 3a55f35f6cb19afb8c47108bcc377e2c12a9bb9e..3c826fcb412823db577765afebda02e4420e3a9e 100644 (file)
@@ -27,7 +27,7 @@ public class Do {
 }
 
 public class User {
-        static void Main ()
+        public static void Main ()
         {
         }
 }
index e9cced721edc44d4a831ea4b8bfee64195663d7e..4b428032bd43d5385f7b2dc228e1ce2f950ed4c6 100644 (file)
@@ -24,7 +24,7 @@ public class S
                const decimal dec = c;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                long i = 1;
                int i2 = 0xA0;
index d4256b3ba765c09cb461aa22b9654c310c1730b6..0cefda8a68e156f81383f9a9a3814a2011865c2a 100644 (file)
@@ -2,7 +2,7 @@ public class TestClass
 {
        delegate void OneDelegate (int i);
 
-       static void Main()
+       public static void Main()
        {
                OneDelegate d = new OneDelegate (TestMethod);
                d.Invoke (1);
index 286cb10dacd9a86700698a0bd4b7a33b0874e57d..b5ca96b7baf0e0ac242bc3d7633a6ea874c21aee 100644 (file)
@@ -52,7 +52,7 @@ class C : A {
 
 class M {
 
-       static int Main ()
+       public static int Main ()
        {
                B b = new B ();
 
index 882989de14babb38b76e5bcdaadb9fe4f74f9023..efbfbb493fcecc6dd68d6ce6d1263d685ee3997a 100644 (file)
@@ -7,7 +7,7 @@ class Program
     [DllImport("foo.dll")]
     public static extern void printf(string format, __arglist);
 
-    static int Main()
+    public static int Main()
     {
         if (typeof (Program).GetMethod ("printf").CallingConvention != CallingConventions.VarArgs)
             return 1;
index 179420c0098cae30935ba5631d6627b9ea5c71e3..424c7ff11db8f135eb8ac995dfb2a1fa90526e83 100644 (file)
@@ -6,7 +6,7 @@ namespace preservesig_test
 {
        class Class1
        {
-               static int Main(string[] args)
+               public static int Main(string[] args)
                {
                        MethodInfo dofoo = typeof(TestClass).GetMethod("DoFoo");
                        if ((dofoo.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) == 0)
index 6884ebeddadb586e832f7f7875e4e7f274dc7232..8aa00c88ead932bb9c696c3f1eecac987d99abe9 100644 (file)
@@ -8,7 +8,7 @@ enum A {
 
 class X {
 
-       static int Main () {
+       public static int Main () {
                try {
                        switch (0) {
                        default:
index f4de8ede5782a4965a0c30f0d3b39592b81de83d..1fc2f31d1126759fa573fbce64a63f390fb77b09 100644 (file)
@@ -7,7 +7,7 @@ using System.IO;
 
 class Program
 {
-       static void Main (string [] args)
+       public static void Main (string [] args)
        {
                using (StringWriter stringWriter = new StringWriter ()) {
                }
index bcf74ad75669d4921cf8d021b812a6127b92dda2..d865b5572b8ef200bba2f036b4297e087bdd3f64 100644 (file)
@@ -1,5 +1,5 @@
 class Foo {
-       static void Main ()
+       public static void Main ()
        {
                int a = 0;
                int b = 5;
index b2e6c68dd3105c7a4948c3f87a55988a4326dcee..9df2a493acda4d8ed41f70d56e5428c542011269 100644 (file)
@@ -2,7 +2,7 @@
 
 public class TestCase
 {
-       static int Main ()
+       public static int Main ()
        {
                int i = 0;
                {
index 44a2494190239c7f35b493bdf41e69fbc68d7e3b..d1b3aa552f88213670731100a449700825817b33 100644 (file)
@@ -1,6 +1,6 @@
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                IExtContainer e = null;
                ObjectContainerBase b = null;
index 30a2af18848a865c17d9f178a58a340708bc90fb..014b9b63e893b88c7c645df980022a8df83b6a3c 100644 (file)
@@ -20,7 +20,7 @@ class X : IA
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
                IA a = null;
                IB b = null;
index 328e3cea0ead9677b22a452cac7fedab8a59a0a4..896560673c41ef0c12245208383ead4c48079385 100644 (file)
@@ -1,6 +1,6 @@
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                MyColor [] c = new MyColor [1];
                c [0] += new MyColor (1.3F);
index ef2ae26bef4ff09e4bea376e6bf170303ff02c2b..65e34026c67e5872b660a7fc3314e75b8e279f7b 100644 (file)
@@ -1,6 +1,6 @@
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                int ctc_f = 0;
 
index f509b02053c4d1168ef4e95bb050d08c5f59a36d..9c0b24dcc573a98a686f7eb87fccfc16c9e22cc1 100644 (file)
@@ -71,7 +71,7 @@ class X {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int v;
                v = test_explicit ();
index f2b2bd03ebc8a73817c6fd4b8f458840a5313790..8390178dfe7d8e12ddb0327b3204cea83931a56d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                return x.Do ("a", "b", "c");
index 8ddf88f6c2cd1342fec7e8145e5d0e292f831b7d..23331fa6ef1b500e27dc4c9e83de3a0f611fa8d0 100644 (file)
@@ -61,5 +61,5 @@ class T {
                ;
        }
 
-       static void Main() {}
+       public static void Main() {}
 }
index c8e0cc6f68dfa9b3756c85b8fc946218fa22d5a4..2d0ff9ef9c7696194d4b38375800512fd6235120 100644 (file)
@@ -5,7 +5,7 @@ using System.Reflection;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var v = typeof (Test).Assembly.GetName ().Version;
                if (v.Major != 2)
index 42ff7b290079c6d59d1d58352c68ef903b5c3f55..e864ba5d97a23438f075d76a69507204273dfdf5 100644 (file)
@@ -25,7 +25,7 @@ class Program
                return dict [name] = value;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                SetDictionaryValue (null, new SymbolId (), 1);
        }
index b95d891b7c4179a7d2373563da6ee5b3cfb0037d..a90e0bf966270516d7b76d501cbb7049fe741668 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                Console.WriteLine ("From 0 to 9");
                int i;
index 5fe57a0b0dd8e41202795fef975da65003153278..7c328637faff7541c43e450d29033cc1fc8e2d39 100644 (file)
@@ -60,7 +60,7 @@
 #endif
 #else
 class X {
-       static int Main ()
+       public static int Main ()
        {
 #if (TEST)
                ns5.Y y = new ns5.Y ();
index c32bfb8b6745f418131f20e7d54cc746a02bd1d3..fee24efd5b9a659075fa5009b3b340e70d4cb35c 100644 (file)
@@ -14,7 +14,7 @@ namespace ConsoleApplication1
        {
                static Strct* ptr = null;
                
-               static int Main ()
+               public static int Main ()
                {
                        Strct* values = ptr;
                        values++;
index 1d3b01a38023dc29c4b878723436c653b7556fe0..789779e13ca775bd1e5218e32414bcd04713f833 100644 (file)
@@ -20,7 +20,7 @@ class Program {
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                object[] o = typeof (ImplementingExplicitInterfacesMembers).GetMethods (BindingFlags.NonPublic | BindingFlags.Instance);
                foreach (MethodInfo mi in o) {
index c9bed59a6e22be98205eb1ba883a45deb43863b8..466d14e8e3d7d366caf32a54231e06e85954bc62 100644 (file)
@@ -6,7 +6,7 @@ using Mono.Test;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance |
                        BindingFlags.DeclaredOnly;
index 5ddd47370932d513f32934250adb77446258323c..885be834068fcba74a33392a5509e566cd3bf606 100644 (file)
@@ -8,7 +8,7 @@ using System.Configuration.Assemblies;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Assembly a = Assembly.GetExecutingAssembly ();
                var an = a.GetName ();
index 9d8c8532b0f4e16c78aceff420e0694010dc2c98..639aaf6e6179f18e7de0ab94c62a9edf9616399d 100644 (file)
@@ -31,7 +31,7 @@ class X {
                remove { int remove = 1; }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index 0907ad049a90892ebbb7f151201189398f5e3e1a..f5660194ffc8868264f97ae1614f008522550ed8 100644 (file)
@@ -30,7 +30,7 @@ public class D2 : T
 
 public class Z
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 71a2a45b0894e9bd63ad7fe4a9c1b5439912549f..4141ba89fca486fdd0adf32bdce6a5cc09738a91 100644 (file)
@@ -347,7 +347,7 @@ public class XXX
            return false;
        }
 
-    static void Main ()
+    public static void Main ()
     {
     }
     
index 78b549a03f72d07e0ccbc0557e6baa9e6603cb4f..7d3e1583425fc6222dd9aaf0bf26c7609d971ab0 100644 (file)
@@ -34,7 +34,7 @@ class C {
                        return;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                value = 0;
                And ();
index c82983e68a3dbbfe18b0474e9a61b9c7c36d1bb0..1a1116efc9f32004e1dd7e4f1835411ddbb91327 100644 (file)
@@ -1,6 +1,6 @@
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                while (true) {
                        if (true)
index 550956009e0e713be4e3459c0ada151d1c74735d..340f40f4de18d8be199a44903633ff069c3626d1 100644 (file)
@@ -21,7 +21,7 @@ class X {
                return (int [,,]) null;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index 61f6eea2bce2f7ad348c3e59320012dcf4c945aa..96b13184d1410789edc5ce16f26279f82e241fa6 100644 (file)
@@ -15,7 +15,7 @@ class X {
                A (ref a);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int a = 10;
 
index af24ecc011b2d11a4b827d73096cc0e8168e606f..ec58418c56bc86f3b7b3e83565aa54cbb894d3af 100644 (file)
@@ -20,7 +20,7 @@ struct A {
 }
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                A a = new A ();
 
index 15193dde4768837bc000521f57ef350efff26e74..8ff008d257d6adde58d0c0eace6590da5f2e68af 100644 (file)
@@ -23,7 +23,7 @@ class X {
                value = new B (1);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                A o;
                Foo (out o);
index 03fce1597500f035a007dda377d538470a27ee9f..9021a6e2c7562a0c52fe15ee260bf4dc1e93b184 100644 (file)
@@ -15,7 +15,7 @@ class Y : X {
                return;
        }
 
-       static void Main () {
+       public static void Main () {
                Y y = new Y ();
 
                ((I) y ).a ();
index 47846f7c4c95b84901fd1656c30c645f9f41ee79..1b201225326eefd91520a37f3d0363cea7977ea3 100644 (file)
@@ -12,7 +12,7 @@ class X {
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Type t = (Type) null;
        }
index b48bc1893f7d6a1b4871bf791bceae2659ff16d9..01177eb188092b87a898cdca1591f811b927fa5a 100644 (file)
@@ -16,7 +16,7 @@ class X {
                int a = Location.Null;
        }
 
-       static void Main () {}
+       public static void Main () {}
 }
        
        
index 9293e2e0d0bb02a6ac06ce11251f8ed2e9481e4b..3680fe936dbd941eb42bb60c7adf4f886c2d140d 100644 (file)
@@ -9,7 +9,7 @@ class X {
        {
        }
                                
-       static void Main ()
+       public static void Main ()
        {
                int loop = 0;
                
index 22e9802759394ca65d22f2fd0da858cbba371a52..62f367ae3cce747bef8a25c43956220d78873384 100644 (file)
@@ -26,7 +26,7 @@ class M {
                object x = (N.B) N;
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 700811f13d0a74b3e8207057232fe23bcacbf819..d65143733ffdebcdcee73138c85377e756166be8 100644 (file)
@@ -40,7 +40,7 @@ public class Y {
 
        const EX myconst = EX.a;
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 268c607f7835affa263501cb4e61de104e1dfccb..4b2ca9a64a0ffaff8d142a805c5e3363a588bd7a 100644 (file)
@@ -4,7 +4,7 @@
 using System;
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                bool one = false, two = false;
 
index 22a5cbdbbbaef6f280ba7394ab859d3e2a0f5f0f..450ff4438885b546492b95afa2e9c697c0403f5b 100644 (file)
@@ -38,7 +38,7 @@ class Bug379822 {
                TestOr (var);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Test (false);
                Test (true);
index e843091b9ab2bacc7b3dd226165752f8912e3269..50dbb08d671a5280c99fa1cb48761d4016abc216 100644 (file)
@@ -7,7 +7,7 @@ class ShortCircuitFold {
   static void a (bool e, bool v) { if (e != v) throw new Exception ("unexpected value"); }
   static void c (int e) { if (e != calls) throw new Exception ("call count mismatch: expected " + e + " but got " + calls); }
   static bool f () { throw new Exception ("not short circuited out"); }
-  static void Main ()
+  public static void Main ()
   {
     // short circuit out f ()
     a (false, false && f ());
index e6aea951222685f818c233e8106b3bb25a2bba32..4dc161ba8cd1127ca97e6f0e9da791e86ed3face 100644 (file)
@@ -45,7 +45,7 @@ class Foo {
       throw new Exception ();
   }
 
-  static void Main ()
+  public static void Main ()
   {
     test_while (100);
     test_do_while (100);
index 6b751cfb1851e9e14cb9ad6f9519c779cf8efa91..9551aa9f612fc7d2ac5a7447996cf77bd20061ec 100644 (file)
@@ -2,7 +2,7 @@ using System;
 using System.Threading;
 
 class Fail {
-  static void Main () {
+  public static void Main () {
     string a = "";
     a += 0 + "A" + 1 + "B" + 2;
     EventHandler t = delegate {
index 4d4587dc36f7221b02c503ce500ba3282dc659ba..2b32d09f6c4c1ababbd3d9760ebf8fa045366aa6 100644 (file)
@@ -5,7 +5,7 @@ class Foo {
     set { if (!got || value != "A1B2") throw new System.Exception (); }
   }
 
-  static void Main ()
+  public static void Main ()
   {
     (new Foo ()).s += "A" + 1 + "B" + 2;
   }
index 43c31d7559e703d43b56129a6d6c8696f33622ce..434d689737e416662f57b70f1d7a4b4c4a4292bd 100644 (file)
@@ -19,7 +19,7 @@ class Blah {
 }
 
 class T {
-       static int Main ()
+       public static int Main ()
        {
                Blah b = new Blah (Blah.Operator.A);
 
index c128d5eca757400f39e6f2d698dada9755de1a57..6428c92a111d923d77c318219b32df39bdb28fed 100644 (file)
@@ -28,7 +28,7 @@ public class Identifier
                return -1;
        }       
 
-       static int Main ()
+       public static int Main ()
        {
                Identifier a = null;
                string b = "a";
index 8ee0d21d732a1e1aa1cb7670763c7e20ee33ad3c..f7204392ff0f28660a209d17185bcab900ead40d 100644 (file)
@@ -4,7 +4,7 @@ using System;
 
 class PointerArithmeticTest
 {
-       unsafe static int Main()
+       unsafe public static int Main()
        {
                try {
                        return CheckAdd((byte*)(-1), -1);
index 801f03fb59d802c21e5b4770683f51ffefb4e5eb..6051d12816fb29e720e656c63524380109a76235 100644 (file)
@@ -32,7 +32,7 @@ class Program
                return d == _value;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                Program p = new Program ();
                if (p.Test_2 ())
index b86ecee23428cf68175632b5e30ccdbc394130f0..e3df3fd59c38187a80b5a24c8835cb5b6953d6f8 100644 (file)
@@ -14,7 +14,7 @@ class Program
                return (uint) ptr;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                if (IntPtr.Size < 8) {
                        if (CastUIntPtrToInt64 (new UIntPtr (uint.MaxValue)) != uint.MaxValue)
index b117ae309a4ba23af0f8062b23dfc253028ba695..4ba623a1c6f1abb68080c3b6b9d1a11b956ad42b 100644 (file)
@@ -29,7 +29,7 @@ class X {
                return new S ();
        }
        
-       static int Main ()
+       public static int Main ()
        {
                object a = new S ();
                receiver (new S ());
index d49dfd61662c7eca900af8d4ac4beec7f83209ae..f573e9a645c60195279d69932c2970ae6f043aff 100644 (file)
@@ -8,7 +8,7 @@
 
 class App
 {
-    static void Main ()
+    public static void Main ()
     {
     }
 }
\ No newline at end of file
index 745aaaffc7dbb66e3f2e25523afd28051d99dae3..7d2a69dabe950e2fa0ee74b249f34c202a5cc75d 100644 (file)
@@ -4,7 +4,7 @@ using System;
 
 class Program
 {
-       static unsafe int Main ()
+       static unsafe public int Main ()
        {
                return Test ((sbyte*) (-1));
        }
index 30be98ddbfb7d53f6811fc7fb729bd9b5c2b0cb7..e7fc496e30cd906bc867f6389298d203e349c8a1 100644 (file)
@@ -11,7 +11,7 @@ public class D
                }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                D d = new D ();
                byte b = 1;
index 26c7e86efb71b387c00ae3692a553e670401683f..45c20b625ea3757d5c95973a3cc57d1fb3a33c9a 100644 (file)
@@ -4,7 +4,7 @@
 
 class Goo
 {
-       static void Main ()
+       public static void Main ()
        {
                string s = new Foo () ["foo"];
        }
index aefc2f85b56dc5b15bdebe24414569d46ebb7f1b..8e5c8fe1b7da832740b9cc959671a07151b5df1c 100644 (file)
@@ -13,7 +13,7 @@ namespace TestDebug
                        throw new ApplicationException ("1");
                }
 
-               static int Main ()
+               public static int Main ()
                {
                        C.Method (); // Only checks that DEBUG is defined in second file
                        
index de18b4f4835738056751ec3f38b77d8db013893e..8b332998df1fc845626e3344b912139f0d77b00c 100644 (file)
@@ -9,7 +9,7 @@ interface Iface
 
 public class MySubClass : Iface
 {
-       static int Main ()
+       public static int Main ()
        {
                MySubClass m = new MySubClass ();
                m [1] = true;
index 7691f6e73343f5ac79761a74b1551fa0a370b45d..d7415861acffdff4bb18668c5fa3d569fe220b86 100644 (file)
@@ -109,7 +109,7 @@ class X {
                return 0;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                FillSingle ();
                FillDouble ();
index ca1652b512aa320e5234861420146753b7dbea78..edff3d4ad05bde2c960afaa7734eb645715698c9 100644 (file)
@@ -2,7 +2,7 @@
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
        }
        
index a6e027c0665b026b2d28992b8b31fd3597a6dbfb..12764eff883175143bd9fa21f02149de615f8a97 100644 (file)
@@ -5,7 +5,7 @@ class Bar { };
 #endif
 
 class Test {
-       static void Main ()
+       public static void Main ()
        {
                new Bar ();
        }
index 5551d00e8ab05e785fe58ccda531297f703ecc69..27e9086b14f6adb143977d124865c7f3ad1be5b1 100644 (file)
@@ -5,7 +5,7 @@ enum E
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                E e = 1 - 2 + 1;
        }
index 817e8e2a38401037333d7ac647b6c9e1338e5da1..f6b992f384ebb1a5bea510c9e84c1a165c093fa6 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class C
 {
-       static int Main ()
+       public static int Main ()
        {
                return Bar (null) ? 1 : 0;
        }
index 9d8d5fb6c87a3e65fa2241eecdd706e890b26240..b50c96180b4bf8295d72c31f65f6604ea916c7d0 100644 (file)
@@ -14,7 +14,7 @@ class X
                get { return null; }
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index cbb5bb7a02265da129df739d8d542506c52428a9..9d810eb53e0c36376dbf1e90d31003968d21ce55 100644 (file)
@@ -17,7 +17,7 @@ public class NaNTest
                        throw new ArgumentException ("fails 4");
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Double.NaN < 0 || Double.NaN < 0)
                        throw new ArgumentException ("passes");
index 8514c9413593d4613f3c84473f112c9c7cf92825..d61be1d101446b14d77a61967b97e26271eaf30d 100644 (file)
@@ -16,7 +16,7 @@ class Y {
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                if ("Hello" != A.Hello.ToString ())
                        return 1;
index 9edbc9f70d5e3e383f535634a30ab3733854e983..1beb1136d2b0c4291295f28049677054d1777478 100644 (file)
@@ -4,7 +4,7 @@ namespace mono_bug
 {
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
 
                        // initialise so no null errors
index 0fde8568a34603e432368db49cffcc31f84db232..69fda793994dd895b96a7daa72d935c9ec6ddc1d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                string s = "test me";
                foreach (char c in s)
index b8e08be06374bcdf3da078087db825a9560b8317..310da7492f6089dc0f2bc0e059a145cc0f5ececf 100644 (file)
@@ -3,7 +3,7 @@ namespace Test
 {
        class Test
        {
-               static void Main () { }
+               public static void Main () { }
        }
 }
 #endregion
index 8366b3267c4558157c35b75aeb332531ade9999a..4fafcf7e531b6472e9c27cc4f66bd0740e8e1163 100644 (file)
@@ -10,7 +10,7 @@ namespace ConsoleApplication6
                static int* the_ptr = (int*) 0xdeadbeaf;
                static int** the_pptr = (int**) 0xdeadbeaf;
 
-               static void Main ()
+               public static void Main ()
                {
                        Console.WriteLine ("TEST: {0:x}", new IntPtr (the_pptr).ToInt64 ());
 
index 63d9da3ae8a8c45d6c497b98eb79b0c139d32d5e..52d3b1e9d97ca5d10a9aa0beeccb6f81db5546ea 100644 (file)
@@ -9,7 +9,7 @@ using Mono.Cecil;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                string basedir = BaseDirectory;
 
index 227308384a1d58581669412fd363184e5affa6ff..1ef255eb7c27111d09cbebd64c343e153c1a404b 100644 (file)
@@ -4,5 +4,5 @@ struct S {
 }
 
 class C {
-       static void Main () { S.f (null); }
+       public static void Main () { S.f (null); }
 }
index 6fe8da995e89c2f8c3a45588934ca63c31718c2a..0173918824582d8cbd118ac6128ec02ba40ad125 100644 (file)
@@ -30,7 +30,7 @@ class Y : X {
 }
 
 class Z {
-       static int Main ()
+       public static int Main ()
        {
                Y y = new Y ();
                X x = new X ();
index 1006bdd47e4737f6e78ff418fda5377f5259bb76..7fb86769fd05fcae7c5e1053d9f45d75e83f6f32 100644 (file)
@@ -18,7 +18,7 @@ class Test
 class Program
 {
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 5698f68ba72213356e6e91f428adfd2b97056893..e45023a1efe7cfd0e93bcee6dcb38ae1f54bd920 100644 (file)
@@ -14,7 +14,7 @@ public class Foo
                return ushort.MaxValue;
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index ba84110bc0b297858d572e58e90325d4cef920a7..ac3422978d9e865b5620b0603dac96faa84b1f0f 100644 (file)
@@ -14,7 +14,7 @@ struct S
                this.b = 2;
        }
        
-       static void Main ()
+       public static void Main ()
        {
                S s = new S (1);
        }
index e6e71099ac0b178adde0315a8234f3b50a6f669c..a45295e052b3d6e727df6677a4f06a10b86e3bf9 100644 (file)
@@ -20,7 +20,7 @@ namespace NObjective
                                Console.WriteLine (TypedReference.ToObject (iter.GetNextArg ()));
                }
 
-               static unsafe void Main (string[] args)
+               unsafe public static void Main (string[] args)
                {
                        ArglistMethod (__arglist (1, 2, 3));
                }
index e7bd956c5f684bff15ac5dc77ba0ee5483ae19f7..9798490f40aeac41080ca62712a51e8a94a75861 100644 (file)
@@ -5,7 +5,7 @@ using System;
 
 class X {
 
-       static void Main ()
+       public static void Main ()
        {
                MethodSignature ms = new MethodSignature ("hello", null, null);
                
index 5f422e6f45bfd630e5c33dc53faacbac11fb8cec..dba30e2ac1f5cacc297d563aeec8bdf433483596 100644 (file)
@@ -7,7 +7,7 @@ interface IFoo
 
 class Hello : IFoo
 {
-       static void Main ()
+       public static void Main ()
        {
                IFoo f = new Hello ();
                int i = f.GetHashCode ();
index 02604a0b792827576b5cfc0802e3e849a293e1c1..d60558e447b7efa6b54ba3a2dce614ca1ad0e8fe 100644 (file)
@@ -6,7 +6,7 @@ class Hello : IFoo
        {
        }
        
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index dea199c276d16ede9859923f203db972d305fa91..0d3edba8ab6a187ad09119c023ad1d0aafd5f607 100644 (file)
@@ -41,7 +41,7 @@ class CCC
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Type t = typeof (S);
                if ((t.Attributes & TypeAttributes.BeforeFieldInit) == 0)
index 06d1cee18f9cb7287b4b9ad2297e2406b0984fd6..9764369318e18302c9bb64298e7f4075e1958483 100644 (file)
@@ -11,7 +11,7 @@ public class outer {
                 }
         }
        
-       static int Main ()
+       public static int Main ()
        {
                // We only test that this compiles.
                
index f85a91b2e6a8baae5f5fb60dccef30e5d130580b..44eed79f2bb06c482116f9c3ee967e3da0cb1c78 100644 (file)
@@ -6,7 +6,7 @@ namespace N
 {
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
                        Parent pr = new Child();
                        ((Child)pr).OnExample();
index 514065a3e2f02d969d7afac3e691b43dd3688d82..12d9f90a458c362a177b98e39d7b9f94674a0b05 100644 (file)
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                Type t = typeof (Control);
                MethodInfo m = t.GetMethod ("set_Foo");
index c8dec1bd92b1b86626a9a3189a57439bcd1fbd9c..a8807033d34fdc36d588085f222145d8afd4d64e 100644 (file)
@@ -27,7 +27,7 @@ struct S : IF
                ((IF)ia).Prop = 3;
        }
        
-       static void Main ()
+       public static void Main ()
        {
                S s = new S ();
                object o = s;
index 2acf9806895893e181467d9770f72dad22eeb341..30bc6629d20063cc7f32aa75a5c1e3ee5e8ba753 100644 (file)
@@ -15,7 +15,7 @@ public class Concrete : Abstract {
 
 class Test {
 
-       static int Main ()
+       public static int Main ()
        {
                Concrete c = new Concrete ();
 
index 2cce773990735d856dca54756fc2ac69f686914c..502d23392419ff568e137aedb597e1d706a25fc4 100644 (file)
@@ -17,7 +17,7 @@ class Demo
                return d (55);
        }
 
-       static int Main ()
+       public static int Main ()
        {
                int r = new Demo ().GetPhones ();
                if (r != 55)
index 986b2db5e8b992e8c57d51e4979eb2f7899260e5..396a1c1e30482f9f0a5aa1136ec49b4d6660c962 100644 (file)
@@ -9,7 +9,7 @@ using System.IO;
 class X {
        #if Blah
        #else
-       static int Main ()
+       public static int Main ()
        {
        #endif
                string s = @"Hola\";
index 8fabcd48bfe88b5c3e46cf885decc37260ef9224..8daaed799f46ed38ac50104f7c21840a303003ea 100644 (file)
@@ -35,7 +35,7 @@ class FixedTest
                }
        }
 
-       public static unsafe int Main ()
+       unsafe public static int Main ()
        {
                TValue[] values = new TValue[10];
                values[0] = new TValue (0L);
index b2aa98ee177b327060652366697277b790bfd74d..8be9f8220c0f6e453b79892bc096ddc794f23dbe 100644 (file)
@@ -17,7 +17,7 @@ public class C
 }
 public class Driver
 {
-       static int Main ()
+       public static int Main ()
        {
                var v = Test.Set (new C ());
                Console.WriteLine (v.Foo);
index a16816cbbf0ae68914949555119ff53f3a85688b..819081b161641520ee170278cfcb3685fa02d179 100644 (file)
@@ -20,7 +20,7 @@ class Z : Y {
 
 class driver {
 
-       static int Main ()
+       public static int Main ()
        {
                Z a = new Z ();
                Z b = new Z ();
index 5cbbdd80278af407b63f8fdcb56b9d3e1eb66e07..038e92fbbf5a8b4e5172de8f63fc003277a05e8a 100644 (file)
@@ -23,7 +23,7 @@ class Item
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
\ No newline at end of file
index 76cef10472f2bbea782f2c70329ceb528d3242a9..72ae2a9da9123d4f39fe400073130940099eacc0 100644 (file)
@@ -17,7 +17,7 @@ class UnsafeTest
                public Foo foo;
        }
 
-       public unsafe static void Main ()
+       unsafe public static void Main ()
        {
                Console.WriteLine (sizeof (Foo));
        }
index eca64b8b0b593c196cef71a23bd0a1ed373748cf..24cc3d66dfa52f9b5f5f595fee424379c89bccbc 100644 (file)
@@ -15,5 +15,5 @@ public class DerivedAttribute : Attribute {
 
 [Derived ()]
 class T {
-       static void Main () {}
+       public static void Main () {}
 }
index ae8927ebda46ced04bfe9e3d199ace917827b05d..bdb03a8a337f99f0c7739f9d2562725f1e270306 100644 (file)
@@ -32,7 +32,7 @@ public class StaticDelegateWithSameNameAsInstance
                i *= 3;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                new StaticDelegateWithSameNameAsInstance ().StaticCallback ();
 
index eb78c9ff59c5cb6f3afcec2a07b7d05f93c69897..bfd058ed936b5cf881b054d73a66063ee89c752c 100644 (file)
@@ -8,7 +8,7 @@ class XX {
                A = 1
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int one = 1;
                int two = 2;
index ff94e1ca9d39304f3dba113ae5695fae8bda452e..031d81d7446adb64f41776139fa1d1c352bd53ab 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo fu = new Foo (null);
        }
index 0c97c021c13ebaf0c5f63b7d981bf9c562cbfb19..8b82e33110b05447f856142bfa4e5e9e4a165b25 100644 (file)
@@ -25,7 +25,7 @@ class Babar : Bar
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (typeof (Foo).GetProperty ("Bar") != null)
                        return 1;
index 8dc7fb1cd76a08a3b9e7f30f267a674d22f44443..3c5b1152566d7527a5a893660f83b944fe5316e5 100644 (file)
@@ -29,7 +29,7 @@ class Third : Second
 
 class a
 {
-       static int Main (string[] args)
+       public static int Main (string[] args)
        {
                First t = (First)new Third ();
                if (t ["test"] != "Second")
index 3787fe6b9e2bb9f65d41f4d03faca181c37a5f9c..e247b61507e530b4f03255d48b9192de7331a7c5 100644 (file)
@@ -40,7 +40,7 @@ namespace N1
                        return true;
                }
        
-               static int Main ()
+               public static int Main ()
                {
                        if (!IntCasting ())
                                return 1;
index f3df83c242bb1c6104f53781956894915eff2866..a5d2cd10e604a6c17eb27946a1e5cb812c43b3c0 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                B b = new B ();
                if (b.Message != "OK")
index ac3d16315034e75a58370fbeeae3422cdf1cd68a..5a8586333447241644e3379a4f47fa9db3c7e8e7 100644 (file)
@@ -2,7 +2,7 @@ using System;
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
                Action action = () => Console.WriteLine (1);
                action += null;
index 8a4012db8ad44399f886af3ef0610a36788aa98f..af3f0266074b0094ee1198898f3278cb1b203fdd 100644 (file)
@@ -5,7 +5,7 @@
 //
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                object o = null;
 
index 209b938b1df0444cbacfb82fbc01f5ddad2212b8..175c506ad681982f94474ccb7c36131fd61e767c 100644 (file)
     ret
   }
 
+  .method public hidebysig static void  Test(object o, class ['missing-lib']XX o2, [opt] object o3) cil managed
+  {
+    .param [2] = nullref  
+    ret
+  }
+
   .method public hidebysig specialname rtspecialname 
           instance void  .ctor() cil managed
   {
index bab6bbe28809d1b2b63c6a5d859e3793e8e99fe1..71102051cdc9fe6dc70feef4751f4a4ca5f84a2f 100644 (file)
@@ -20,7 +20,7 @@ class Program
                var t = typeof (IMemberDelayed);
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 688a1ca775a7420ac70fbced351bdafbc24d53a8..a52c0a72b201a6cc31925ba03be6f36e9a6ecbda 100644 (file)
@@ -13,7 +13,7 @@ namespace MonoPointerBugTest
 
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        unsafe {
                                MyStructure structure = new MyStructure ();
index 999645cd29c3c2e4d81a088a0f787892d90beedf..5f0e60dd7307a2e897c5e30ffc680ab4dccbb5e2 100644 (file)
@@ -12,7 +12,7 @@ public class Test2
                {
                }
        }
-       static int Main ()
+       public static int Main ()
        {
                new Bar (new Foo ());
                return 0;
index 5de9804f3417362b665fc6fd160f42b202adefa3..fe91afab0d0f35d45719ce7b5fd3ceb361fa87e2 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static public int Main (string [] args)
+       public static int Main (string [] args)
        {
                int a, b, c, d;
 
index ec2270b1c403f0b8bf13af7cd5e7af6d68b7d97b..882f33ad6ee01a1f34e4639747026ece6f637e77 100644 (file)
@@ -18,7 +18,7 @@ public class X {
 
 class Y : X, A {
 
-       static int Main ()
+       public static int Main ()
        {
                Y y = new Y ();
                
index 440186210d9487178fc8906b401e0a546f0977e9..3ac207dde5c0d805326967a44e98205d9a93df98 100644 (file)
@@ -4,7 +4,7 @@ using System;
 
 unsafe class Program
 {
-       unsafe static int Main ()
+       unsafe public static int Main ()
        {
                float* to = stackalloc float[2];
                to[0] = to[1] = float.MaxValue;
index 9afe83c4631dfb162f6f155a39bd32df1c7d3d9e..3dbc1f8077c9dfb02ccde5f76bfd195835c9b16b 100644 (file)
@@ -18,7 +18,7 @@ class D : IS
 
 static class X
 {
-       static int Main ()
+       public static int Main ()
        {
                IS a = new D ();
                int r = a[1];
index d0b62d68366ee1998f87a8fb8d70519b6c04bc72..fce32fdc2eb893eeafcfef95ca30a5b1dca5da6d 100644 (file)
@@ -8,7 +8,7 @@ namespace System
 
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        System.AppDomain.CurrentDomain.TypeResolve += new ResolveEventHandler (CurrentDomain_TypeResolve);
                        System.Type intType = System.Type.GetType ("System.Int32");
index 6cd20639c403d83fa1b7c722b13d5c02e15347af..9bdf32a6b88833f085c32d56e4aa494912a853d8 100644 (file)
@@ -7,7 +7,7 @@ namespace System
 
        class Program
        {
-               static void Main ()
+               public static void Main ()
                {
                        Int32 a = new Int32 ();
                        a.Value = 6;
index 4aca10c9dab12d9b009b09d952133676d5c3628e..f3b89e5001baf762258b4d2a71c291f729d112ca 100644 (file)
@@ -13,7 +13,7 @@ namespace Foo
        [C]
        class Foo
        {
-               static void Main ()
+               public static void Main ()
                {
                }
        }
index 99a328b8ac6e61df421e30831d699868d4b6863f..30dd682f071df614c0d5e6198b5b80f90f83c249 100644 (file)
@@ -15,7 +15,7 @@ class Context : IZZZ
 
 class Test : IAAA, IBBB
 {
-       static void Main ()
+       public static void Main ()
        {
                Test cmd = new Test ();
                IZZZ context = new Context ();
index faf6a57db58f533f33c1fbf64ef120e4f2e834b1..17ef17179f9dc327da08480b3eb8b29ac78cfc8f 100644 (file)
@@ -4,7 +4,7 @@
 
 class Program
 {
-       static void Main ()
+       public static void Main ()
        {
                S s;
                s.Test ();
index 86b6e34e510cf6c3f23827183482afaf98a5fe47..cd51d7fa1f3c16e81fbf9af7c3e8375bd4659fa5 100644 (file)
@@ -18,7 +18,7 @@ public struct S
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                S s;
                s.s2.v = 9;
index f416ddb4a6dfb3e26203ebbefe72d720da1ee876..e0c758fb78bb2caf80731f61ff335ef0b2741d47 100644 (file)
@@ -39,7 +39,7 @@ class Room {
 }
 
 class DelegateTest {
-    static int Main () {
+    public static int Main () {
        return 0;
     }
 }
index ffcb3d465315e57308c1c95776bfd363b47954c6..a08a048a3c51ce65b0f3c67b7ce63a21d206b60f 100644 (file)
@@ -7,7 +7,7 @@ class C
        {
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
\ No newline at end of file
index fb08e9a6fdb056888ae18ba56242f2a3db333751..a07aefb8998a2d9f858af6b49ff4b56efac52ee6 100644 (file)
@@ -1,6 +1,6 @@
 public class A
 {
-       static int Main ()
+       public static int Main ()
        {
                var a = new A ();
                a.Test ();
index e6b3d4e3f0d73e7d429b23b52a6ed823afb8bf57..438760f5a712ff0f9e2a044ddac94540f14ca555 100644 (file)
@@ -10,7 +10,7 @@
 
 class Ghost {
 
-       static int Main ()
+       public static int Main ()
        {
                int Ghost = 0;
                
index c7964c5bf55a31689912e7b9d6edd86d81bbd113..caf7062ca7cfa01273026f80c2e187a0f9ed47a7 100644 (file)
@@ -10,7 +10,7 @@ class Program
        {
        }
 
-       static void Main ()
+       public static void Main ()
        {
                A<string> pp = null;
                Foo (pp, (object s, string e) => { });
index 58be5f68f4123ddbd0488bbfb1cdc110f06ba554..83310f20dcdf9b72bcfae533b0da4e6a9900373c 100644 (file)
@@ -2,6 +2,11 @@ using System;
 
 class ConditionalPromotions
 {
+       public static int Test (bool condition, short value)
+       {
+               return condition ? -1 : value;
+       }
+
        public static int Main(string[] args)
        {
                var r1 = args.Length > 0 ? 1 : (short)1;
index a50379568f3f95e2c37d18543ff275d614282288..f0f8c3a3ac9c7eebbd3c569c7fbae146bc65e699 100644 (file)
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
 class X {
        static UnmanagedType UnmanagedType;
 
-       static int Main ()
+       public static int Main ()
        {
                UnmanagedType = (UnmanagedType) 0;
 
index 3be25704dfe47a31d2f5edfd34bd350b07c347b5..3f6c207cc477c35059cbef42b994edac1f53d13d 100644 (file)
@@ -2,7 +2,7 @@ using System;
 \r
 class Program\r
 {\r
-       static int Main ()\r
+       public static int Main ()\r
        {\r
 string s = @"a\r
 \r
diff --git a/mcs/tests/test-855.cs b/mcs/tests/test-855.cs
new file mode 100644 (file)
index 0000000..29aa90d
--- /dev/null
@@ -0,0 +1,29 @@
+namespace Test
+{
+       public interface IInterface
+       {
+               string Get (string key, string v);
+               int Get (string key, int v);
+       }
+
+       public class BaseClass
+       {
+               public string Get (string key, string v)
+               {
+                       return v;
+               }
+
+               public int Get (string key, int v)
+               {
+                       return 0;
+               }
+       }
+
+       public class Subclass : BaseClass, IInterface
+       {
+               public static void Main ()
+               {
+                       new Subclass ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-856.cs b/mcs/tests/test-856.cs
new file mode 100644 (file)
index 0000000..232a26a
--- /dev/null
@@ -0,0 +1,38 @@
+using System;
+
+public abstract class A : IDisposable
+{
+       public int i;
+
+       public virtual void Dispose ()
+       {
+               ++i;
+       }
+}
+
+public abstract class B : A
+{
+       private new void Dispose ()
+       {
+               throw new ApplicationException ("B");
+       }
+}
+
+public class C : B
+{
+       public static int Main ()
+       {
+               var c = new C ();
+               c.Dispose ();
+               if (c.i != 1)
+                       return 1;
+
+               return 0;
+       }
+
+       public override void Dispose ()
+       {
+               base.Dispose ();
+       }
+}
+
diff --git a/mcs/tests/test-857.cs b/mcs/tests/test-857.cs
new file mode 100644 (file)
index 0000000..3da34d6
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+
+public class Outer
+{
+       public enum Inner
+       {
+               ONE,
+               TWO
+       }
+}
+
+public class TypeHiding
+{
+
+       public static bool Test1 (Outer Outer)
+       {
+               return 0 == Outer.Inner.ONE;
+       }
+
+       public static bool Test2 ()
+       {
+               Outer Outer = null;
+               return 0 == Outer.Inner.ONE;
+       }
+
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-858-lib.il b/mcs/tests/test-858-lib.il
new file mode 100644 (file)
index 0000000..20cd244
--- /dev/null
@@ -0,0 +1,93 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly 'test-858-lib'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+.module 'test-858-lib.dll'
+
+.class public auto ansi beforefieldinit 'Foo'
+       extends [mscorlib]System.Object
+  {
+
+    .method public hidebysig  specialname  rtspecialname 
+           instance default void .ctor ()  cil managed 
+    {
+      ldarg.0 
+      call instance void valuetype [mscorlib]'System.Object'::.ctor()
+      ret 
+    }
+
+    .method public virtual  hidebysig  newslot  specialname 
+           instance default string 'Monkey_Jump' ()  cil managed 
+    {
+      ldstr "foo"
+      ret 
+    }
+
+       .property specialname rtspecialname string Message ()
+       {
+               .get instance default string 'Foo'::'Monkey_Jump' () 
+       }
+}
+
+.class public auto ansi beforefieldinit 'Bar'
+       extends Foo
+  {
+    .method public hidebysig  specialname  rtspecialname 
+           instance default void .ctor ()  cil managed 
+    {
+      ldarg.0 
+      call instance void class 'Foo'::.ctor()
+      ret 
+    }
+
+    .method public virtual  hidebysig  specialname 
+           instance default string 'Boston' ()  cil managed 
+    {
+      ldstr "bar"
+      ret 
+    }
+
+    .property specialname rtspecialname string Message ()
+    {
+                 .get instance default string 'Bar'::'Boston' () 
+    }
+}
+
+.class public auto ansi beforefieldinit C
+       extends [mscorlib]System.Object
+{
+  .method public hidebysig specialname instance int32 
+          get_Value() cil managed
+  {
+    .locals init (int32 V_0)
+    IL_0000:  ldc.i4.3
+    IL_0001:  stloc.0
+    IL_0002:  br.s       IL_0004
+
+    IL_0004:  ldloc.0
+    IL_0005:  ret
+  }
+
+  .method public hidebysig specialname instance void 
+          add_Arg(bool arg) cil managed
+  {
+    ret
+  }
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    ldarg.0
+    call       instance void [mscorlib]System.Object::.ctor()
+    ret
+  }
+}
+
+
+
diff --git a/mcs/tests/test-858.cs b/mcs/tests/test-858.cs
new file mode 100644 (file)
index 0000000..78fe95c
--- /dev/null
@@ -0,0 +1,24 @@
+// Compiler options: -r:test-858-lib.dll
+
+using System;
+
+class X
+{
+       public static int Main ()
+       {
+               Bar bar = new Bar ();
+               if (bar.Message != "bar")
+                       return 1;
+
+               Foo foo = new Foo ();
+               if (foo.Message != "foo")
+                       return 2;
+
+               C c = new C ();
+               c.get_Value ();
+               c.add_Arg (false);
+        
+               Console.WriteLine ("Test ok");
+               return 0;
+       }
+}
diff --git a/mcs/tests/test-859-lib.il b/mcs/tests/test-859-lib.il
new file mode 100644 (file)
index 0000000..94922ba
--- /dev/null
@@ -0,0 +1,39 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly 'test-859-lib'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+
+.module 'test-859-lib.dll'
+
+// Import flag enables more magic
+
+.class interface public auto ansi import C
+{
+  .method public hidebysig newslot specialname virtual abstract
+          instance object 
+          get_Value([opt] object a) runtime managed preservesig internalcall
+  {
+  }
+
+  .property object Value(object)
+  {
+    .get instance object C::get_Value(object)
+  }
+
+  .method public hidebysig newslot specialname virtual abstract
+          instance void 
+          set_Value2([opt] object a, [opt] object b) runtime managed preservesig internalcall
+  {
+  }
+
+  .property object Value2(object)
+  {
+    .set instance void C::set_Value2(object, object)
+  }
+
+}
diff --git a/mcs/tests/test-859.cs b/mcs/tests/test-859.cs
new file mode 100644 (file)
index 0000000..fafd7f7
--- /dev/null
@@ -0,0 +1,24 @@
+// Compiler options: -r:test-859-lib.dll
+
+using System;
+
+class X
+{
+       void Test_PropertyOptionalParameters (C c)
+       {
+               // need to just run verifier on the method
+               if (c == null)
+                       return;
+
+               Console.WriteLine (c.Value);
+               c.Value2 = 1;
+       }
+
+       public static int Main ()
+       {
+               var x = new X ();
+               x.Test_PropertyOptionalParameters (null);
+
+               return 0;
+       }
+}
index aaa809f8bc4b153bed2ab7a5640c617d227189f8..aa476b400a209e7c359764cb7f41628eb6e929cc 100644 (file)
@@ -29,7 +29,7 @@ class Top {
                public int get_two () { return 2; }
        }
        
-       static int Main ()
+       public static int Main ()
        {
                XA x = new XA ();
 
index a45aafe7e5b15884b11a307584ff278f31adfd26..c9b3a480b153a135bb60db7dad1170aad2a42088 100644 (file)
@@ -5,7 +5,7 @@ static void f (string s)
 s. Split ('a');
 }
 
-       static int Main ()
+       public static int Main ()
        {
                string s = "";
                
index 3f1b86ed6b29f99968f7e48977120eab08b3e528..bdf1e135ac80685c26f840926ac1b8f57f20d1d1 100644 (file)
@@ -18,7 +18,7 @@ struct X {
                return new X (a);
        }
        
-       static int Main ()
+       public static int Main ()
        {
                X [] x = { new X (40), F (10) };
 
index 4fd35e3714bf8432b36d548263f25a5517918e1a..581b9aed0f79d543d4e9d00937b2a2c181b78a69 100644 (file)
@@ -1,5 +1,5 @@
 class X {
-       static public int Main (string [] args)
+       public static int Main (string [] args)
        {
                decimal a, b, c, d;
 
index 8d7c147ec3fd351599ce5a13971e01be5c198f12..eae64a7dd232a70b0abce9e4f68a39a95be9adc8 100644 (file)
@@ -29,7 +29,7 @@ namespace N1
        }
 
        public class Blah {
-               static int Main  ()
+               public static int Main  ()
                {
                        return 0;
                }
index 3414d1985346958bdb63a46b73ed9facce939e22..344efd5145c78b2968cad855c61ce4057a8eae11 100644 (file)
@@ -20,7 +20,7 @@ class Test {
        static public void MyPublic () { }
        static void MyPrivate () {}
              
-       static int Main ()
+       public static int Main ()
        {
                Type myself = typeof (Test);
                BindingFlags bf = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
index a8c5fea996fcd814f5ca78d08a7192d4292b3aa7..bafd610ac5c7a1736ad3bea749306eab21587609 100644 (file)
@@ -30,7 +30,7 @@ public class Derived2 : Base, IVehicle {
 
 public class Test {
 
-       static int Main () {
+       public static int Main () {
                Derived1 d1 = new Derived1 ();
                Derived2 d2 = new Derived2 ();
                Base b1 = d1;
index 8a134a566e1eec3cea3a13ea34c9b4bb87a05625..7289acfbd1ee545ad076c0ccf4b957ddb028af88 100644 (file)
@@ -6,7 +6,7 @@ class X {
        {
        }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
 
index 718a95f17496e532ca53226f11a23a959c92ad57..5cd064601426e4420d32c769f800b816dee857f0 100644 (file)
@@ -7,7 +7,7 @@ namespace N1
 {      
        public class A
        {               
-               static int Main  ()
+               public static int Main  ()
                {
                        return 0;
                }
index 612185cf1aaf6ff3c8503554c4b4cb6d542a992a..32dc9d5ec467b9071267db7a4fbd9c0d6399dbf8 100644 (file)
@@ -11,7 +11,7 @@ public enum FL {
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                return 0;
        }
index caf2f6742131671867a70c9d63d27cc0f16503ff..2f2b7ab2c9ecf6efbb09b6de7a858a561f65258f 100644 (file)
@@ -13,7 +13,7 @@ class X {
                B
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int v = 1;
                object foo = (v + A.a);
index 0bb2390c698174b82f9d4c2e97d8946e02380300..68a2b497904808c98ac525a579124708f1bdd4e7 100644 (file)
@@ -5,7 +5,7 @@ class X {
        //
        // DO NOT ADD ANYTHING ELSE TO THIS TEST
        //
-       static int Main ()
+       public static int Main ()
        {
                int a;
 
index 21fe237a934697bde738795aa8cc36e4b4494a03..58ea7801e3aaf35300f37ad0b1267a8b8fa22c92 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void S ();
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                int a = 1;
                Console.WriteLine ("A is = " + a);
index c6f4032579b098d1c8043c50a9e2bda1dbc8baff..5be25e62212cee438e764f460d2e9bef08aa8c9d 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void S ();
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                int a = 1;
                S b = delegate {
index 50985f4fb2bee92ed3d2a906c97000cda74f93fc..7cbec62f14f6b9da0e5f2595c9fe66e6cc3c4a3c 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void S ();
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                int a = 1;
                S b = delegate {
index fe456bede026f0c28b891292624c3a69bf5c9c28..632007e70bcd0802e38e40cc78cfab1e755b8246 100644 (file)
@@ -5,7 +5,7 @@ using System;
 delegate void S ();
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                int i;
                S b = null;
index 758bcc70f6de9cece684a1b825da93317647dfba..5f238c734147d015685bb0b1df5bb8c9fe6751d5 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void S ();
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                int a = 1;
                if (a != 1)
index 0dcd92fb3bc3b89c2ebc03a696f974e0caa72634..5c08e5e4726f423af4e69f9774f01cdb9bd52714 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void D ();
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                int a = 0;
                D d1 = delegate {
index 40602f3a2745c9266495dce407d0fb30d66e8f68..f7464c4d05870fc5b60271c5737fb98889ecfaac 100644 (file)
@@ -9,7 +9,7 @@ class X {
        //
        // DO NOT ADD ANYTHING ELSE TO THIS TEST
        //
-       static int Main ()
+       public static int Main ()
        {
                int a = 2;
                int b = 1;
index 55d3fdd8f7409f5b1d9e3eaa4bcc0757075a58b0..f3519660b7de651e2ce82e2fb496c3d5c57c4513 100644 (file)
@@ -8,7 +8,7 @@ class X {
 
        static int gt, gj;
     
-       static int Main ()
+       public static int Main ()
        {
                int times = 0;
                
index 065f7c2cae5bf95eb531e2809dfbb4114c486b7d..bee3519ea97ada57441ae27c63b95cc4a8a5e6d2 100644 (file)
@@ -26,7 +26,7 @@ class S {
                }
        }
        
-       static int Main ()
+       public static int Main ()
        {
            S s = new S ();
            s.Test ();
index 4a656d064c770775c63ac4ff06a2856f99b629d1..63d96639f68c5f846cd227f05fe85406f6bb6970 100644 (file)
@@ -18,7 +18,7 @@ class X
                Hello (u);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index bf6bbb317d2533d84fe60b4aaab0fb8e60f2c561..577d299fe087952f2d80f425adb843b141689d4f 100644 (file)
@@ -26,7 +26,7 @@ class X
                Hello (u);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index 0d1df48ba35ce5d49f657b090248770a385aa06c..37ecab0540ee39459801c2c74badc0bb8eb0ec98 100644 (file)
@@ -16,7 +16,7 @@ class X
                foo (t);
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index 258dd873ff0909ac3e73a012cf91a7542cdf98ce..6789b74d17082c941c45b950b0c8a308cbeec1a6 100644 (file)
@@ -32,7 +32,7 @@ struct Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo (3);
                foreach (Foo bar in foo.Test (new Foo (8)))
index 9fc04683460a93546531aa0cc56dfb29c8780161..c47d23535ed6cdbb3db295d36d3e920fa41a8a41 100644 (file)
@@ -17,7 +17,7 @@ class X
                };
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3, Math.PI, 1 << 8);
index 4a27f625a1e2961612f24dc36d1e87beb5287df5..943502a1f0defb4c50c94cda3601acf0a1f1a75a 100644 (file)
@@ -30,7 +30,7 @@ class X
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                foreach (int a in Test (5))
                        Console.WriteLine (a);
index 5712fb9d8fb7b624aeee53a02c45b4717e1b62e3..1f531b1c8e07dffd7f51a8cbbe90cd79f16eb18a 100644 (file)
@@ -5,7 +5,7 @@ delegate int Foo ();
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test ("Hello World", 8);
        }
index 0af13b8f997fdbf9730ac60e524d0964fa30f74c..a487a976c83b9f5e44a447844a1da92b9df9a10d 100644 (file)
@@ -27,7 +27,7 @@ public class Test
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Test test = new Test ();
                Foo foo = test;
index 255b0f1b704874031951249287a6904b8b1687f8..21c6638586008b6e0ff2c22c1d7d3279adb031e4 100644 (file)
@@ -7,7 +7,7 @@ delegate void E (out int x);
 delegate void F (params int[] x);
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                // This should create an AnonymousMethod with the implicit argument
                D d1 = delegate {};
index b632c6bc2dbe7beab4145aae40e41520dcaafc50..094d1b4a3723a23c15048993d0b5ef0fb97ab85a 100644 (file)
@@ -10,7 +10,7 @@ class X
                yield return a;
         }
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X ();
                long sum = 0;
index 0a629af971981c12e177b5d6311b73c64af16483..99c67adcd9b88b6ba7949ae7dd75cf3807097813 100644 (file)
@@ -18,7 +18,7 @@ public class World<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                World<X> world = new World<X> ();
                world.Test (new X ());
index 99d55bc821b8bfcf95e1e4146484f8431cd0bbd5..6efd170dd5bccf6b498a6155b146ec0a216816ea 100644 (file)
@@ -13,6 +13,6 @@ class X
                };
        }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 6157a8540bd5f3d6a6e2f3aed8d743ba6ee90735..fcc7b0bc158e8df13d8cbe03689479809d50c982 100644 (file)
@@ -6,6 +6,6 @@ class T{
                 SomeMethod (delegate (Int32 a) { return a; });
         }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
index 432501e0df5194d3975b03975698ae7e9e189bf0..886c49874c45213f7182f6a3cba449fd26ac983f 100644 (file)
@@ -25,7 +25,7 @@ class Test<T>
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test<string>.Hello ("World", 3.1415F);
        }
index dadb22a676ee8b7827d2c69ab8703ea00ef5cbe4..a8f7da19f68cf6f5371446f610121d9a42fcf10c 100644 (file)
@@ -5,7 +5,7 @@ class A
 {
        public A(TestFunc<int> func) { }
 
-       static void Main ()
+       public static void Main ()
        { }
 }
 
index d2265a53b9049ce0b647932dbd1875795372738b..3203ed8ed01493e47cd04e8991ba230d42c42ecf 100644 (file)
@@ -5,7 +5,7 @@ delegate bool predicate (object a);
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                ArrayList a = new ArrayList ();
                for (int i = 0; i < 10; i++)
index e90e976b4768e0d4416616c4e886380c76eb862d..2c24abb8421e762039078b6db90069e19956476e 100644 (file)
@@ -3,7 +3,7 @@ using System;
 delegate void D ();
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                X x = new X (1);
                X y = new X (100);
index 6d9698ca4e052fdf48421fb3d501ca0d5b5a680c..449b8f7d92ee2e0171213346755970567368f230 100644 (file)
@@ -25,7 +25,7 @@ class X
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 } 
index 090ab843c63d5530acb9c7b00c874c0b446d5e0f..01bd5922cf484d79012b19c955dce80aaae67188 100644 (file)
@@ -14,7 +14,7 @@ public class Test
 {
        delegate void D ();
        
-       static int Main ()
+       public static int Main ()
        {
                MyClass mc = null;
                
index b7e84293c9fee724e779d1922fa18fa6b3aa008c..f68b9552eaebb52493047c74cd09f5abca8b9621 100644 (file)
@@ -30,7 +30,7 @@ class Foo<T> {
 
 class Program {
 
-       static int Main ()
+       public static int Main ()
        {
                var x = new Foo<int> ();
                x.Handler += null;
index 2495a62d2c0e17db8f6971d27cf08a6239399aa6..1d51085841ebc564cfa7f20731b9a321a3c02d42 100644 (file)
@@ -27,7 +27,7 @@ class Foo<T>
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                var x = new Foo<int> ();
                return x.ContainsAll (new [] { 4, 6, 78 }) ? 0 : 1;
index 572e9bc66bf5ea8abd8870c11affdf50cd972237..7967001c97f9fddd11a5e42084f1e7089f4b40e8 100644 (file)
@@ -12,7 +12,7 @@ class X {
        {
        }
 
-       static void Main ()
+       public static void Main ()
        {
                T t;
 
index 80fedb5a226fc9671f5c1d9d34f9a5ac55bd071e..ff84acea191e7cb9fc3a28eff5693a5c4338c0fc 100644 (file)
@@ -10,7 +10,7 @@ static class C
 
 class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                Action<int, int, int> test = (x, y, z) => {
                        int i = x + y + z;
index 52855ef11e7e8d9c317c5085bdde03c778c5986a..505efc7440bb8e007e4d466afa52121bece22a28 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 class Test
 {
-       static void Main ()
+       public static void Main ()
        {
 
        }
index 09c6d122e3ae6f39acbf7fa94fdf1cf05ea485b0..e9a049412bfce03c457aadbf1762271295fd6ce6 100644 (file)
@@ -4,7 +4,7 @@ public delegate void Bla ();
 
 public class Driver
 {
-       static int Main ()
+       public static int Main ()
        {
                new Driver().Repro ();
                return 0;
index 4e81921d28b7924cec08549167e90ac177c8dd07..182c73d371d9c2eaac29462d004cfc8bd346b259 100644 (file)
@@ -22,7 +22,7 @@ namespace TestComp
                        }
                }
 
-               static void Main (string[] args)
+               public static void Main (string[] args)
                {
                }
        }
index 9887afbc96bf8765a5e251c50058e753c9ab4a04..11d22661add08226e111f61b6bc4ec11668f7666 100644 (file)
@@ -14,7 +14,7 @@ class C
                df = delegate { foo (g.def ()); };
        }
 
-       static int Main ()
+       public static int Main ()
        {
                cf<int> ();
                df ();
index 728ab70488716578839877f2fe14c58604ab8962..622f84eb3f82481dde4cc8fff4207a17940858ae 100644 (file)
@@ -21,7 +21,7 @@ class X<T> : IFoo<T>
 
 class M
 {
-       static void Main ()
+       public static void Main ()
        {
                IFoo<int> x = new X<int> ();
                x.Test ();
index 01500c1baf481b3839b0fed414a0fe499482e7b0..ffe8fec2de6970d394a4a03188105b7b466b23d0 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void D ();
 
 class X {
-       static void Main ()
+       public static void Main ()
        {
                X x = new X (1);
                X y = new X (100);
index 519397e4903321f3cf18ca5a99e9eeef90decd4f..4fb07e9766fc0b3e874c8c97fa25747c45cea950 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 public class TestCase
 {
-       static void Main ()
+       public static void Main ()
        {
                Test (new IList<int> [] { new int[] { 1, 2, 3 } });
        }
index f75c2a818f486eb0c60eaae33b338d1ca8a110dc..5e7aff0941fd85cb414f6427069f109a0cdebc36 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 static class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var fs = new List<Func<int>> ();
 
index a05dd23f3316e8a5ff0e9852f42ccb4ba8012e85..133f38258e37cbc56abf9371eff272210a1dc00e 100644 (file)
@@ -18,7 +18,7 @@ class Button {
 class X {
        static bool called = false;
        
-       static int Main ()
+       public static int Main ()
        {
                Button b = new Button ();
                                       
index 678c0b5f50633aa9274e3dc0b35b55088bb76a6b..540786bba53d45ee932c93772da75dd437560120 100644 (file)
@@ -3,7 +3,7 @@ using System;
 delegate void A ();
 
 class DelegateTest {
-       static void Main (string[] argv)
+       public static void Main (string[] argv)
        {
                Console.WriteLine ("Test");
 
index 050b9fb65aa95dd4a1901859005e7988bb88cbf7..01e681e80b231ce8e12511b8a9fa74bf3452a23f 100644 (file)
@@ -6,7 +6,7 @@ using System;
 delegate void S ();
 
 class X {
-       static int Main ()
+       public static int Main ()
        {
                int i;
                int a = 0;
index da92400d7c488c607f377f5db70acb7898206317..d44d779f345e0abc213470410b824504f93e71fa 100644 (file)
@@ -8,7 +8,7 @@ delegate void D ();
 class X {
        static D GlobalStoreDelegate;
        
-       static void Main ()
+       public static void Main ()
        {
                D d = MainHost ();
 
index 7531dfe6145e85d9c9a985fe8f8948604f2db528..cedf161bccacd6dc06ec30f05e252a986fb13d5a 100644 (file)
@@ -7,7 +7,7 @@ delegate void D ();
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X();
                x.M ();
index b697da3bf836c21ab83dd37749cd9e8707424e0d..42ec9111c28316fb9f852f79ed972f087e81bf9a 100644 (file)
@@ -6,7 +6,7 @@ delegate void D ();
 class X {
        static D r;
        
-       static void Main ()
+       public static void Main ()
        {
                D d = T ();
 
index 8fcb6d4bc5be6c64467872b315512b6cc84fd3bd..9858dc9a0a9adbe652dc8035e2971bd45a593109 100644 (file)
@@ -4,7 +4,7 @@ delegate void D ();
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X();
                x.M ();
index 8b7169478281189cc5257b3424869c0fc903c83d..e9957f19a7ff42f2a9964cca35c36cd3a3ad137a 100644 (file)
@@ -4,7 +4,7 @@ delegate int D ();
 
 class X {
 
-       static void Main ()
+       public static void Main ()
        {
                D x = T (1);
 
index 7aafe7f7bdbf3ddeb8594c42ddad2b9af9a1dde5..ac399d804d2759fae15e3d2485db505619d22630 100644 (file)
@@ -4,7 +4,7 @@ delegate int D (int arg);
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                D x = T (1);
 
index 3bfaef3e804e6f1785d8bd2cef7782d88cbf38a3..d1607443b0a61ed3063f52b3eb1674a7e2e1daf5 100644 (file)
@@ -4,7 +4,7 @@ delegate void D ();
 
 class X {
 
-       static int Main ()
+       public static int Main ()
        {
                X x = new X();
                x.M (10);
index dcbd0f6c2db8d5a58f1d95bec09e533bd1b8d51d..3d192300b48fb50e11f0fa6bc788542db7ad0d41 100644 (file)
@@ -5,7 +5,7 @@ class Delegable {
 }
 
 class DelegateTest {
-       static void Main (string[] argv)
+       public static void Main (string[] argv)
        {
                Console.WriteLine ("Test");
 
index 7cb601d7599c3f28ed078e9c7ae6f89b2d3db0b7..0c83462d519953b7ea0a706a18ec4eb8cb2ce64d 100644 (file)
@@ -6,7 +6,7 @@ static class Program {
        delegate void D (X o);
        static event D E;
        
-       static void Main()
+       public static void Main()
        {
                bool running = true;
 
index dd32486d053158f624d4634768b761bde8bb55df..c63c204c000002d67afa1a90065c09ce543aa6f8 100644 (file)
@@ -4,7 +4,7 @@ using System.Reflection;
 class X {
        delegate object test (MethodInfo x);
                
-       static void Main ()
+       public static void Main ()
        {
                DoCall (delegate(MethodInfo from) {
                     return from.Invoke (null, new object[] { from });
index 6537567f5a050ed0b38fe31366facab0cf657343..46d65b71fce93f0bb3ae70a216d9222599789c8c 100644 (file)
@@ -15,7 +15,7 @@ class T {
         static void doit (int v) {
                 Console.WriteLine (v);
         }
-        static void Main () {
+        public static void Main () {
                 Do[] arr = new Do [5];
                 for (int i = 0; i < 5; ++i) {
                         arr [i] = delegate {doit (i);};
index 3e75f7af74aea28647c50613c8acfbd8198f364e..cf0615afa4202510cf38f8a6445e5f22b7c9d73f 100644 (file)
@@ -58,7 +58,7 @@ namespace Delegates
       Console.WriteLine(s.Value);
     }
 
-    static void Main(string[] args)
+    public static void Main(string[] args)
     { SpaceLeak();
     }
   }
index 96aff697d74b2c8c4496cc6a8f25f07ce3dfb6d7..f3c27082a6ec5a556884584a33121c8030a6dbf2 100644 (file)
@@ -24,7 +24,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index a5c4c5b0a0de4e9d9f795d95ad70cda617d5876f..e71224363709dfc9fa0151086f9b5ff45dab4be4 100644 (file)
@@ -23,7 +23,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index a5c4c5b0a0de4e9d9f795d95ad70cda617d5876f..e71224363709dfc9fa0151086f9b5ff45dab4be4 100644 (file)
@@ -23,7 +23,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index d64280cf8ef632045f3fde226fc70fa1037a79f6..d8639c8b8173bcccf11760d3d2b2d132fd9eebc7 100644 (file)
@@ -25,7 +25,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index 5a8ba9d9223001c943beb1fc28829ea26965740b..079e44dd0b3ea82816830ca24b9211256ac78f13 100644 (file)
@@ -22,7 +22,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                X.Test (3);
index 30fc229eea6f675a57da156e3492299cc58bad36..a93ba8b532a45e44673df85c50481785f41c5156 100644 (file)
@@ -22,7 +22,7 @@ class X
                };
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index 8963a063715989f34a2deb3e1083bd0be2f5a076..63d73ffc6872df74c4d78eb919bb04dcf9e1d419 100644 (file)
@@ -32,7 +32,7 @@ class X
                simple ();
        }
 
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Test (3);
index 60f0ca137811cd564d92073a84e22eb2e485abf2..3c57a3b697a2509c4caa925c4b91e337e9b40a20 100644 (file)
@@ -13,7 +13,7 @@ class TestClass
        static int i = 1;
        static readonly A a = new A(delegate(int a) { i = a; });
 
-       static int Main ()
+       public static int Main ()
        {
                return i;
        }
index 283fd126a675b203184acb5f43df5236be6f5246..30da5856f72f49e5bbb79ba9aad1888ef894e25a 100644 (file)
@@ -20,7 +20,7 @@ public class World
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                World world = new World ();
                world.Test (5);
index 31f6100310872d78a04e5caf7bb4e2e7652e5e44..c0747483b718d919029101625f57df70fe00e6a8 100644 (file)
@@ -24,7 +24,7 @@ public class World
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                World world = new World ();
                world.Test (5);
index 77acd9bd31e23c41a3d76477e72bfae499877dcf..dd639b196592f48751370a4ea09072be67ec17b1 100644 (file)
@@ -26,7 +26,7 @@ public class World
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                World world = new World ();
                world.Test (5);
index 72c046e357418910bba54b31e1ac505f84490a0e..245cd0195cc1f2b8462d20bcd6e1a5f366dc6bb9 100644 (file)
@@ -15,7 +15,7 @@ public class Test
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Test test = new Test ();
 
index d653736c11f44a728ac4d0ac753cbabd1acbed09..31f78409eacd8c5be2cc65966a1012fbe03c76b6 100644 (file)
@@ -17,7 +17,7 @@ class X {
                 }
         }
  
-        static int Main ()
+        public static int Main ()
         {
                 IEnumerator enumerator = GetIt (new int [] { 1, 2, 3});
                enumerator.MoveNext ();
index 914f90b0297b66b85127df60713bd283c87fc7f8..d5eafc9dfe0ffd814bc6565b32a02825ff9a2064 100644 (file)
@@ -24,7 +24,7 @@ class Test
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Test test = new Test (9);
                Console.WriteLine (test);
index 78c54e689466a890707ba63bb0a9e283ca6de011..a0962cdaf895e038206ec8c388242e8b591eaf3c 100644 (file)
@@ -35,7 +35,7 @@ struct Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo (3);
                foo.Test (new Foo (8));
index 7ccaaaf4f51c7ef0c29dca735810ba254b50c1f3..6e1e9b92a06565919a4aa9873905ab316583cb68 100644 (file)
@@ -24,7 +24,7 @@ public class Foo
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        {
                Foo foo = new Foo ();
                foo.Test ();
index d36918ccb9708c2c40dde96a190b0946488f42f1..26dacde38b82d4ba88c7b1d978e6e7f35a1e7ce0 100644 (file)
@@ -4,7 +4,7 @@ delegate void QueueHandler (Observable sender);
 class Observable {
        static QueueHandler Queue;
          
-       static void Main (string[] args) {
+       public static void Main (string[] args) {
                Queue += (QueueHandler) delegate { System.Console.WriteLine ("OK"); };
        }
 }
\ No newline at end of file
index aba3e9d5df0acc544bdff47e40c51e57a6368df4..f74d82259d06a8bd86db00f5319b379506e5e631 100644 (file)
@@ -10,7 +10,7 @@ public class X
                this.a = a;
        }
 
-       static void Main()
+       public static void Main()
        {
        }
 }
index 97fa75c97bca72b023677ed66be9e6614ae1c7ff..f3bf68c590402e52d537ebf773103ef1806d0a52 100644 (file)
@@ -17,7 +17,7 @@ class X {
                 }
         }
  
-        static int Main ()
+        public static int Main ()
         {
                 IEnumerator enumerator = GetIt (new int [] { 4, 8, 9});
                enumerator.MoveNext ();
index 8035749d335355064784a74e3db183f8eae066a4..aef4ae420ffcc4ecceda46638865ff3498c60711 100644 (file)
@@ -22,6 +22,6 @@ class Source {
             };
 
         }
-        static void Main () {}
+        public static void Main () {}
 
 }
index fdb55457edbfa8ec29e1b793268a0d669b53c134..b748c4450635ef9ccd9ed9e5d0190103fd3431f6 100644 (file)
@@ -20,7 +20,7 @@ public class TestClass : BaseClass
        {
        }
 
-       static int Main (string[] args)
+       public static int Main (string[] args)
        {
                TestClass c = new TestClass (1);
                return 0;
index 61f74979a13def8108a5e637552d90b4004817d0..2503770ceca0845da9c5afa25125c769254cedd3 100644 (file)
@@ -25,6 +25,6 @@ public class SingleSteppingEngine
 
 class X
 {
-        static void Main ()
+        public static void Main ()
         { }
 }
\ No newline at end of file
index 3f62e78138694045a9dc5224e4950e4158bfdc30..7d6fbf270091a9beebcd01e810cb4697aa58076a 100644 (file)
@@ -6,7 +6,7 @@ using System.Threading;
 delegate void D (object o);
 
 class T {
-       static void Main ()
+       public static void Main ()
        {
                        D d = delegate (object state) {
                        try {
index ee50eba347f8a842cc2635ecc11e9bd2b7cbcf34..10c7f38eb6716c00b40b0fe9640023ad8a278996 100644 (file)
@@ -22,7 +22,7 @@ public class C
                };
        }
 
-       static int Main ()
+       public static int Main ()
        {
                C o = new C ();
                o.X ();
index 8e06bb2e6d005db78f75895f81ad4e75d931f396..71a2e705e7dc4be3f6720446a595b50075539243 100644 (file)
@@ -41,7 +41,7 @@ namespace MonoBug
                        }
                }
 
-               static int Main ()
+               public static int Main ()
                {
                        EventHandlers handlers = new EventHandlers ();
                        handlers.Handler = handlers.DoSomethingEventHandler;
index cc263e7da51623df0d1905c8f24f6b28e8913e0d..e8d585df8bcf541c5917a683a82efa2444b6eeb1 100644 (file)
@@ -4,7 +4,7 @@ unsafe class X
 {
        delegate void D ();
        
-       static int Main ()
+       public static int Main ()
        {
                byte* a = null;
                D d = delegate () {
index adad3ff938844eeaed5da38f378ad4cb934056e8..97ff41cf2c8f42595d5abd3001f19f7f864479ac 100644 (file)
@@ -32,7 +32,7 @@ static class Program
                return Get (i) ();
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Run (0) != 42)
                        return 1;
index c594439cc23179dc7439596aaf022f97ba4a8dd4..62d0a6921b3e48b386f4a74d0cb9f71b35b98156 100644 (file)
@@ -32,7 +32,7 @@ using System.Text;
 
   class Program
   { 
-    static void Main(string[] args)
+    public static void Main(string[] args)
     {
     }
   }
index 8ff320813111faafc904045045d2d427f5f8f702..544839c9c3cf0cfc930815d0e497c063ac6094ba 100644 (file)
@@ -34,7 +34,7 @@ class C
                a ();
        }
 
-       static int Main ()
+       public static int Main ()
        {
                new C ().Test ();
                return 0;
index 6f9f8aa830c8013d11b49d41953fdfffdc4d673e..91c7d722083932e0b53bd560a259dcb97fede9ff 100644 (file)
@@ -10,7 +10,7 @@ class Program
 
        static int pos;
 
-       static int Main ()
+       public static int Main ()
        {
                pos = 0;
                TestAsync ();
index 27e6d205583812164b064ba0be61aca6631d0d31..8d50e08acda559e987d611b2032e8ceda2c4b5db 100644 (file)
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                var mre = new ManualResetEvent (false);
                var mre_l = new ManualResetEvent (false);
index 55d7b08c89b51de6e0e87f0c97078858b31daee5..0a6dd398dbefaa52913db60f80353747997bea9a 100644 (file)
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 
 class Program
 {
-       static int Main ()
+       public static int Main ()
        {
                var mre_l = new ManualResetEvent (false);
                var mre = new ManualResetEvent (false);
index 5b18d6b54e0f18b568bd9f30ebb01ea4e2dbadfa..0c401f2fed4b3fcba0eebd22266567100f043b18 100644 (file)
@@ -15,7 +15,7 @@ class Test
                return 2;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                if (Foo (async (string str) => (short) 1) != 2)
                        return 1;
index 6593100005275a9dd3c6af759efda360f45737c4..8d4fe91de0427581cc453f2d64954978f598bfb1 100644 (file)
@@ -22,7 +22,7 @@ struct Struct
 
 class C
 {
-       static int Main ()
+       public static int Main ()
        {
                Struct s = new Struct ("1");
                var t = s.AsyncMethod ();
index 519c9bbc6591471fb26177448b39a8c0dc244032..494894786507d01a96e88fa3528062db183e1769 100644 (file)
@@ -10,7 +10,7 @@ class Program
                var t2 = Task.Run (() => { return t; });
        }
        
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 0c0d4a20c532c9d1ce046e4181e43494f6816258..93f0139c28de60c23785964d571cd9c173c68c16 100644 (file)
@@ -19,7 +19,7 @@ namespace ConsoleApplication1
                        return await task.Result;
                }
 
-               static int Main ()
+               public static int Main ()
                {
                        var t2 = Run (() => Task<int>.Factory.StartNew (() => 5));
 
index f0e3fc64870f8d1954df2e65932cf256b770c310..8942844d0a0ca6689ed8942ae8c953ddc5261303 100644 (file)
@@ -22,7 +22,7 @@ class Program
                throw new ApplicationException();
        }
 
-       static int Main()
+       public static int Main()
        {
                bool canceled = false;
                var t = TestCanceled().ContinueWith(l =>
index f43a3fe84b212c888bd4a3e759c7d93533edb554..4bb0ad9af4ad48818b52602aa1e972e8ac1e1977 100644 (file)
@@ -37,7 +37,7 @@ class B : A
 
 class Program
 {
-       static int Main()
+       public static int Main()
        {
                var b = new B ();
                if (b.Foo (3).Result != 4)
index b65822e11fe8fb4a03116572210c263165ad4fce..5b2cadb227447d463e9707739515cd0344f72504 100644 (file)
@@ -14,7 +14,7 @@ namespace N.M
                        return 0;
                }
 
-               static int Main ()
+               public static int Main ()
                {
                        var m = typeof (C).GetMethod ("AsyncMethod");
                        var attr = m.GetCustomAttribute<AsyncStateMachineAttribute> ();
index d02772f0d702e149ec31f826ef1c03d93bc451d4..40138879cae15888747bdce259456e713def706a 100644 (file)
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
 
 public class CompilerBug
 {
-       static void Main ()
+       public static void Main ()
        {
                var res = Foo ().Result;
                Console.WriteLine (res);
diff --git a/mcs/tests/test-async-41.cs b/mcs/tests/test-async-41.cs
new file mode 100644 (file)
index 0000000..0e8c0fa
--- /dev/null
@@ -0,0 +1,30 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public class AmbiguousGeneric
+{
+       public async void NestedVoidTestSuccess ()
+       {
+               await Run2 (async () => await ReturnOne ());
+       }
+
+       static Task<int> ReturnOne ()
+       {
+               return Task.Run (() => 1);
+       }
+
+       Task Run2 (Func<Task> arg)
+       {
+               return null;
+       }
+
+       Task Run2<T> (Func<T> arg)
+       {
+               return null;
+       }
+
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
index a59aff114dd139f188f1a98c6a8e507dfb7cf2a8..248c98f6b6b8c5928c1b300716d59e817339a9d1 100644 (file)
@@ -11,5 +11,5 @@ public class CLSClass {
                 return null;
         }
        
-        static void Main() {}
+        public static void Main() {}
 }
diff --git a/mcs/tests/test-com-01.cs b/mcs/tests/test-com-01.cs
new file mode 100644 (file)
index 0000000..9d3e0dd
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Runtime.InteropServices;
+
+       [ComImport, GuidAttribute("E5CB7A31-7512-11D2-89CE-0080C792E5D8")]
+       public class CorMetaDataDispenserExClass { }
+
+       [ComImport, GuidAttribute("31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3"),
+       CoClass(typeof(CorMetaDataDispenserExClass))]
+       public interface IMetaDataDispenserEx { }
+
+       
+public class Test
+{
+       public static void XXX ()
+       {
+               IMetaDataDispenserEx o = new IMetaDataDispenserEx();
+       }
+
+       public static void Main()
+       {
+               /* It doesn't work on Mono runtime
+               IMetaDataDispenserEx o = new IMetaDataDispenserEx();
+               if (o.GetType () != typeof (CorMetaDataDispenserExClass))
+                       return 1;
+               Console.WriteLine ("OK");
+               return 0;
+               */
+       }
+}
index 114808d3dffa6b8d6a4b1dbb6ccc47574a08e1da..6216b888614ab0496c5dce0f94bd23444c6f07db 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <symbols>
   <files>
-    <file id="1" name="support-test-debug-04.cs" checksum="b9b719e8fba5bec23da52975bc38e6ce" />
-    <file id="2" name="test-debug-04.cs" checksum="a57ebe1403fe320f2a98377745f7f0d1" />
+    <file id="1" name="test-debug-04.cs" checksum="a57ebe1403fe320f2a98377745f7f0d1" />
+    <file id="2" name="support-test-debug-04.cs" checksum="b9b719e8fba5bec23da52975bc38e6ce" />
   </files>
   <methods>
     <method token="0x6000001">
     </method>
     <method token="0x6000002">
       <sequencepoints>
-        <entry il="0x0" row="7" col="2" file_ref="1" hidden="false" />
-        <entry il="0x8" row="9" col="2" file_ref="2" hidden="false" />
+        <entry il="0x0" row="9" col="2" file_ref="1" hidden="false" />
+        <entry il="0x8" row="7" col="2" file_ref="2" hidden="false" />
       </sequencepoints>
       <locals />
       <scopes />
     </method>
     <method token="0x6000003">
       <sequencepoints>
-        <entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
-        <entry il="0x8" row="14" col="2" file_ref="2" hidden="false" />
-        <entry il="0x10" row="14" col="2" file_ref="1" hidden="false" />
-        <entry il="0x16" row="15" col="2" file_ref="1" hidden="false" />
-        <entry il="0x17" row="16" col="2" file_ref="1" hidden="false" />
+        <entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
+        <entry il="0x8" row="12" col="2" file_ref="2" hidden="false" />
+        <entry il="0x10" row="14" col="2" file_ref="2" hidden="false" />
+        <entry il="0x16" row="15" col="2" file_ref="2" hidden="false" />
+        <entry il="0x17" row="16" col="2" file_ref="2" hidden="false" />
       </sequencepoints>
       <locals />
       <scopes />
     </method>
     <method token="0x6000004">
       <sequencepoints>
-        <entry il="0x0" row="22" col="2" file_ref="1" hidden="false" />
-        <entry il="0x1" row="23" col="2" file_ref="1" hidden="false" />
+        <entry il="0x0" row="22" col="2" file_ref="2" hidden="false" />
+        <entry il="0x1" row="23" col="2" file_ref="2" hidden="false" />
       </sequencepoints>
       <locals />
       <scopes />
index ed5b7d8530172b162a30b1e5cfdba77668d18b49..bb884fe89d1ab023d0be0002c954ef61f8601048 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <symbols>
   <files>
-    <file id="1" name="test-debug-23.cs" checksum="50c2e83a7c3a471eb8f9993800d16ac8" />
+    <file id="1" name="test-debug-23.cs" checksum="11dd652c953a502005ebdc9b6cc6f94d" />
   </files>
   <methods>
     <method token="0x6000001">
index 29d7ecac4b8cfaa57998bc210e6099df94de8ee8..e7e6cef74785614d45b477abb956b8f35d742841 100644 (file)
@@ -41,7 +41,7 @@ class Program
                }
        }
 
-       static void Main ()
+       public static void Main ()
        {
        }
 }
\ No newline at end of file
index b15040a1e8565dfaf29df37089d1a6f437b11601..6e77421cad0d248514eb154d241d5e532005583b 100644 (file)
@@ -2,7 +2,7 @@
  
 class TestClass
 {
-       static void Main()
+       public static void Main()
        {
        }
 }
\ No newline at end of file
index 3895e3837b4c9c2e1af2f5419356daa139656899..80f36531b68e1b61756ee1e3f6a08e1d74ae4c27 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (MyAssembly01::GlobalClass.StaticMethod () != 1)
                        return 1;
index 2b4babc56b22511d623f74866d0fd4831208b5f4..b88942cc9a904c8fce5ca2f5d87408874e5898a7 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (MyAssembly01::Namespace1.MyClass1.StaticMethod () != 1)
                        return 1;
index d0e0affcbaf51b334d56abbc13b0655ee71b9d9f..e381c43286774b5ce88a1441f7a60931a5f92de4 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (MyAssembly01::Namespace1.MyClass1.MyNestedClass1.StaticMethod () != 1)
                        return 1;
index 81ff97e0c20ab05547841dd70211095c004b44ed..f5557930119b5500b91620256aee9b90e85bbcc9 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (MyAssembly01::Namespace1.Namespace2.MyClass2.StaticMethod () != 1)
                        return 1;
index fcff0b0c57a3153cf09a35bd6c03de971664b0bd..059f699e8a9896c8bf5bbcdf7884b5fd797aa719 100644 (file)
@@ -6,7 +6,7 @@ using System;
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
                MyAssembly01::GlobalClass.JustForFirst ();
                MyAssembly02::GlobalClass.JustForSecond ();
index 641d5dd3b2a2636166cfbb05a1665fa34b49c21b..a1879dd95128785bbaf0520b22194c549c807295 100644 (file)
@@ -36,7 +36,7 @@ namespace MyAssembly02
 
 public class Test
 {
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index d0d09c67c3599b12f9da3031275d529769f1ea97..bb102017a08b432a2ab90e600a4796e8ae8b025f 100644 (file)
@@ -17,7 +17,7 @@ namespace NS
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                if (NS.MyClass.GetInt () != 1)
                        return 1;
index 2aeb1994b380d826c13a6666ecf5c6446dc4ccc2..7a0919c3afb0add7e13e014f31de9c349d3ecc72 100644 (file)
@@ -9,7 +9,7 @@ using Namespace1;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                // This shouldn't produce a clash
                if (MyClass1.StaticMethod () != 2)
index 10077a05d95ea159e937d92f6cff2beea09faf51..8ede921a872dd2282036061503dd1ad375a88d06 100644 (file)
@@ -1,13 +1,13 @@
-// Compiler options: -r:MyAssembly01=test-externalias-00-lib.dll
+// Compiler options: -r:MyAssembly_01=test-externalias-00-lib.dll
 
-extern alias MyAssembly01;
+extern alias MyAssembly_01;
 using System;
 
-using SameNamespace = MyAssembly01;
+using SameNamespace = MyAssembly_01;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                SameNamespace.GlobalClass.StaticMethod ();
                return 0;
index 04a52b53fe507619bbcf6a8095c9836ea935e315..bb8a1aa9b77862d145d329fbc8be83ff868adc3e 100644 (file)
@@ -18,7 +18,7 @@ class X {
                yield return 3;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                IEnumerator e = GetIt ();
                int total = 0;
index b32c30b4e65565e87d39a7c959f180911515b450..1be1bb28b489679d86f80af8f11621749a4331ab 100644 (file)
@@ -15,7 +15,7 @@ class X {
                yield return 100;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                start = 10;
                end = 30;
index 342c03fa4bc5cf8c3e393adfeb6b4897214ae246..7f2e747b1fca7a73699ee8a551edc8466424c36a 100644 (file)
@@ -19,7 +19,7 @@ class X {
                        yield return a;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int total = 0;
                foreach (int i in GetIt (new int [] { 1, 2, 3})){
index 002230470285ec7442cf0b10ac5389472438f00c..dff8d02ba3e2f929fc149719d22215e53bc7986f 100644 (file)
@@ -10,7 +10,7 @@ class X {
                        yield return i;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                Console.WriteLine ("GetRange 10..20");
                                   
index d178419028c9c977043dc9887f894fc37d2bed62..cb35b7aeaf4649cf963a4cf0170fae26c62739b0 100644 (file)
@@ -18,7 +18,7 @@ class X {
                        yield return i;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                int total = 0;
                foreach (int i in GetIt ()) {
index 1abdcb8cdb80c7f2603fcd2dec9faf0af2308160..a291bb8b9a622d5adffea78ab02233e797c27f35 100644 (file)
@@ -38,7 +38,7 @@ class X {
                yield return 1;
        }
        
-       static int Main ()
+       public static int Main ()
        {
                X y = new X ();
 
index 051f00f4e7191a1bc93ee576b752ec0748495b73..13b338423ca1caf0c4cd65e72839e08af61895bd 100644 (file)
@@ -32,7 +32,7 @@ public class Test
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Test test = new Test ();
 
index 3b7b4b9e517fe168fc275fa5d8c90de0be26fd4f..562b1a526a41a0b9c5390f9f2af399ac232adb1d 100644 (file)
@@ -38,7 +38,7 @@ class X
                yield return foo4.disposed;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                ArrayList list = new ArrayList ();
                foreach (object data in Test (3, 5))
index b2ad3c8bf78fd043e819db751128c406e03699e1..95f8cd4129aff2cb72591d224e1ca08ea2fef9e1 100644 (file)
@@ -26,7 +26,7 @@ class X {
            }
        }
 
-       static int Main ()
+       public static int Main ()
        {
                IEnumerator e = GetIt;
                int total = 0;
index 3dcce679f4aaeb56fea79a7e13c6025a73d23cae..91f016d3915ef79690d00d1142b36be89e94ea68 100644 (file)
@@ -19,7 +19,7 @@ class X {
                Console.WriteLine ("Hook invoked");
        }
        
-       static void Main ()
+       public static void Main ()
        {
                X x = new X ();
                x.Hook += M;
index 88e102ed0894548504eb037559274d8b339bf2bb..213baa77140d89a0419b8744df3f87cbd18010c1 100644 (file)
@@ -7,5 +7,5 @@ class X {
                }
        }
 
-       static void Main () {}
+       public static void Main () {}
 }
index 482ba03670ccb5c2b29f9d17f0af40d558c11d75..62ddd6d632fdab0c9acf6717e040bc321fd938a6 100644 (file)
@@ -24,7 +24,7 @@ class XX {
                yield return 0;
        }
        
-       static void Main ()
+       public static void Main ()
        {
                foreach (int a in X ()){
                }
index 4e3125a7741248a392997451558cb6520da9d67d..abab58606bc72b98fe4f4574a3a19b70c7365cfb 100644 (file)
@@ -14,7 +14,7 @@ public class Test
                yield return "TEST2";
        }
 
-       static void Main ()
+       public static void Main ()
        {
                new Test ().Run ();
        }
index 81133012a7542cd749bb576e7939e52bb7688f24..d9be1a74d7157dcbca1420ec78a15f1edf784404 100644 (file)
@@ -4,7 +4,7 @@ class Foo {
        {
                try { yield break; } catch { } finally { }
        }
-       static int Main ()
+       public static int Main ()
        {
                int i = 0;
                foreach (object o in foo ())
index 00568fdbb77eeadef02a3a07b5eea6c7257de382..f31879a65ae2383736ce5d6866858e2c7982177c 100644 (file)
@@ -12,7 +12,7 @@ class Program
         }
     }
 
-    static void Main()
+    public static void Main()
     {
         IEnumerator enumerator = Empty.GetEnumerator();
         if (enumerator.Current == null)
index 6ed567b228835f4e4e418c5ecd21d01dea8ad0b4..dc0751750ede2ec7b2e45b6f144c5c8888cc387f 100644 (file)
@@ -17,7 +17,7 @@ class X {
                 }
         }
  
-        static int Main ()
+        public static int Main ()
         {
                 int total = 0;
                 foreach (int i in GetIt (new int [] { 1, 2, 3})){
index 8db4e3d679e94704fa36cbf301fd6b9ea9e76217..cf1b181359111ffbc14a818e673130866fa39d1d 100644 (file)
@@ -19,7 +19,7 @@ class X
                return 1;
        }
 
-       static int Main ()
+       public static int Main ()
        {
                var e = GetIt2 ().GetEnumerator ();
                ThreadPool.QueueUserWorkItem (l => {
index b795c980bdaa020a779e7acf33cf9b8430058879..d2bf163f89334c662413fe7fbd70aa8a588e25b7 100644 (file)
@@ -33,7 +33,7 @@ public class UploadAction
                yield break;
        }
 
-       static void Main ()
+       public static void Main ()
        {
                foreach (object bar in TagsError ()) {
                        Console.WriteLine ("No op {0}", bar);
index 66bb94728c4cc13f39e08e94f65a022501345a17..9bf6da10d7c70af0616e4f1b43b54cc9540e0ad0 100644 (file)
@@ -44,7 +44,7 @@ namespace X
 
 class Y
 {
-       static int Main ()
+       public static int Main ()
        {
                if (X.Test.FooWorld () != 8)
                        return 1;
index cd9ce174ceb4980235fced7c43f14962ffc460fd..e84f996d4968b2105820f202feb60d053cba43b0 100644 (file)
@@ -33,6 +33,6 @@ partial class D { }
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index fa4eb1be1f18fa546e68540d6778b70c1a85bccc..f4b77c75fe48d5a1888a13dfb01db6950ce74be4 100644 (file)
@@ -43,7 +43,7 @@ public partial class Test
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                Test test = new Test ();
                if (test.TestFoo () != 1)
index 3158d8e5cc56754bf534ae16e5ac364a78e861f1..1070fb77b8f2a1b8636650a7639f8bc14be52b24 100644 (file)
@@ -27,6 +27,6 @@ namespace B
 
 class X
 {
-       static void Main ()
+       public static void Main ()
        { }
 }
index e097bfc7864f89685516203f0db68fd9463936f7..6604fbf970df6db54954d2a462fc1ea38779aa0c 100644 (file)
@@ -19,4 +19,4 @@ partial class A2 : System.Object {
 partial class A2 {
 }
 
-class D { static void Main () {} }
+class D { public static void Main () {} }
index a8d184160b55d89ba0858f785b162287f4e7432b..5df048b372d4fb9c6022deb1362ad088cbba0543 100644 (file)
@@ -9,5 +9,5 @@ partial class Foo
 partial class Foo
 { }
 
-class B { static void Main () {} }
+class B { public static void Main () {} }
 
index d3cb8f612d823615f22dbc4afd999257794c1f9d..496f11bdfab5fd6783d37db9dfb0fa50c96e73ab 100644 (file)
@@ -23,7 +23,7 @@ public struct Test_2 {
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                if (Attribute.GetCustomAttributes (typeof (Test)).Length != 1)
                        return 1;
index 16eb58abeeca0fac98085d30a1ec3cc21b5d7793..ba8a5c32c46553a31475e0f17419218da362efe6 100644 (file)
@@ -36,7 +36,7 @@ namespace Test3
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                if (Test2.Foo.f != 10)
                        return 1;
index 0e6e9e12c33fa04a95e54ec68f7ccfa3d1bbc009..bed102e11dacf432f4b81bcd7c96f1fc8bf82285 100644 (file)
@@ -15,7 +15,7 @@ namespace Test1
 
 class X
 {
-       static int Main ()
+       public static int Main ()
        {
                foreach (string s in Test1.Foo.E())
                {
index 5f0b3509a7ddc0f8e363fef4c544740c4c9283cc..1cc0ef6bed716e728daf3f8e74dea7baa0f831ad 100644 (file)
@@ -8,6 +8,6 @@ namespace Test{
        public override int GetHashCode(){  
            return 1;  
        }
-       static void Main () {}
+       public static void Main () {}
     }  
 }
index 574e456154ef9991ce8ee2316271e0a7d963914f..54cfb9cb4e19d1e7892bca2c9278428940d6b1f1 100644 (file)
@@ -32,7 +32,7 @@ namespace ConsoleApplication1
 
        class Program
        {
-               static int Main ()
+               public static int Main ()
                {
                        var x = typeof (X).GetMethod ("Foo", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetCustomAttributes (true);
                        Console.WriteLine (x.Length);
index 2ecbbb92cd4a26fd21180f9bec084f6b48081346..8c865f4da8fceb1beaf7e4133c31bafc8e1ea275 100644 (file)
@@ -4,7 +4,7 @@ partial class A
 
 public class TestCase : A
 {      
-       static void Main ()
+       public static void Main ()
        {
        }
 }
index 0131a42ed2482676a6535397be5a314faf06abe5..4ca9106d0afff25d87d489980723fc694126cc20 100644 (file)
@@ -7,7 +7,7 @@ static partial class C
        [Obsolete]
        static partial void Foo_2 (string s);
 
-       static void Main()
+       public static void Main()
        {
        }
 }
index 576daff6d8b9218b78a1794fc85fbf40efd76a43..200436e92fc936c16383e5259885b553cfc8833a 100644 (file)
@@ -4,7 +4,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                var i = 5;
                var b = true;
index 46fe49daec12f48f2ec1b823a8bce169a8a029d6..d64527b69329b479e82f2e4cfec20b40ea75c0a1 100644 (file)
@@ -21,7 +21,7 @@ public class Test
                }
                public int Property = 42;
        }       
-       static int Main ()
+       public static int Main ()
        {
                var class1 = new Class1 ();
                
index e63fc09636d16ca8eeddf3916d9a79868f2fdd5f..7df159597406e4ae2480b059d87b0a6b73323d58 100644 (file)
@@ -5,7 +5,7 @@ using System.Collections;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                string [] strings = new string [] { "Foo", "Bar", "Baz" };
                foreach (var item in strings)
index 8e048709cda6cb2c996a5b3641e2f59a3bb94e7e..7a68b10fa1792c94c273884d9fc45fcc821d4980 100644 (file)
@@ -17,7 +17,7 @@ public class MyClass : IDisposable
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                using (var v = new MyClass("foo"))
                        if (v.GetType() != typeof (MyClass))
index d87ce0bbae4ff46bce72bd10dafb64f4731e5b37..08345c36686bf8ed133336511ece2d81aaae774a 100644 (file)
@@ -5,7 +5,7 @@ using System;
 
 public class Test
 {
-       static int Main ()
+       public static int Main ()
        {
                for (var i = 0; i < 1; ++i)
                        if (i.GetType() != typeof (int))
index 62caf69d3bbeb3583555ce899a1b7e68ccdd9d1a..5bf591a63987117f8f13921382283c8282e8ff22 100644 (file)
@@ -11,7 +11,7 @@ class X
                 var = i;
         }
 
-        static void Main ()
+        public static void Main ()
         {
         }
 }
index 584b0f0e1e4e668b1ae4b321527436079b7c1730..b6a6144fabd264b75e3788da59d6b5100f5d4b7b 100644 (file)
       <method name="Void test()" attrs="129">\r
         <size>197</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="dtest-015.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>67</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void TestErrorVersions()" attrs="129">\r
         <size>198</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>996</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo(IA`1)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>175</size>\r
       </method>\r
       <method name="System.Object &lt;Main&gt;m__0(System.Object)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="A">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>374</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test_2[T](IList`1, T)" attrs="150">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>868</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="dtest-045.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>249</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(System.Func`1[System.String])" attrs="150">\r
         <size>17</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="System.Object &lt;Main&gt;m__0()" attrs="145">\r
   </test>\r
   <test name="dtest-collectioninit-01.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>488</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable`1 D2()" attrs="150">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Boot">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="D">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo(Stack`1[Test])" attrs="134">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>26</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo(Stack)" attrs="150">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo(Stack)" attrs="150">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-019.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Print(System.Object)" attrs="150">\r
         <size>40</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Foo`1[System.Int32])" attrs="145">\r
         <size>9</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Foo)" attrs="145">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>37</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object Test(Stack`1[System.Int32])" attrs="150">\r
         <size>15</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Bar`2[System.Int32,System.String])" attrs="145">\r
         <size>25</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Bar`2[System.Int32,System.String])" attrs="150">\r
         <size>25</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Bar`2)" attrs="145">\r
         <size>25</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Bar`3)" attrs="145">\r
         <size>36</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>49</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 DoTheTest[T]()" attrs="145">\r
         <size>145</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>177</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>87</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void do_hello(System.String)" attrs="145">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-047.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="T G[T]()" attrs="150">\r
         <size>7</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Hello()" attrs="129">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test.X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Array[T](T[])" attrs="145">\r
         <size>22</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="N2.X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       </method>\r
-    </type>\r
-    <type name="TestLog+MyTest">\r
       <method name="Void Main(System.String[])" attrs="150">\r
         <size>207</size>\r
       </method>\r
-      <method name="Void .ctor()" attrs="6278">\r
-        <size>7</size>\r
-      </method>\r
     </type>\r
   </test>\r
   <test name="gtest-057.cs">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>49</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-058.cs">\r
     <type name="Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>84</size>\r
       </method>\r
       <method name="System.String &lt;Main&gt;m__0(Double)" attrs="145">\r
       <method name="IEnumerable`1 Test(Int32, Int64)" attrs="134">\r
         <size>51</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>95</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>85</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Add(Int32, Int32)" attrs="145">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>27</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Baulig.X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       </method>\r
     </type>\r
-    <type name="TestLog+MyTest">\r
+    <type name="Pair`2[T,U]">\r
+      <method name="Void .ctor(T, U)" attrs="6278">\r
+        <size>16</size>\r
+      </method>\r
+    </type>\r
+    <type name="TestLog">\r
       <method name="Void Main(System.String[])" attrs="150">\r
         <size>212</size>\r
       </method>\r
       <method name="Void TestPairLog()" attrs="150">\r
         <size>186</size>\r
       </method>\r
-      <method name="Void .ctor()" attrs="6278">\r
-        <size>7</size>\r
-      </method>\r
-    </type>\r
-    <type name="Pair`2[T,U]">\r
-      <method name="Void .ctor(T, U)" attrs="6278">\r
-        <size>16</size>\r
-      </method>\r
     </type>\r
   </test>\r
   <test name="gtest-073.cs">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>113</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>54</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Quicksort[U](Foo`1[U][])" attrs="150">\r
         <size>9</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-101.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-104.cs">\r
     <type name="MainClass">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>27</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>58</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-109.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>76</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>86</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>43</size>\r
       </method>\r
       <method name="Double &lt;Main&gt;m__0(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Slow.Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>202</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean Check2[T](E)" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>213</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-122.cs">\r
     <type name="Test">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>27</size>\r
       </method>\r
       <method name="Void D(Int32)" attrs="150">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Collections.Generic.List`1[T] foo1[T](Filter`1)" attrs="145">\r
         <size>46</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>46</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-135.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>117</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Martin.X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>149</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-138.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-140.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>134</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-141.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>2253</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test()" attrs="145">\r
         <size>1157</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-172.cs">\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-177.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>119</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-178.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>289</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>211</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-184.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>69</size>\r
       </method>\r
       <method name="Boolean &lt;Main&gt;m__0(System.String)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-192.cs">\r
     <type name="xX">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Martin.Collections.Generic.X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(System.Type, System.Object)" attrs="145">\r
         <size>32</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>145</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void p(System.String)" attrs="145">\r
         <size>8</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Driver">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="ClassLibrary3.Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Fun[T](T)" attrs="150">\r
         <size>16</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Fun[T](T)" attrs="150">\r
         <size>79</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-214.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>104</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="PopQuiz">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>171</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="SetTest">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Tester">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-231.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-233.cs">\r
     <type name="Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>26</size>\r
       </method>\r
       <method name="Void list_ListChanged(System.Object, System.ComponentModel.ListChangedEventArgs)" attrs="145">\r
       <method name="IFoo`1 GetFooGeneric[T]()" attrs="134">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>83</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-238.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>297</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="main">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-246.cs">\r
     <type name="TestCase.CTest">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Bar()" attrs="134">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean Test(System.Object)" attrs="145">\r
         <size>27</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>7</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
         <size>22</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void Run()" attrs="129">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void f6(ParamEnum)" attrs="134">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>167</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator`1 Test[S,T](S)" attrs="150">\r
         <size>29</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Response[T](Handler`1[T])" attrs="129">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Bar()" attrs="129">\r
         <size>8</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(Boolean)" attrs="145">\r
         <size>71</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>247</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(Nullable`1)" attrs="145">\r
         <size>63</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test[T](T)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>448</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-277.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="BugReport">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test()" attrs="145">\r
         <size>54</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-287.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void D()" attrs="486">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>74</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-291.cs">\r
     <type name="Global">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="System.String Test2(Nullable`1)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="A Test(A, B)" attrs="150">\r
         <size>18</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>101</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test.Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-297.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestClass">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void &lt;a&gt;m__0(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>63</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 g()" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void test(Int32)" attrs="145">\r
         <size>30</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>142</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-316.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(Callback)" attrs="6278">\r
       <method name="Void Test(MyBase`2+Callback[System.String,System.Int32])" attrs="134">\r
         <size>9</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(Callback)" attrs="6278">\r
       <method name="Void F(Int64)" attrs="134">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>59</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-333.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
     </type>\r
       <method name="Void SetValue[T](System.Object, T)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-338.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void Foo[T](IList`1)" attrs="145">\r
   </test>\r
   <test name="gtest-339.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void SerializeDictionary(IDictionary)" attrs="145">\r
       <method name="IEnumerable Enumerable(System.String)" attrs="134">\r
         <size>7</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-349.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>121</size>\r
       </method>\r
       <method name="Int32 f2(IList, IList)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>125</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-364.cs">\r
     <type name="BugReport.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>380</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-365.cs">\r
     <type name="B.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>69</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Assert[T](T, T)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Repro">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Bar[TFoo](TFoo)" attrs="145">\r
   </test>\r
   <test name="gtest-371.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>87</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean Compute2(Int32)" attrs="150">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>46</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-381.cs">\r
     <type name="TestGoto">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="IEnumerable`1 setX()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>279</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void f(Data)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-390.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Func`1[System.Int32] Method(System.String)" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Nullable`1 NegateBar(Bar)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>168</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestIssue.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean Foo[T]()" attrs="145">\r
         <size>25</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>94</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-402.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 &lt;Test_12&gt;m__0()" attrs="145">\r
         <size>10</size>\r
       </method>\r
+      <method name="Void Test_13(System.Object)" attrs="129">\r
+        <size>53</size>\r
+      </method>\r
     </type>\r
   </test>\r
   <test name="gtest-410.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-412.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>261</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>103</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-415.cs">\r
     <type name="Foo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
       <method name="Boolean Bar[T](T)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="TestCase">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>141</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-419.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>64</size>\r
       </method>\r
       <method name="System.Object Test(System.String)" attrs="145">\r
       <method name="Int32 Test(System.Object, System.Object[])" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="MonoTest.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Nullable`1 get_Prop()" attrs="2182">\r
         <size>50</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-431.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-433.cs">\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="testcase.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>88</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-435.cs">\r
     <type name="testcase.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>293</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="EntryPoint">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-445.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Foo[T](T ByRef)" attrs="145">\r
   </test>\r
   <test name="gtest-449.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-450.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-455.cs">\r
     <type name="ConsoleApplication1.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo[T]()" attrs="129">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="GenericTest.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-462.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>97</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean Test[T](T)" attrs="129">\r
         <size>18</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>58</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Bar">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-483.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>109</size>\r
       </method>\r
       <method name="Void ReplaceContentsWith[T](T, T)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-495.cs">\r
     <type name="Repro">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="a">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="a">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-500.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>101</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Dispose()" attrs="486">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="T FindExisting[T]()" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-536.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>7</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>35</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="TR Test[T1,T2,TR](T1, T2, System.Func`3[T1,T2,TR])" attrs="145">\r
         <size>17</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-554.cs">\r
     <type name="Mono.Test.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>159</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void PassByRef[T](T ByRef)" attrs="145">\r
         <size>17</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-568.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>111</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-571.cs">\r
+    <type name="A`1[T]">\r
+      <method name="A`1[MM] For[MM]()" attrs="1478">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="B`3[U,X,V]">\r
+      <method name="A`1[PP] For[PP]()" attrs="198">\r
+        <size>20</size>\r
+      </method>\r
+      <method name="Void .ctor(A`1)" attrs="6278">\r
+        <size>15</size>\r
+      </method>\r
+    </type>\r
+    <type name="Test">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>20</size>\r
+      </method>\r
+      <method name="A`1[QQ] For[QQ]()" attrs="198">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-anontype-01.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object TestA(System.String)" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>122</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>139</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String Null()" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>357</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-anontype-06.cs">\r
     <type name="CastByExample">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>30</size>\r
       </method>\r
       <method name="T Cast[T](System.Object, T)" attrs="145">\r
   </test>\r
   <test name="gtest-anontype-07.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
     </type>\r
       <method name="IEnumerable`1 Select[T](System.Array, System.Func`2[System.Object,T])" attrs="150">\r
         <size>51</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>182</size>\r
       </method>\r
       <method name="Boolean &lt;Main&gt;m__1(&lt;&gt;__AnonType0`2[System.String,System.Reflection.PropertyInfo])" attrs="145">\r
       <method name="Void set_Answer(Int32)" attrs="2177">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>120</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Answer(Int32)" attrs="2193">\r
         <size>7</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>142</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Foo(System.String)" attrs="2182">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>301</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">\r
         <size>91</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>562</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-collectioninit-03.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>42</size>\r
       </method>\r
       <method name="Void R(System.Object ByRef)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>394</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Assert[T](T, T)" attrs="145">\r
         <size>48</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>358</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-etree-11.cs">\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-etree-13.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>66</size>\r
       </method>\r
       <method name="IEnumerable`1 Test[T](Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Repro">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>67</size>\r
       </method>\r
       <method name="IEnumerable`1 GetPersons[T](IEnumerable`1, Int32)" attrs="145">\r
   </test>\r
   <test name="gtest-etree-16.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>152</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>156</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void RunOnBaz(System.Action`1[IBaz])" attrs="486">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>222</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-exmethod-12.cs">\r
     <type name="Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>64</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String get_Property()" attrs="2182">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>45</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Repro">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>173</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void M(I)" attrs="145">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void M(I)" attrs="145">\r
         <size>8</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Bar.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>18</size>\r
       </method>\r
       <method name="System.String Pan(System.Byte[])" attrs="147">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo()" attrs="129">\r
         <size>18</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-exmethod-45.cs">\r
+    <type name="C">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-fixedbuffer-01.cs">\r
     <type name="TestNew">\r
       <method name="Void SetTest()" attrs="134">\r
   </test>\r
   <test name="gtest-friend-01.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-02.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-03.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-04.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-05.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-06.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-07.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-08.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-09.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-10.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-11.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-friend-12.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-implicitarray-01.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>329</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>63</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>85</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-initialize-02.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>1280</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object Foo()" attrs="134">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Boolean Do(Foo)" attrs="145">\r
       <method name="IEnumerable`1 Annotations(System.Type)" attrs="134">\r
         <size>44</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="145">\r
         <size>51</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>185</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>157</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable`1 GetIt()" attrs="129">\r
         <size>30</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>145</size>\r
       </method>\r
       <method name="Int32 &lt;get_BaseM&gt;__BaseCallProxy0()" attrs="129">\r
       <method name="IEnumerable`1 TestMethod()" attrs="134">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-iter-20.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>72</size>\r
       </method>\r
       <method name="IEnumerable GetAll()" attrs="145">\r
   </test>\r
   <test name="gtest-iter-27.cs">\r
     <type name="CompilerBug">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>61</size>\r
       </method>\r
       <method name="IEnumerable`1 Foo()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>328</size>\r
       </method>\r
       <method name="Int32 &lt;Main&gt;m__0(Int32)" attrs="145">\r
       <method name="Void Foo(funcs)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="System.String &lt;Main&gt;m__0(System.String)" attrs="145">\r
       <method name="Y F[X,Y](Int32, X, Func`2[X,Y])" attrs="145">\r
         <size>16</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="TimeSpan &lt;Main&gt;m__0(System.String)" attrs="145">\r
       <method name="Z F[X,Y,Z](X, Func`2[X,Y], Func`2[Y,Z])" attrs="145">\r
         <size>22</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>116</size>\r
       </method>\r
       <method name="TimeSpan &lt;Main&gt;m__0(System.String)" attrs="145">\r
       <method name="Void StopTrue(T)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>44</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0(F)" attrs="145">\r
       <method name="Void F[T](T[], T, Func`1[T])" attrs="145">\r
         <size>43</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>78</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String Bar()" attrs="145">\r
         <size>43</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>77</size>\r
       </method>\r
       <method name="System.String &lt;Bar&gt;m__1(System.String)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Repro">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>128</size>\r
       </method>\r
       <method name="Int32 &lt;Main&gt;m__1(System.String)" attrs="145">\r
       <method name="Void AssertFoo[T](IList`1)" attrs="145">\r
         <size>35</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String Bar()" attrs="145">\r
         <size>43</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>108</size>\r
       </method>\r
       <method name="System.String &lt;Bar&gt;m__0(System.String)" attrs="145">\r
   </test>\r
   <test name="gtest-lambda-26.cs">\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="Void Execute(System.Action)" attrs="150">\r
       </method>\r
     </type>\r
     <type name="CustomQueryExpressionPattern">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>171</size>\r
       </method>\r
       <method name="TestA &lt;Main&gt;m__0(TestA)" attrs="145">\r
   </test>\r
   <test name="gtest-linq-13.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Foo(TypeDefinition)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Assert(System.Action)" attrs="150">\r
       <method name="Boolean Test2(System.Func`2[System.Int32,System.Int32])" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>658</size>\r
       </method>\r
       <method name="&lt;&gt;__AnonType0`2[System.Int32,System.Boolean] &lt;Main&gt;m__0(Int32)" attrs="145">\r
   </test>\r
   <test name="gtest-linq-21.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Test.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>80</size>\r
       </method>\r
       <method name="System.String &lt;Main&gt;m__0(Test.C)" attrs="145">\r
       <method name="Void m(Int32, Int32, Int32, Int32)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>336</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test_7(Boolean, Int32, System.Object[])" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>161</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="gtest-optional-10.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>9</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(S)" attrs="150">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-partial-04.cs">\r
+    <type name="C">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-var-04.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>246</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>75</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>42</size>\r
       </method>\r
     </type>\r
   </test>\r
   <test name="gtest-variance-18.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Bla[T,U]()" attrs="145">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>7</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>110</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>69</size>\r
       </method>\r
       <method name="Int32 Bar(Foo`1[System.Object])" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Int32 Bar(Foo`1[System.String], System.String)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>136</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-1.cs">\r
     <type name="X">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void TestDecimal(Decimal)" attrs="129">\r
         <size>16</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void GetProperty()" attrs="134">\r
         <size>13</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void async_callback(IAsyncResult)" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>427</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void async_callback(IAsyncResult)" attrs="145">\r
         <size>101</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>97</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-108.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>107</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-109.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>31</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object get_obj()" attrs="145">\r
         <size>14</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Int32[] g()" attrs="145">\r
         <size>22</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>31</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-116.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-118.cs">\r
     <type name="Container">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>45</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-12.cs">\r
     <type name="X">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>322</size>\r
       </method>\r
       <method name="System.String s(System.String, Int32)" attrs="145">\r
   </test>\r
   <test name="test-120.cs">\r
     <type name="test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>154</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 g()" attrs="145">\r
         <size>22</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>104</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object get_null()" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>125</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Iface.Method()" attrs="481">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>46</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-127.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>45</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-129.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>156</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-130.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-132.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>75</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void get_struct(S ByRef)" attrs="145">\r
         <size>25</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>103</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void B()" attrs="486">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>94</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="A get_Prop()" attrs="2182">\r
         <size>14</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestConflict">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void X()" attrs="486">\r
         <size>16</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>123</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-138.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 GetHashCode()" attrs="198">\r
         <size>26</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
     </type>\r
       <method name="Int32 GetInfo(MonoEnumInfo ByRef)" attrs="145">\r
         <size>28</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Run">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>73</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(System.String, System.Object[])" attrs="150">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>94</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 blah(System.Object)" attrs="145">\r
         <size>70</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="DateTime get_DateTime()" attrs="2182">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor(String)" attrs="6278">\r
       <method name="Int32 Hello()" attrs="129">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6276">\r
       <method name="Int32 Hello(IInferior)" attrs="129">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>84</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(X+Foo[])" attrs="145">\r
         <size>41</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="D">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>120</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 A()" attrs="129">\r
         <size>56</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-171.cs">\r
     <type name="IntPtr_Conv.Class1">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 test_inline()" attrs="145">\r
         <size>42</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>132</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test()" attrs="145">\r
         <size>297</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-174.cs">\r
     <type name="ProtectedAccessToPropertyOnChild">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>77</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-176.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>48</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 ret(Int32)" attrs="145">\r
         <size>33</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>90</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 M(Int32, Int32 ByRef)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>89</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
       <method name="Int32 Test(Int32)" attrs="150">\r
         <size>50</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestBUG.Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void A(System.Collections.Specialized.NameValueCollection, MyClass, System.Object)" attrs="145">\r
         <size>66</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-190.cs">\r
     <type name="A">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="R">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-192.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>4</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(Int32)" attrs="145">\r
         <size>94</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
       <method name="Void Bug2()" attrs="129">\r
         <size>16</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-2.cs">\r
     <type name="X">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>123</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-214.cs">\r
     <type name="N2.Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="MonoEmbed">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void Whatever(System.String)" attrs="145">\r
   </test>\r
   <test name="test-217.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>226</size>\r
       </method>\r
       <method name="System.Object compare_gte(Int32, Int32)" attrs="145">\r
   </test>\r
   <test name="test-218.cs">\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void compareQueryQuery1(System.Object)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Driver">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>61</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-223.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>89</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 foo()" attrs="134">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Value(Int32)" attrs="2198">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>213</size>\r
       </method>\r
       <method name="Void .cctor()" attrs="6289">\r
   </test>\r
   <test name="test-230.cs">\r
     <type name="TestClass">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>70</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-231.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>48</size>\r
       </method>\r
       <method name="Void Foo()" attrs="129">\r
   </test>\r
   <test name="test-233.cs">\r
     <type name="Tests">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="Int32 test_0_beq()" attrs="145">\r
   </test>\r
   <test name="test-234.cs">\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>701</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void ConditionalMethod()" attrs="145">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="MainClass">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>26</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_S(System.String)" attrs="2193">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>115</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void ConditionalMethod()" attrs="150">\r
         <size>18</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String Test()" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>9</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-244.cs">\r
     <type name="Foo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>164</size>\r
       </method>\r
       <method name="MyBool get_t()" attrs="2193">\r
       <method name="System.String get_def_kind()" attrs="2182">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="B">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="B">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>73</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Foo GetFoo()" attrs="145">\r
         <size>18</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>33</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-249.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-25.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>264</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-251.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-257.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>9</size>\r
       </method>\r
       <method name="Void call(Int32 ByRef)" attrs="145">\r
       <method name="Void MyTest.Test.Inner.Foo()" attrs="481">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(T)" attrs="145">\r
         <size>134</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void X()" attrs="129">\r
         <size>8</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-265.cs">\r
     <type name="ClassFormatError">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(String, Object[])" attrs="6275">\r
   </test>\r
   <test name="test-268.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Result InstVtAddASecondBunchOfInts(Int32, ...)" attrs="129">\r
         <size>80</size>\r
       </method>\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>415</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Test(System.String, ...)" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>93</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="C X()" attrs="145">\r
         <size>18</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>65</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void f3()" attrs="129">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-277.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Int32 X(Byte)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-279.cs">\r
     <type name="FlagsAttributeDemo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Item(Int32, Int32)" attrs="2177">\r
         <size>27</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>152</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean EnumInSet(System.Enum, System.Enum[])" attrs="150">\r
         <size>54</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object Add(integer, System.Object)" attrs="150">\r
         <size>83</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>86</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Foo()" attrs="198">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>70</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-285.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>11</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Demo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>69</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void bar_f(System.Object)" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-292.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-296.cs">\r
     <type name="GetElementTypeTest">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>49</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-297.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>378</size>\r
       </method>\r
       <method name="Void Login(System.String)" attrs="134">\r
       </method>\r
     </type>\r
     <type name="test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>220</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 T()" attrs="145">\r
         <size>82</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void A.B.METHOD()" attrs="481">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>167</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-314.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>75</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test2(IE)" attrs="145">\r
         <size>21</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-317.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-319.cs">\r
     <type name="ConstFields">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>352</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-320.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor(SByte*, Int32, Int32)" attrs="6278">\r
       <method name="Void Dispose()" attrs="486">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>31</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>52</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-323.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>68</size>\r
       </method>\r
       <method name="Double &lt;Main&gt;m__0(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="A.B.Tester">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-328.cs">\r
     <type name="A.B.Tester">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-329.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Application">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>149</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-330.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>9</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-334.cs">\r
     <type name="Test.Foo.Index.CompoundFileReader">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void C(Int32 ByRef)" attrs="145">\r
         <size>5</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor(Foo)" attrs="6278">\r
   </test>\r
   <test name="test-339.cs">\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Concat(System.String[])" attrs="145">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void remove_y(Y)" attrs="2182">\r
         <size>42</size>\r
       </method>\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void Foo()" attrs="129">\r
   </test>\r
   <test name="test-346.cs">\r
     <type name="TestMethods.Class1">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>101</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>63</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void w(Int32)" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>310</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Bar(System.String, System.Object[])" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>243</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="A">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-356.cs">\r
     <type name="MainClass">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Foo.Bar">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>311</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-362.cs">\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void Test()" attrs="145">\r
   </test>\r
   <test name="test-364.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>52</size>\r
       </method>\r
       <method name="Int32 t1(Int32)" attrs="145">\r
       <method name="Int32 t2(Int32)" attrs="145">\r
         <size>55</size>\r
       </method>\r
-      <method name="Void Main2(System.String[])" attrs="145">\r
+      <method name="Void Main2(System.String[])" attrs="150">\r
         <size>75</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_LiteralType(LiteralType)" attrs="2182">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-366.cs">\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-367.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-368.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>26</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 GetHashCode()" attrs="198">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>48</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 simple_test_double_dim()" attrs="145">\r
         <size>96</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-371.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(Boolean&amp;)" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Rest">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="c">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>320</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-380.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>30</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-382.cs">\r
     <type name="Dec">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>109</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="145">\r
         <size>43</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-385.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="ObjectID op_Implicit(Int64)" attrs="2198">\r
         <size>15</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor(Int64)" attrs="6278">\r
       <method name="C MethodSampleC(System.String)" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>114</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.String MethodSampleC(C)" attrs="145">\r
         <size>31</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>129</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void MethodSample(B, A, C)" attrs="145">\r
         <size>56</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>72</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-398.cs">\r
     <type name="Tester">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>119</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void G(...)" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>394</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void test(Int32)" attrs="129">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>126</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 TestMultiple()" attrs="145">\r
         <size>111</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>115</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-401.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>207</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-402.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>26</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32* get_v()" attrs="145">\r
         <size>29</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="testapp.TestApp">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-406.cs">\r
     <type name="TestCase.Test">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>228</size>\r
       </method>\r
       <method name="UInt32 DoOp(UInt32*)" attrs="145">\r
   </test>\r
   <test name="test-408.cs">\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>59</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-409.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
       </method>\r
     </type>\r
       <method name="Void A(Int32 ByRef, UInt32 ByRef, SByte ByRef, Byte ByRef, Int64 ByRef, UInt64 ByRef, Int16 ByRef, UInt16 ByRef, Char ByRef, X ByRef, Single ByRef, Double ByRef)" attrs="145">\r
         <size>189</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>310</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-419.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 arrays()" attrs="145">\r
         <size>265</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>214</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-420.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Func(Int32 ByRef)" attrs="145">\r
         <size>13</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>11</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-426.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-427.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean test_multi(System.Int32[,])" attrs="145">\r
         <size>100</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>332</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 count(System.Object)" attrs="145">\r
         <size>50</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>154</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-442.cs">\r
     <type name="ConsoleApplication1.Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>73</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-449.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Z()" attrs="129">\r
   </test>\r
   <test name="test-451.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void IInteger.Add(Int32)" attrs="481">\r
         <size>12</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean cast_bool(System.Object)" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>1364</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Method(System.String)" attrs="129">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
-  <test name="test-468.cs">\r
-    <type name="CorMetaDataDispenserExClass">\r
-      <method name="Void .ctor()" attrs="6278">\r
-        <size>0</size>\r
-      </method>\r
-    </type>\r
-    <type name="Test">\r
-      <method name="Void XXX()" attrs="150">\r
-        <size>13</size>\r
-      </method>\r
-      <method name="Void Main()" attrs="150">\r
-        <size>2</size>\r
-      </method>\r
-      <method name="Void .ctor()" attrs="6278">\r
-        <size>7</size>\r
-      </method>\r
-    </type>\r
-  </test>\r
   <test name="test-469.cs">\r
     <type name="Del">\r
       <method name="Void Invoke(Int32)" attrs="454">\r
       <method name="Del[] Make2(Int32)" attrs="145">\r
         <size>58</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>86</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean t()" attrs="145">\r
         <size>32</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>511</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Demo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Prop(Int32)" attrs="2182">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>97</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-474.cs">\r
     <type name="Z">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void TestPreinc(Int32)" attrs="145">\r
       <method name="Int32 GetHashCode()" attrs="198">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void M4(Int32, ...)" attrs="134">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-487.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>33</size>\r
       </method>\r
       <method name="Void .ctor(Object)" attrs="6273">\r
       <method name="IEnumerable foo()" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>169</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-489.cs">\r
     <type name="test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void test_1597()" attrs="145">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>1390</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-490.cs">\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-494.cs">\r
     <type name="Agresso.Foundation.Function">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="plj.fromClass">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-497.cs">\r
     <type name="PlotMenuItem">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>63</size>\r
       </method>\r
       <method name="Void MenuItem_Click(System.Object, System.EventArgs)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>99</size>\r
       </method>\r
     </type>\r
   </test>\r
   <test name="test-5.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>45</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 get_Property()" attrs="2182">\r
         <size>11</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-503.cs">\r
     <type name="Foo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 f()" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Name(System.String)" attrs="2243">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="boot">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-513.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>322</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void HandleConflict(Int32)" attrs="150">\r
         <size>37</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>56</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-515.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-516.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>41</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-518.cs">\r
     <type name="Foo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-519.cs">\r
     <type name="Foo">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void f()" attrs="145">\r
       <method name="Y GetEnumerator()" attrs="134">\r
         <size>14</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>548</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void stuff_finally()" attrs="129">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-526.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void Foo(IListCounter)" attrs="145">\r
   </test>\r
   <test name="test-527.cs">\r
     <type name="Repro">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>56</size>\r
       </method>\r
       <method name="Void foo()" attrs="134">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>288</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void e(System.Object[])" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void False(Boolean)" attrs="145">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-535.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>77</size>\r
       </method>\r
       <method name="Void Compile()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-539.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>84</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean v()" attrs="129">\r
         <size>19</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Item(Int32, Boolean, System.Object[], Boolean)" attrs="2182">\r
         <size>41</size>\r
       </method>\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>259</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-544.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-547.cs">\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="User">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void CharToX()" attrs="134">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>48</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-558.cs">\r
     <type name="TestClass">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void TestMethod(Int32)" attrs="150">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>279</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-562.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>58</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-567.cs">\r
     <type name="preservesig_test.Class1">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>166</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-574.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-575.cs">\r
     <type name="Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-576.cs">\r
     <type name="Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-579.cs">\r
     <type name="TestCase">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>49</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-583.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>27</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-586.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>112</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-587.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 test_implicit()" attrs="145">\r
         <size>136</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>75</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-590.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="System.String Foo()" attrs="129">\r
       <method name="Void XXXA()" attrs="145">\r
         <size>7</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-594.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>112</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Object SetDictionaryValue(System.Object, SymbolId, System.Object)" attrs="150">\r
         <size>26</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-6.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>45</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-603.cs">\r
     <type name="ConsoleApplication1.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>65</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-604.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>102</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-606.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>194</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-607.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>143</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void remove_XX(X+MyEvent)" attrs="2182">\r
         <size>4</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Z">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean IsAltered()" attrs="134">\r
         <size>872</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Or()" attrs="147">\r
         <size>142</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>88</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-619.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Int32[,,] getMoreInt()" attrs="129">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void B(Int32 ByRef)" attrs="145">\r
         <size>8</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>35</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-621.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>130</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo(System.Object ByRef)" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void a()" attrs="198">\r
         <size>17</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 get_Type()" attrs="2177">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>4</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
       <method name="Void A()" attrs="129">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>44</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void N(System.Object)" attrs="145">\r
         <size>9</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-63.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Boolean)" attrs="145">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean f()" attrs="145">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>168</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void test_for_empty()" attrs="145">\r
         <size>36</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>31</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-638.cs">\r
     <type name="Fail">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>111</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_s(System.String)" attrs="2177">\r
         <size>35</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>68</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Decimal op_Implicit(Identifier)" attrs="2198">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>73</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-643.cs">\r
     <type name="PointerArithmeticTest">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>137</size>\r
       </method>\r
       <method name="Int32* Conversions(Int64)" attrs="145">\r
       <method name="Boolean Test_4(Program+D)" attrs="134">\r
         <size>21</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="UInt32 CastIntPtrToUInt32(IntPtr)" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>145</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="S Plain()" attrs="145">\r
         <size>24</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>132</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-650.cs">\r
     <type name="App">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-654.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Int32 Test(SByte*)" attrs="145">\r
       <method name="Void set_Item(Int32, Byte)" attrs="2177">\r
         <size>9</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>76</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-656.cs">\r
     <type name="Goo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>27</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Excluded()" attrs="150">\r
         <size>12</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-659.cs">\r
     <type name="MySubClass">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void set_BB(Int32, Boolean)" attrs="2534">\r
       <method name="Int32 TestObjectDouble()" attrs="145">\r
         <size>87</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>108</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-661.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void TestMethod()" attrs="134">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>8</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-669.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>4</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-671.cs">\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>27</size>\r
       </method>\r
       <method name="Boolean Bar(System.Object)" attrs="145">\r
       <method name="S* get_Foo2()" attrs="2177">\r
         <size>11</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-678.cs">\r
     <type name="NaNTest">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="Void .ctor(Double, Double)" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>197</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-684.cs">\r
     <type name="mono_bug.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>78</size>\r
       </method>\r
       <method name="System.Double[][,] ReturnArray()" attrs="145">\r
   </test>\r
   <test name="test-686.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>53</size>\r
       </method>\r
       <method name="Void Foo()" attrs="145">\r
   </test>\r
   <test name="test-690.cs">\r
     <type name="Test.Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-691.cs">\r
     <type name="ConsoleApplication6.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>133</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-695.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>766</size>\r
       </method>\r
       <method name="System.String get_BaseDirectory()" attrs="2193">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Z">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>98</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="UInt16 ToUint16()" attrs="131">\r
         <size>14</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-702.cs">\r
     <type name="S">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor(Int32)" attrs="6278">\r
       <method name="Void ArglistMethod(...)" attrs="145">\r
         <size>52</size>\r
       </method>\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-71.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-712.cs">\r
     <type name="Hello">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void IBar.Test()" attrs="481">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>230</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-72.cs">\r
     <type name="outer">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-720.cs">\r
     <type name="N.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-721.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>68</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void M[T](T)" attrs="129">\r
         <size>19</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>61</size>\r
       </method>\r
       <method name="Void .ctor(Int32)" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>35</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 GetPhones()" attrs="129">\r
         <size>30</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-74.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>198</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Driver">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>54</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="driver">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void StaticCallback(System.String)" attrs="150">\r
         <size>36</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>49</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-77.cs">\r
     <type name="XX">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>258</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-772.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>86</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="a">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>44</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Boolean IntCasting()" attrs="145">\r
         <size>31</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>44</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-788.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>44</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-789.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>77</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0()" attrs="145">\r
   </test>\r
   <test name="test-79.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>48</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test2(IMemberDelayed)" attrs="129">\r
         <size>20</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-793.cs">\r
     <type name="MonoPointerBugTest.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-799.cs">\r
     <type name="Test2">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-808.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>70</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>38</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="System.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="System.Reflection.Assembly CurrentDomain_TypeResolve(System.Object, System.ResolveEventArgs)" attrs="145">\r
   </test>\r
   <test name="test-817.cs">\r
     <type name="System.Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>18</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Foo.Foo">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>21</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-827.cs">\r
     <type name="Program">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>9</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="DelegateTest">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-832.cs">\r
     <type name="A">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>54</size>\r
       </method>\r
       <method name="Void Test()" attrs="129">\r
   </test>\r
   <test name="test-84.cs">\r
     <type name="Ghost">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Foo[TEventArgs,TEventHandler](A`1[TEventHandler], System.Action`2[System.Object,TEventArgs])" attrs="150">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0(System.Object, System.String)" attrs="145">\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       </method>\r
+      <method name="Int32 Test(Boolean, Int16)" attrs="150">\r
+        <size>22</size>\r
+      </method>\r
     </type>\r
   </test>\r
   <test name="test-85.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>33</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-853.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>35</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-855.cs">\r
+    <type name="Test.BaseClass">\r
+      <method name="System.String Get(System.String, System.String)" attrs="486">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Int32 Get(System.String, Int32)" attrs="486">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="Test.Subclass">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>8</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-856.cs">\r
+    <type name="A">\r
+      <method name="Void Dispose()" attrs="454">\r
+        <size>16</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="B">\r
+      <method name="Void Dispose()" attrs="129">\r
+        <size>12</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="C">\r
+      <method name="Int32 Main()" attrs="150">\r
+        <size>41</size>\r
+      </method>\r
+      <method name="Void Dispose()" attrs="198">\r
+        <size>8</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-857.cs">\r
+    <type name="Outer">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="TypeHiding">\r
+      <method name="Boolean Test1(Outer)" attrs="150">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Boolean Test2()" attrs="150">\r
+        <size>12</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-858.cs">\r
+    <type name="X">\r
+      <method name="Int32 Main()" attrs="150">\r
+        <size>108</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-859.cs">\r
+    <type name="X">\r
+      <method name="Void Test_PropertyOptionalParameters(C)" attrs="129">\r
+        <size>46</size>\r
+      </method>\r
+      <method name="Int32 Main()" attrs="150">\r
+        <size>23</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-86.cs">\r
     <type name="T.T">\r
       <method name="Int32 method1(System.Type, Int32)" attrs="145">\r
   </test>\r
   <test name="test-87.cs">\r
     <type name="Top">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void f(System.String)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>71</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="X F(Int32)" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>117</size>\r
       </method>\r
       <method name="Void .ctor(Int32)" attrs="6273">\r
   </test>\r
   <test name="test-90.cs">\r
     <type name="N1.Blah">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void MyPrivate()" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>288</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>128</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-95.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>43</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6273">\r
   </test>\r
   <test name="test-96.cs">\r
     <type name="N1.A">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-97.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>10</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-99.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>126</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>175</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>227</size>\r
       </method>\r
       <method name="Boolean t(Int32, Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>135</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>143</size>\r
       </method>\r
       <method name="Boolean t(Int32, Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>43</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-anon-09.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>77</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="134">\r
         <size>101</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>79</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test[T](T)" attrs="134">\r
         <size>65</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test[T](T)" attrs="134">\r
         <size>72</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test[T](T)" attrs="134">\r
         <size>29</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void &lt;Test`1&gt;m__0[T](T)" attrs="129">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test[A,B,C](A, B, C)" attrs="134">\r
         <size>50</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>29</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable`1 Test(Int32)" attrs="150">\r
         <size>37</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
       <method name="Void Test[R](R, Int32)" attrs="150">\r
       <method name="Void set_Foo(IEnumerable`1)" attrs="2182">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void &lt;op_Implicit&gt;m__0()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>132</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0(Int32)" attrs="145">\r
       <method name="IEnumerable`1 Test[T](T, T)" attrs="134">\r
         <size>51</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>110</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>19</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="X+ModuleBinder`1[TDelegate] CreateMethodUnscoped[TDelegate]()" attrs="134">\r
         <size>21</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="TDelegate &lt;CreateMethodUnscoped`1&gt;m__0[TDelegate](System.Object)" attrs="145">\r
       <method name="Void SomeCaller()" attrs="129">\r
         <size>37</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Int32 &lt;SomeCaller&gt;m__0(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="A">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(TestFunc`1)" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>283</size>\r
       </method>\r
       <method name="System.Collections.ArrayList Find(predicate, System.Collections.ArrayList)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>43</size>\r
       </method>\r
       <method name="D T()" attrs="129">\r
       <method name="Void Test[T](T)" attrs="134">\r
         <size>49</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>100</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>50</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Method()" attrs="145">\r
         <size>2</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>67</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__3(Int32, Int32, Int32)" attrs="145">\r
   </test>\r
   <test name="test-anon-149.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void DetermineLinkedCells()" attrs="129">\r
       </method>\r
     </type>\r
     <type name="Driver">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void P(Int32, Int32)" attrs="129">\r
   </test>\r
   <test name="test-anon-153.cs">\r
     <type name="TestComp.Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void cf[T]()" attrs="145">\r
         <size>36</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>25</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="M">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>43</size>\r
       </method>\r
       <method name="D T()" attrs="129">\r
   </test>\r
   <test name="test-anon-161.cs">\r
     <type name="TestCase">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>33</size>\r
       </method>\r
       <method name="Void Test[T](IList`1)" attrs="150">\r
   </test>\r
   <test name="test-anon-169.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>521</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>74</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="DelegateTest">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>87</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>248</size>\r
       </method>\r
       <method name="Boolean t(Int32, Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="D MainHost()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void M()" attrs="129">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>34</size>\r
       </method>\r
       <method name="D T()" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>81</size>\r
       </method>\r
       <method name="Void M()" attrs="129">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>30</size>\r
       </method>\r
       <method name="D T(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>56</size>\r
       </method>\r
       <method name="D T(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>151</size>\r
       </method>\r
       <method name="Void M(Int32)" attrs="129">\r
       </method>\r
     </type>\r
     <type name="DelegateTest">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>59</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void remove_E(Program+D)" attrs="2193">\r
         <size>40</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>39</size>\r
       </method>\r
     </type>\r
   </test>\r
   <test name="test-anon-31.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>36</size>\r
       </method>\r
       <method name="Void DoCall(X+test)" attrs="145">\r
       <method name="Void doit(Int32)" attrs="145">\r
         <size>8</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>171</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void SpaceLeak()" attrs="145">\r
         <size>38</size>\r
       </method>\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>7</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>68</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>66</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>66</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>66</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="150">\r
         <size>52</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Simple &lt;Test&gt;m__0()" attrs="145">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>55</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test(Int32)" attrs="134">\r
         <size>69</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestClass">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void &lt;a&gt;m__0(Int32)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>15</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>252</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
         <size>29</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>23</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>14</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Observable">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>51</size>\r
       </method>\r
       <method name="Void &lt;Main&gt;m__0(Observable)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(String)" attrs="6278">\r
       <method name="IEnumerator GetIt(System.Int32[])" attrs="145">\r
         <size>29</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>40</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void AddSource(Source, Int32, System.Object)" attrs="129">\r
         <size>106</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void &lt;AddSource&gt;m__1(System.Object, System.EventArgs)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="TestClass">\r
-      <method name="Int32 Main(System.String[])" attrs="145">\r
+      <method name="Int32 Main(System.String[])" attrs="150">\r
         <size>17</size>\r
       </method>\r
       <method name="Void .ctor(Int32)" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="T">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>32</size>\r
       </method>\r
       <method name="Void Test_1()" attrs="145">\r
       <method name="Void X()" attrs="134">\r
         <size>25</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>83</size>\r
       </method>\r
       <method name="System.Object &lt;X&gt;m__0()" attrs="129">\r
   </test>\r
   <test name="test-anon-80.cs">\r
     <type name="MonoBug.MyTest">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>190</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-anon-85.cs">\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>37</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Run(Int32)" attrs="145">\r
         <size>20</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>110</size>\r
       </method>\r
     </type>\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Void Main(System.String[])" attrs="145">\r
+      <method name="Void Main(System.String[])" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void Test()" attrs="129">\r
         <size>38</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>20</size>\r
       </method>\r
       <method name="Void &lt;Test&gt;m__0()" attrs="145">\r
   </test>\r
   <test name="test-async-01.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>131</size>\r
       </method>\r
       <method name="Void TestAsync()" attrs="145">\r
   </test>\r
   <test name="test-async-06.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>482</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.Decimal] &lt;Main&gt;m__4(Decimal)" attrs="145">\r
   </test>\r
   <test name="test-async-07.cs">\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>358</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.Int16] &lt;Main&gt;m__2(Int16)" attrs="145">\r
       <method name="Int32 Foo[T](System.Func`2[T,System.Threading.Tasks.Task`1[System.Int16]])" attrs="145">\r
         <size>10</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>57</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.Int16] &lt;Main&gt;m__0(System.String)" attrs="145">\r
       </method>\r
     </type>\r
     <type name="C">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>80</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void CompilationTestOnly()" attrs="145">\r
         <size>66</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Int32 &lt;CompilationTestOnly&gt;m__0()" attrs="145">\r
       <method name="System.Threading.Tasks.Task`1[TResult] GetTaskResult[TResult](System.Threading.Tasks.Task`1[System.Threading.Tasks.Task`1[TResult]])" attrs="145">\r
         <size>41</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>95</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.Int32] &lt;Main&gt;m__0()" attrs="145">\r
       <method name="System.Threading.Tasks.Task`1[System.Int32] TestException()" attrs="145">\r
         <size>33</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>274</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>76</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="System.Threading.Tasks.Task`1[System.Int32] AsyncMethod()" attrs="150">\r
         <size>33</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>178</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.Int32] &lt;Main&gt;m__0()" attrs="145">\r
   </test>\r
   <test name="test-async-39.cs">\r
     <type name="CompilerBug">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>24</size>\r
       </method>\r
       <method name="System.Threading.Tasks.Task`1[System.String] Foo()" attrs="145">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-async-41.cs">\r
+    <type name="AmbiguousGeneric">\r
+      <method name="Void NestedVoidTestSuccess()" attrs="134">\r
+        <size>35</size>\r
+      </method>\r
+      <method name="System.Threading.Tasks.Task`1[System.Int32] ReturnOne()" attrs="145">\r
+        <size>43</size>\r
+      </method>\r
+      <method name="System.Threading.Tasks.Task Run2(System.Func`1[System.Threading.Tasks.Task])" attrs="129">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="System.Threading.Tasks.Task Run2[T](System.Func`1[T])" attrs="129">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Int32 &lt;ReturnOne&gt;m__0()" attrs="145">\r
+        <size>9</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="AmbiguousGeneric+&lt;NestedVoidTestSuccess&gt;c__async0">\r
+      <method name="Void MoveNext()" attrs="486">\r
+        <size>191</size>\r
+      </method>\r
+      <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
+        <size>13</size>\r
+      </method>\r
+      <method name="System.Threading.Tasks.Task`1[System.Int32] &lt;&gt;m__1()" attrs="145">\r
+        <size>33</size>\r
+      </method>\r
+    </type>\r
+    <type name="AmbiguousGeneric+&lt;NestedVoidTestSuccess&gt;c__async0+&lt;NestedVoidTestSuccess&gt;c__async4">\r
+      <method name="Void MoveNext()" attrs="486">\r
+        <size>162</size>\r
+      </method>\r
+      <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
+        <size>13</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-cls-00.cs">\r
     <type name="CLSCLass_6">\r
       <method name="Void add_Disposed(Delegate)" attrs="2182">\r
       <method name="I1 Foo()" attrs="133">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-com-01.cs">\r
+    <type name="CorMetaDataDispenserExClass">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>0</size>\r
+      </method>\r
+    </type>\r
+    <type name="Test">\r
+      <method name="Void XXX()" attrs="150">\r
+        <size>13</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-debug-01.cs">\r
     <type name="C">\r
       <method name="Void Main()" attrs="150">\r
       <method name="Program get_Prop()" attrs="2182">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Program &lt;Test_4&gt;m__0()" attrs="145">\r
   </test>\r
   <test name="test-debug-25.cs">\r
     <type name="TestClass">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-01.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-02.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-03.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-04.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>92</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-05.cs">\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>22</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>28</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-08.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>82</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-externalias-09.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>16</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetIt2()" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>199</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator GetRange()" attrs="145">\r
         <size>15</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>103</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetMulti(System.Int32[,])" attrs="145">\r
         <size>37</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>275</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetRange(Int32, Int32)" attrs="145">\r
         <size>51</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>104</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetIt()" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>119</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetS(Int32)" attrs="145">\r
         <size>37</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>449</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>464</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable Test(Int32, Int32)" attrs="150">\r
         <size>51</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>210</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void set_Item(Int32, IEnumerable)" attrs="2177">\r
         <size>2</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>211</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Void M(System.Object, System.EventArgs)" attrs="145">\r
         <size>12</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>40</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable a()" attrs="129">\r
         <size>30</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable X()" attrs="145">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>69</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerator GetEnumerator()" attrs="134">\r
         <size>22</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>12</size>\r
       </method>\r
       <method name="Void Run()" attrs="129">\r
       <method name="IEnumerable foo()" attrs="150">\r
         <size>23</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>78</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable get_Empty()" attrs="2198">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>62</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable GetIt(System.Int32[])" attrs="145">\r
         <size>37</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>138</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 Delay()" attrs="145">\r
         <size>28</size>\r
       </method>\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>141</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="IEnumerable`1 TagsError()" attrs="150">\r
         <size>23</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>68</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Y">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>47</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>60</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="D">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="B">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>80</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>96</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="X">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>112</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       <method name="Int32 GetHashCode()" attrs="198">\r
         <size>10</size>\r
       </method>\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="ConsoleApplication1.Program">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>116</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="TestCase">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-partial-29.cs">\r
     <type name="C">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
     </type>\r
   </test>\r
   <test name="test-var-01.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>70</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>164</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-var-03.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>201</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>72</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-var-06.cs">\r
     <type name="Test">\r
-      <method name="Int32 Main()" attrs="145">\r
+      <method name="Int32 Main()" attrs="150">\r
         <size>68</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
   </test>\r
   <test name="test-var-08.cs">\r
     <type name="X">\r
-      <method name="Void Main()" attrs="145">\r
+      <method name="Void Main()" attrs="150">\r
         <size>2</size>\r
       </method>\r
       <method name="Void .ctor(Int32, Int32)" attrs="6278">\r
diff --git a/mcs/tools/compiler-tester/App.config b/mcs/tools/compiler-tester/App.config
new file mode 100644 (file)
index 0000000..cad8446
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<configuration>\r
+  <runtime>\r
+    <loadFromRemoteSources enabled="true"/>\r
+  </runtime>\r
+</configuration>
\ No newline at end of file
index 97e1e42b7de46da302975b901742ce712507d583..17241e7d046cce15d899dffed0a9d60ece494908 100644 (file)
@@ -84,5 +84,8 @@
     <Compile Include="compiler-tester.cs" />\r
     <Compile Include="xmldocdiff.cs" />\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="App.config" />\r
+  </ItemGroup>\r
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
 </Project>
\ No newline at end of file
index d0a7b06f0d5c6853f09bf1d5efbc15802fabf320..eed75991911e208a6810cd055e53245e301c5651 100644 (file)
@@ -151,6 +151,130 @@ namespace TestRunner {
                }
        }
 
+       class NUnitChecker : PositiveChecker
+       {
+               class TestCaseEntry
+               {
+                       string name;
+                       string referenceFile;
+                       string executedMethod;
+                       bool has_return;
+
+                       public TestCaseEntry (string name, string referenceFile, MethodInfo executedMethod)
+                       {
+                               this.name = name.Replace ('-', '_');
+                               this.referenceFile = referenceFile;
+                               this.executedMethod = ConvertMethodInfoToText (executedMethod, out has_return);
+                       }
+
+                       public string Name
+                       {
+                               get
+                               {
+                                       return name;
+                               }
+                       }
+
+                       public string ReferenceFile {
+                               get {
+                                       return referenceFile;
+                               }
+                       }
+
+                       static string ConvertMethodInfoToText (MethodInfo mi, out bool hasReturn)
+                       {
+                               hasReturn = mi.ReturnType != typeof (void);
+                               string declaring = mi.DeclaringType.FullName.Replace ('+', '.');
+                               var param = mi.GetParameters ();
+                               if (param.Length == 0)
+                                       return declaring + "." + mi.Name + " ()";
+
+                               return declaring + "." + mi.Name + " (new string[0])";
+                       }
+
+                       public string GetTestFixture ()
+                       {
+                               var call = name + "::" + executedMethod;
+                               if (!has_return)
+                                       return call;
+
+                               return string.Format ("Assert.AreEqual (0, {0})", call); 
+                       }
+               }
+
+               List<TestCaseEntry> entries = new List<TestCaseEntry> ();
+
+               public NUnitChecker (ITester tester)
+                       : base (tester, null)
+               {
+               }
+
+               public override void CleanUp ()
+               {
+                       base.CleanUp ();
+
+                       StringBuilder aliases = new StringBuilder ();
+                       var src_dir = Path.Combine ("projects", "MonoTouch");
+                       string src_file = Path.Combine (src_dir, "tests.cs");
+
+                       using (var file = new StreamWriter (src_file, false)) {
+                               foreach (var e in entries) {
+                                       file.WriteLine ("extern alias {0};", e.Name);
+                                       aliases.AppendFormat ("    <Reference Include=\"{0}\">", Path.GetFileNameWithoutExtension (e.ReferenceFile));
+                                       aliases.Append (Environment.NewLine);
+                                       aliases.AppendFormat ("      <Aliases>{0}</Aliases>", e.Name);
+                                       aliases.Append (Environment.NewLine);
+                                       aliases.AppendFormat ("      <HintPath>..\\..\\{0}</HintPath>", Path.GetFileName (e.ReferenceFile));
+                                       aliases.Append (Environment.NewLine);
+                                       aliases.AppendLine ("    </Reference>");
+                               }
+
+                               file.WriteLine ();
+                               file.WriteLine ("using NUnit.Framework;");
+                               file.WriteLine ();
+                               file.WriteLine ("[TestFixture]");
+                               file.WriteLine ("public class Tests {");
+
+                               foreach (var e in entries) {
+                                       file.WriteLine ("\t[Test]");
+                                       file.WriteLine ("\tpublic void TestFile_{0} ()", e.Name);
+                                       file.WriteLine ("\t{");
+                                       file.WriteLine ("\t\t{0};", e.GetTestFixture ());
+                                       file.WriteLine ("\t}");
+                                       file.WriteLine ();
+                               }
+
+                               file.WriteLine ("}");
+                       }
+
+                       var input = File.ReadAllText (Path.Combine (src_dir, "MonoTouch.csproj.template"));
+                       input = input.Replace ("@GENERATED_REFERENCES", aliases.ToString ());
+                       input = input.Replace ("@TEST_SOURCEFILE", Path.GetFileName (src_file));
+
+                       File.WriteAllText (Path.Combine (src_dir, "MonoTouch.csproj"), input);
+                       return;
+               }
+
+               protected override bool ExecuteTestFile (TestCase test, string binaryFileName)
+               {
+                       Assembly assembly = Assembly.LoadFile (binaryFileName);
+                       var ep = assembly.EntryPoint;
+                       if (!ep.IsPublic) {
+                               HandleFailure (test.FileName, TestResult.LoadError, "Entry method is private");
+                               return false;
+                       }
+
+                       if (ep.DeclaringType.IsNestedPrivate || ep.DeclaringType.IsNestedFamily) {
+                               HandleFailure (test.FileName, TestResult.LoadError, "Entry method in hidden nested type");
+                               return false;
+                       }
+
+                       entries.Add (new TestCaseEntry (Path.GetFileNameWithoutExtension (test.FileName), binaryFileName, ep));
+                       HandleFailure (test.FileName, TestResult.Success, null);
+                       return true;
+               }
+       }
+
        class PositiveTestCase : TestCase
        {
                public class VerificationData : MarshalByRefObject
@@ -315,6 +439,7 @@ namespace TestRunner {
                protected ArrayList know_issues = new ArrayList ();
                protected ArrayList ignore_list = new ArrayList ();
                protected ArrayList no_error_list = new ArrayList ();
+               ArrayList skip = new ArrayList ();
                
                protected bool verbose;
                protected bool safe_execution;
@@ -414,6 +539,10 @@ namespace TestRunner {
                        if (verbose)
                                Log (filename + "...\t");
 
+                       if (skip.Contains (filename)) {
+                               return false;
+                       }
+
                        if (ignore_list.Contains (filename)) {
                                ++ignored;
                                LogFileLine (filename, "NOT TESTED");
@@ -460,13 +589,14 @@ namespace TestRunner {
                        string[] test_args;
 
                        if (test.CompilerOptions != null) {
-                               test_args = new string [2 + test.CompilerOptions.Length];
+                               test_args = new string[2 + test.CompilerOptions.Length];
                                test.CompilerOptions.CopyTo (test_args, 0);
                        } else {
-                               test_args = new string [2];
+                               test_args = new string[2];
                        }
-                       test_args [test_args.Length - 2] = test.FileName;
-                       test_args [test_args.Length - 1] = "-debug";
+                       test_args[test_args.Length - 2] = test_args[0];
+                       test_args[test_args.Length - 1] = "-debug";
+                       test_args[0] = test.FileName;
 
                        return tester.Invoke (test_args);
                }
@@ -480,6 +610,7 @@ namespace TestRunner {
                {
                        const string ignored = "IGNORE";
                        const string no_error = "NO ERROR";
+                       const string skip_tag = "SKIP";
 
                        using (StreamReader sr = new StreamReader (file)) {
                                string line;
@@ -493,6 +624,8 @@ namespace TestRunner {
                                                active_cont = ignore_list;
                                        else if (line.IndexOf (no_error) > 0)
                                                active_cont = no_error_list;
+                                       else if (line.Contains (skip_tag))
+                                               active_cont = skip;
 
                                        string file_name = line.Split (' ')[0];
                                        if (file_name.Length == 0)
@@ -827,6 +960,13 @@ namespace TestRunner {
                                return true;
                        }
 
+                       return ExecuteTestFile (test, file);
+               }
+
+               protected virtual bool ExecuteTestFile (TestCase test, string binaryFileName)
+               {
+                       string filename = test.FileName;
+
                        AppDomain domain = null;
 #if !NET_2_1
                        if (safe_execution) {
@@ -834,7 +974,7 @@ namespace TestRunner {
                                AppDomainSetup setupInfo = new AppDomainSetup ();
                                setupInfo.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
                                setupInfo.LoaderOptimization = LoaderOptimization.SingleDomain;
-                               domain = AppDomain.CreateDomain (Path.GetFileNameWithoutExtension (file), null, setupInfo);
+                               domain = AppDomain.CreateDomain (Path.GetFileNameWithoutExtension (binaryFileName), null, setupInfo);
                        }
 #endif
                        try {
@@ -847,7 +987,7 @@ namespace TestRunner {
 #endif
                                                tester = new DomainTester ();
 
-                                       if (!tester.Test (file))
+                                       if (!tester.Test (binaryFileName))
                                                return false;
 
                                } catch (ApplicationException e) {
@@ -873,12 +1013,12 @@ namespace TestRunner {
                                                PositiveTestCase pt = (PositiveTestCase) test;
                                                pt.VerificationProvider = (PositiveTestCase.VerificationData) verif_data[filename];
 
-                                               if (!tester.CheckILSize (pt, this, file))
+                                               if (!tester.CheckILSize (pt, this, binaryFileName))
                                                        return false;
                                        }
 
                                        if (filename.StartsWith ("test-debug", StringComparison.OrdinalIgnoreCase)) {
-                                               var mdb_file_name = file + ".mdb";
+                                               var mdb_file_name = binaryFileName + ".mdb";
                                                MonoSymbolFile mdb_file = MonoSymbolFile.ReadSymbolFile (mdb_file_name);
                                                var mdb_xml_file = mdb_file_name + ".xml";
                                                ConvertSymbolFileToXml (mdb_file, mdb_xml_file);
@@ -1038,7 +1178,11 @@ namespace TestRunner {
                                        break;
 
                                case TestResult.LoadError:
-                                       LogFileLine (file, "REGRESSION (SUCCESS -> LOAD ERROR)");
+                                       if (extra != null)
+                                               extra = ": " + extra;
+
+                                       LogFileLine (file, "REGRESSION (SUCCESS -> LOAD ERROR)" + extra);
+                                       extra = null;
                                        break;
 
                                case TestResult.MethodAttributesError:
@@ -1451,6 +1595,10 @@ namespace TestRunner {
                                                ((PositiveChecker) checker).UpdateVerificationDataFile = true;
                                        }
 
+                                       break;
+                               case "nunit":
+                                       positive = true;
+                                       checker = new NUnitChecker (tester);
                                        break;
                                default:
                                        Console.Error.WriteLine ("Invalid -mode argument");
index e8b9783e614a81a6a167cdd44bb559a5974bc8a0..b6dcf0759b66fdca59df0a2da54b94235f669be6 100644 (file)
@@ -869,6 +869,13 @@ namespace Mono.Terminal {
 
                        return result;
                }
+               
+               public void SaveHistory ()
+               {
+                       if (history != null) {
+                               history.Close ();
+                       }
+               }
 
                public bool TabAtStartCompletes { get; set; }
                        
index 24a5d2a5ef5db459f6398ea2c33454601e247ece..89af0a942b7d9dab14608b87a956113117c0ff81 100644 (file)
@@ -314,7 +314,7 @@ namespace Mono {
                                expr = expr == null ? input : expr + "\n" + input;
                                
                                expr = Evaluate (expr);
-                       } 
+                       }
                }
 
                public int ReadEvalPrintLoop ()
@@ -326,17 +326,24 @@ namespace Mono {
 
                        LoadStartupFiles ();
 
-                       if (startup_files != null && startup_files.Length != 0)
+                       if (startup_files != null && startup_files.Length != 0) {
                                ExecuteSources (startup_files, false);
-                       else if (Driver.StartupEvalExpression != null){
-                               ReadEvalPrintLoopWith (p => {
-                                       var ret = Driver.StartupEvalExpression;
-                                       Driver.StartupEvalExpression = null;
-                                       return ret;
-                                       });
-                       } else
-                               ReadEvalPrintLoopWith (GetLine);
+                       } else {
+                               if (Driver.StartupEvalExpression != null){
+                                       ReadEvalPrintLoopWith (p => {
+                                               var ret = Driver.StartupEvalExpression;
+                                               Driver.StartupEvalExpression = null;
+                                               return ret;
+                                               });
+                               } else {
+                                       ReadEvalPrintLoopWith (GetLine);
+                               }
+                               
+                               editor.SaveHistory ();
+                       }
 
+                       Console.CancelKeyPress -= ConsoleInterrupt;
+                       
                        return 0;
                }
 
index 4f84e43eba555bfb5afe2372dac39b6eb7102882..8d97f8dc1504b62d710c91111c05e999ed479cab 100644 (file)
@@ -144,15 +144,19 @@ namespace Mono.Linker {
                public AssemblyDefinition Resolve (IMetadataScope scope)
                {
                        AssemblyNameReference reference = GetReference (scope);
+                       try {
+                               AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
 
-                       AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
+                               if (SeenFirstTime (assembly)) {
+                                       SafeReadSymbols (assembly);
+                                       SetAction (assembly);
+                               }
 
-                       if (SeenFirstTime (assembly)) {
-                               SafeReadSymbols (assembly);
-                               SetAction (assembly);
+                               return assembly;
+                       }
+                       catch {
+                               throw new AssemblyResolutionException (reference);
                        }
-
-                       return assembly;
                }
 
                bool SeenFirstTime (AssemblyDefinition assembly)
index e8c0a5cd5bdeb45f8d1b5e5eee88e6224d34d0e8..86f8a7c63153cbf32bb5ea2cd9b2ef4cef2d89d1 100644 (file)
@@ -115,7 +115,7 @@ namespace Mono.Documentation
                                return CreateDefaultDocument ();
 
                        var settings = new XmlReaderSettings {
-                               ProhibitDtd = false,
+                               DtdProcessing = DtdProcessing.Parse
                        };
                        using (var reader = XmlReader.Create (file, settings))
                                return XDocument.Load (reader);
index a930951268c6bac376249bb4986e525da9c8a1f1..dcb23d2f17c9890b7477423b5c0f73e9717f0598 100644 (file)
@@ -60,6 +60,8 @@ class MDocUpdater : MDocCommand
 
        MyXmlNodeList extensionMethods = new MyXmlNodeList ();
 
+       HashSet<string> forwardedTypes = new HashSet<string> ();
+
        public override void Run (IEnumerable<string> args)
        {
                show_exceptions = DebugOutput;
@@ -142,6 +144,9 @@ class MDocUpdater : MDocCommand
                
                this.assemblies = assemblies.Select (a => LoadAssembly (a)).ToList ();
 
+               // Store types that have been forwarded to avoid duplicate generation
+               GatherForwardedTypes ();
+
                docEnum = docEnum ?? new DocumentationEnumerator ();
                
                // PERFORM THE UPDATES
@@ -188,6 +193,13 @@ class MDocUpdater : MDocCommand
                }
        }
 
+       void GatherForwardedTypes ()
+       {
+               foreach (var asm in assemblies)
+                       foreach (var type in asm.MainModule.ExportedTypes.Where (t => t.IsForwarder).Select (t => t.FullName))
+                               forwardedTypes.Add (type);
+       }
+
        static ExceptionLocations ParseExceptionLocations (string s)
        {
                ExceptionLocations loc = ExceptionLocations.Member;
@@ -641,7 +653,7 @@ class MDocUpdater : MDocCommand
        {
                foreach (TypeDefinition type in docEnum.GetDocumentationTypes (assembly, null)) {
                        string typename = GetTypeFileName(type);
-                       if (!IsPublic (type) || typename.IndexOfAny (InvalidFilenameChars) >= 0)
+                       if (!IsPublic (type) || typename.IndexOfAny (InvalidFilenameChars) >= 0 || forwardedTypes.Contains (type.FullName))
                                continue;
 
                        string reltypepath = DoUpdateType (type, source, dest);
diff --git a/mcs/tools/monkeydoc/Assembly/AssemblyInfo.cs b/mcs/tools/monkeydoc/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..61c5fdc
--- /dev/null
@@ -0,0 +1,6 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly:AssemblyVersion("1.0.0.0")]
+[assembly:AssemblyDelaySign(false)]
+[assembly:AssemblyKeyFile("../../class/mono.snk")]
diff --git a/mcs/tools/monkeydoc/Makefile b/mcs/tools/monkeydoc/Makefile
new file mode 100644 (file)
index 0000000..890d06d
--- /dev/null
@@ -0,0 +1,141 @@
+thisdir = tools/monkeydoc
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = monkeydoc.dll
+LIBRARY_PACKAGE = monkeydoc
+# Remove a bunch of "obsolete"-type warning for Lucene.NET
+LOCAL_MCS_FLAGS = /nowarn:618,612,672,809
+
+JAY_FLAGS = -ct
+
+IMAGES = \
+       Resources/images/bc_bg.png              \
+       Resources/images/bc_separator.png       \
+       Resources/images/error.png              \
+       Resources/images/hatch.png              \
+       Resources/images/headerbg.png           \
+       Resources/images/help.png               \
+       Resources/images/house.png              \
+       Resources/images/members.png            \
+       Resources/images/namespace.png          \
+       Resources/images/privclass.png          \
+       Resources/images/privdelegate.png       \
+       Resources/images/privenumeration.png    \
+       Resources/images/privevent.png          \
+       Resources/images/privextension.png      \
+       Resources/images/privfield.png          \
+       Resources/images/privinterface.png      \
+       Resources/images/privmethod.png         \
+       Resources/images/privproperty.png       \
+       Resources/images/privstructure.png      \
+       Resources/images/protclass.png          \
+       Resources/images/protdelegate.png       \
+       Resources/images/protenumeration.png    \
+       Resources/images/protevent.png          \
+       Resources/images/protextension.png      \
+       Resources/images/protfield.png          \
+       Resources/images/protinterface.png      \
+       Resources/images/protmethod.png         \
+       Resources/images/protproperty.png       \
+       Resources/images/protstructure.png      \
+       Resources/images/pubclass.png           \
+       Resources/images/pubdelegate.png        \
+       Resources/images/pubenumeration.png     \
+       Resources/images/pubevent.png           \
+       Resources/images/pubextension.png       \
+       Resources/images/pubfield.png           \
+       Resources/images/pubinterface.png       \
+       Resources/images/pubmethod.png          \
+       Resources/images/pubproperty.png        \
+       Resources/images/pubstructure.png       \
+       Resources/images/reference.png          \
+       Resources/images/treebg.png             
+
+IMAGE_RESOURCE_COMMAND = $(foreach file,$(IMAGES),/resource:$(file),$(notdir $(file)))
+
+RESOURCE_FILES = \
+       ../../docs/monodoc.xml            \
+       Resources/base.css                \
+       Resources/ecmaspec-html-css.xsl   \
+       Resources/ecmaspec-html.xsl       \
+       Resources/ecmaspec.css            \
+       Resources/helper.js               \
+       Resources/home.html               \
+       Resources/Lminus.gif              \
+       Resources/Lplus.gif               \
+       Resources/mdoc-html-format.xsl    \
+       Resources/mdoc-html-utils.xsl     \
+       Resources/mdoc-sections-css.xsl   \
+       Resources/mdoc-sections.xsl       \
+       Resources/mono-ecma-css.xsl       \
+       Resources/mono-ecma-impl.xsl      \
+       Resources/mono-ecma.css           \
+       Resources/mono-ecma.xsl                 \
+       Resources/toc-html.xsl           \
+       $(IMAGES)
+
+EXTRA_DISTFILES = \
+       monkeydoc.dll.config.in   \
+       $(RESOURCE_FILES)
+
+LIB_MCS_FLAGS = \
+       /unsafe                                                           \
+       /codepage:utf8                                                    \
+       /nowarn:169,164,162,168,219,618,612                               \
+       /r:Commons.Xml.Relaxng                                            \
+       /resource:../../docs/monodoc.xml,monodoc.xml                      \
+       /resource:Resources/base.css,base.css                             \
+       /resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl   \
+       /resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl           \
+       /resource:Resources/ecmaspec.css,ecmaspec.css                     \
+       /resource:Resources/helper.js,helper.js                           \
+       /resource:Resources/home.html,home.html                           \
+       /resource:Resources/Lminus.gif,Lminus.gif                         \
+       /resource:Resources/Lplus.gif,Lplus.gif                           \
+       /resource:Resources/mdoc-html-format.xsl,mdoc-html-format.xsl     \
+       /resource:Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl       \
+       /resource:Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl   \
+       /resource:Resources/mdoc-sections.xsl,mdoc-sections.xsl           \
+       /resource:Resources/mono-ecma-css.xsl,mono-ecma-css.xsl           \
+       /resource:Resources/mono-ecma-impl.xsl,mono-ecma-impl.xsl         \
+       /resource:Resources/mono-ecma.css,mono-ecma.css                   \
+       /resource:Resources/mono-ecma.xsl,mono-ecma.xsl                   \
+       /resource:Resources/toc-html.xsl,toc-html.xsl                     \
+       $(IMAGE_RESOURCE_COMMAND)                                                             \
+       /r:ICSharpCode.SharpZipLib                                        \
+       /r:$(corlib)                                                      \
+       /r:System.dll                                                     \
+       /r:System.Core.dll                                                \
+       /r:System.Xml.dll                                                 \
+       /r:System.Xml.Linq.dll                                            \
+       /r:System.Configuration.dll
+
+TEST_MCS_FLAGS = /r:System.Core.dll
+
+DOC_SOURCE_DIRS = \
+       ../../docs \
+       ../../../docs
+
+DOC_SOURCES = $(foreach dir,$(DOC_SOURCE_DIRS),$(wildcard $(dir)/*.source $(dir)/*.tree $(dir)/*.zip))
+
+include ../../build/library.make
+
+$(the_lib): Makefile $(RESOURCE_FILES)
+
+all-local: $(the_lib).config Monkeydoc.Ecma/EcmaUrlParser.cs
+
+test-local: setup-doc-sources
+
+$(the_lib).config: Makefile
+       sed 's,@monodoc_refdir@,$(mono_libdir)/monodoc,g' monkeydoc.dll.config.in > $@
+
+Monkeydoc.Ecma/EcmaUrlParser.cs: Monkeydoc.Ecma/EcmaUrlParser.jay $(topdir)/jay/skeleton.cs
+       $(topdir)/jay/jay $(JAY_FLAGS) < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
+
+parser.exe: Monkeydoc.Ecma/EcmaUrlParser.cs Monkeydoc.Ecma/EcmaUrlTokenizer.cs Monkeydoc.Ecma/EcmaUrlParserDriver.cs Monkeydoc.Ecma/EcmaDesc.cs
+       mcs /out:$@ /debug $^
+
+setup-doc-sources: $(DOC_SOURCES)
+       mkdir -p ./Test/monodoc/sources/
+       cp $(DOC_SOURCES) ./Test/monodoc/sources/
diff --git a/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaDesc.cs b/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaDesc.cs
new file mode 100644 (file)
index 0000000..e8fa191
--- /dev/null
@@ -0,0 +1,333 @@
+using System;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
+
+namespace Monkeydoc.Ecma
+{
+       /* Some properties might not be filled/meaningful depending on kind
+        * like a namespace EcmaUrl won't have a valid TypeName
+        */
+       public class EcmaDesc : IEquatable<EcmaDesc>
+       {
+               public enum Kind
+               {
+                       Type,
+                       Constructor,
+                       Method,
+                       Namespace,
+                       Field,
+                       Property,
+                       Event,
+                       Operator
+               }
+
+               public enum Mod
+               {
+                       Normal,
+                       Pointer,
+                       Ref,
+                       Out
+               }
+
+               public enum Format
+               {
+                       WithArgs,
+                       WithoutArgs
+               }
+
+               public Kind DescKind {
+                       get;
+                       set;
+               }
+
+               public Mod DescModifier {
+                       get;
+                       set;
+               }
+
+               public string Namespace {
+                       get;
+                       set;
+               }
+
+               public string TypeName {
+                       get;
+                       set;
+               }
+
+               public string MemberName {
+                       get;
+                       set;
+               }
+
+               public EcmaDesc NestedType {
+                       get;
+                       set;
+               }
+
+               /* A list of the array dimensions attached to this type.
+                * The list count corresponds to the number of recursive
+                * array definition (jagged arrays) the value of the
+                * corresponding list item is the number of dimension
+                * attached to that array definition instance
+                */
+               public IList<int> ArrayDimensions {
+                       get;
+                       set;
+               }
+
+               /* Depending on the form of the url, we might not have the type
+                * of the argument but only how many the type/member has i.e.
+                * when such number is specified with a backtick
+                */
+               public IList<EcmaDesc> GenericTypeArguments {
+                       get;
+                       set;
+               }
+
+               public IList<EcmaDesc> GenericMemberArguments {
+                       get;
+                       set;
+               }
+
+               public IList<EcmaDesc> MemberArguments {
+                       get;
+                       set;
+               }
+
+               /* This indicates that we actually want an inner part of the ecmadesc
+                * i.e. in case of T: we could want the members (*), ctor (C), methods (M), ...
+                */
+               public char Etc {
+                       get;
+                       set;
+               }
+
+               public bool IsEtc {
+                       get {
+                               return Etc != (char)0;
+                       }
+               }
+
+               /* EtcFilter is only valid in some case of IsEtc when the inner part needs
+                * to be further filtered e.g. in case we want a listing of the type overloads
+                * Equals
+                */
+               public string EtcFilter {
+                       get;
+                       set;
+               }
+
+               /* When a member is an explicit implementation of an interface member, we register
+                * the member EcmaDesc with its interface parent here
+                */
+               public EcmaDesc ExplicitImplMember {
+                       get;
+                       set;
+               }
+
+               // Returns the TypeName and the generic/inner type information if existing
+               public string ToCompleteTypeName (char innerTypeSeparator = '.')
+               {
+                       var result = TypeName;
+                       if (GenericTypeArguments != null)
+                               result += FormatGenericArgs (GenericTypeArguments);
+                       if (NestedType != null)
+                               result += innerTypeSeparator + NestedType.ToCompleteTypeName ();
+                       if (ArrayDimensions != null && ArrayDimensions.Count > 0)
+                               result += ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat);
+
+                       return result;
+               }
+
+               // Returns the member name with its generic types if existing
+               public string ToCompleteMemberName (Format format)
+               {
+                       /* We special process two cases:
+                        *   - Explicit member implementation which append a full type specification
+                        *   - Conversion operator which are exposed as normal method but have specific captioning in the end
+                        */
+                       if (ExplicitImplMember != null) {
+                               var impl = ExplicitImplMember;
+                               return impl.FormattedNamespace + impl.ToCompleteTypeName () + "." + impl.ToCompleteMemberName (format);
+                       } else if (format == Format.WithArgs && DescKind == Kind.Operator && MemberName.EndsWith ("Conversion")) {
+                               var type1 = MemberArguments[0].FormattedNamespace + MemberArguments[0].ToCompleteTypeName () + ModToString (MemberArguments[0]);
+                               var type2 = MemberArguments[1].FormattedNamespace + MemberArguments[1].ToCompleteTypeName () + ModToString (MemberArguments[1]);
+                               return type1 + " to " + type2;
+                       }
+
+                       var result = IsEtc && !string.IsNullOrEmpty (EtcFilter) ? EtcFilter : MemberName;
+
+                       // Temporary hack for monodoc produced inner type ctor
+                       //if (DescKind == Kind.Constructor && NestedType != null)
+                               //result = ToCompleteTypeName ();
+
+                       if (GenericMemberArguments != null)
+                               result += FormatGenericArgs (GenericMemberArguments);
+
+                       if (format == Format.WithArgs) {
+                               result += '(';
+                               if (MemberArguments != null && MemberArguments.Count > 0) {
+                                       var args = MemberArguments.Select (a => FormatNamespace (a) + a.ToCompleteTypeName ('+') + ModToString (a));
+                                       result += string.Join (",", args);
+                               }
+                               result += ')';
+                       }
+
+                       return result;
+               }
+
+               public string ToEcmaCref ()
+               {
+                       var sb = new StringBuilder ();
+                       // Cref type
+                       sb.Append (DescKind.ToString ()[0]);
+                       // Create the rest
+                       ConstructCRef (sb);
+
+                       return sb.ToString ();
+               }
+
+               void ConstructCRef (StringBuilder sb)
+               {
+                       sb.Append (Namespace);
+                       if (DescKind == Kind.Namespace)
+                               return;
+
+                       sb.Append ('.');
+                       sb.Append (TypeName);
+                       if (GenericTypeArguments != null) {
+                               sb.Append ('<');
+                               foreach (var t in GenericTypeArguments)
+                                       t.ConstructCRef (sb);
+                               sb.Append ('>');
+                       }
+                       if (NestedType != null) {
+                               sb.Append ('+');
+                               NestedType.ConstructCRef (sb);
+                       }
+                       if (ArrayDimensions != null && ArrayDimensions.Count > 0) {
+                               for (int i = 0; i < ArrayDimensions.Count; i++) {
+                                       sb.Append ('[');
+                                       sb.Append (new string (',', ArrayDimensions[i] - 1));
+                                       sb.Append (']');
+                               }
+                       }
+                       if (DescKind == Kind.Type)
+                               return;
+
+                       if (MemberArguments != null) {
+                               
+                       }
+               }
+
+               public override string ToString ()
+               {
+                       return string.Format ("({8}) {0}::{1}{2}{3}{7} {4}{5}{6} {9} {10}",
+                                             Namespace,
+                                             TypeName,
+                                             FormatGenericArgsFull (GenericTypeArguments),
+                                             NestedType != null ? "+" + NestedType.ToString () : string.Empty,
+                                             MemberName ?? string.Empty,
+                                             FormatGenericArgsFull (GenericMemberArguments),
+                                             MemberArguments != null ? "(" + string.Join (",", MemberArguments.Select (m => m.ToString ())) + ")" : string.Empty,
+                                             ArrayDimensions != null && ArrayDimensions.Count > 0 ? ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat) : string.Empty,
+                                             DescKind.ToString ()[0],
+                                             Etc != 0 ? '(' + Etc.ToString () + ')' : string.Empty,
+                                             ExplicitImplMember != null ? "$" + ExplicitImplMember.ToString () : string.Empty);
+                                             
+               }
+
+               public override bool Equals (object other)
+               {
+                       var otherDesc = other as EcmaDesc;
+                       return otherDesc != null && Equals (otherDesc);
+               }
+
+               public bool Equals (EcmaDesc other)
+               {
+                       if (other == null)
+                               return false;
+
+                       if (NestedType == null ^ other.NestedType == null
+                           || ArrayDimensions == null ^ other.ArrayDimensions == null
+                           || GenericTypeArguments == null ^ other.GenericTypeArguments == null
+                           || GenericMemberArguments == null ^ other.GenericMemberArguments == null
+                           || MemberArguments == null ^ other.MemberArguments == null
+                           || ExplicitImplMember == null ^ other.ExplicitImplMember == null)
+                               return false;
+
+                       return other != null
+                               && DescKind == other.DescKind
+                               && TypeName == other.TypeName
+                               && Namespace == other.Namespace
+                               && MemberName == other.MemberName
+                               && (NestedType == null || NestedType.Equals (other.NestedType))
+                               && (ArrayDimensions == null || ArrayDimensions.SequenceEqual (other.ArrayDimensions))
+                               && (GenericTypeArguments == null || GenericTypeArguments.SequenceEqual (other.GenericTypeArguments))
+                               && (GenericMemberArguments == null || GenericMemberArguments.SequenceEqual (other.GenericMemberArguments))
+                               && (MemberArguments == null || MemberArguments.SequenceEqual (other.MemberArguments))
+                               && Etc == other.Etc
+                               && EtcFilter == other.EtcFilter
+                               && (ExplicitImplMember == null || ExplicitImplMember.Equals (other.ExplicitImplMember));
+               }
+
+               public override int GetHashCode ()
+               {
+                       return DescKind.GetHashCode ()
+                               ^ TypeName.GetHashCode ()
+                               ^ Namespace.GetHashCode ()
+                               ^ MemberName.GetHashCode ();
+               }
+
+               bool What (bool input)
+               {
+                       if (!input)
+                               throw new Exception ("Not equal");
+                       return input;
+               }
+
+               bool WhatT (bool input)
+               {
+                       if (input)
+                               throw new Exception ("Not equal");
+                       return input;
+               }
+
+               string FormatNamespace (EcmaDesc desc)
+               {
+                       return string.IsNullOrEmpty (desc.Namespace) ? string.Empty : desc.Namespace + ".";
+               }
+
+               string FormatGenericArgs (IEnumerable<EcmaDesc> genericArgs)
+               {
+                       return genericArgs != null ? "<" + string.Join (",", genericArgs.Select (t => FormatNamespace (t) + t.ToCompleteTypeName ())) + ">" : string.Empty;
+               }
+
+               string FormatGenericArgsFull (IEnumerable<EcmaDesc> genericArgs)
+               {
+                       return genericArgs != null ? "<" + string.Join (",", genericArgs.Select (t => t.ToString ())) + ">" : string.Empty;
+               }
+
+               string ModToString (EcmaDesc desc)
+               {
+                       switch (desc.DescModifier) {
+                       case Mod.Pointer:
+                               return "*";
+                       case Mod.Ref:
+                               return "&";
+                       case Mod.Out:
+                               return "@";
+                       default:
+                               return string.Empty;
+                       }
+               }
+
+               string FormattedNamespace {
+                       get {
+                               return !string.IsNullOrEmpty (Namespace) ? Namespace + "." : string.Empty;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParser.jay b/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParser.jay
new file mode 100644 (file)
index 0000000..bee2810
--- /dev/null
@@ -0,0 +1,263 @@
+%{
+using System.Text;
+using System.IO;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace Monkeydoc.Ecma
+{
+       public class EcmaUrlParser
+       {
+        int yacc_verbose_flag = 0;
+
+        public void IsValid (string input)
+        {
+                       var lexer = new EcmaUrlTokenizer (input);
+                       this.yyparse (lexer);
+        }
+
+        public EcmaDesc Parse (string input)
+        {
+                       var lexer = new EcmaUrlTokenizer (input);
+                       return (EcmaDesc)this.yyparse (lexer);
+        }
+
+        public bool TryParse (string input, out EcmaDesc desc)
+        {
+            desc = null;
+            try {
+                desc = Parse (input);
+            } catch {
+                return false;
+            }
+            return true;
+        }
+
+        EcmaDesc SetEcmaDescType (object result, EcmaDesc.Kind kind)
+        {
+            var desc = result as EcmaDesc;
+            desc.DescKind = kind;
+            return desc;
+        }
+
+        List<T> SafeReverse<T> (List<T> input)
+        {
+            if (input == null)
+               return null;
+            input.Reverse ();
+            return input;
+        }
+%}
+
+%token ERROR
+%token IDENTIFIER
+%token DIGIT
+%token DOT
+%token COMMA
+%token COLON
+%token INNER_TYPE_SEPARATOR
+%token OP_GENERICS_LT
+%token OP_GENERICS_GT
+%token OP_GENERICS_BACKTICK
+%token OP_OPEN_PAREN
+%token OP_CLOSE_PAREN
+%token OP_ARRAY_OPEN
+%token OP_ARRAY_CLOSE
+%token SLASH_SEPARATOR
+%token STAR
+%token REF_ARG
+%token OUT_ARG
+%token EXPLICIT_IMPL_SEP
+
+%start expression
+
+%%
+
+expression
+        : 'T' COLON type_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Type); }
+        | 'N' COLON namespace_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Namespace); }
+        | 'M' COLON method_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Method); }
+        | 'F' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Field); }
+        | 'C' COLON constructor_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Constructor); }
+        | 'P' COLON property_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Property); }
+        | 'E' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Event); }
+        | 'O' COLON operator_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Operator); }
+
+/* i.e. id.id.id or id */
+dot_expression
+        : IDENTIFIER { $$ = new List<string> { (string)$1 }; }
+        | IDENTIFIER DOT dot_expression { ((ICollection<string>)$3).Add ((string)$1); $$ = $3; }
+
+namespace_expression
+        : dot_expression { $$ = new EcmaDesc { Namespace = string.Join (".", ((IEnumerable<string>)$1).Reverse ()) }; }
+
+type_expression
+        : dot_expression type_expression_suffix {
+                         var dotExpr = ((List<string>)$1);
+                         dotExpr.Reverse ();
+                         var desc = $2 as EcmaDesc;
+                         desc.DescKind = EcmaDesc.Kind.Type;
+                         desc.Namespace = string.Join (".", dotExpr.Take (dotExpr.Count - 1));
+                         desc.TypeName = dotExpr.Last ();
+                         $$ = desc;
+                     }
+
+/* To be used in types with no namespaces attached to them like an inner type*/
+reduced_type_expression
+        : IDENTIFIER type_expression_suffix {
+                         var desc = $2 as EcmaDesc;
+                         desc.DescKind = EcmaDesc.Kind.Type;
+                         desc.TypeName = $1 as string;
+                         $$ = desc;
+                     }
+
+type_expression_suffix
+        : opt_generic_type_suffix opt_inner_type_description opt_array_definition opt_etc {
+                         bool nestedDescHasEtc = $2 != null && ((EcmaDesc)$2).IsEtc;
+                         EcmaDesc nestedType = (EcmaDesc)$2;
+                         $$ = new EcmaDesc {
+                            GenericTypeArguments = $1 as List<EcmaDesc>,
+                            NestedType = nestedType,
+                            ArrayDimensions = SafeReverse ($3 as List<int>),
+                            Etc = $4 != null ? ((Tuple<char, string>)$4).Item1 : nestedDescHasEtc ? nestedType.Etc : (char)0,
+                            EtcFilter = $4 != null ? ((Tuple<char, string>)$4).Item2 : nestedDescHasEtc ? nestedType.EtcFilter : null
+                         };
+                         if (nestedDescHasEtc) {
+                            nestedType.Etc = (char)0;
+                            nestedType.EtcFilter = null;
+                         }
+                     }
+
+opt_inner_type_description
+        : /* empty */ { $$ = null; }
+        | INNER_TYPE_SEPARATOR reduced_type_expression { $$ = $2; }
+
+opt_generic_type_suffix
+        : /* empty */ { $$ = null; }
+        | OP_GENERICS_BACKTICK DIGIT { $$ = Enumerable.Repeat<string> (null, (int)$2).ToList (); }
+        | OP_GENERICS_LT generic_type_arg_list OP_GENERICS_GT { $$ = $2; }
+
+generic_type_arg_list
+        : type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
+        | generic_type_arg_list COMMA type_expression { ((List<EcmaDesc>)$1).Add ((EcmaDesc)$3); $$ = $1; }
+
+opt_array_definition
+        : /* empty */ { $$ = null; }
+        | OP_ARRAY_OPEN opt_array_definition_list OP_ARRAY_CLOSE opt_array_definition {
+                      var dims = ((IList<int>)$4) ?? new List<int> (2);
+                      dims.Add ((int)$2);
+                      $$ = dims;
+                }
+
+opt_array_definition_list
+        : /* empty */ { $$ = 1; }
+        | COMMA opt_array_definition_list { $$ = ((int)$2) + 1; }
+
+opt_etc
+        : /* empty */ { $$ = null; }
+        | SLASH_SEPARATOR etc_identifier { $$ = Tuple.Create<char, string> (((string)$2)[0], null); }
+        | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR reduced_member_expression { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4); }
+/*        | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR IDENTIFIER opt_generic_type_suffix { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4 + ($5 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$5).Select (t => t.ToCompleteTypeName ())) + ">")); } */
+
+etc_identifier
+        : STAR { $$ = "*"; }
+        | IDENTIFIER { $$ = $1; }
+
+method_expression
+        : type_expression DOT IDENTIFIER opt_generic_type_suffix opt_arg_list_suffix {
+                      var desc = $1 as EcmaDesc;
+                      desc.MemberName = $3 as string;
+                      desc.GenericMemberArguments = $4 as List<EcmaDesc>;
+                      desc.MemberArguments = SafeReverse ($5 as List<EcmaDesc>);
+                      $$ = desc;
+                }
+        | dot_expression opt_generic_type_suffix opt_arg_list_suffix {
+                      var dotExpr = ((List<string>)$1);
+                      $$ = new EcmaDesc {
+                           Namespace = string.Join (".", dotExpr.Skip (2).DefaultIfEmpty (string.Empty).Reverse ()),
+                           TypeName = dotExpr.Skip (1).First (),
+                           MemberName = dotExpr.First (),
+                           GenericMemberArguments = $2 as List<EcmaDesc>,
+                           MemberArguments = SafeReverse ($3 as List<EcmaDesc>)
+                      };
+                }
+        | type_expression EXPLICIT_IMPL_SEP method_expression {
+                      var desc = $1 as EcmaDesc;
+                      desc.ExplicitImplMember = $3 as EcmaDesc;
+                      $$ = desc;
+                }
+
+/* To be used with members that may have no type/namespace attached */
+reduced_member_expression
+        : IDENTIFIER opt_generic_type_suffix { $$ = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">"); }
+        | IDENTIFIER opt_generic_type_suffix DOT reduced_member_expression {
+                      var existing = $4 as string;
+                      var expr = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">");
+                      $$ = expr + "." + existing;
+                }
+
+arg_type_expression
+        : type_expression opt_arg_type_suffix { var desc = (EcmaDesc)$1; desc.DescModifier = (EcmaDesc.Mod)$2; $$ = desc; }
+
+opt_arg_type_suffix
+        : /* empty */ { $$ = EcmaDesc.Mod.Normal; }
+        | STAR { $$ = EcmaDesc.Mod.Pointer; }
+        | REF_ARG { $$ = EcmaDesc.Mod.Ref; }
+        | OUT_ARG { $$ = EcmaDesc.Mod.Out; }
+
+type_expression_list
+        : /* empty */ { $$ = null; }
+        | arg_type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
+        | arg_type_expression COMMA type_expression_list { ((List<EcmaDesc>)$3).Add ((EcmaDesc)$1); $$ = $3; }
+
+simple_member_expression
+        : dot_expression {
+                 var dotExpr = ((List<string>)$1);
+                 dotExpr.Reverse ();
+
+                 $$ = new EcmaDesc {
+                      Namespace = dotExpr.Count > 2 ? string.Join (".", dotExpr.Take (dotExpr.Count - 2)) : string.Empty,
+                      TypeName = dotExpr.Count > 1 ?  dotExpr[dotExpr.Count - 2] : string.Empty,
+                      MemberName = dotExpr[dotExpr.Count - 1]
+                 };
+             }
+        | type_expression DOT IDENTIFIER {
+                 var desc = $1 as EcmaDesc;
+                 desc.MemberName = $3 as string;
+                 $$ = desc;
+             }
+        | type_expression EXPLICIT_IMPL_SEP simple_member_expression {
+                 var desc = $1 as EcmaDesc;
+                 desc.ExplicitImplMember = $3 as EcmaDesc;
+                 $$ = desc;
+             }
+
+constructor_expression
+        : method_expression { $$ = $1; }
+
+operator_expression
+        : method_expression { $$ = $1; }
+
+property_expression
+        : simple_member_expression opt_property_indexer {
+                 var desc = $1 as EcmaDesc;
+                 (desc.ExplicitImplMember ?? desc).MemberArguments = SafeReverse ($2 as List<EcmaDesc>);
+                 $$ = desc;
+             }
+
+opt_property_indexer
+        : opt_arg_list_suffix { $$ = $1; }
+
+/*simple_member_expression opt_arg_list_suffix { $$ = CopyFromEcmaDesc (new EcmaDesc {
+                           MemberArguments = SafeReverse ($2 as List<EcmaDesc>)
+                      }, (EcmaDesc)$1);
+                }*/
+
+opt_arg_list_suffix
+        : /* empty */ { $$ = null; }
+        | OP_OPEN_PAREN type_expression_list OP_CLOSE_PAREN { $$ = $2; }
+
+%%
+
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParserDriver.cs b/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlParserDriver.cs
new file mode 100644 (file)
index 0000000..93e8c35
--- /dev/null
@@ -0,0 +1,17 @@
+using System;
+using System.IO;
+
+namespace Monkeydoc.Ecma
+{
+       public class EcmaUrlParserDriver
+       {
+               public static void Main (string[] args)
+               {
+                       var input = new StringReader (args[0]);
+                       var lexer = new EcmaUrlTokenizer (input);
+                       var parser = new EcmaUrlParser ();
+
+                       Console.WriteLine (parser.yyparse (lexer));
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlTokenizer.cs b/mcs/tools/monkeydoc/Monkeydoc.Ecma/EcmaUrlTokenizer.cs
new file mode 100644 (file)
index 0000000..bb1ffb1
--- /dev/null
@@ -0,0 +1,168 @@
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace Monkeydoc.Ecma
+{
+       public class EcmaUrlTokenizer : yyParser.yyInput
+       {
+               const char EndOfStream = (char)0;
+               string input;
+               object val;
+               int current_token;
+               int current_pos;
+               int real_current_pos;
+               int identCount = 0;
+
+               public EcmaUrlTokenizer (string input)
+               {
+                       this.input = input;
+               }
+
+               static bool is_identifier_start_character (char c)
+               {
+                       return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || Char.IsLetter (c);
+               }
+
+               static bool is_identifier_part_character (char c)
+               {
+                       if (c >= 'a' && c <= 'z')
+                               return true;
+
+                       if (c >= 'A' && c <= 'Z')
+                               return true;
+
+                       if (c == '_' || (c >= '0' && c <= '9'))
+                               return true;
+
+                       if (c < 0x80)
+                               return false;
+
+                       return Char.IsLetter (c) || Char.GetUnicodeCategory (c) == UnicodeCategory.ConnectorPunctuation;
+               }
+
+               public bool advance ()
+               {
+                       return Peek () != EndOfStream;
+               }
+
+               public Object Value {
+                       get {
+                               return val;
+                       }
+               }
+
+               public Object value ()
+               {
+                       return val;
+               }
+
+               public int token ()
+               {
+                       int token = xtoken ();
+                       //Console.WriteLine ("Current token {0} with value {1}", token, val == null ? "(none)" : val.ToString ());
+                       if (token == Token.ERROR)
+                               Console.WriteLine ("Problem at pos {0} after token {1}", current_pos, current_token);
+                       current_token = token;
+                       return token;
+               }
+
+               int xtoken ()
+               {
+                       char next = Read ();
+                       while (char.IsWhiteSpace (next))
+                               next = Read ();
+                       current_pos++;
+                       val = null;
+
+                       switch (next) {
+                       case ',':
+                               return Token.COMMA;
+                       case '.':
+                               return Token.DOT;
+                       case '<':
+                               return Token.OP_GENERICS_LT;
+                       case '>':
+                               return Token.OP_GENERICS_GT;
+                       case '`':
+                               return Token.OP_GENERICS_BACKTICK;
+                       case '(':
+                               return Token.OP_OPEN_PAREN;
+                       case ')':
+                               return Token.OP_CLOSE_PAREN;
+                       case '+':
+                               return Token.INNER_TYPE_SEPARATOR;
+                       case ':':
+                               return Token.COLON;
+                       case '/':
+                               return Token.SLASH_SEPARATOR;
+                       case '[':
+                               return Token.OP_ARRAY_OPEN;
+                       case ']':
+                               return Token.OP_ARRAY_CLOSE;
+                       case '*':
+                               return Token.STAR;
+                       case '&':
+                               return Token.REF_ARG;
+                       case '@':
+                               return Token.OUT_ARG;
+                       case '$':
+                               return Token.EXPLICIT_IMPL_SEP;
+                       default:
+                               return TokenizeIdentifierOrNumber (next);
+                       }
+               }
+
+               int TokenizeIdentifierOrNumber (char current)
+               {
+                       // We must first return the expression type which is a uppercase letter and a colon
+                       if (current_pos < 2) {
+                               val = null;
+                               return (int)current;
+                       }
+
+                       if (is_identifier_start_character (current) || current == '*') {
+                               unsafe {
+                                       // identifier length is artificially limited to 1024 bytes by implementations
+                                       char* pIdent = stackalloc char[512];
+                                       *pIdent = current;
+                                       identCount = 1;
+
+                                       char peek;
+                                       while ((peek = Peek ()) != EndOfStream && is_identifier_part_character (peek)) {
+                                               *(pIdent + identCount) = Read ();
+                                               ++current_pos;
+                                               ++identCount;
+                                       }
+
+                                       val = new string ((char*)pIdent, 0, identCount);
+                                       return Token.IDENTIFIER;
+                               }
+                       } else if (char.IsDigit (current)) {
+                               val = current - '0';
+                               return Token.DIGIT;
+                       } else {
+                               val = null;
+                               return Token.ERROR;
+                       }
+               }
+
+               char Read ()
+               {
+                       try {
+                               return input[real_current_pos++];
+                       } catch {
+                               return EndOfStream;
+                       }
+               }
+
+               char Peek ()
+               {
+                       try {
+                               return input[real_current_pos];
+                       } catch {
+                               return EndOfStream;
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/HelpSource.cs b/mcs/tools/monkeydoc/Monkeydoc/HelpSource.cs
new file mode 100644 (file)
index 0000000..b22742b
--- /dev/null
@@ -0,0 +1,335 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+using Mono.Utilities;
+using Lucene.Net.Index;
+
+namespace MonkeyDoc
+{
+       //
+       // The HelpSource class keeps track of the archived data, and its
+       // tree
+       //
+       public class HelpSource
+       {
+               static int id;
+
+               //
+               // The unique ID for this HelpSource.
+               //
+               int source_id;
+
+               // The name of the HelpSource, used by all the file (.tree, .zip, ...) used by it
+               string name;
+               // The full directory path where the HelpSource files are located
+               string basePath;
+
+               // The tree of this help source
+               Tree tree;
+               string treeFilePath;
+               RootTree rootTree;
+
+               IDocCache cache = new MonkeyDoc.Caches.FileCache (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "monkeydoc", "cache"));
+               IDocStorage storage;
+
+               public HelpSource (string base_filename, bool create)
+               {
+                       this.name = Path.GetFileName (base_filename);
+                       this.basePath = Path.GetDirectoryName (base_filename);
+                       this.treeFilePath = base_filename + ".tree";
+                       this.storage = new MonkeyDoc.Storage.ZipStorage (base_filename + ".zip");
+
+                       tree = create ? new Tree (this, string.Empty, string.Empty) : new Tree (this, treeFilePath);
+
+                       source_id = id++;
+               }
+       
+               public HelpSource ()
+               {
+                       tree = new Tree (this, "Blah", "Blah");
+                       source_id = id++;
+               }
+       
+               public int SourceID {
+                       get {
+                               return source_id;
+                       }
+               }
+       
+               public string Name {
+                       get {
+                               return name;
+                       }
+               }
+
+               /* This gives the full path of the source/ directory */
+               public string BaseFilePath {
+                       get {
+                               return basePath;
+                       }
+               }
+
+               public TraceLevel TraceLevel {
+                       get;
+                       set;
+               }
+
+               public string BaseDir {
+                       get {
+                               return basePath;
+                       }
+               }
+
+               public Tree Tree {
+                       get {
+                               return tree;
+                       }
+               }
+
+               public RootTree RootTree {
+                       get {
+                               return rootTree;
+                       }
+                       set {
+                               rootTree = value;
+                       }
+               }
+
+               public IDocCache Cache {
+                       get {
+                               return cache;
+                       }
+               }
+
+               public IDocStorage Storage {
+                       get {
+                               return storage;
+                       }
+               }
+
+               // A HelpSource may have a common prefix to its URL, give it here
+               protected virtual string UriPrefix {
+                       get {
+                               return "dummy:";
+                       }
+               }
+       
+               /// <summary>
+               ///   Returns a stream from the packaged help source archive
+               /// </summary>
+               public virtual Stream GetHelpStream (string id)
+               {
+                       return storage.Retrieve (id);
+               }
+
+               public virtual Stream GetCachedHelpStream (string id)
+               {
+                       if (string.IsNullOrEmpty (id))
+                               throw new ArgumentNullException ("id");
+                       if (!cache.CanCache (DocEntity.Text))
+                               return GetHelpStream (id);
+                       if (!cache.IsCached (id))
+                               cache.CacheText (id, GetHelpStream (id));
+                       return cache.GetCachedStream (id);
+               }
+
+               public XmlReader GetHelpXml (string id)
+               {
+                       var url = "monodoc:///" + SourceID + "@" + Uri.EscapeDataString (id) + "@";
+                       var stream = cache.IsCached (id) ? cache.GetCachedStream (id) : storage.Retrieve (id);
+                       
+                       return stream == null ? null : new XmlTextReader (url, stream);
+               }
+       
+               public virtual XmlDocument GetHelpXmlWithChanges (string id)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       if (!storage.SupportRevision) {
+                               doc.Load (GetHelpXml (id));
+                       } else {
+                               var revManager = storage.RevisionManager;
+                               doc.Load (revManager.RetrieveLatestRevision (id));
+                       }
+                       return doc;
+               }
+
+               public virtual string GetCachedText (string id)
+               {
+                       if (!cache.CanCache (DocEntity.Text))
+                               return GetText (id);
+                       if (!cache.IsCached (id))
+                               cache.CacheText (id, GetText (id));
+                       return cache.GetCachedString (id);
+               }
+
+               public virtual string GetText (string id)
+               {
+                       return new StreamReader (GetHelpStream (id)).ReadToEnd ();
+               }
+
+               // Tells if the result for the provided id is generated dynamically
+               // by the help source
+               public virtual bool IsGeneratedContent (string id)
+               {
+                       return false;
+               }
+
+               // Tells if the content of the provided id is meant to be returned raw
+               public virtual bool IsRawContent (string id)
+               {
+                       return false;
+               }
+
+               // Tells if provided id refers to a multi-content-type document if it's case
+               // tells the ids it's formed of
+               public virtual bool IsMultiPart (string id, out IEnumerable<string> parts)
+               {
+                       parts = null;
+                       return false;
+               }
+
+               /// <summary>
+               ///   Saves the tree and the archive
+               /// </summary>
+               public void Save ()
+               {
+                       tree.Save (treeFilePath);
+                       storage.Dispose ();
+               }
+       
+               public virtual void RenderPreviewDocs (XmlNode newNode, XmlWriter writer)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public virtual string GetPublicUrl (Node node)
+               {
+                       return node.GetInternalUrl ();
+               }
+
+               public virtual bool CanHandleUrl (string url)
+               {
+                       return url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase);
+               }
+
+               public virtual string GetInternalIdForUrl (string url, out Node node)
+               {
+                       node = MatchNode (url);
+                       return node == null ? null : url.Substring (UriPrefix.Length);
+               }
+               
+               public virtual Node MatchNode (string url)
+               {
+                       Node current = null;
+
+                       var matchCache = LRUCache<string, Node>.Default;
+                       if ((current = matchCache.Get (url)) != null)
+                               return current;
+
+                       current = Tree.RootNode;
+                       var strippedUrl = url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? url.Substring (UriPrefix.Length) : url;
+                       var searchNode = new Node () { Element = strippedUrl };
+
+                       do {
+                               int index = current.Nodes.BinarySearch (searchNode, NodeElementComparer.Instance);
+                               if (index >= 0) {
+                                       Node n = current.Nodes[index];
+                                       //Console.WriteLine ("Binarysearch success for {0} which fell on {1}", strippedUrl, n.Element);
+                                       matchCache.Put (url, n);
+                                       return n;
+                               }
+                               index = ~index;
+                               if (index == current.Nodes.Count) {
+                                       //Console.WriteLine ("Match fail for {0}", strippedUrl);
+                                       //Console.WriteLine (current.Nodes.Select (n => n.Element).Aggregate ((e1, e2) => e1 + ", " + e2));
+                                       return SlowMatchNode (Tree.RootNode, matchCache, strippedUrl);
+                               }
+                               current = current.Nodes [index - 1];
+                               //Console.WriteLine ("Binarysearch failed for {0}, next node check is {1}", strippedUrl, current.Element);
+                       } while (true);
+
+                       return null;
+               }
+
+               /* That slow path is mainly here to handle ecmaspec type of url which are composed of hard to sort numbers
+                * because they don't have the same amount of digit. We could use a regex to harmonise the various number
+                * parts but then it would be quite specific. Since in the case of ecmaspec the tree is well-formed enough
+                * the "Slow" match should still be fast enough
+                */
+               Node SlowMatchNode (Node current, LRUCache<string, Node> matchCache, string url)
+               {
+                       //Console.WriteLine ("Entering slow path for {0} starting from {1}", url, current.Element);
+                       while (current != null) {
+                               bool stop = true;
+                               foreach (Node n in current.Nodes) {
+                                       var element = n.Element.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (UriPrefix.Length) : n.Element;
+                                       if (url == element) {
+                                               matchCache.Put (url, n);
+                                               return n;
+                                       } else if (url.StartsWith (element + ".", StringComparison.OrdinalIgnoreCase) && !n.IsLeaf) {
+                                               current = n;
+                                               stop = false;
+                                               break;
+                                       }
+                               }
+                               if (stop)
+                                       current = null;
+                       }
+
+                       return null;
+               }
+               
+               class NodeElementComparer : IComparer<Node>
+               {
+                       public static NodeElementComparer Instance = new NodeElementComparer ();
+
+                       public int Compare (Node n1, Node n2)
+                       {
+                               return string.Compare (Cleanup (n1), Cleanup (n2), StringComparison.Ordinal);
+                       }
+
+                       string Cleanup (Node n)
+                       {
+                               var prefix = n.Tree != null && n.Tree.HelpSource != null ? n.Tree.HelpSource.UriPrefix : string.Empty;
+                               var element = n.Element.StartsWith (prefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (prefix.Length) : n.Element;
+                               if (char.IsDigit (element, 0)) {
+                                       var count = element.TakeWhile (char.IsDigit).Count ();
+                                       element = element.PadLeft (Math.Max (0, 3 - count) + element.Length, '0');
+                               }
+                               //Console.WriteLine ("Cleaned up {0} to {1}", n.Element, element);
+                               return element;
+                       }
+               }
+
+               public virtual DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+               {
+                       extraParams = null;
+                       return DocumentType.PlainText;
+               }
+
+               public virtual Stream GetImage (string url)
+               {
+                       return null;
+               }
+
+               //
+               // Populates the index.
+               //
+               public virtual void PopulateIndex (IndexMaker index_maker)
+               {
+               }
+
+               //
+               // Create different Documents for adding to Lucene search index
+               // The default action is do nothing. Subclasses should add the docs
+               // 
+               public virtual void PopulateSearchableIndex (IndexWriter writer)
+               {
+
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/Node.cs b/mcs/tools/monkeydoc/Monkeydoc/Node.cs
new file mode 100644 (file)
index 0000000..8d9bd1e
--- /dev/null
@@ -0,0 +1,323 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+       public class Node : IComparable<Node>, IComparable
+       {
+               readonly Tree tree;
+               string caption, element, pubUrl;
+               public bool Documented;
+               bool loaded;
+               Node parent;
+               List<Node> nodes;
+               Dictionary<string, Node> childrenLookup;
+               /* Address has three types of value, 
+                *   _ 0 is for no on-disk representation
+                *   _ >0 is a valid address that is loaded immediately
+                *   _ <0 is a valid negated address to indicate lazy loading
+                */
+               int address;
+
+               public Node (Node parent, string caption, string element) : this (parent.Tree, caption, element)
+               {
+                       this.parent = parent;
+               }
+
+               internal Node (Tree tree, string caption, string element)
+               {
+                       this.tree = tree;
+                       this.caption = caption;
+                       this.element = element;
+               }
+       
+               /// <summary>
+               ///    Creates a node from an on-disk representation
+               /// </summary>
+               internal Node (Node parent, int address) : this (parent.tree, address)
+               {
+                       this.parent = parent;
+               }
+
+               internal Node (Tree tree, int address)
+               {
+                       this.address = address;
+                       this.tree = tree;
+                       if (address > 0)
+                               LoadNode ();
+               }
+
+               /* This is solely used for MatchNode to check for equality */
+               internal Node ()
+               {
+               }
+
+               void LoadNode ()
+               {
+                       tree.InflateNode (this);
+                       if (parent != null)
+                               parent.RegisterFullNode (this);
+               }
+
+               public void AddNode (Node n)
+               {
+                       nodes.Add (n);
+                       n.parent = this;
+                       n.Documented = true;
+                       RegisterFullNode (n);
+               }
+
+               public void DeleteNode (Node n)
+               {
+                       nodes.Remove (n);
+                       if (!string.IsNullOrEmpty (n.element))
+                               childrenLookup.Remove (n.element);
+               }
+
+               // When a child node is inflated, it calls this method
+               // so that we can add it to our lookup for quick search
+               void RegisterFullNode (Node child)
+               {
+                       if (childrenLookup == null)
+                               childrenLookup = new Dictionary<string, Node> ();
+                       if (!string.IsNullOrEmpty (child.element))
+                               childrenLookup[child.element] = child;
+               }
+
+               public List<Node> Nodes {
+                       get {
+                               EnsureLoaded ();
+                               return nodes != null ? nodes : new List<Node> ();
+                       }
+               }
+
+               public string Element {
+                       get {
+                               EnsureLoaded ();
+                               return element;
+                       }
+                       set {
+                               element = value;
+                       }
+               }
+
+               public string Caption {
+                       get {
+                               EnsureLoaded ();
+                               return caption;
+                       }
+                       internal set {
+                               caption = value;
+                       }
+               }
+       
+               public Node Parent {
+                       get {
+                               return parent;
+                       }
+               }
+
+               public Tree Tree {
+                       get {
+                               return tree;
+                       }
+               }
+
+               internal int Address {
+                       get {
+                               return address;
+                       }
+               }
+       
+               /// <summary>
+               ///   Creates a new node, in the locator entry point, and with
+               ///   a user visible caption of @caption
+               /// </summary>
+               public Node CreateNode (string c_caption, string c_element)
+               {
+                       EnsureNodes ();
+                       if (string.IsNullOrEmpty (c_caption))
+                               throw new ArgumentNullException ("c_caption");
+                       if (string.IsNullOrEmpty (c_element))
+                               throw new ArgumentNullException ("c_element");
+
+                       Node t = new Node (this, c_caption, c_element);
+                       nodes.Add (t);
+                       childrenLookup[c_element] = t;
+
+                       return t;
+               }
+
+               public Node GetOrCreateNode (string c_caption, string c_element)
+               {
+                       if (nodes == null)
+                               return CreateNode (c_caption, c_element);
+                       if (childrenLookup.Count != nodes.Count || (nodes.Count == 0 && childrenLookup.Count != nodes.Capacity))
+                               UpdateLookup ();
+
+                       Node result;
+                       if (!childrenLookup.TryGetValue (c_element, out result))
+                               result = CreateNode (c_caption, c_element);
+                       return result;
+               }
+
+               public void EnsureNodes ()
+               {
+                       if (nodes == null) {
+                               nodes = new List<Node> ();
+                               childrenLookup = new Dictionary<string, Node> ();
+                       }
+               }
+
+               public void EnsureLoaded ()
+               {
+                       if (address < 0 && !loaded) {
+                               LoadNode ();
+                               loaded = true;
+                       }
+               }
+
+               void UpdateLookup ()
+               {
+                       foreach (var node in nodes)
+                               childrenLookup[node.Element] = node;
+               }
+       
+               public bool IsLeaf {
+                       get {
+                               return nodes == null || nodes.Count == 0;
+                       }
+               }
+
+               void EncodeInt (BinaryWriter writer, int value)
+               {
+                       do {
+                               int high = (value >> 7) & 0x01ffffff;
+                               byte b = (byte)(value & 0x7f);
+
+                               if (high != 0) {
+                                       b = (byte)(b | 0x80);
+                               }
+                       
+                               writer.Write(b);
+                               value = high;
+                       } while(value != 0);
+               }
+
+               int DecodeInt (BinaryReader reader)
+               {
+                       int ret = 0;
+                       int shift = 0;
+                       byte b;
+               
+                       do {
+                               b = reader.ReadByte();
+
+                               ret = ret | ((b & 0x7f) << shift);
+                               shift += 7;
+                       } while ((b & 0x80) == 0x80);
+                       
+                       return ret;
+               }
+
+               internal void Deserialize (BinaryReader reader)
+               {
+                       int count = DecodeInt (reader);
+                       element = reader.ReadString ();
+                       caption = reader.ReadString ();
+
+                       if (count == 0)
+                               return;
+               
+                       nodes = new List<Node> (count);
+                       for (int i = 0; i < count; i++) {
+                               int child_address = DecodeInt (reader);
+                                                             
+                               Node t = new Node (this, -child_address);
+                               nodes.Add (t);
+                       }
+               }
+
+               internal void Serialize (FileStream output, BinaryWriter writer)
+               {
+                       if (nodes != null)
+                               foreach (Node child in nodes)
+                                       child.Serialize (output, writer);
+
+                       address = (int) output.Position;
+                       EncodeInt (writer, nodes == null ? 0 : (int) nodes.Count);
+                       writer.Write (element);
+                       writer.Write (caption);
+
+                       if (nodes != null)
+                               foreach (Node child in nodes)
+                                       EncodeInt (writer, child.address);
+               }
+
+               public void Sort ()
+               {
+                       if (nodes != null)
+                               nodes.Sort ();
+               }
+
+               internal string GetInternalUrl ()
+               {
+                       EnsureLoaded ();
+                       if (element.IndexOf (":") != -1 || parent == null)
+                               return element;
+
+                       var parentUrl = parent.GetInternalUrl ();
+                       return parentUrl.EndsWith ("/") ? parentUrl + element : parentUrl + "/" + element;
+               }
+               
+               public string PublicUrl {
+                       get {
+                               if (pubUrl != null)
+                                       return pubUrl;
+                               return pubUrl = tree.HelpSource != null ? tree.HelpSource.GetPublicUrl (this) : GetInternalUrl ();
+                       }
+               }
+
+               int IComparable.CompareTo (object obj)
+               {
+                       Node other = obj as Node;
+                       if (other == null)
+                               return -1;
+                       return CompareToInternal (other);
+               }
+
+               int IComparable<Node>.CompareTo (Node obj)
+               {
+                       return CompareToInternal (obj);
+               }
+
+               int CompareToInternal (Node other)
+               {
+                       EnsureLoaded ();
+                       other.EnsureLoaded ();
+
+                       var cap1 = caption;
+                       var cap2 = other.caption;
+
+                       /* Some node (notably from ecmaspec) have number prepended to them
+                        * which we need to sort better by padding them to the same number
+                        * of digits
+                        */
+                       if (char.IsDigit (cap1[0]) && char.IsDigit (cap2[0])) {
+                               int c1 = cap1.TakeWhile (char.IsDigit).Count ();
+                               int c2 = cap2.TakeWhile (char.IsDigit).Count ();
+                               
+                               if (c1 != c2) {
+                                       cap1 = cap1.PadLeft (cap1.Length + Math.Max (0, c2 - c1), '0');
+                                       cap2 = cap2.PadLeft (cap2.Length + Math.Max (0, c1 - c2), '0');
+                               }
+                       }
+
+                       return string.Compare (cap1, cap2, StringComparison.Ordinal);
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/Provider.cs b/mcs/tools/monkeydoc/Monkeydoc/Provider.cs
new file mode 100644 (file)
index 0000000..03c54e5
--- /dev/null
@@ -0,0 +1,27 @@
+using System;
+
+namespace MonkeyDoc
+{
+       public abstract class Provider
+       {
+               //
+               // This code is used to "tag" all the different sources
+               //
+               static short serial;
+
+               public int Code { get; set; }
+
+               public Provider ()
+               {
+                       Code = serial++;
+               }
+
+               public abstract void PopulateTree (Tree tree);
+
+               //
+               // Called at shutdown time after the tree has been populated to perform
+               // any fixups or final tasks.
+               //
+               public abstract void CloseTree (HelpSource hs, Tree tree);
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs b/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs
new file mode 100644 (file)
index 0000000..daf745c
--- /dev/null
@@ -0,0 +1,481 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+using MonkeyDoc.Providers;
+using Lucene.Net.Analysis.Standard;
+using Lucene.Net.Index;
+
+namespace MonkeyDoc
+{
+       public class RootTree : Tree
+       {
+               public const int MonodocVersion = 2;
+               const string RootNamespace = "root:/";
+               string basedir;
+               List<string> uncompiledHelpSourcePaths = new List<string>();
+               HashSet<string> loadedSourceFiles = new HashSet<string>();
+               List<HelpSource> helpSources = new List<HelpSource>();
+               Dictionary<string, Node> nameToNode = new Dictionary<string, Node>();
+               Dictionary<string, HelpSource> nameToHelpSource = new Dictionary<string, HelpSource>();
+
+               public IList<HelpSource> HelpSources {
+                       get {
+                               return this.helpSources.AsReadOnly();
+                       }
+               }
+
+               public DateTime LastHelpSourceTime {
+                       get;
+                       set;
+               }
+
+               static bool IsUnix {
+                       get {
+                               int platform = (int)Environment.OSVersion.Platform;
+                               return platform == 4 || platform == 128 || platform == 6;
+                       }
+               }
+
+               RootTree () : base (null, "Mono Documentation", "root:")
+               {
+                       base.RootNode.EnsureNodes();
+                       this.LastHelpSourceTime = DateTime.Now;
+               }
+
+               public static RootTree LoadTree ()
+               {
+                       return RootTree.LoadTree (RootTree.ProbeBaseDirectories ());
+               }
+
+               static string ProbeBaseDirectories ()
+               {
+                       string result;
+                       try {
+                               NameValueCollection appSettings = ConfigurationManager.AppSettings;
+                               result = appSettings["docPath"];
+                       } catch {
+                               result = ".";
+                       }
+                       return result;
+               }
+
+               public static RootTree LoadTree (string basedir, bool includeExternal = true)
+               {
+                       if (string.IsNullOrEmpty (basedir))
+                               throw new ArgumentNullException ("basedir");
+                       if (!Directory.Exists (basedir))
+                               throw new ArgumentException ("basedir", string.Format ("Base documentation directory at '{0}' doesn't exist", basedir));
+
+                       XmlDocument xmlDocument = new XmlDocument ();
+                       string filename = Path.Combine (basedir, "monodoc.xml");
+                       xmlDocument.Load (filename);
+                       IEnumerable<string> sourceFiles = Directory.EnumerateFiles (Path.Combine (basedir, "sources"), "*.source");
+                       if (includeExternal)
+                               sourceFiles = sourceFiles.Concat (RootTree.ProbeExternalDirectorySources ());
+                       return RootTree.LoadTree (basedir, xmlDocument, sourceFiles);
+               }
+
+               static IEnumerable<string> ProbeExternalDirectorySources ()
+               {
+                       IEnumerable<string> enumerable = Enumerable.Empty<string> ();
+                       try {
+                               string path = ConfigurationManager.AppSettings["docExternalPath"];
+                               enumerable = enumerable.Concat (System.IO.Directory.EnumerateFiles (path, "*.source"));
+                       }
+                       catch {}
+
+                       if (Directory.Exists ("/Library/Frameworks/Mono.framework/External/monodoc"))
+                               enumerable = enumerable.Concat (Directory.EnumerateFiles ("/Library/Frameworks/Mono.framework/External/monodoc", "*.source"));
+                       return enumerable;
+               }
+
+               public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles)
+               {
+                       if (docTree == null) {
+                               docTree = new XmlDocument ();
+                               using  (Stream manifestResourceStream = typeof (RootTree).Assembly.GetManifestResourceStream ("monodoc.xml")) {
+                                       docTree.Load (manifestResourceStream);
+                               }
+                       }
+
+                       sourceFiles =  (sourceFiles ?? new string[0]);
+                       RootTree rootTree = new RootTree ();
+                       rootTree.basedir = indexDir;
+                       XmlNodeList xml_node_list = docTree.SelectNodes ("/node/node");
+                       rootTree.nameToNode["root"] = rootTree.RootNode;
+                       rootTree.nameToNode["libraries"] = rootTree.RootNode;
+                       rootTree.Populate (rootTree.RootNode, xml_node_list);
+
+                       if (rootTree.LookupEntryPoint ("various") == null) {
+                               Console.Error.WriteLine ("No 'various' doc node! Check monodoc.xml!");
+                               Node rootNode = rootTree.RootNode;
+                       }
+
+                       foreach (string current in sourceFiles)
+                               rootTree.AddSourceFile (current);
+
+                       RootTree.PurgeNode (rootTree.RootNode);
+                       rootTree.RootNode.Sort ();
+                       return rootTree;
+               }
+
+               public void AddSource (string sourcesDir)
+               {
+                       IEnumerable<string> enumerable = Directory.EnumerateFiles (sourcesDir, "*.source");
+                       foreach (string current in enumerable)
+                               if (!this.AddSourceFile (current))
+                                       Console.Error.WriteLine ("Error: Could not load source file {0}", current);
+               }
+
+               public bool AddSourceFile (string sourceFile)
+               {
+                       if (this.loadedSourceFiles.Contains (sourceFile))
+                               return false;
+
+                       Node node = this.LookupEntryPoint ("various") ?? base.RootNode;
+                       XmlDocument xmlDocument = new XmlDocument ();
+                       try {
+                               xmlDocument.Load (sourceFile);
+                       } catch {
+                               bool result = false;
+                               return result;
+                       }
+
+                       XmlNodeList extra_nodes = xmlDocument.SelectNodes ("/monodoc/node");
+                       if (extra_nodes.Count > 0)
+                               this.Populate (node, extra_nodes);
+
+                       XmlNodeList sources = xmlDocument.SelectNodes ("/monodoc/source");
+                       if (sources == null) {
+                               Console.Error.WriteLine ("Error: No <source> section found in the {0} file", sourceFile);
+                               return false;
+                       }
+
+                       loadedSourceFiles.Add (sourceFile);
+                       foreach (XmlNode xmlNode in sources) {
+                               XmlAttribute a = xmlNode.Attributes["provider"];
+                               if (a == null) {
+                                       Console.Error.WriteLine ("Error: no provider in <source>");
+                                       continue;
+                               }
+                               string provider = a.InnerText;
+                               a = xmlNode.Attributes["basefile"];
+                               if (a == null) {
+                                       Console.Error.WriteLine ("Error: no basefile in <source>");
+                                       continue;
+                               }
+                               string basefile = a.InnerText;
+                               a = xmlNode.Attributes["path"];
+                               if (a == null) {
+                                       Console.Error.WriteLine ("Error: no path in <source>");
+                                       continue;
+                               }
+                               string path = a.InnerText;
+                               string basefilepath = Path.Combine (Path.GetDirectoryName (sourceFile), basefile);
+                               HelpSource helpSource = RootTree.GetHelpSource (provider, basefilepath);
+                               if (helpSource != null) {
+                                       helpSource.RootTree = this;
+                                       this.helpSources.Add (helpSource);
+                                       this.nameToHelpSource[path] = helpSource;
+                                       Node node2 = this.LookupEntryPoint (path);
+                                       if (node2 == null) {
+                                               Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
+                                               node2 = node;
+                                       }
+                                       foreach (Node current in helpSource.Tree.RootNode.Nodes) {
+                                               node2.AddNode (current);
+                                       }
+                                       node2.Sort ();
+                               }
+                       }
+                       return true;
+               }
+
+               static bool PurgeNode (Node node)
+               {
+                       bool result = false;
+                       if (!node.Documented)
+                       {
+                               List<Node> list = new List<Node> ();
+                               foreach (Node current in node.Nodes)
+                               {
+                                       bool flag = RootTree.PurgeNode (current);
+                                       if (flag)
+                                       {
+                                               list.Add (current);
+                                       }
+                               }
+                               result =  (node.Nodes.Count == list.Count);
+                               foreach (Node current2 in list)
+                               {
+                                       node.DeleteNode (current2);
+                               }
+                       }
+                       return result;
+               }
+
+               public static string[] GetSupportedFormats ()
+               {
+                       return new string[]
+                       {
+                               "ecma",
+                               "ecmaspec",
+                               "error",
+                               "man",
+                               "xhtml"
+                       };
+               }
+
+               public static HelpSource GetHelpSource (string provider, string basefilepath)
+               {
+                       HelpSource result;
+                       try {
+                               switch (provider) {
+                               case "xhtml":
+                               case "hb":
+                                       result = new XhtmlHelpSource (basefilepath, false);
+                                       break;
+                               case "man":
+                                       result = new ManHelpSource (basefilepath, false);
+                                       break;
+                               case "error":
+                                       result = new ErrorHelpSource (basefilepath, false);
+                                       break;
+                               case "ecmaspec":
+                                       result = new EcmaSpecHelpSource (basefilepath, false);
+                                       break;
+                               case "ecma":
+                                       result = new EcmaHelpSource (basefilepath, false);
+                                       break;
+                               default:
+                                       Console.Error.WriteLine ("Error: Unknown provider specified: {0}", provider);
+                                       result = null;
+                                       break;
+                               }
+                       } catch (FileNotFoundException) {
+                               Console.Error.WriteLine ("Error: did not find one of the files in sources/" + basefilepath);
+                               result = null;
+                       }
+                       return result;
+               }
+
+               public static Provider GetProvider (string provider, params string[] basefilepaths)
+               {
+                       switch (provider) {
+                       case "ecma":
+                               return new EcmaProvider (basefilepaths[0]);
+                       case "ecmaspec":
+                               return new EcmaSpecProvider (basefilepaths[0]);
+                       case "error":
+                               return new ErrorProvider (basefilepaths[0]);
+                       case "man":
+                               return new ManProvider (basefilepaths);
+                       case "xhml":
+                       case "hb":
+                               return new XhtmlProvider (basefilepaths[0]);
+                       }
+
+                       throw new NotSupportedException (provider);
+               }
+
+               void Populate (Node parent, XmlNodeList xml_node_list)
+               {
+                       foreach (XmlNode xmlNode in xml_node_list) {
+                               XmlAttribute e = xmlNode.Attributes["parent"];
+                               Node parent2 = null;
+                               if (e != null && this.nameToNode.TryGetValue (e.InnerText, out parent2)) {
+                                       xmlNode.Attributes.Remove (e);
+                                       Populate (parent2, xmlNode.SelectNodes ("."));
+                                       continue;
+                               }
+                               e = xmlNode.Attributes["label"];
+                               if (e == null) {
+                                       Console.Error.WriteLine ("`label' attribute missing in <node>");
+                                       continue;
+                               }
+                               string label = e.InnerText;
+                               e = xmlNode.Attributes["name"];
+                               if (e == null) {
+                                       Console.Error.WriteLine ("`name' attribute missing in <node>");
+                                       continue;
+                               }
+                               string name = e.InnerText;
+                               Node orCreateNode = parent.GetOrCreateNode (label, "root:/" + name);
+                               orCreateNode.EnsureNodes ();
+                               this.nameToNode[name] = orCreateNode;
+                               XmlNodeList xmlNodeList = xmlNode.SelectNodes ("./node");
+                               if (xmlNodeList != null) {
+                                       this.Populate (orCreateNode, xmlNodeList);
+                               }
+                       }
+               }
+
+               public Node LookupEntryPoint (string name)
+               {
+                       Node result = null;
+                       if (!this.nameToNode.TryGetValue (name, out result)) {
+                               result = null;
+                       }
+                       return result;
+               }
+
+               public TOutput RenderUrl<TOutput> (string url, IDocGenerator<TOutput> generator, out Node node)
+               {
+                       node = null;
+                       string internalId = null;
+                       HelpSource hs = GetHelpSourceAndIdForUrl (url, out internalId, out node);
+                       return generator.Generate (hs, internalId);
+               }
+
+               public HelpSource GetHelpSourceAndIdForUrl (string url, out string internalId, out Node node)
+               {
+                       node = null;
+                       internalId = null;
+
+                       if (url.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+                               return this.GetHelpSourceAndIdFromName (url.Substring ("root:/".Length), out internalId, out node);
+
+                       HelpSource helpSource = null;
+                       foreach (var hs in helpSources.Where (h => h.CanHandleUrl (url))) {
+                               if (!string.IsNullOrEmpty (internalId = hs.GetInternalIdForUrl (url, out node))) {
+                                       helpSource = hs;
+                                       break;
+                               }
+                       }
+
+                       return helpSource;
+               }
+
+               public HelpSource GetHelpSourceAndIdFromName (string name, out string internalId, out Node node)
+               {
+                       internalId = "root:";
+                       node = this.LookupEntryPoint (name);
+
+                       return node == null ? null : node.Nodes.Select (n => n.Tree.HelpSource).Where (hs => hs != null).Distinct ().FirstOrDefault ();
+               }
+
+               public HelpSource GetHelpSourceFromId (int id)
+               {
+                       return  (id < 0 || id >= this.helpSources.Count) ? null : this.helpSources[id];
+               }
+
+               public Stream GetImage (string url)
+               {
+                       if (url.StartsWith ("source-id:", StringComparison.OrdinalIgnoreCase)) {
+                               string text = url.Substring (10);
+                               int num = text.IndexOf (":");
+                               string text2 = text.Substring (0, num);
+                               int id = 0;
+                               try {
+                                       id = int.Parse (text2);
+                               } catch {
+                                       Console.Error.WriteLine ("Failed to parse source-id url: {0} `{1}'", url, text2);
+                                       return null;
+                               }
+                               HelpSource helpSourceFromId = this.GetHelpSourceFromId (id);
+                               return helpSourceFromId.GetImage (text.Substring (num + 1));
+                       }
+                       Assembly assembly = Assembly.GetAssembly (typeof (RootTree));
+                       return assembly.GetManifestResourceStream (url);
+               }
+
+               public IndexReader GetIndex ()
+               {
+                       string text = Path.Combine (this.basedir, "monodoc.index");
+                       if (File.Exists (text))
+                       {
+                               return IndexReader.Load (text);
+                       }
+                       text = Path.Combine (ConfigurationManager.AppSettings["monodocIndexDirectory"], "monodoc.index");
+                       return IndexReader.Load (text);
+               }
+
+               public static void MakeIndex ()
+               {
+                       RootTree rootTree = RootTree.LoadTree ();
+                       rootTree.GenerateIndex ();
+               }
+
+               public void GenerateIndex ()
+               {
+                       IndexMaker indexMaker = new IndexMaker ();
+                       foreach (HelpSource current in this.helpSources)
+                               current.PopulateIndex (indexMaker);
+                       string text = Path.Combine (this.basedir, "monodoc.index");
+                       try {
+                               indexMaker.Save (text);
+                       } catch (UnauthorizedAccessException) {
+                               text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "monodoc.index");
+                               try {
+                                       indexMaker.Save (text);
+                               } catch (UnauthorizedAccessException) {
+                                       Console.WriteLine ("Unable to write index file in {0}", Path.Combine (ConfigurationManager.AppSettings["docDir"], "monodoc.index"));
+                                       return;
+                               }
+                       }
+                       if (RootTree.IsUnix)
+                               RootTree.chmod (text, 420);
+
+                       Console.WriteLine ("Documentation index at {0} updated", text);
+               }
+
+               public SearchableIndex GetSearchIndex ()
+               {
+                       string text = Path.Combine (this.basedir, "search_index");
+                       if (System.IO.Directory.Exists (text)) {
+                               return SearchableIndex.Load (text);
+                       }
+                       text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "search_index");
+                       return SearchableIndex.Load (text);
+               }
+
+               public static void MakeSearchIndex ()
+               {
+                       RootTree rootTree = RootTree.LoadTree ();
+                       rootTree.GenerateSearchIndex ();
+               }
+
+               public void GenerateSearchIndex ()
+               {
+                       Console.WriteLine ("Loading the monodoc tree...");
+                       string text = Path.Combine (this.basedir, "search_index");
+                       IndexWriter indexWriter;
+                       var analyzer = new StandardAnalyzer (Lucene.Net.Util.Version.LUCENE_CURRENT);
+                       var directory = Lucene.Net.Store.FSDirectory.Open (text);
+
+                       try {
+                               if (!Directory.Exists (text))
+                                       Directory.CreateDirectory (text);
+                               indexWriter = new IndexWriter (directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+                       } catch (UnauthorizedAccessException) {
+                               try {
+                                       text = Path.Combine (ConfigurationManager.AppSettings["docDir"], "search_index");
+                                       if (!Directory.Exists (text))
+                                               Directory.CreateDirectory (text);
+                                       indexWriter = new IndexWriter (directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+                               } catch (UnauthorizedAccessException) {
+                                       Console.WriteLine ("You don't have permissions to write on " + text);
+                                       return;
+                               }
+                       }
+                       Console.WriteLine ("Collecting and adding documents...");
+                       foreach (HelpSource current in this.helpSources) {
+                               current.PopulateSearchableIndex (indexWriter);
+                       }
+                       Console.WriteLine ("Closing...");
+                       indexWriter.Optimize ();
+                       indexWriter.Close ();
+               }
+
+               [DllImport ("libc")]
+               static extern int chmod (string filename, int mode);
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/SearchableDocument.cs b/mcs/tools/monkeydoc/Monkeydoc/SearchableDocument.cs
new file mode 100644 (file)
index 0000000..6c2bacc
--- /dev/null
@@ -0,0 +1,43 @@
+//
+//
+// SearchableDocument.cs: Abstracts our model of document from the Lucene Document 
+//
+// Author: Mario Sopena
+//
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc
+{
+       struct SearchableDocument
+       {
+               public string title;
+               public string url;
+               public string fulltitle;
+               public string hottext;
+               public string text;
+               public string examples;
+
+               public Document LuceneDoc {
+                       get {
+                               Document doc = new Document ();
+                               doc.Add (UnIndexed ("title", title));
+                               doc.Add (UnIndexed ("url", url));
+                               doc.Add (UnIndexed ("fulltitle", fulltitle ?? string.Empty));
+                               doc.Add (UnStored ("hottext", hottext));
+                               doc.Add (UnStored ("text", text));
+                               doc.Add (UnStored ("examples", examples));
+                               return doc;
+                       }
+               }
+
+               static Field UnIndexed(System.String name, System.String value_Renamed)
+               {
+                       return new Field(name, value_Renamed, Field.Store.YES, Field.Index.NO);
+               }
+
+               static Field UnStored(System.String name, System.String value_Renamed)
+               {
+                       return new Field(name, value_Renamed, Field.Store.NO, Field.Index.ANALYZED);
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/SearchableIndex.cs b/mcs/tools/monkeydoc/Monkeydoc/SearchableIndex.cs
new file mode 100644 (file)
index 0000000..6ad2a65
--- /dev/null
@@ -0,0 +1,190 @@
+//
+//
+// SearchableIndex.cs: Index that uses Lucene to search through the docs 
+//
+// Author: Mario Sopena
+//
+
+using System;
+using System.IO;
+using System.Collections;
+// Lucene imports
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+using Lucene.Net.Analysis;
+using Lucene.Net.Analysis.Standard;
+using Lucene.Net.Search;
+using Lucene.Net.QueryParsers;
+using Lucene.Net.Store;
+
+namespace MonkeyDoc
+{
+       public class SearchableIndex 
+       {
+               const int maxSearchCount = 30;
+
+               IndexSearcher searcher;
+               string dir;
+               public string Dir {
+                       get { 
+                               if (dir == null) dir = "search_index";
+                               return dir;
+                       }
+                       set { dir = value; }
+               }
+               public ArrayList Results;
+       
+               public static SearchableIndex Load (string dir) {
+                       SearchableIndex s = new SearchableIndex ();
+                       s.dir = dir;
+                       s.Results = new ArrayList (20);
+                       try {
+                               //s.searcher = new IndexSearcher (dir);
+                               // TODO: parametrize that depending if we run on the desktop (low footprint) or the server (use RAMDirectory for instance)
+                               s.searcher = new IndexSearcher (FSDirectory.Open (dir));
+                       } catch (IOException) {
+                               Console.WriteLine ("Index nonexistent or in bad format");
+                               return null;
+                       }
+                       return s;
+               }
+               
+               //
+               // Search the index with term
+               //
+
+               public Result Search (string term)
+               {
+                       return Search (term, maxSearchCount);
+               }
+
+               public Result Search (string term, int count)
+               {
+                       return Search (term, count, 0);
+               }
+
+               public Result Search (string term, int count, int start) {
+                       try {
+                               term = term.ToLower ();
+                               Term htTerm = new Term ("hottext", term);
+                               Query qq1 = new FuzzyQuery (htTerm);
+                               Query qq2 = new TermQuery (htTerm);
+                               qq2.Boost = 10f;
+                               Query qq3 = new PrefixQuery (htTerm);
+                               qq3.Boost = 10f;
+                               DisjunctionMaxQuery q1 = new DisjunctionMaxQuery (0f);
+                               q1.Add (qq1);
+                               q1.Add (qq2);
+                               q1.Add (qq3);
+                               Query q2 = new TermQuery (new Term ("text", term));
+                               q2.Boost = 3f;
+                               Query q3 = new TermQuery (new Term ("examples", term));
+                               q3.Boost = 3f;
+                               DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
+
+                               q.Add (q1);
+                               q.Add (q2);
+                               q.Add (q3);
+                       
+                               TopDocs top = SearchInternal (q, count, start);
+                               Result r = new Result (term, searcher, top.ScoreDocs);
+                               Results.Add (r);
+                               return r;
+                       } catch (IOException) {
+                               Console.WriteLine ("No index in {0}", dir);
+                               return null;
+                       }
+               }
+
+               TopDocs SearchInternal (Query q, int count, int start)
+               {
+                       // Easy path that doesn't involve creating a Collector ourselves
+                       // watch for Lucene.NET improvement on that (like searcher.SearchAfter)
+                       if (start == 0)
+                               return searcher.Search (q, count);
+
+                       var weight = searcher.CreateWeight (q); // TODO: reuse weight instead of query
+                       var collector = TopScoreDocCollector.Create (start + count + 1, false);
+                       searcher.Search (q, collector);
+
+                       return collector.TopDocs (start, count);
+               }
+
+               public Result FastSearch (string term, int number)
+               {
+                       try {
+                               term = term.ToLower ();
+                               Query q1 = new TermQuery (new Term ("hottext", term));
+                               Query q2 = new PrefixQuery (new Term ("hottext", term));
+                               q2.Boost = 0.5f;
+                               DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
+                               q.Add (q1);
+                               q.Add (q2);
+                               TopDocs top = searcher.Search (q, number);
+                               return new Result (term, searcher, top.ScoreDocs);
+                       } catch (IOException) {
+                               Console.WriteLine ("No index in {0}", dir);
+                               return null;
+                       }
+               }
+       
+               Query Parse (string term, string field, bool fuzzy)
+               {
+                       QueryParser parser = new QueryParser (Lucene.Net.Util.Version.LUCENE_CURRENT,
+                                                             field,
+                                                             new StandardAnalyzer (Lucene.Net.Util.Version.LUCENE_CURRENT));
+                       return parser.Parse (term);
+               }
+       }
+       //
+       // An object representing the search term with the results
+       // 
+       public class Result {
+               string term;
+               Searcher searcher;
+               ScoreDoc[] docs;
+
+               public string Term {
+                       get { return term;}
+               }
+
+               public int Count {
+                       get { return docs.Length; }
+               }
+
+               public Document this [int i] {
+                       get { return searcher.Doc (docs[i].Doc); }
+               }
+       
+               public string GetTitle (int i) 
+               {
+                       Document d = this[i];
+                       return d == null ? string.Empty : d.Get ("title");
+               }
+
+               public string GetUrl (int i)
+               {
+                       Document d = this[i];
+                       return d == null ? string.Empty : d.Get ("url");
+               }
+
+               public string GetFullTitle (int i)
+               {
+                       Document d = this[i];
+                       return d == null ? string.Empty : d.Get ("fulltitle");
+               }
+
+               public float Score (int i)
+               {
+                       return docs[i].Score;
+               }
+
+               public Result (string Term, Searcher searcher, ScoreDoc[] docs) 
+               {
+                       this.term = Term;
+                       this.searcher = searcher;
+                       this.docs = docs;
+               }
+       }
+}
+
diff --git a/mcs/tools/monkeydoc/Monkeydoc/Tree.cs b/mcs/tools/monkeydoc/Monkeydoc/Tree.cs
new file mode 100644 (file)
index 0000000..a9b3367
--- /dev/null
@@ -0,0 +1,164 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+       /// <summary>
+       ///    This tree is populated by the documentation providers, or populated
+       ///    from a binary encoding of the tree.  The format of the tree is designed
+       ///    to minimize the need to load it in full.
+       /// </summary>
+
+       /* Ideally this class should also be abstracted to let user have something
+        * else than a file as a backing store, a database for instance
+        */
+       public class Tree
+       {
+               public readonly HelpSource HelpSource;
+       
+               FileStream InputStream;
+               BinaryReader InputReader;
+
+               // This is the node which contains all the other node of the tree
+               Node rootNode;
+
+               /// <summary>
+               ///   Load from file constructor
+               /// </summary>
+               public Tree (HelpSource hs, string filename)
+               {
+                       Encoding utf8 = new UTF8Encoding (false, true);
+
+                       if (!File.Exists (filename)){
+                               throw new FileNotFoundException ();
+                       }
+               
+                       InputStream = File.OpenRead (filename);
+                       InputReader = new BinaryReader (InputStream, utf8);
+                       byte [] sig = InputReader.ReadBytes (4);
+               
+                       if (!GoodSig (sig))
+                               throw new Exception ("Invalid file format");
+               
+                       InputStream.Position = 4;
+                       var position = InputReader.ReadInt32 ();
+                       rootNode = new Node (this, position);
+                       InflateNode (rootNode);
+
+                       HelpSource = hs;
+               }
+
+               /// <summary>
+               ///    Tree creation and merged tree constructor
+               /// </summary>
+               public Tree (HelpSource hs, string caption, string url) : this (hs, null, caption, url)
+               {
+               }
+
+               public Tree (HelpSource hs, Node parent, string caption, string element)
+               {
+                       HelpSource = hs;
+                       rootNode = parent == null ? new Node (this, caption, element) : new Node (parent, caption, element);
+               }
+
+               /// <summary>
+               ///    Saves the tree into the specified file using the help file format.
+               /// </summary>
+               public void Save (string file)
+               {
+                       Encoding utf8 = new UTF8Encoding (false, true);
+                       using (FileStream output = File.OpenWrite (file)){
+                               // Skip over the pointer to the first node.
+                               output.Position = 8;
+                       
+                               using (BinaryWriter writer = new BinaryWriter (output, utf8)) {
+                                       // Recursively dump
+                                       rootNode.Serialize (output, writer);
+
+                                       output.Position = 0;
+                                       writer.Write (new byte [] { (byte) 'M', (byte) 'o', (byte) 'H', (byte) 'P' });
+                                       writer.Write (rootNode.Address);
+                               }
+                       }
+               }
+
+               public Node RootNode {
+                       get {
+                               return rootNode;
+                       }
+               }
+
+               static bool GoodSig (byte [] sig)
+               {
+                       if (sig.Length != 4)
+                               return false;
+                       return sig [0] == (byte) 'M'
+                               && sig [1] == (byte) 'o'
+                           && sig [2] == (byte) 'H'
+                               && sig [3] == (byte) 'P';
+               }
+
+               public void InflateNode (Node baseNode)
+               {
+                       var address = baseNode.Address;
+                       if (address < 0)
+                               address = -address;
+
+                       InputStream.Position = address;
+                       baseNode.Deserialize (InputReader);
+               }
+       }
+
+       public static class TreeDumper
+       {
+               static int indent;
+
+               static void Indent ()
+               {
+                       for (int i = 0; i < indent; i++)
+                               Console.Write ("   ");
+               }
+       
+               public static void PrintTree (Node node)
+               {
+                       Indent ();
+                       Console.WriteLine ("{0},{1}\t[PublicUrl: {2}]", node.Element, node.Caption, node.PublicUrl);
+                       if (node.Nodes.Count == 0)
+                               return;
+
+                       indent++;
+                       foreach (Node n in node.Nodes)
+                               PrintTree (n);
+                       indent--;
+               }
+
+               public static string ExportToTocXml (Node root, string title, string desc)
+               {
+                       if (root == null)
+                               throw new ArgumentNullException ("root");
+                       // Return a toc index of sub-nodes
+                       StringBuilder buf = new StringBuilder ();
+                       var writer = XmlWriter.Create (buf);
+                       writer.WriteStartElement ("toc");
+                       writer.WriteAttributeString ("title", title ?? string.Empty);
+                       writer.WriteElementString ("description", desc ?? string.Empty);
+                       writer.WriteStartElement ("list");
+                       foreach (Node n in root.Nodes) {
+                               writer.WriteStartElement ("item");
+                               writer.WriteAttributeString ("url", n.Element);
+                               writer.WriteValue (n.Caption);
+                               writer.WriteEndElement ();
+                       }
+                       writer.WriteEndElement ();
+                       writer.WriteEndElement ();
+                       writer.Flush ();
+                       writer.Close ();
+
+                       return buf.ToString ();
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/TypeUtils.cs b/mcs/tools/monkeydoc/Monkeydoc/TypeUtils.cs
new file mode 100644 (file)
index 0000000..2e75663
--- /dev/null
@@ -0,0 +1,40 @@
+using System;
+
+namespace MonkeyDoc
+{
+       public static class TypeUtils
+       {
+               public static bool GetNamespaceAndType (string url, out string ns, out string type)
+               {
+                       int nsidx = -1;
+                       int numLt = 0;
+                       for (int i = 0; i < url.Length; ++i) {
+                               char c = url [i];
+                               switch (c) {
+                               case '<':
+                               case '{':
+                                       ++numLt;
+                                       break;
+                               case '>':
+                               case '}':
+                                       --numLt;
+                                       break;
+                               case '.':
+                                       if (numLt == 0)
+                                               nsidx = i;
+                                       break;
+                               }
+                       }
+
+                       if (nsidx == -1) {
+                               ns = null;
+                               type = null;
+                               return false;
+                       }
+                       ns = url.Substring (0, nsidx);
+                       type = url.Substring (nsidx + 1);
+               
+                       return true;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/cache.cs b/mcs/tools/monkeydoc/Monkeydoc/cache.cs
new file mode 100644 (file)
index 0000000..2c089be
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+using System.IO;
+
+namespace MonkeyDoc
+{
+       public enum DocEntity
+       {
+               Text,
+               Blob
+       }
+
+       public interface IDocCache : IDisposable
+       {
+               bool IsCached (string id);
+               bool CanCache (DocEntity entity);
+
+               Stream GetCachedStream (string id);
+               string GetCachedString (string id);
+
+               void CacheText (string id, string content);
+               void CacheText (string id, Stream stream);
+
+               void CacheBlob (string id, byte[] data);
+               void CacheBlob (string id, Stream stream);
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/caches/FileCache.cs b/mcs/tools/monkeydoc/Monkeydoc/caches/FileCache.cs
new file mode 100644 (file)
index 0000000..333f33b
--- /dev/null
@@ -0,0 +1,75 @@
+using System;
+using System.IO;
+
+namespace MonkeyDoc.Caches
+{
+       public class FileCache : IDocCache
+       {
+               string baseCacheDir;
+
+               public FileCache (string baseCacheDir)
+               {
+                       this.baseCacheDir = baseCacheDir;
+                       if (!Directory.Exists (baseCacheDir))
+                               Directory.CreateDirectory (baseCacheDir);
+               }
+
+               public bool IsCached (string id)
+               {
+                       return File.Exists (MakePath (id));
+               }
+
+               public bool CanCache (DocEntity entity)
+               {
+                       return true;
+               }
+
+               public Stream GetCachedStream (string id)
+               {
+                       return File.OpenRead (MakePath (id));
+               }
+
+               public string GetCachedString (string id)
+               {
+                       return File.ReadAllText (MakePath (id));
+               }
+
+               public void CacheText (string id, string content)
+               {
+                       File.WriteAllText (MakePath (id), content);
+               }
+
+               public void CacheText (string id, Stream stream)
+               {
+                       using (var file = File.OpenWrite (MakePath (id)))
+                               stream.CopyTo (file);
+               }
+
+               public void CacheBlob (string id, byte[] data)
+               {
+                       File.WriteAllBytes (MakePath (id), data);
+               }
+
+               public void CacheBlob (string id, Stream stream)
+               {
+                       using (var file = File.OpenWrite (MakePath (id)))
+                               stream.CopyTo (file);
+               }
+
+               string MakePath (string id)
+               {
+                       id = id.Replace (Path.DirectorySeparatorChar, '_');
+                       return Path.Combine (baseCacheDir, id);
+               }
+
+               public void Dispose ()
+               {
+                       if (!Directory.Exists (baseCacheDir))
+                               return;
+
+                       try {
+                               Directory.Delete (baseCacheDir, true);
+                       } catch {}
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/caches/NullCache.cs b/mcs/tools/monkeydoc/Monkeydoc/caches/NullCache.cs
new file mode 100644 (file)
index 0000000..1514d66
--- /dev/null
@@ -0,0 +1,54 @@
+using System;
+using System.IO;
+
+namespace MonkeyDoc.Caches
+{
+       // This is basically a no-cache implementation
+       public class NullCache : IDocCache
+       {
+               public bool IsCached (string id)
+               {
+                       return false;
+               }
+
+               public bool CanCache (DocEntity entity)
+               {
+                       return false;
+               }
+
+               public Stream GetCachedStream (string id)
+               {
+                       return null;
+               }
+
+               public string GetCachedString (string id)
+               {
+                       return null;
+               }
+
+               public void CacheText (string id, string content)
+               {
+
+               }
+
+               public void CacheText (string id, Stream stream)
+               {
+
+               }
+
+               public void CacheBlob (string id, byte[] data)
+               {
+
+               }
+
+               public void CacheBlob (string id, Stream stream)
+               {
+
+               }
+
+               public void Dispose ()
+               {
+                       
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generator.cs b/mcs/tools/monkeydoc/Monkeydoc/generator.cs
new file mode 100644 (file)
index 0000000..f0949b9
--- /dev/null
@@ -0,0 +1,27 @@
+using System;
+
+namespace MonkeyDoc
+{
+       // All type of documents that a generator may find as input
+       public enum DocumentType {
+               EcmaXml, // Our main monodoc format
+               EcmaSpecXml,
+               Man,
+               AddinXml,
+               MonoBook, // This is mostly XHTML already, just need a tiny bit of processing
+               Html,
+               TocXml, // Used by help source displaying some kind of toc of the content they host
+               PlainText,
+               ErrorXml
+       }
+
+       /* This interface defines a set of transformation engine
+        * that convert multiple documentation source to a single output format
+        */
+       public interface IDocGenerator<TOutput>
+       {
+               // This method is responsible for finding out the documentation type
+               // for the given ID and use the right engine internally
+               TOutput Generate (HelpSource hs, string internalId);
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/HtmlGenerator.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/HtmlGenerator.cs
new file mode 100644 (file)
index 0000000..553a187
--- /dev/null
@@ -0,0 +1,131 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+
+namespace MonkeyDoc.Generators
+{
+       using Html;
+
+       interface IHtmlExporter
+       {
+               string CssCode { get; }
+               string Export (Stream input, Dictionary<string, string> extras);
+               string Export (string input, Dictionary<string, string> extras);
+       }
+
+       public class HtmlGenerator : IDocGenerator<string>
+       {
+               const string cachePrefix = "htmlcached#";
+
+               static string css_code;
+
+               IDocCache defaultCache;
+               static Dictionary<DocumentType, IHtmlExporter> converters;
+
+               static HtmlGenerator ()
+               {
+                       converters = new Dictionary<DocumentType, IHtmlExporter> {
+                               { DocumentType.EcmaXml, new Ecma2Html () },
+                               { DocumentType.Man, new Man2Html () },
+                               { DocumentType.TocXml, new Toc2Html () },
+                               { DocumentType.EcmaSpecXml, new Ecmaspec2Html () },
+                               { DocumentType.ErrorXml, new Error2Html () },
+                               { DocumentType.Html, new Idem () },
+                               { DocumentType.MonoBook, new MonoBook2Html () },
+                               { DocumentType.AddinXml, new Addin2Html () },
+                               { DocumentType.PlainText, new Idem () },
+                       };
+               }
+
+               public HtmlGenerator (IDocCache defaultCache)
+               {
+                       this.defaultCache = defaultCache;
+               }
+
+               public string Generate (HelpSource hs, string id)
+               {
+                       if (hs == null || string.IsNullOrEmpty (id))
+                               return MakeHtmlError ("Your request has found no candidate provider");
+                       var cache = defaultCache ?? hs.Cache;
+                       if (cache != null && cache.IsCached (MakeCacheKey (hs, id, null)))
+                               return cache.GetCachedString (MakeCacheKey (hs, id, null));
+
+                       IEnumerable<string> parts;
+                       if (hs.IsMultiPart (id, out parts))
+                               return GenerateMultiPart (hs, parts, id);
+
+                       if (hs.IsRawContent (id))
+                               return hs.GetText (id) ?? string.Empty;
+
+                       Dictionary<string, string> extraParams = null;
+                       DocumentType type = hs.GetDocumentTypeForId (id, out extraParams);
+                       if (cache != null && extraParams != null && cache.IsCached (MakeCacheKey (hs, id, extraParams)))
+                               return cache.GetCachedString (MakeCacheKey (hs, id, extraParams));
+
+                       IHtmlExporter exporter;
+                       if (!converters.TryGetValue (type, out exporter))
+                               return MakeHtmlError (string.Format ("Input type '{0}' not supported",
+                                                                    type.ToString ()));
+                       var result = hs.IsGeneratedContent (id) ? 
+                               exporter.Export (hs.GetCachedText (id), extraParams) :
+                               exporter.Export (hs.GetCachedHelpStream (id), extraParams);
+
+                       if (cache != null)
+                               cache.CacheText (MakeCacheKey (hs, id, extraParams), result);
+                       return result;
+               }
+
+               string GenerateMultiPart (HelpSource hs, IEnumerable<string> ids, string originalId)
+               {
+                       var sb = new StringBuilder ();
+                       foreach (var id in ids)
+                               sb.AppendLine (Generate (hs, id));
+
+                       var cache = defaultCache ?? hs.Cache;
+                       if (cache != null)
+                               cache.CacheText (MakeCacheKey (hs, originalId, null), sb.ToString ());
+                       return sb.ToString ();
+               }
+
+               public static string InlineCss {
+                       get {
+                               if (css_code != null)
+                                       return css_code;
+
+                               System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly (typeof (HtmlGenerator));
+                               Stream str_css = assembly.GetManifestResourceStream ("base.css");
+                               StringBuilder sb = new StringBuilder ((new StreamReader (str_css)).ReadToEnd());
+                               sb.Replace ("@@FONT_FAMILY@@", "Sans Serif");
+                               sb.Replace ("@@FONT_SIZE@@", "100%");
+                               css_code = sb.ToString () + converters.Values
+                                       .Select (c => c.CssCode)
+                                       .Where (css => !string.IsNullOrEmpty (css))
+                                       .DefaultIfEmpty (string.Empty)
+                                       .Aggregate (string.Concat);
+                               return css_code;
+                       }
+                       set { 
+                               css_code = value;
+                       }
+               }
+
+               string MakeHtmlError (string error)
+               {
+                       return string.Format ("<html><head></head><body><p>{0}</p></body></html>", error);
+               }
+
+               string MakeCacheKey (HelpSource hs, string page, IDictionary<string,string> extraParams)
+               {
+                       var key = cachePrefix + hs.SourceID + page;
+                       if (extraParams != null && extraParams.Count > 0) {
+                               var paramPart = string.Join ("-", extraParams.Select (kvp => kvp.Key + kvp.Value));
+                               key += '_' + paramPart;
+                       }
+                       return key;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Addin2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Addin2Html.cs
new file mode 100644 (file)
index 0000000..3d37482
--- /dev/null
@@ -0,0 +1,197 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Addin2Html : IHtmlExporter
+       {
+               public string CssCode {
+                       get {
+                               return string.Empty;
+                       }
+               }
+
+               public string Export (Stream stream, Dictionary<string, string> extraArgs)
+               {
+                       using (var reader = new StreamReader (stream))
+                               return Htmlize (GetAddin (reader, extraArgs["AddinID"]),
+                                               extraArgs["show"],
+                                               extraArgs["AddinID"],
+                                               extraArgs["FileID"],
+                                               extraArgs["NodeID"]);
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (GetAddin (new StringReader (input), extraArgs["AddinID"]),
+                                       extraArgs["show"],
+                                       extraArgs["AddinID"],
+                                       extraArgs["FileID"],
+                                       extraArgs["NodeID"]);
+               }
+
+               XmlElement GetAddin (TextReader reader, string addinId)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.Load (reader);
+                       XmlElement addin = (XmlElement) doc.SelectSingleNode ("Addins/Addin[@fullId='" + addinId + "']");
+                       return addin != null ? addin : null;
+               }
+
+               public string Htmlize (XmlElement addin, string urlType, string addinId, string fileId, string path)
+               {
+                       if (urlType == MonkeyDoc.Providers.AddinsHelpSource.AddinPrefix)
+                               return GetAddinTextFromUrl (addin, addinId, fileId);
+                       else if (urlType == MonkeyDoc.Providers.AddinsHelpSource.ExtensionPrefix)
+                               return GetExtensionTextFromUrl (addin, addinId, fileId, path);
+                       else if (urlType == MonkeyDoc.Providers.AddinsHelpSource.ExtensionNodePrefix)
+                               return GetExtensionNodeTextFromUrl (addin, addinId, fileId, path);
+
+                       return null;
+               }
+
+               protected string GetAddinTextFromUrl (XmlElement addin, string addinId, string fileId)
+               {
+                       if (addin == null)
+                               return "<html>Add-in not found: " + addinId + "</html>";
+                       
+                       StringBuilder sb = new StringBuilder ("<html>");
+                       sb.Append ("<h1>").Append (addin.GetAttribute ("name")).Append ("</h1>");
+                       XmlElement docs = (XmlElement) addin.SelectSingleNode ("Description");
+                       if (docs != null)
+                               sb.Append (docs.InnerText);
+
+                       sb.Append ("<p><table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+                       sb.AppendFormat ("<tr><td><b>Id</b></td><td>{0}</td></tr>", addin.GetAttribute ("addinId"));
+                       sb.AppendFormat ("<tr><td><b>Namespace</b></td><td>{0}</td></tr>", addin.GetAttribute ("namespace"));
+                       sb.AppendFormat ("<tr><td><b>Version</b></td><td>{0}</td></tr>", addin.GetAttribute ("version"));
+                       sb.Append ("</table></p>");
+                       sb.Append ("<p><b>Extension Points</b>:</p>");
+                       sb.Append ("<ul>");
+                       
+                       foreach (XmlElement ep in addin.SelectNodes ("ExtensionPoint")) {
+                               sb.AppendFormat ("<li><a href=\"extension-point:{0}#{1}#{2}\">{3}</li>", fileId, addinId, ep.GetAttribute ("path"), ep.GetAttribute ("name"));
+                       }
+                       sb.Append ("</ul>");
+                       
+                       sb.Append ("</html>");
+                       return sb.ToString ();
+               }
+               
+               protected string GetExtensionTextFromUrl (XmlElement addin, string addinId, string fileId, string path)
+               {
+                       if (addin == null)
+                               return "<html>Add-in not found: " + addinId + "</html>";
+                       
+                       XmlElement ext = (XmlElement) addin.SelectSingleNode ("ExtensionPoint[@path='" + path + "']");
+                       if (ext == null)
+                               return "<html>Extension point not found: " + path + "</html>";
+                       
+                       StringBuilder sb = new StringBuilder ("<html>");
+                       sb.Append ("<h1>").Append (ext.GetAttribute ("name")).Append ("</h1>");
+
+                       path = path.Replace ("/", " <b>/</b> ");
+                       sb.Append ("<p><b>Path</b>: ").Append (path).Append ("</p>");
+                       XmlElement desc = (XmlElement) ext.SelectSingleNode ("Description");
+                       if (desc != null)
+                               sb.Append (desc.InnerText);
+
+                       sb.Append ("<p><b>Extension Nodes</b>:</p>");
+                       sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+                       
+                       foreach (XmlElement en in ext.SelectNodes ("ExtensionNode")) {
+                               string nid = en.GetAttribute ("id");
+                               string nname = en.GetAttribute ("name"); 
+                               string sdesc = "";
+                               desc = (XmlElement) en.SelectSingleNode ("Description");
+                               if (desc != null)
+                                       sdesc = desc.InnerText;
+                               
+                               sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
+                       }
+                       sb.Append ("</table>");
+                       
+                       sb.Append ("</html>");
+                       return sb.ToString ();
+               }
+               
+               protected string GetExtensionNodeTextFromUrl (XmlElement addin, string addinId, string fileId, string nodeId)
+               {
+                       if (addin == null)
+                               return "<html>Add-in not found: " + addinId + "</html>";
+                       
+                       XmlElement node = (XmlElement) addin.SelectSingleNode ("ExtensionNodeType[@id='" + nodeId + "']");
+                       if (node == null)
+                               return "<html>Extension point not found: " + nodeId + "</html>";
+                       
+                       StringBuilder sb = new StringBuilder ("<html>");
+                       sb.Append ("<h1>").Append (node.GetAttribute ("name")).Append ("</h1>");
+                       XmlElement desc = (XmlElement) node.SelectSingleNode ("Description");
+                       if (desc != null)
+                               sb.Append (desc.InnerText);
+
+                       sb.Append ("<p><b>Attributes</b>:</p>");
+                       sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\"><tr>");
+                       sb.Append ("<td><b>Name</b></td>");
+                       sb.Append ("<td><b>Type</b></td>");
+                       sb.Append ("<td><b>Required</b></td>");
+                       sb.Append ("<td><b>Localizable</b></td>");
+                       sb.Append ("<td><b>Description</b></td>");
+                       sb.Append ("<tr>");
+                       sb.Append ("<td>id</td>");
+                       sb.Append ("<td>System.String</td>");
+                       sb.Append ("<td></td>");
+                       sb.Append ("<td></td>");
+                       sb.Append ("<td>Identifier of the node.</td>");
+                       sb.Append ("</tr>");
+                       
+                       foreach (XmlElement at in node.SelectNodes ("Attributes/Attribute")) {
+                               sb.Append ("<tr>");
+                               sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("name"));
+                               sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("type"));
+                               if (at.GetAttribute ("required") == "True")
+                                       sb.Append ("<td>Yes</td>");
+                               else
+                                       sb.Append ("<td></td>");
+                               if (at.GetAttribute ("localizable") == "True")
+                                       sb.Append ("<td>Yes</td>");
+                               else
+                                       sb.Append ("<td></td>");
+                               string sdesc = "";
+                               desc = (XmlElement) at.SelectSingleNode ("Description");
+                               if (desc != null)
+                                       sdesc = desc.InnerText;
+                               
+                               sb.AppendFormat ("<td>{0}</td>", sdesc);
+                               sb.Append ("</tr>");
+                       }
+                       sb.Append ("</table>");
+
+                       XmlNodeList children = node.SelectNodes ("ChildNodes/ExtensionNode");
+                       if (children.Count > 0) {
+                               sb.Append ("<p><b>Child Nodes</b>:</p>");
+                               sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
+                               
+                               foreach (XmlElement en in children) {
+                                       string nid = en.GetAttribute ("id");
+                                       string nname = en.GetAttribute ("name"); 
+                                       string sdesc = "";
+                                       desc = (XmlElement) en.SelectSingleNode ("Description");
+                                       if (desc != null)
+                                               sdesc = desc.InnerText;
+                                       
+                                       sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
+                               }
+                               sb.Append ("</table>");
+                       }
+                       
+                       sb.Append ("</html>");
+                       return sb.ToString ();
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecma2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecma2Html.cs
new file mode 100644 (file)
index 0000000..ed329e3
--- /dev/null
@@ -0,0 +1,307 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+using Mono.Documentation;
+using BF = System.Reflection.BindingFlags;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Ecma2Html : IHtmlExporter
+       {
+               static string css_ecma;
+               static string js;
+               static XslCompiledTransform ecma_transform;
+               readonly ExtensionObject ExtObject = new ExtensionObject ();
+
+               public Ecma2Html ()
+               {
+               }
+
+               public string CssCode {
+                       get {
+                               if (css_ecma != null)
+                                       return css_ecma;
+                               var assembly = typeof(Ecma2Html).Assembly;
+                               Stream str_css = assembly.GetManifestResourceStream ("mono-ecma.css");
+                               css_ecma = (new StreamReader (str_css)).ReadToEnd();
+                               return css_ecma;
+                       }
+               }
+
+               public string JsCode {
+                       get {
+                               if (js != null)
+                                       return js;
+                               var assembly = typeof(Ecma2Html).Assembly;
+                               Stream str_js = assembly.GetManifestResourceStream ("helper.js");
+                               js = (new StreamReader (str_js)).ReadToEnd();
+                               return js;
+                       }
+               }
+               
+               public string Htmlize (XmlReader ecma_xml, Dictionary<string, string> extraArgs)
+               {
+                       var args = new XsltArgumentList ();
+                       args.AddExtensionObject("monodoc:///extensions", ExtObject);
+                       foreach (var kvp in extraArgs)
+                               args.AddParam (kvp.Key, string.Empty, kvp.Value);
+
+                       return Htmlize(ecma_xml, args);
+               }
+
+               public string Htmlize (XmlReader ecma_xml, XsltArgumentList args)
+               {
+                       EnsureTransform ();
+               
+                       var output = new StringBuilder ();
+                       ecma_transform.Transform (ecma_xml, 
+                                                 args, 
+                                                 XmlWriter.Create (output, ecma_transform.OutputSettings),
+                                                 CreateDocumentResolver ());
+                       return output.ToString ();
+               }
+               
+               protected virtual XmlResolver CreateDocumentResolver ()
+               {
+                       // results in using XmlUrlResolver
+                       return null;
+               }
+
+               public string Export (Stream stream, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (XmlReader.Create (stream), extraArgs);
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (XmlReader.Create (new StringReader (input)), extraArgs);
+               }
+               
+               static void EnsureTransform ()
+               {
+                       if (ecma_transform == null) {
+                               ecma_transform = new XslCompiledTransform ();
+                               var assembly = System.Reflection.Assembly.GetCallingAssembly ();
+                       
+                               Stream stream = assembly.GetManifestResourceStream ("mono-ecma-css.xsl");
+                               XmlReader xml_reader = new XmlTextReader (stream);
+                               XmlResolver r = new ManifestResourceResolver (".");
+                               ecma_transform.Load (xml_reader, XsltSettings.TrustedXslt, r);                  
+                       }
+               }
+
+               public class ExtensionObject
+               {
+                       bool quiet = true;
+
+                       public string Colorize(string code, string lang)
+                       {
+                               return Mono.Utilities.Colorizer.Colorize(code,lang);
+                       }
+
+                       // Used by stylesheet to nicely reformat the <see cref=> tags. 
+                       public string MakeNiceSignature(string sig, string contexttype)
+                       {
+                               if (sig.Length < 3)
+                                       return sig;
+                               if (sig[1] != ':')
+                                       return sig;
+
+                               char s = sig[0];
+                               sig = sig.Substring(2);
+                       
+                               switch (s) {
+                               case 'N': return sig;
+                               case 'T': return ShortTypeName (sig, contexttype);
+
+                               case 'C': case 'M': case 'P': case 'F': case 'E':
+                                       string type, mem, arg;
+                                       
+                                       // Get arguments
+                                       int paren;
+                                       if (s == 'C' || s == 'M')
+                                               paren = sig.IndexOf("(");
+                                       else if (s == 'P')
+                                               paren = sig.IndexOf("[");
+                                       else
+                                               paren = 0;
+                                       
+                                       if (paren > 0 && paren < sig.Length-1) {
+                                               string[] args = sig.Substring(paren+1, sig.Length-paren-2).Split(',');                                          
+                                               for (int i = 0; i < args.Length; i++)
+                                                       args[i] = ShortTypeName(args[i], contexttype);
+                                               arg = "(" + String.Join(", ", args) + ")";
+                                               sig = sig.Substring(0, paren); 
+                                       } else {
+                                               arg = string.Empty;
+                                       }
+
+                                       // Get type and member names
+                                       int dot = sig.LastIndexOf(".");
+                                       if (s == 'C' || dot <= 0 || dot == sig.Length-1) {
+                                               mem = string.Empty;
+                                               type = sig;
+                                       } else {
+                                               type = sig.Substring(0, dot);
+                                               mem = sig.Substring(dot);
+                                       }
+                                               
+                                       type = ShortTypeName(type, contexttype);
+                                       
+                                       return type + mem + arg;
+
+                               default:
+                                       return sig;
+                               }
+                       }
+
+                       static string ShortTypeName(string name, string contexttype)
+                       {
+                               int dot = contexttype.LastIndexOf(".");
+                               if (dot < 0) return name;
+                               string contextns = contexttype.Substring(0, dot+1);
+
+                               if (name == contexttype)
+                                       return name.Substring(dot+1);
+                       
+                               if (name.StartsWith(contextns))
+                                       return name.Substring(contextns.Length);
+                       
+                               return name.Replace("+", ".");
+                       }
+
+                       string MonoImpInfo(string assemblyname, string typename, string membername, string arglist, bool strlong)
+                       {
+                               if (quiet)
+                                       return string.Empty;
+                               
+                               var a = new List<string> ();
+                               if (!string.IsNullOrEmpty (arglist)) a.Add (arglist);
+                               return MonoImpInfo(assemblyname, typename, membername, a, strlong);
+                       }
+
+                       string MonoImpInfo(string assemblyname, string typename, string membername, XPathNodeIterator itr, bool strlong)
+                       {
+                               if (quiet)
+                                       return string.Empty;
+                               
+                               var rgs = itr.Cast<XPathNavigator> ().Select (nav => nav.Value).ToList ();
+                       
+                               return MonoImpInfo (assemblyname, typename, membername, rgs, strlong);
+                       }
+               
+                       string MonoImpInfo(string assemblyname, string typename, string membername, List<string> arglist, bool strlong)
+                       {
+                               try {
+                                       System.Reflection.Assembly assembly = null;
+                               
+                                       try {
+                                               assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+                                       } catch (Exception) {
+                                               // nothing.
+                                       }
+                               
+                                       if (assembly == null) {
+                                               /*if (strlong) return "The assembly " + assemblyname + " is not available to MonoDoc.";
+                                                 else return string.Empty;*/
+                                               return string.Empty; // silently ignore
+                                       }
+
+                                       Type t = assembly.GetType(typename, false);
+                                       if (t == null) {
+                                               if (strlong)
+                                                       return typename + " has not been implemented.";
+                                               else
+                                                       return "Not implemented.";
+                                       }
+
+                                       // The following code is flakey and fails to find existing members
+                                       return string.Empty;
+                               } catch (Exception) {
+                                       return string.Empty;
+                               }
+                       }
+               
+                       string MonoImpInfo(System.Reflection.MemberInfo mi, string itemtype, bool strlong)
+                       {
+                               if (quiet)
+                                       return string.Empty;
+                               
+                               string s = string.Empty;
+
+                               object[] atts = mi.GetCustomAttributes(true);
+                               int todoctr = 0;
+                               foreach (object att in atts) if (att.GetType().Name == "MonoTODOAttribute") todoctr++;
+
+                               if (todoctr > 0) {
+                                       if (strlong)
+                                               s = "This " + itemtype + " is marked as being unfinished.<BR/>\n";
+                                       else 
+                                               s = "Unfinished.";
+                               }
+
+                               return s;
+                       }
+
+                       public string MonoImpInfo(string assemblyname, string typename, bool strlong)
+                       {
+                               if (quiet)
+                                       return string.Empty;
+                               
+                               try {
+                                       if (assemblyname == string.Empty)
+                                               return string.Empty;
+
+                                       var assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+                                       if (assembly == null)
+                                               return string.Empty;
+
+                                       Type t = assembly.GetType(typename, false);
+                                       if (t == null) {
+                                               if (strlong)
+                                                       return typename + " has not been implemented.";
+                                               else
+                                                       return "Not implemented.";
+                                       }
+
+                                       string s = MonoImpInfo(t, "type", strlong);
+
+                                       if (strlong) {
+                                               var mis = t.GetMembers (BF.Static | BF.Instance | BF.Public | BF.NonPublic);
+
+                                               // Scan members for MonoTODO attributes
+                                               int mctr = 0;
+                                               foreach (var mi in mis) {
+                                                       string mii = MonoImpInfo(mi, null, false);
+                                                       if (mii != string.Empty) mctr++; 
+                                               }
+                                               if (mctr > 0) {
+                                                       s += "This type has " + mctr + " members that are marked as unfinished.<BR/>";
+                                               }
+                                       }
+
+                                       return s;
+
+                               } catch (Exception) {
+                                       return string.Empty;
+                               }                       
+                       }
+
+                       public bool MonoEditing ()
+                       {
+                               return false;
+                       }
+               
+                       public bool IsToBeAdded(string text)
+                       {
+                               return text.StartsWith ("To be added");
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecmaspec2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Ecmaspec2Html.cs
new file mode 100644 (file)
index 0000000..95f4064
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Ecmaspec2Html : IHtmlExporter
+       {
+               static string css_ecmaspec;
+               static XslTransform ecma_transform;
+               static XsltArgumentList args = new XsltArgumentList();
+
+               public string CssCode {
+                       get {
+                               if (css_ecmaspec != null)
+                                       return css_ecmaspec;
+                               System.Reflection.Assembly assembly = System.Reflection.Assembly.GetCallingAssembly ();
+                               Stream str_css = assembly.GetManifestResourceStream ("ecmaspec.css");
+                               css_ecmaspec = (new StreamReader (str_css)).ReadToEnd ();
+                               return css_ecmaspec;
+                       }
+               }
+
+               class ExtObj
+               {
+                       public string Colorize (string code, string lang)
+                       {
+                               return Mono.Utilities.Colorizer.Colorize (code, lang);
+                       }
+               }
+
+               public string Export (Stream stream, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (new XPathDocument (stream));
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (new XPathDocument (new StringReader (input)));
+               }
+
+               static string Htmlize (XPathDocument ecma_xml)
+               {
+                       if (ecma_transform == null){
+                               ecma_transform = new XslTransform ();
+                               System.Reflection.Assembly assembly = System.Reflection.Assembly.GetCallingAssembly ();
+                               Stream stream;
+                               stream = assembly.GetManifestResourceStream ("ecmaspec-html-css.xsl");
+
+                               XmlReader xml_reader = new XmlTextReader (stream);
+                               ecma_transform.Load (xml_reader, null, null);
+                               args.AddExtensionObject ("monodoc:///extensions", new ExtObj ()); 
+                       }
+               
+                       if (ecma_xml == null) return "";
+
+                       StringWriter output = new StringWriter ();
+                       ecma_transform.Transform (ecma_xml, args, output, null);
+               
+                       return output.ToString ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Error2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Error2Html.cs
new file mode 100644 (file)
index 0000000..167d1f5
--- /dev/null
@@ -0,0 +1,110 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Xml.XPath;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Error2Html : IHtmlExporter
+       {
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (new XPathDocument (new StringReader (input)));
+               }
+
+               public string Export (Stream input, Dictionary<string, string> extraArgs)
+               {
+                       return Htmlize (new XPathDocument (input));
+               }
+
+               public string CssCode {
+                       get {
+                               return @"
+                                        #error_ref { 
+                                           background: #debcb0; 
+                                           border: 2px solid #782609; 
+                                        }
+                                        div.summary {
+                                                font-size: 110%;
+                                                font-weight: bolder;
+                                        }
+                                        div.details {
+                                                font-size: 110%;
+                                                font-weight: bolder;
+                                        }
+                                        div.code_example {
+                                               background: #f5f5dd;
+                                               border: 1px solid black;
+                                               padding-left: 1em;
+                                               padding-bottom: 1em;
+                                               margin-top: 1em;
+                                               white-space: pre;
+                                               margin-bottom: 1em;
+                                        }
+                                        div.code_ex_title {
+                                               position: relative;
+                                               top: -1em;
+                                               left: 30%;
+                                               background: #cdcd82;
+                                               border: 1px solid black;
+                                               color: black;
+                                               font-size: 65%;
+                                               text-transform: uppercase;
+                                               width: 40%;
+                                               padding: 0.3em;
+                                               text-align: center;
+                                        }";
+                       }
+               }
+
+               public string Htmlize (IXPathNavigable doc)
+               {
+                       var navigator = doc.CreateNavigator ();
+                       var errorName = navigator.SelectSingleNode ("//ErrorDocumentation/ErrorName");
+                       var details = navigator.SelectSingleNode ("//ErrorDocumentation/Details");
+
+                       StringWriter sw = new StringWriter ();
+                       XmlWriter w = new XmlTextWriter (sw);
+                       
+                       WriteElementWithClass (w, "div", "header");
+                       w.WriteAttributeString ("id", "error_ref");
+                       WriteElementWithClass (w, "div", "subtitle", "Compiler Error Reference");
+                       WriteElementWithClass (w, "div", "title", "Error " + (errorName == null ? string.Empty : errorName.Value));
+                       w.WriteEndElement ();
+
+                       if (details != null) {
+                               WriteElementWithClass (w, "div", "summary", "Summary");
+
+                               var summary = details.SelectSingleNode ("/Summary");
+                               w.WriteValue (summary == null ? string.Empty : summary.Value);
+                               
+                               WriteElementWithClass (w, "div", "details", "Details");
+                               var de = details.SelectSingleNode ("/Details");
+                               w.WriteValue (de == null ? string.Empty : de.Value);
+                       }
+                       
+                       foreach (XPathNavigator xmp in navigator.Select ("//ErrorDocumentation/Examples/string")) {
+                               WriteElementWithClass (w, "div", "code_example");
+                               WriteElementWithClass (w, "div", "code_ex_title", "Example");
+                               w.WriteRaw (Mono.Utilities.Colorizer.Colorize (xmp.Value, "c#"));;
+                               w.WriteEndElement ();
+                       }
+                       
+                       w.Close ();
+                       
+                       return sw.ToString ();
+               }
+
+               void WriteElementWithClass (XmlWriter w, string element, string cls, string content = null)
+               {
+                       w.WriteStartElement (element);
+                       w.WriteAttributeString ("class", cls);
+                       if (!string.IsNullOrEmpty (content)) {
+                               w.WriteValue (content);
+                               w.WriteEndElement ();
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Idem.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Idem.cs
new file mode 100644 (file)
index 0000000..0a58b21
--- /dev/null
@@ -0,0 +1,34 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+       // Input is expected to be already HTML so just return it
+       public class Idem : IHtmlExporter
+       {
+               public string CssCode {
+                       get {
+                               return string.Empty;
+                       }
+               }
+
+               public string Export (Stream input, Dictionary<string, string> extraArgs)
+               {
+                       if (input == null)
+                               return null;
+                       return new StreamReader (input).ReadToEnd ();
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       if (string.IsNullOrEmpty (input))
+                               return null;
+                       return input;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Man2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Man2Html.cs
new file mode 100644 (file)
index 0000000..68ed5ed
--- /dev/null
@@ -0,0 +1,316 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Man2Html : IHtmlExporter
+       {
+               public string CssCode {
+                       get {
+                               return string.Empty;
+                       }
+               }
+
+               public string Export (Stream input, Dictionary<string, string> extraArgs)
+               {
+                       if (input == null)
+                               return null;
+                       return GetTextFromReader (new StreamReader (input));
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       if (string.IsNullOrEmpty (input))
+                               return null;
+                       return GetTextFromReader (new StringReader (input));
+               }
+
+               public static string GetTextFromReader (TextReader file)
+               {
+                       string line;
+                       StateInfo s = new StateInfo ();
+
+                       while ((line = file.ReadLine ()) != null)
+                               ProcessLine (line, s);
+
+                       return s.output.ToString ();
+               }
+
+               enum ListState {
+                       None,
+                       Start,
+                       Title,
+               }
+
+               class StateInfo {
+                       public ListState ls;
+                       public Stack<string> tags = new Stack<string> ();
+                       public StringBuilder output = new StringBuilder ();
+               }
+
+               static void ProcessLine (string line, StateInfo s)
+               {
+                       string[] parts = SplitLine (line);
+                       switch (parts [0]) {
+                       case ".\\\"": // comments
+                       case ".de":   // define macro
+                       case ".if":   // if
+                       case ".ne":   // ???
+                       case "..":    // end macro
+                               // ignore
+                               break;
+                       case ".I":
+                               s.output.Append ("<i>");
+                               Translate (parts, 1, s.output);
+                               s.output.Append ("</i>");
+                               break;
+                       case ".B":
+                               s.output.Append ("<b>");
+                               Translate (parts, 1, s.output);
+                               s.output.Append ("</b>");
+                               break;
+                       case ".br":
+                               Translate (parts, 1, s.output);
+                               s.output.Append ("<br />");
+                               break;
+                       case ".nf":
+                               Expect (s, "</p>");
+                               s.output.Append ("<pre>\n");
+                               s.tags.Push ("</pre>");
+                               break;
+                       case ".fi":
+                               Expect (s, "</pre>");
+                               break;
+                       case ".PP":
+                               Expect (s, "</p>", "</dd>", "</dl>");
+                               goto case ".Sp";
+                       case ".Sp":
+                               Expect (s, "</p>");
+                               s.output.Append ("<p>");
+                               Translate (parts, 1, s.output);
+                               s.tags.Push ("</p>");
+                               break;
+                       case ".RS":
+                               Expect (s, "</p>");
+                               s.output.Append ("<blockquote>");
+                               s.tags.Push ("</blockquote>");
+                               break;
+                       case ".RE":
+                               ClearUntil (s, "</blockquote>");
+                               break;
+                       case ".SH":
+                               ClearAll (s);
+                               s.output.Append ("<h2>");
+                               Translate (parts, 1, s.output);
+                               s.output.Append ("</h2>")
+                                       .Append ("<blockquote>");
+                               s.tags.Push ("</blockquote>");
+                               break;
+                       case ".SS":
+                               s.output.Append ("<h3>");
+                               Translate (parts, 1, s.output);
+                               s.output.Append ("</h3>");
+                               break;
+                       case ".TH": {
+                               ClearAll (s);
+                               string name = "", extra = "";
+                               if (parts.Length >= 4 && parts [2].Trim ().Length == 0) {
+                                       name = parts [1] + "(" + parts [3] + ")";
+                                       if (parts.Length > 4) {
+                                               int start = 4;
+                                               if (parts [start].Trim ().Length == 0)
+                                                       ++start;
+                                               extra = string.Join ("", parts, start, parts.Length-start);
+                                       }
+                               }
+                               else
+                                       name = string.Join ("", parts, 1, parts.Length-1);
+                               s.output.Append ("<table width=\"100%\" bgcolor=\"#b0c4da\">" + 
+                                                "<tr colspan=\"2\"><td>Manual Pages</td></tr>\n" +
+                                                "<tr><td><h3>");
+                               Translate (name, s.output);
+                               s.output.Append ("</h3></td><td align=\"right\">");
+                               Translate (extra, s.output);
+                               s.output.Append ("</td></tr></table>");
+                               break;
+                       }
+                       case ".TP":
+                               Expect (s, "</p>");
+                               if (s.tags.Count > 0 && s.tags.Peek ().ToString () != "</dd>") {
+                                       s.output.Append ("<dl>");
+                                       s.tags.Push ("</dl>");
+                               }
+                               else
+                                       Expect (s, "</dd>");
+                               s.output.Append ("<dt>");
+                               s.tags.Push ("</dt>");
+                               s.ls = ListState.Start;
+                               break;
+                       default:
+                               Translate (line, s.output);
+                               break;
+                       }
+                       if (s.ls == ListState.Start)
+                               s.ls = ListState.Title;
+                       else if (s.ls == ListState.Title) {
+                               Expect (s, "</dt>");
+                               s.output.Append ("<dd>");
+                               s.tags.Push ("</dd>");
+                               s.ls = ListState.None;
+                       }
+                       s.output.Append ("\n");
+               }
+
+               static string[] SplitLine (string line)
+               {
+                       if (line.Length > 1 && line [0] != '.')
+                               return new string[]{null, line};
+
+                       int i;
+                       for (i = 0; i < line.Length; ++i) {
+                               if (char.IsWhiteSpace (line, i))
+                                       break;
+                       }
+
+                       if (i == line.Length)
+                               return new string[]{line};
+
+                       var pieces = new List<string> ();
+                       pieces.Add (line.Substring (0, i));
+                       bool inQuotes = false;
+                       bool prevWs   = true;
+                       ++i;
+                       int start = i;
+                       for ( ; i < line.Length; ++i) {
+                               char c = line [i];
+                               if (inQuotes) {
+                                       if (c == '"') {
+                                               Add (pieces, line, start, i);
+                                               start = i+1;
+                                               inQuotes = false;
+                                       }
+                               }
+                               else {
+                                       if (prevWs && c == '"') {
+                                               Add (pieces, line, start, i);
+                                               start = i+1;
+                                               inQuotes = true;
+                                       }
+                                       else if (char.IsWhiteSpace (c)) {
+                                               if (!prevWs) {
+                                                       Add (pieces, line, start, i);
+                                                       start = i;
+                                               }
+                                               prevWs = true;
+                                       }
+                                       else {
+                                               if (prevWs) {
+                                                       Add (pieces, line, start, i);
+                                                       start = i;
+                                               }
+                                               prevWs = false;
+                                       }
+                               }
+                       }
+                       if (start > 0 && start != line.Length)
+                               pieces.Add (line.Substring (start, line.Length-start));
+                       return pieces.ToArray ();
+               }
+
+               static void Add (List<string> pieces, string line, int start, int end)
+               {
+                       if (start == end)
+                               return;
+                       pieces.Add (line.Substring (start, end-start));
+               }
+
+               static void Expect (StateInfo s, params string[] expected)
+               {
+                       string e;
+                       while (s.tags.Count > 0 && 
+                              Array.IndexOf (expected, (e = s.tags.Peek ().ToString ())) >= 0) {
+                               s.output.Append (s.tags.Pop ().ToString ());
+                       }
+               }
+
+               static void ClearUntil (StateInfo s, string required)
+               {
+                       string e;
+                       while (s.tags.Count > 0 && 
+                              (e = s.tags.Peek ().ToString ()) != required) {
+                               s.output.Append (s.tags.Pop ().ToString ());
+                       }
+                       if (e == required)
+                               s.output.Append (s.tags.Pop ().ToString ());
+               }
+
+               static void ClearAll (StateInfo s)
+               {
+                       while (s.tags.Count > 0)
+                               s.output.Append (s.tags.Pop ().ToString ());
+               }
+
+               static void Translate (string[] lines, int startIndex, StringBuilder output)
+               {
+                       if (lines.Length <= startIndex)
+                               return;
+                       do {
+                               Translate (lines [startIndex++], output);
+                               if (startIndex == lines.Length)
+                                       break;
+                       } while (startIndex < lines.Length);
+               }
+
+               static void Translate (string line, StringBuilder output)
+               {
+                       string span = null;
+                       int start = output.Length;
+                       for (int i = 0; i < line.Length; ++i) {
+                               switch (line [i]) {
+                               case '\\': {
+                                       if ((i+2) < line.Length && line [i+1] == 'f') {
+                                               if (line [i+2] == 'I') {
+                                                       output.Append ("<i>");
+                                                       span = "</i>";
+                                               }
+                                               else if (line [i+2] == 'B') {
+                                                       output.Append ("<b>");
+                                                       span = "</b>";
+                                               }
+                                               else if (line [i+2] == 'R' || line [i+2] == 'P') {
+                                                       output.Append (span);
+                                               }
+                                               else
+                                                       goto default;
+                                               i += 2;
+                                       }
+                                       else if ((i+1) < line.Length) {
+                                               output.Append (line [i+1]);
+                                               ++i;
+                                       }
+                                       else
+                                               goto default;
+                                       break;
+                               }
+                               case '<':
+                                       output.Append ("&lt;");
+                                       break;
+                               case '>':
+                                       output.Append ("&gt;");
+                                       break;
+                               case '&':
+                                       output.Append ("&amp;");
+                                       break;
+                               default:
+                                       output.Append (line [i]);
+                                       break;
+                               }
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/MonoBook2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/MonoBook2Html.cs
new file mode 100644 (file)
index 0000000..89a531c
--- /dev/null
@@ -0,0 +1,87 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Collections.Generic;
+
+using MonkeyDoc;
+using MonkeyDoc.Generators;
+
+namespace MonkeyDoc.Generators.Html
+{
+       // Input is expected to be already HTML so just return it
+       public class MonoBook2Html : IHtmlExporter
+       {
+               public string CssCode {
+                       get {
+                               return @"   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid !important;
+     padding: 0 0 5pt 5pt !important;
+     margin: 10pt !important;
+     white-space: pre !important;
+       font-family: monospace !important;
+     font-weight: normal !important;
+     font-size: 1em !important;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+";
+                       }
+               }
+
+               public string Export (Stream input, Dictionary<string, string> extraArgs)
+               {
+                       if (input == null)
+                               return null;
+                       return FromXmlReader (XmlReader.Create (input));
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       if (string.IsNullOrEmpty (input))
+                               return null;
+                       return FromXmlReader (XmlReader.Create (new StringReader (input)));
+               }
+
+               public string FromXmlReader (XmlReader reader)
+               {
+                       if (!reader.ReadToDescendant ("head"))
+                               return null;
+                       if (!reader.ReadToNextSibling ("body"))
+                               return null;
+
+                       return reader.ReadInnerXml ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/generators/html/Toc2Html.cs b/mcs/tools/monkeydoc/Monkeydoc/generators/html/Toc2Html.cs
new file mode 100644 (file)
index 0000000..eef17c2
--- /dev/null
@@ -0,0 +1,44 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Generators.Html
+{
+       public class Toc2Html : IHtmlExporter
+       {
+               XslTransform transform;
+
+               public Toc2Html ()
+               {
+                       transform = new XslTransform ();
+                       var assembly = Assembly.GetCallingAssembly ();
+                       var stream = assembly.GetManifestResourceStream ("toc-html.xsl");
+                       XmlReader xml_reader = new XmlTextReader (stream);
+                       transform.Load (xml_reader, null, null);
+               }
+
+               public string Export (Stream input, Dictionary<string, string> extraArgs)
+               {
+                       var output = new StringWriter ();
+                       transform.Transform (new XPathDocument (input), null, output, null);
+                       return output.ToString ();
+               }
+
+               public string Export (string input, Dictionary<string, string> extraArgs)
+               {
+                       var output = new StringWriter ();
+                       transform.Transform (new XPathDocument (new StringReader (input)), null, output, null);
+                       return output.ToString ();
+               }
+
+               public string CssCode {
+                       get {
+                               return string.Empty;
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/index.cs b/mcs/tools/monkeydoc/Monkeydoc/index.cs
new file mode 100644 (file)
index 0000000..62e4e31
--- /dev/null
@@ -0,0 +1,360 @@
+//
+// index.cs: Handling of the index files
+//
+// Author:
+//   Miguel de Icaza (miguel@xamarin.com)
+//
+// (C) 2003 Ximian, Inc.
+// Copyright 2003-2011 Novell Inc
+// Copyright 2011 Xamarin Inc.
+//
+// Possible file format optimizations:
+//   * Do not use 4 bytes for each index entry, use 3 bytes
+//   * Find a way of compressing strings, there are plenty of duplicates
+//     Find common roots, and use an encoding that uses a root to compress data.
+//     "System", "System.Data", "System.Data class"
+//     0: PLAIN: "System"
+//     1: PLAIN: " class"
+//     2: LINK0 PLAIN ".DATA"
+//     3: LINK0 LINK1
+//     
+//     Maybe split everything at spaces and dots, and encode that:
+//     string-1-idx "System."
+//     string-1-idx "Data"
+//     2-items [ string-1-idx string-2-idx]
+//
+//     Other variations are possible;  Like Archive "System", "System." when we
+//     see "System.Data".
+//
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+
+namespace MonkeyDoc
+{
+
+       public class Topic  {
+               public readonly string Caption;
+               public readonly string SortKey;
+               public readonly string Url;
+
+               public Topic (string caption, string sort_key, string url)
+               {
+                       Caption = caption;
+                       SortKey = sort_key;
+                       Url = url;
+               }
+       }
+
+       public class IndexEntry {
+               public int Position;
+               public object topics;
+               public int Count;
+               
+               public void Add (Topic t)
+               {
+                       Count++;
+                       if (topics == null)
+                               topics = t;
+                       else {
+                               if (!(topics is ArrayList)){
+                                       Topic temp = (Topic) topics;
+
+                                       topics = new ArrayList ();
+                                       ((ArrayList)topics).Add (temp);
+                               }
+                               ((ArrayList)topics).Add (t);
+                       }
+               }
+
+               public Topic this [int idx] {
+                       get {
+                               if (topics is Topic){
+                                       if (idx == 0)
+                                               return (Topic) topics;
+                                       else
+                                               throw new Exception ("Out of range index");
+                               } else {
+                                       return (Topic) (((ArrayList)topics) [idx]);
+                               }
+                       }
+               }
+
+               //
+               // Constructor from a stream
+               //
+               public IndexEntry (FileStream fs, BinaryReader reader, int position)
+               {
+                       Count = reader.ReadInt32 ();
+                       int caption_offset = reader.ReadInt32 ();
+                       string caption;
+               
+                       if (Count == 1){
+                               int url_offset = reader.ReadInt32 ();
+                               fs.Position = caption_offset;
+                               caption = reader.ReadString ();
+                               fs.Position = url_offset;
+                               string url = reader.ReadString ();
+                               topics = new Topic (caption, "", url);
+                       } else {
+                               ArrayList l = new ArrayList (Count);
+                               topics = l;
+                               int [] offsets = new int [Count];
+                               for (int i = 0; i < Count; i++){
+                                       offsets [i] = reader.ReadInt32 ();
+                               }
+                               fs.Position = caption_offset;
+                               caption = reader.ReadString ();
+                               for (int i = 0; i < Count; i++){
+                                       fs.Position = offsets [i];
+                                       string url = reader.ReadString ();
+                                       l.Add (new Topic (caption, "", url));
+                               }
+                       }
+               }
+
+               //      Topic ReadTopic (FileStream fs, BinaryReader reader, ref string caption)
+               //      {
+               //              int caption_offset = -1;
+               //              if (caption == null)
+               //                      caption_offset = reader.ReadInt32 ();
+               //              int url_offset = reader.ReadInt32 ();
+               //
+               //              if (caption == null){
+               //                      fs.Position = caption_offset;
+               //                      caption = reader.ReadString ();
+               //              }
+               //              fs.Position = url_offset;
+               //              string url = reader.ReadString ();
+               //
+               //              return new Topic (caption, "", url);
+               //      }
+       
+               //
+               // Regular constructor
+       
+               public IndexEntry ()
+               {
+               }
+
+               public void WriteTopics (IndexMaker maker, Stream stream, BinaryWriter writer)
+               {
+                       //
+                       // Convention: entries with the same SortKey should have the same Caption
+                       //
+                       Position = (int) stream.Position;
+                       writer.Write (Count);
+
+                       if (topics is ArrayList){
+                               bool first = true;
+                               foreach (Topic t in (ArrayList) topics){
+                                       if (first){
+                                               writer.Write (maker.GetCode (t.Caption));
+                                               first = false;
+                                       }
+                                       writer.Write (maker.GetCode (t.Url));
+                               }
+                       } else {
+                               Topic t = (Topic) topics;
+
+                               writer.Write (maker.GetCode (t.Caption));
+                               writer.Write (maker.GetCode (t.Url));
+                       }
+               }
+       }
+
+       public class IndexMaker {
+               Hashtable entries = new Hashtable ();
+               Hashtable all_strings = new Hashtable ();
+
+               void add_string (string s)
+               {
+                       if (all_strings.Contains (s))
+                               return;
+                       all_strings [s] = 0;
+               }
+       
+               public void AddTopic (Topic topic)
+               {
+                       IndexEntry entry = (IndexEntry) entries [topic.SortKey];
+                       if (entry == null){
+                               entry = new IndexEntry ();
+                               entries [topic.SortKey] = entry;
+                       }
+
+                       add_string (topic.SortKey);
+                       add_string (topic.Caption);
+                       add_string (topic.Url);
+                       entry.Add (topic);
+               }
+
+               public void Add (string caption, string sort_key, string url)
+               {
+                       Topic t = new Topic (caption, sort_key, url);
+                       AddTopic (t);
+               }
+       
+               void SaveStringTable (Stream stream, BinaryWriter writer)
+               {
+                       ICollection k = all_strings.Keys;
+                       string [] ks = new string [k.Count];
+                       k.CopyTo (ks, 0);
+               
+                       foreach (string s in ks){
+                               int pos = (int) stream.Position;
+                               writer.Write (s);
+                               all_strings [s] = pos;
+                       }
+               }
+
+               public int GetCode (string s)
+               {
+                       return (int) all_strings [s];
+               }
+
+               int index_position;
+       
+               void SaveTopics (Stream stream, BinaryWriter writer)
+               {
+                       //
+                       // Convention: entries with the same SortKey should have the same Caption
+                       //
+                       foreach (IndexEntry e in entries.Values)
+                               e.WriteTopics (this, stream, writer);
+               }
+
+               void SaveIndexEntries (Stream stream, BinaryWriter writer)
+               {
+                       index_position = (int) stream.Position;
+                       writer.Write (entries.Count);
+                       ICollection keys = entries.Keys;
+                       string [] keys_name = new string [keys.Count];
+                       keys.CopyTo (keys_name, 0);
+                       Array.Sort (keys_name, new NameSort ());
+               
+                       foreach (string s in keys_name){
+                               IndexEntry e = (IndexEntry) entries [s];
+                               writer.Write (e.Position);
+                       }
+               }
+
+               class NameSort : IComparer {
+                       public int Compare (object a, object b)
+                       {
+                               string sa = (string) a;
+                               string sb = (string) b;
+
+                               return String.Compare (sa, sb, StringComparison.OrdinalIgnoreCase);
+                       }
+               }
+       
+               public void Save (string filename)
+               {
+                       Encoding utf8 = new UTF8Encoding (false, true);
+
+                       using (FileStream fs = File.OpenWrite (filename)){
+                               BinaryWriter writer = 
+                                       new BinaryWriter (fs, utf8);
+                               writer.Write (new byte [] { (byte) 'M', 
+                                                           (byte) 'o', (byte) 'i', 
+                                                           (byte) 'x'});
+
+                               // Leave room for pointer
+                               fs.Position = 8;
+
+                               SaveStringTable (fs, writer);
+                               SaveTopics (fs, writer);
+
+                               // index_position is set here
+                       
+                               SaveIndexEntries (fs, writer);
+
+                               fs.Position = 4;
+                               writer.Write (index_position);
+                       }
+               }
+       }
+
+       public interface IListModel {
+               int Rows {get; }
+               string GetValue (int row);
+               string GetDescription (int row);
+       }
+
+       public class IndexReader : IListModel {
+               Encoding utf8 = new UTF8Encoding (false, true);
+               FileStream fs;
+               BinaryReader reader;
+
+               // The offset of the table of entries
+               int table_offset;
+               int entries;
+
+               static public IndexReader Load (string filename)
+               {
+                       if (!File.Exists (filename))
+                               return null;
+
+                       try {
+                               return new IndexReader (filename);
+                       } catch {
+                               return null;
+                       }
+               }
+       
+               IndexReader (string filename)
+               {
+                       fs = File.OpenRead (filename);
+                       reader = new BinaryReader (fs, utf8);
+
+                       if (fs.ReadByte () != 'M' ||
+                           fs.ReadByte () != 'o' ||
+                           fs.ReadByte () != 'i' ||
+                           fs.ReadByte () != 'x'){
+                               throw new Exception ("Corrupt index");
+                       }
+
+                       // Seek to index_entries
+                       fs.Position = reader.ReadInt32 ();
+               
+                       entries = reader.ReadInt32 ();
+
+                       table_offset = (int) fs.Position;
+               }
+
+               public int Rows {
+                       get {
+                               return entries;
+                       }
+               }
+
+               public string GetValue (int row)
+               {
+                       fs.Position = row * 4 + table_offset;
+                       fs.Position = reader.ReadInt32 () + 4;
+                       int code = reader.ReadInt32 ();
+                       fs.Position = code;
+                       string caption = reader.ReadString ();
+
+                       return caption;
+               }
+
+               public string GetDescription (int row)
+               {
+                       return GetValue (row);
+               }
+       
+               public IndexEntry GetIndexEntry (int row)
+               {
+                       fs.Position = row * 4 + table_offset;
+                       int entry_offset = reader.ReadInt32 ();
+                       fs.Position = entry_offset;
+               
+                       return new IndexEntry (fs, reader, entry_offset);
+               }
+       }
+}
+
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/addins-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/addins-provider.cs
new file mode 100644 (file)
index 0000000..3768717
--- /dev/null
@@ -0,0 +1,136 @@
+// addins-provider.cs
+//
+// A provider to display Mono.Addins extension models
+//
+// Author:
+//   Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Linq;
+using System.Diagnostics;
+using System.Text;
+using System.IO;
+using System.Xml;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Providers
+{
+       public class AddinsProvider : Provider
+       {
+               string file;
+               
+               public AddinsProvider (string xmlModelFile)
+               {
+                       file = xmlModelFile;
+                       
+                       if (!File.Exists (file))
+                               throw new FileNotFoundException (String.Format ("The file `{0}' does not exist", file));
+               }
+
+               public override void PopulateTree (Tree tree)
+               {
+                       string fileId = Path.GetFileNameWithoutExtension (file);
+                       using (var f = File.OpenRead (file))
+                               tree.HelpSource.Storage.Store (fileId, f);
+
+                       XmlDocument doc = new XmlDocument ();
+                       doc.Load (file);
+                       
+                       foreach (XmlElement addin in doc.SelectNodes ("Addins/Addin")) {
+
+                               string addinId = addin.GetAttribute ("fullId");
+                               Node newNode = tree.RootNode.CreateNode (addin.GetAttribute ("name"), "addin:" + fileId + "#" + addinId);
+
+                               foreach (XmlElement node in addin.SelectNodes ("ExtensionPoint")) {
+                                       string target = "extension-point:" + fileId + "#" + addinId + "#" + node.GetAttribute ("path");
+                                       Node newExt = newNode.CreateNode (node.GetAttribute ("name"), target);
+                       
+                                       foreach (XmlElement en in node.SelectNodes ("ExtensionNode")) {
+                                               string nid = en.GetAttribute ("id");
+                                               string nname = en.GetAttribute ("name");
+                                               newExt.CreateNode (nname, "extension-node:" + fileId + "#" + addinId + "#" + nid);
+                                       }
+                               }
+                       }
+               }
+
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+               }
+       }
+
+       public class AddinsHelpSource : HelpSource
+       {
+               public AddinsHelpSource (string base_file, bool create) : base (base_file, create) 
+               {
+               }
+               
+               internal protected const string AddinPrefix = "addin:";
+               internal protected const string ExtensionPrefix = "extension-point:";
+               internal protected const string ExtensionNodePrefix = "extension-node:";
+
+               public override bool CanHandleUrl (string url)
+               {
+                       return url.StartsWith (AddinPrefix, StringComparison.OrdinalIgnoreCase)
+                               || url.StartsWith (ExtensionPrefix, StringComparison.OrdinalIgnoreCase)
+                               || url.StartsWith (ExtensionNodePrefix, StringComparison.OrdinalIgnoreCase);
+               }
+
+               protected override string UriPrefix {
+                       get {
+                               return AddinPrefix;
+                       }
+               }
+               
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraArgs)
+               {
+                       extraArgs = new Dictionary<string, string> ();
+                       var idParts = id.Split ('#');
+                       extraArgs["FileID"] = idParts[0];
+                       extraArgs["AddinID"] = idParts[1];
+                       extraArgs["NodeID"] = idParts[2];
+
+                       return DocumentType.AddinXml;
+               }
+
+               public override Node MatchNode (string url)
+               {
+                       var prefix = new[] { AddinPrefix, ExtensionPrefix, ExtensionNodePrefix }.First (p => url.StartsWith (p, StringComparison.OrdinalIgnoreCase));
+                       return base.MatchNode (prefix != null ? url.Substring (prefix.Length) : url);
+               }
+
+               public override Stream GetHelpStream (string id)
+               {
+                       var idParts = id.Split ('#');
+                       return base.GetHelpStream (idParts[0]);
+               }
+
+               public override Stream GetCachedHelpStream (string id)
+               {
+                       var idParts = id.Split ('#');
+                       return base.GetHelpStream (idParts[0]);
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/ecma-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/ecma-provider.cs
new file mode 100644 (file)
index 0000000..8d0ca2d
--- /dev/null
@@ -0,0 +1,763 @@
+//
+// The ecmaspec provider is for ECMA specifications
+//
+// Authors:
+//     John Luke (jluke@cfl.rr.com)
+//     Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// Use like this:
+//   mono assembler.exe --ecmaspec DIRECTORY --out name
+//
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Linq;
+using System.Collections.Generic;
+
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+using Monkeydoc.Ecma;
+using Mono.Utilities;
+
+namespace MonkeyDoc.Providers
+{
+       public enum EcmaNodeType {
+               Invalid,
+               Namespace,
+               Type,
+               Member,
+               Meta, // A node that's here to serve as a header for other node
+       }
+
+       public class EcmaProvider : Provider
+       {
+               HashSet<string> directories = new HashSet<string> ();
+
+               public EcmaProvider ()
+               {
+               }
+
+               public EcmaProvider (string baseDir)
+               {
+                       AddDirectory (baseDir);
+               }
+
+               public void AddDirectory (string directory)
+               {
+                       if (string.IsNullOrEmpty (directory))
+                               throw new ArgumentNullException ("directory");
+
+                       directories.Add (directory);
+               }
+
+               public override void PopulateTree (Tree tree)
+               {
+                       var root = tree.RootNode;
+                       var storage = tree.HelpSource.Storage;
+                       int resID = 0;
+                       var nsSummaries = new Dictionary<string, XElement> ();
+
+                       foreach (var asm in directories) {
+                               var indexFilePath = Path.Combine (asm, "index.xml");
+                               if (!File.Exists (indexFilePath)) {
+                                       Console.Error.WriteLine ("Warning: couldn't process directory `{0}' as it has no index.xml file", asm);
+                                       continue;
+                               }
+                               using (var reader = XmlReader.Create (File.OpenRead (indexFilePath))) {
+                                       reader.ReadToFollowing ("Types");
+                                       var types = XElement.Load (reader.ReadSubtree ());
+
+                                       foreach (var ns in types.Elements ("Namespace")) {
+                                               var nsName = (string)ns.Attribute ("Name");
+                                               nsName = !string.IsNullOrEmpty (nsName) ? nsName : "global";
+                                               var nsNode = root.GetOrCreateNode (nsName, "N:" + nsName);
+
+                                               XElement nsElements;
+                                               if (!nsSummaries.TryGetValue (nsName, out nsElements))
+                                                       nsSummaries[nsName] = nsElements = new XElement ("elements",
+                                                                                                        new XElement ("summary"),
+                                                                                                        new XElement ("remarks"));
+
+                                               foreach (var type in ns.Elements ("Type")) {
+                                                       // Add the XML file corresponding to the type to our storage
+                                                       var id = resID++;
+                                                       var typeFilePath = Path.Combine (asm, nsName, Path.ChangeExtension (type.Attribute ("Name").Value, ".xml"));
+                                                       if (!File.Exists (typeFilePath)) {
+                                                               Console.Error.WriteLine ("Warning: couldn't process type file `{0}' as it doesn't exist", typeFilePath);
+                                                               continue;
+                                                       }
+                                                       using (var file = File.OpenRead (typeFilePath))
+                                                               storage.Store (id.ToString (), file);
+                                                       nsElements.Add (ExtractClassSummary (typeFilePath));
+
+                                                       var typeCaption = ((string)(type.Attribute ("DisplayName") ?? type.Attribute ("Name"))).Replace ('+', '.');
+                                                       var url = "ecma:" + id + '#' + typeCaption + '/';
+                                                       var typeNode = nsNode.CreateNode (typeCaption, url);
+
+                                                       // Add meta "Members" node
+                                                       typeNode.CreateNode ("Members", "*");
+                                                       var typeDocument = XDocument.Load (typeFilePath);
+                                                       var membersNode = typeDocument.Root.Element ("Members");
+                                                       if (membersNode == null || !membersNode.Elements ().Any ())
+                                                               continue;
+                                                       var members = membersNode
+                                                               .Elements ("Member")
+                                                               .ToLookup (m => m.Attribute ("MemberName").Value.StartsWith ("op_") ? "Operator" : m.Element ("MemberType").Value);
+
+                                                       foreach (var memberType in members) {
+                                                               // We pluralize the member type to get the caption and take the first letter as URL
+                                                               var node = typeNode.CreateNode (PluralizeMemberType (memberType.Key), memberType.Key[0].ToString ());
+                                                               var memberIndex = 0;
+
+                                                               var isCtors = memberType.Key[0] == 'C';
+
+                                                               // We do not escape much member name here
+                                                               foreach (var memberGroup in memberType.GroupBy (m => MakeMemberCaption (m, isCtors))) {
+                                                                       if (memberGroup.Count () > 1) {
+                                                                               // Generate overload
+                                                                               var overloadCaption = MakeMemberCaption (memberGroup.First (), false);
+                                                                               var overloadNode = node.CreateNode (overloadCaption, overloadCaption);
+                                                                               foreach (var member in memberGroup)
+                                                                                       overloadNode.CreateNode (MakeMemberCaption (member, true), (memberIndex++).ToString ());
+                                                                               overloadNode.Sort ();
+                                                                       } else {
+                                                                               // We treat constructor differently by showing their argument list in all cases
+                                                                               node.CreateNode (MakeMemberCaption (memberGroup.First (), isCtors), (memberIndex++).ToString ());
+                                                                       }
+                                                               }
+                                                               node.Sort ();
+                                                       }
+                                               }
+
+                                               nsNode.Sort ();
+                                       }
+                                       root.Sort ();
+                               }
+                       }
+
+                       foreach (var summary in nsSummaries)
+                               storage.Store ("xml.summary." + summary.Key, summary.Value.ToString ());
+
+                       var masterSummary = new XElement ("elements",
+                                                         directories
+                                                         .SelectMany (d => Directory.EnumerateFiles (d, "ns-*.xml"))
+                                                         .Select (ExtractNamespaceSummary));
+                       storage.Store ("mastersummary.xml", masterSummary.ToString ());
+               }
+
+               string PluralizeMemberType (string memberType)
+               {
+                       switch (memberType) {
+                       case "Property":
+                               return "Properties";
+                       default:
+                               return memberType + "s";
+                       }
+               }
+
+               string MakeMemberCaption (XElement member, bool withArguments)
+               {
+                       var caption = (string)member.Attribute ("MemberName");
+                       // Use type name instead of .ctor for cosmetic sake
+                       if (caption == ".ctor") {
+                               caption = (string)member.Ancestors ("Type").First ().Attribute ("Name");
+                               // If this is an inner type ctor, strip the parent type reference
+                               var plusIndex = caption.LastIndexOf ('+');
+                               if (plusIndex != -1)
+                                       caption = caption.Substring (plusIndex + 1);
+                       }
+                       if (caption.StartsWith ("op_")) {
+                               string sig;
+                               caption = MakeOperatorSignature (member, out sig);
+                               caption = withArguments ? sig : caption;
+                               return caption;
+                       }
+                       if (withArguments) {
+                               var args = member.Element ("Parameters");
+                               caption += '(';
+                               if (args != null && args.Elements ("Parameter").Any ()) {
+                                       caption += args.Elements ("Parameter")
+                                               .Select (p => (string)p.Attribute ("Type"))
+                                               .Aggregate ((p1, p2) => p1 + "," + p2);
+                               }
+                               caption += ')';
+                       }
+                       
+                       return caption;
+               }
+
+               XElement ExtractClassSummary (string typeFilePath)
+               {
+                       using (var reader = XmlReader.Create (typeFilePath)) {
+                               reader.ReadToFollowing ("Type");
+                               var name = reader.GetAttribute ("Name");
+                               var fullName = reader.GetAttribute ("FullName");
+                               reader.ReadToFollowing ("AssemblyName");
+                               var assemblyName = reader.ReadElementString ();
+                               reader.ReadToFollowing ("summary");
+                               var summary = reader.ReadInnerXml ();
+                               reader.ReadToFollowing ("remarks");
+                               var remarks = reader.ReadInnerXml ();
+
+                               return new XElement ("class",
+                                                    new XAttribute ("name", name ?? string.Empty),
+                                                    new XAttribute ("fullname", fullName ?? string.Empty),
+                                                    new XAttribute ("assembly", assemblyName ?? string.Empty),
+                                                    new XElement ("summary", new XCData (summary)),
+                                                    new XElement ("remarks", new XCData (remarks)));
+                       }
+               }
+
+               XElement ExtractNamespaceSummary (string nsFile)
+               {
+                       using (var reader = XmlReader.Create (nsFile)) {
+                               reader.ReadToFollowing ("Namespace");
+                               var name = reader.GetAttribute ("Name");
+                               reader.ReadToFollowing ("summary");
+                               var summary = reader.ReadInnerXml ();
+                               reader.ReadToFollowing ("remarks");
+                               var remarks = reader.ReadInnerXml ();
+
+                               return new XElement ("namespace",
+                                                    new XAttribute ("ns", name ?? string.Empty),
+                                                    new XElement ("summary", new XCData (summary)),
+                                                    new XElement ("remarks", new XCData (remarks)));
+                       }
+               }
+
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+                       AddImages (hs);
+                       AddExtensionMethods (hs);
+               }
+
+               void AddEcmaXml (HelpSource hs)
+               {
+                       var xmls = directories
+                               .SelectMany (Directory.EnumerateDirectories) // Assemblies
+                               .SelectMany (Directory.EnumerateDirectories) // Namespaces
+                               .SelectMany (Directory.EnumerateFiles)
+                               .Where (f => f.EndsWith (".xml")); // Type XML files
+
+                       int resID = 0;
+                       foreach (var xml in xmls)
+                               using (var file = File.OpenRead (xml))
+                                       hs.Storage.Store ((resID++).ToString (), file);
+               }
+
+               void AddImages (HelpSource hs)
+               {
+                       var imgs = directories
+                               .SelectMany (Directory.EnumerateDirectories)
+                               .Select (d => Path.Combine (d, "_images"))
+                               .Where (Directory.Exists)
+                               .SelectMany (Directory.EnumerateFiles);
+
+                       foreach (var img in imgs)
+                               using (var file = File.OpenRead (img))
+                                       hs.Storage.Store (Path.GetFileName (img), file);
+               }
+
+               void AddExtensionMethods (HelpSource hs)
+               {
+                       var extensionMethods = directories
+                               .SelectMany (Directory.EnumerateDirectories)
+                               .Select (d => Path.Combine (d, "index.xml"))
+                               .Where (File.Exists)
+                               .Select (f => {
+                                       using (var file = File.OpenRead (f)) {
+                                               var reader = XmlReader.Create (file);
+                                               reader.ReadToFollowing ("ExtensionMethods");
+                                               return reader.ReadInnerXml ();
+                                       }
+                           })
+                           .DefaultIfEmpty (string.Empty);
+
+                       hs.Storage.Store ("ExtensionMethods.xml",
+                                         "<ExtensionMethods>" + extensionMethods.Aggregate (string.Concat) + "</ExtensionMethods>");
+               }
+
+               IEnumerable<string> GetEcmaXmls ()
+               {
+                       return directories
+                               .SelectMany (Directory.EnumerateDirectories) // Assemblies
+                               .SelectMany (Directory.EnumerateDirectories) // Namespaces
+                               .SelectMany (Directory.EnumerateFiles)
+                               .Where (f => f.EndsWith (".xml")); // Type XML files
+               }
+
+               string MakeOperatorSignature (XElement member, out string memberSignature)
+               {
+                       string name = (string)member.Attribute ("MemberName");
+                       var nicename = name.Substring(3);
+                       memberSignature = null;
+
+                       switch (name) {
+                       // unary operators: no overloading possible     [ECMA-335 §10.3.1]
+                       case "op_UnaryPlus":                    // static     R operator+       (T)
+                       case "op_UnaryNegation":                // static     R operator-       (T)
+                       case "op_LogicalNot":                   // static     R operator!       (T)
+                       case "op_OnesComplement":               // static     R operator~       (T)
+                       case "op_Increment":                    // static     R operator++      (T)
+                       case "op_Decrement":                    // static     R operator--      (T)
+                       case "op_True":                         // static  bool operator true   (T)
+                       case "op_False":                        // static  bool operator false  (T)
+                       case "op_AddressOf":                    // static     R operator&       (T)
+                       case "op_PointerDereference":           // static     R operator*       (T)
+                               memberSignature = nicename;
+                               break;
+                       // conversion operators: overloading based on parameter and return type [ECMA-335 §10.3.3]
+                       case "op_Implicit":                    // static implicit operator R (T)
+                       case "op_Explicit":                    // static explicit operator R (T)
+                               nicename = name.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
+                               string arg = (string)member.Element ("Parameters").Element ("Parameter").Attribute ("Type");
+                               string ret = (string)member.Element ("ReturnValue").Element ("ReturnType");
+                               memberSignature = arg + " to " + ret;
+                               break;
+                       // binary operators: overloading is possible [ECMA-335 §10.3.2]
+                       default:
+                               memberSignature =
+                                       nicename + "("
+                                       + string.Join (",", member.Element ("Parameters").Elements ("Parameter").Select (p => (string)p.Attribute ("Type")))
+                                       + ")";
+                               break;
+                       }
+
+                       return nicename;
+               }
+       }
+
+       public class EcmaHelpSource : HelpSource
+       {
+               const string EcmaPrefix = "ecma:";
+               EcmaUrlParser parser = new EcmaUrlParser ();
+               LRUCache<string, Node> cache = new LRUCache<string, Node> (4);
+
+               public EcmaHelpSource (string base_file, bool create) : base (base_file, create)
+               {
+               }
+
+               protected override string UriPrefix {
+                       get {
+                               return EcmaPrefix;
+                       }
+               }
+
+               public override bool CanHandleUrl (string url)
+               {
+                       if (url.Length > 2 && url[1] == ':') {
+                               switch (url[0]) {
+                               case 'T':
+                               case 'M':
+                               case 'C':
+                               case 'P':
+                               case 'E':
+                               case 'F':
+                               case 'N':
+                               case 'O':
+                                       return true;
+                               }
+                       }
+                       return base.CanHandleUrl (url);
+               }
+
+               // Clean the extra paramers in the id
+               public override Stream GetHelpStream (string id)
+               {
+                       var idParts = id.Split ('?');
+                       return base.GetHelpStream (idParts[0]);
+               }
+
+               public override Stream GetCachedHelpStream (string id)
+               {
+                       var idParts = id.Split ('?');
+                       return base.GetCachedHelpStream (idParts[0]);
+               }
+
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+               {
+                       extraParams = null;
+                       int interMark = id.LastIndexOf ('?');
+                       if (interMark != -1)
+                               extraParams = id.Substring (interMark)
+                                       .Split ('&')
+                                       .Select (nvp => {
+                                               var eqIdx = nvp.IndexOf ('=');
+                                               return new { Key = nvp.Substring (0, eqIdx < 0 ? nvp.Length : eqIdx), Value = nvp.Substring (eqIdx + 1) };
+                                       })
+                                       .ToDictionary (kvp => kvp.Key, kvp => kvp.Value );
+                       return DocumentType.EcmaXml;
+               }
+
+               public override string GetPublicUrl (Node node)
+               {
+                       string url = string.Empty;
+                       var type = GetNodeType (node);
+                       //Console.WriteLine ("GetPublicUrl {0} : {1} [{2}]", node.Element, node.Caption, type.ToString ());
+                       switch (type) {
+                       case EcmaNodeType.Namespace:
+                               return node.Element; // A namespace node has already a well formated internal url
+                       case EcmaNodeType.Type:
+                               return MakeTypeNodeUrl (node);
+                       case EcmaNodeType.Meta:
+                               return MakeTypeNodeUrl (GetNodeTypeParent (node)) + GenerateMetaSuffix (node);
+                       case EcmaNodeType.Member:
+                               var typeChar = GetNodeMemberTypeChar (node);
+                               var parentNode = GetNodeTypeParent (node);
+                               var typeNode = MakeTypeNodeUrl (parentNode).Substring (2);
+                               return typeChar + ":" + typeNode + MakeMemberNodeUrl (typeChar, node);
+                       default:
+                               return null;
+                       }
+               }
+
+               string MakeTypeNodeUrl (Node node)
+               {
+                       // A Type node has a Element property of the form: 'ecma:{number}#{typename}/'
+                       var hashIndex = node.Element.IndexOf ('#');
+                       var typeName = node.Element.Substring (hashIndex + 1, node.Element.Length - hashIndex - 2);
+                       return "T:" + node.Parent.Caption + '.' + typeName.Replace ('.', '+');
+               }
+
+               string MakeMemberNodeUrl (char typeChar, Node node)
+               {
+                       // We clean inner type ctor name which may contain the outer type name
+                       var caption = node.Caption;
+
+                       // Sanitize constructor caption of inner types
+                       if (typeChar == 'C') {
+                               int lastDot = -1;
+                               for (int i = 0; i < caption.Length && caption[i] != '('; i++)
+                                       lastDot = caption[i] == '.' ? i : lastDot;
+                               return lastDot == -1 ? '.' + caption : caption.Substring (lastDot);
+                       }
+
+                       /* We handle type conversion operator by checking if the name contains " to "
+                        * (as in 'foo to bar') and we generate a corresponding conversion signature
+                        */
+                       if (typeChar == 'O' && caption.IndexOf (" to ") != -1) {
+                               var parts = caption.Split (' ');
+                               return "." + node.Parent.Caption + "(" + parts[0] + ", " + parts[2] + ")";
+                       }
+
+                       /* The goal here is to treat method which are explicit interface definition
+                        * such as 'void IDisposable.Dispose ()' for which the caption is a dot
+                        * expression thus colliding with the ecma parser.
+                        * If the first non-alpha character in the caption is a dot then we have an
+                        * explicit member implementation (we assume the interface has namespace)
+                        */
+                       var firstNonAlpha = caption.FirstOrDefault (c => !char.IsLetterOrDigit (c));
+                       if (firstNonAlpha == '.')
+                               return "$" + caption;
+
+                       return "." + caption;
+               }
+
+               EcmaNodeType GetNodeType (Node node)
+               {
+                       // We guess the node type by checking the depth level it's at in the tree
+                       int level = GetNodeLevel (node);
+                       switch (level) {
+                       case 0:
+                               return EcmaNodeType.Namespace;
+                       case 1:
+                               return EcmaNodeType.Type;
+                       case 2:
+                               return EcmaNodeType.Meta;
+                       case 3: // Here it's either a member or, in case of overload, a meta
+                               return node.IsLeaf ? EcmaNodeType.Member : EcmaNodeType.Meta;
+                       case 4: // At this level, everything is necessarily a member
+                               return EcmaNodeType.Member;
+                       default:
+                               return EcmaNodeType.Invalid;
+                       }
+               }
+
+               int GetNodeLevel (Node node)
+               {
+                       int i = 0;
+                       for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++) {
+                               //Console.WriteLine ("\tLevel {0} : {1} {2}", i, node.Element, node.Caption);
+                               node = node.Parent;
+                       }
+                       return i - 1;
+               }
+
+               char GetNodeMemberTypeChar (Node node)
+               {
+                       int level = GetNodeLevel (node);
+                       // We try to reach the member group node depending on node nested level
+                       switch (level) {
+                       case 2:
+                               return node.Element[0];
+                       case 3:
+                               return node.Parent.Element[0];
+                       case 4:
+                               return node.Parent.Parent.Element[0];
+                       default:
+                               throw new ArgumentException ("node", "Couldn't determine member type of node `" + node.Caption + "'");
+                       }
+               }
+
+               Node GetNodeTypeParent (Node node)
+               {
+                       // Type nodes are always at level 2 so we just need to get there
+                       while (node != null && node.Parent != null && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+                               node = node.Parent;
+                       return node;
+               }
+
+               string GenerateMetaSuffix (Node node)
+               {
+                       string suffix = string.Empty;
+                       // A meta node has always a type element to begin with
+                       while (GetNodeType (node) != EcmaNodeType.Type) {
+                               suffix = '/' + node.Element + suffix;
+                               node = node.Parent;
+                       }
+                       return suffix;
+               }
+
+               public override string GetInternalIdForUrl (string url, out Node node)
+               {
+                       var id = string.Empty;
+                       node = null;
+
+                       if (!url.StartsWith (EcmaPrefix, StringComparison.OrdinalIgnoreCase)) {
+                               node = MatchNode (url);
+                               if (node == null)
+                                       return null;
+                               id = node.GetInternalUrl ();
+                       }
+
+                       if (id.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase))
+                               id = id.Substring (UriPrefix.Length);
+                       else if (id.StartsWith ("N:", StringComparison.OrdinalIgnoreCase))
+                               id = "xml.summary." + id.Substring ("N:".Length);
+
+                       var hashIndex = id.IndexOf ('#');
+                       var hash = string.Empty;
+                       if (hashIndex != -1) {
+                               hash = id.Substring (hashIndex + 1);
+                               id = id.Substring (0, hashIndex);
+                       }
+
+                       return id + GetArgs (hash, node);
+               }
+
+               public override Node MatchNode (string url)
+               {
+                       Node node = null;
+                       if ((node = cache.Get (url)) == null) {
+                               node = InternalMatchNode (url);
+                               if (node != null)
+                                       cache.Put (url, node);
+                       }
+                       return node;
+               }
+
+               public Node InternalMatchNode (string url)
+               {
+                       Node result = null;
+                       EcmaDesc desc;
+                       if (!parser.TryParse (url, out desc))
+                               return null;
+
+                       // Namespace search
+                       Node currentNode = Tree.RootNode;
+                       Node searchNode = new Node () { Caption = desc.Namespace };
+                       int index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+                       if (index >= 0)
+                               result = currentNode.Nodes[index];
+                       if (desc.DescKind == EcmaDesc.Kind.Namespace || index < 0)
+                               return result;
+
+                       // Type search
+                       currentNode = result;
+                       result = null;
+                       searchNode.Caption = desc.ToCompleteTypeName ();
+                       index = currentNode.Nodes.BinarySearch (searchNode, EcmaTypeNodeComparer.Instance);
+                       if (index >= 0)
+                               result = currentNode.Nodes[index];
+                       if ((desc.DescKind == EcmaDesc.Kind.Type && !desc.IsEtc) || index < 0)
+                               return result;
+
+                       // Member selection
+                       currentNode = result;
+                       result = null;
+                       var caption = desc.IsEtc ? EtcKindToCaption (desc.Etc) : MemberKindToCaption (desc.DescKind);
+                       currentNode = FindNodeForCaption (currentNode.Nodes, caption);
+                       if (currentNode == null 
+                           || (desc.IsEtc && desc.DescKind == EcmaDesc.Kind.Type && string.IsNullOrEmpty (desc.EtcFilter)))
+                               return currentNode;
+
+                       // Member search
+                       result = null;
+                       var format = desc.DescKind == EcmaDesc.Kind.Constructor ? EcmaDesc.Format.WithArgs : EcmaDesc.Format.WithoutArgs;
+                       searchNode.Caption = desc.ToCompleteMemberName (format);
+                       index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+                       if (index < 0)
+                               return null;
+                       result = currentNode.Nodes[index];
+                       if (result.Nodes.Count == 0 || desc.IsEtc)
+                               return result;
+
+                       // Overloads search
+                       currentNode = result;
+                       searchNode.Caption = desc.ToCompleteMemberName (EcmaDesc.Format.WithArgs);
+                       index = currentNode.Nodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
+                       if (index < 0)
+                               return result;
+                       result = result.Nodes[index];
+                       
+                       return result;
+               }
+
+               // This comparer returns the answer straight from caption comparison
+               class EcmaGenericNodeComparer : IComparer<Node>
+               {
+                       public static readonly EcmaGenericNodeComparer Instance = new EcmaGenericNodeComparer ();
+
+                       public int Compare (Node n1, Node n2)
+                       {
+                               return string.Compare (n1.Caption, n2.Caption, StringComparison.Ordinal);
+                       }
+               }
+
+               // This comparer take into account the space in the caption
+               class EcmaTypeNodeComparer : IComparer<Node>
+               {
+                       public static readonly EcmaTypeNodeComparer Instance = new EcmaTypeNodeComparer ();
+
+                       public int Compare (Node n1, Node n2)
+                       {
+                               int length1 = CaptionLength (n1.Caption);
+                               int length2 = CaptionLength (n2.Caption);
+
+                               return string.Compare (n1.Caption, 0, n2.Caption, 0, Math.Max (length1, length2), StringComparison.Ordinal);
+                       }
+
+                       int CaptionLength (string caption)
+                       {
+                               var length = caption.LastIndexOf (' ');
+                               return length == -1 ? caption.Length : length;
+                       }
+               }
+
+               string EtcKindToCaption (char etc)
+               {
+                       switch (etc) {
+                       case 'M':
+                               return "Methods";
+                       case 'P':
+                               return "Properties";
+                       case 'C':
+                               return "Constructors";
+                       case 'F':
+                               return "Fields";
+                       case 'E':
+                               return "Events";
+                       case 'O':
+                               return "Operators";
+                       case '*':
+                               return "Members";
+                       default:
+                               return null;
+                       }
+               }
+
+               string MemberKindToCaption (EcmaDesc.Kind kind)
+               {
+                       switch (kind) {
+                       case EcmaDesc.Kind.Method:
+                               return "Methods";
+                       case EcmaDesc.Kind.Property:
+                               return "Properties";
+                       case EcmaDesc.Kind.Constructor:
+                               return "Constructors";
+                       case EcmaDesc.Kind.Field:
+                               return "Fields";
+                       case EcmaDesc.Kind.Event:
+                               return "Events";
+                       case EcmaDesc.Kind.Operator:
+                               return "Operators";
+                       default:
+                               return null;
+                       }
+               }
+
+               Node FindNodeForCaption (List<Node> nodes, string caption)
+               {
+                       foreach (var node in nodes)
+                               if (node.Caption.Equals (caption, StringComparison.OrdinalIgnoreCase))
+                                       return node;
+                       return null;
+               }
+
+               string GetArgs (string hash, Node node)
+               {
+                       var args = new Dictionary<string, string> ();
+                       
+                       args["source-id"] = SourceID.ToString ();
+                       
+                       if (node != null) {
+                               var nodeType = GetNodeType (node);
+                               switch (nodeType) {
+                               case EcmaNodeType.Namespace:
+                                       args["show"] = "namespace";
+                                       args["namespace"] = node.Element.Substring ("N:".Length);
+                                       break;
+                               case EcmaNodeType.Type:
+                                       args["show"] = "typeoverview";
+                                       break;
+                               case EcmaNodeType.Member:
+                               case EcmaNodeType.Meta:
+                                       switch (GetNodeMemberTypeChar (node)){
+                                       case 'C':
+                                               args["membertype"] = "Constructor";
+                                               break;
+                                       case 'M':
+                                               args["membertype"] = "Method";
+                                               break;
+                                       case 'P':
+                                               args["membertype"] = "Property";
+                                               break;
+                                       case 'F':
+                                               args["membertype"] = "Field";
+                                               break;
+                                       case 'E':
+                                               args["membertype"] = "Event";
+                                               break;
+                                       case 'O':
+                                               args["membertype"] = "Operator";
+                                               break;
+                                       case 'X':
+                                               args["membertype"] = "ExtensionMethod";
+                                               break;
+                                       case '*':
+                                               args["membertype"] = "All";
+                                               break;
+                                       }
+
+                                       if (nodeType == EcmaNodeType.Meta) {
+                                               args["show"] = "members";
+                                               args["index"] = "all";
+                                       } else {
+                                               args["show"] = "member";
+                                               args["index"] = node.Element;
+                                       }
+                                       break;
+                               }
+                       }
+
+                       if (!string.IsNullOrEmpty (hash))
+                               args["hash"] = hash;
+
+                       return "?" + string.Join ("&", args.Select (kvp => kvp.Key == kvp.Value ? kvp.Key : kvp.Key + '=' + kvp.Value));
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/ecmaspec-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/ecmaspec-provider.cs
new file mode 100644 (file)
index 0000000..bbe71eb
--- /dev/null
@@ -0,0 +1,194 @@
+//
+// The ecmaspec provider is for ECMA specifications
+//
+// Authors:
+//     John Luke (jluke@cfl.rr.com)
+//     Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// Use like this:
+//   mono assembler.exe --ecmaspec DIRECTORY --out name
+//
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+using System.Xml;
+using System.Collections.Generic;
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc.Providers
+{
+       public class EcmaSpecProvider : Provider
+       {
+               string basedir;
+       
+               public EcmaSpecProvider (string base_directory)
+               {
+                       basedir = base_directory;
+                       if (!Directory.Exists (basedir))
+                               throw new DirectoryNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
+               }
+       
+               public override void PopulateTree (Tree tree)
+               {
+                       XPathNavigator n = new XPathDocument (Path.Combine (basedir, "toc.xml")).CreateNavigator ();
+                       n.MoveToRoot ();
+                       n.MoveToFirstChild ();
+                       PopulateNode (n.SelectChildren ("node", ""), tree.RootNode);
+               }
+       
+               void PopulateNode (XPathNodeIterator nodes, Node treeNode)
+               {
+                       foreach (XPathNavigator n in nodes) {
+                               string secNumber = n.GetAttribute ("number", "");
+                               string secName = n.GetAttribute ("name", "");
+
+                               var storage = treeNode.Tree.HelpSource.Storage;
+                               using (var file = File.OpenRead (Path.Combine (basedir, secNumber + ".xml")))
+                                       storage.Store (secNumber, file);
+
+                               Node thisNode = treeNode.GetOrCreateNode (secNumber + ": " + secName, "ecmaspec:" + secNumber);
+                       
+                               if (n.HasChildren)
+                                       PopulateNode (n.SelectChildren ("node", ""), thisNode);
+                       }
+               }
+
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+               }
+       }
+
+       public class EcmaSpecHelpSource : HelpSource
+       {
+               const string EcmaspecPrefix = "ecmaspec:";
+               const string TocPart = "%toc"; // What is returned as TocXml
+               const string SpecPart = "%spec"; // What is returned as Ecmaspec
+
+               public EcmaSpecHelpSource (string base_file, bool create) : base (base_file, create)
+               {
+               }
+
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+               {
+                       extraParams = null;
+                       return id.EndsWith (TocPart) ? DocumentType.TocXml : DocumentType.EcmaSpecXml;
+               }
+
+               public override bool IsGeneratedContent (string id)
+               {
+                       return id == "root:" || id.EndsWith (TocPart);
+               }
+
+               public override bool IsMultiPart (string id, out IEnumerable<string> parts)
+               {
+                       if (id == "root:" || id.EndsWith (TocPart) || id.EndsWith (SpecPart)) {
+                               parts = null;
+                               return false;
+                       }
+                       parts = MakeMultiPart (id);
+                       return true;
+               }
+
+               IEnumerable<string> MakeMultiPart (string baseId)
+               {
+                       yield return baseId + SpecPart;
+                       yield return baseId + TocPart;
+               }
+
+               public override string GetText (string id)
+               {
+                       Node n = id == "root:" ? Tree.RootNode : MatchNode (EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length));
+                       if (n == null)
+                               throw new ArgumentException ("id", string.Format ("{0} -> {1}", id, EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length)));
+                       return TreeDumper.ExportToTocXml (n, "C# Language Specification", "In this section:");
+               }
+
+               public override Stream GetHelpStream (string id)
+               {
+                       return id.EndsWith (SpecPart) ? base.GetHelpStream (id.Substring (0, id.IndexOf (SpecPart))) : base.GetHelpStream (id);
+               }
+       
+               public override void PopulateSearchableIndex (IndexWriter writer) 
+               {
+                       foreach (Node n in Tree.RootNode.Nodes)
+                               AddDocuments (writer, n);
+               }
+
+               protected override string UriPrefix {
+                       get {
+                               return EcmaspecPrefix;
+                       }
+               }
+
+               void AddDocuments (IndexWriter writer, Node node) 
+               {
+                       string url = node.PublicUrl;
+                       Stream file_stream = GetHelpStream (url.Substring (9));
+                       if (file_stream == null) //Error
+                               return;
+                       XmlDocument xdoc = new XmlDocument ();
+                       xdoc.Load (new XmlTextReader (file_stream));
+
+                       //Obtain the title
+                       XmlNode nelem = xdoc.DocumentElement;
+                       string title = nelem.Attributes["number"].Value + ": " + nelem.Attributes["title"].Value;
+
+                       //Obtain the text
+                       StringBuilder s = new StringBuilder ();
+                       GetTextNode (nelem, s);
+                       string text = s.ToString ();
+
+                       //Obtain the examples
+                       StringBuilder s2 = new StringBuilder ();
+                       GetExamples (nelem, s2);
+                       string examples = s2.ToString ();
+
+                       //Write to the Lucene Index all the parts
+                       SearchableDocument doc = new SearchableDocument ();
+                       doc.title = title;
+                       doc.hottext = title.Substring (title.IndexOf (':')); 
+                       doc.url = url;
+                       doc.text = text;
+                       doc.examples = examples;
+                       writer.AddDocument (doc.LuceneDoc);
+               
+                       if (node.IsLeaf)
+                               return;
+
+                       foreach (Node n in node.Nodes)
+                               AddDocuments (writer, n);
+               }
+
+               void GetTextNode (XmlNode n, StringBuilder s) 
+               {
+                       //dont include c# code
+                       if (n.Name == "code_example")
+                               return;
+                       //include all text from nodes
+                       if (n.NodeType == XmlNodeType.Text)
+                               s.Append (n.Value);
+               
+                       //recursively explore all nodes
+                       if (n.HasChildNodes)
+                               foreach (XmlNode n_child in n.ChildNodes)
+                                       GetTextNode (n_child, s);
+               }
+
+               void GetExamples (XmlNode n, StringBuilder s)
+               {
+                       if (n.Name == "code_example") {
+                               if (n.FirstChild.Name == "#cdata-section")
+                                       s.Append (n.FirstChild.Value);
+                       } else {
+                               if (n.HasChildNodes)
+                                       foreach (XmlNode n_child in n.ChildNodes)
+                                               GetExamples (n_child, s);
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/error-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/error-provider.cs
new file mode 100644 (file)
index 0000000..0c1597e
--- /dev/null
@@ -0,0 +1,201 @@
+//
+// error-provider.cs
+//
+// Author:
+//   Ben Maurer (bmaurer@users.sourceforge.net)
+//
+// (C) 2003 Ben Maurer
+// Copyright 2003-2011 Novell
+// Copyright 2011 Xamarin Inc
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Linq;
+using Lucene.Net.Index;
+using Lucene.Net.Documents;
+
+namespace MonkeyDoc.Providers
+{
+       public class ErrorProviderConfig
+       {
+               public string FilesPath;
+               public string Match;
+               public int ErrorNumSubstringStart;
+               public int ErrorNumSubstringLength;
+               public string FriendlyFormatString;
+
+               public override string ToString ()
+               {
+                       var sb = new StringBuilder ();
+                       var w = new StringWriter (sb);
+                       
+                       w.WriteLine ("FilesPath: {0}", FilesPath);
+                       w.WriteLine ("Match: {0}", Match);
+                       w.WriteLine ("Error Number Substring: {0} Length:{1}", ErrorNumSubstringStart, ErrorNumSubstringLength);
+                       w.WriteLine ("FriendlyFormatString: {0}", FriendlyFormatString);
+                       
+                       return w.ToString ();
+               }
+               
+               public Dictionary<string, ErrorDocumentation> Compile (HelpSource hs)
+               {
+                       string[] files = Directory.GetFiles (FilesPath, Match);
+                       var ret = new Dictionary<string, ErrorDocumentation> ();
+                       
+                       foreach (string s in files) {
+                               ErrorDocumentation d;
+                               int errorNum = 0;
+
+                               try {
+                                       errorNum = int.Parse (Path.GetFileName (s).Substring (ErrorNumSubstringStart, ErrorNumSubstringLength));
+                               } catch {
+                                       Console.WriteLine ("Ignoring file {0}", s);
+                               }
+                               
+                               string errorName = String.Format (FriendlyFormatString, errorNum);
+                               
+                               if (!ret.TryGetValue (errorName, out d))
+                                       ret[errorName] = d = new ErrorDocumentation (errorName);
+
+                               if (d.Details == null) {
+                                       string xmlFile = Path.ChangeExtension (s, "xml");
+                                       if (File.Exists (xmlFile)) {
+                                               XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorDetails));
+                                               d.Details = (ErrorDetails)cfgRdr.Deserialize (new XmlTextReader (xmlFile));
+                                       }
+                               }
+                               // Encoding is same as used in MCS, so we will be able to do all those files
+                               using (StreamReader reader = new StreamReader (s, Encoding.GetEncoding (28591))) {
+                                       d.Examples.Add (reader.ReadToEnd ());
+                               }
+                       }
+                       
+                       return ret;
+               }
+       }
+
+       public class ErrorDocumentation
+       {
+               public string ErrorName;
+               public ErrorDetails Details;
+               public List<string> Examples = new List<string> ();
+               
+               public ErrorDocumentation () {}
+               public ErrorDocumentation (string ErrorName)
+               {
+                       this.ErrorName = ErrorName;
+               }
+       }
+       
+       public class ErrorDetails
+       {
+               public XmlNode Summary;
+               public XmlNode Details;
+       }
+
+       public class ErrorProvider : Provider
+       {
+               ErrorProviderConfig config;
+               
+               public ErrorProvider (string configFile)
+               {
+                       config = ReadConfig (configFile);
+               }
+               
+               public static ErrorProviderConfig ReadConfig (string file)
+               {
+                       XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorProviderConfig));
+                       ErrorProviderConfig ret = (ErrorProviderConfig)cfgRdr.Deserialize (new XmlTextReader (file));
+                       // handle path rel to the config file
+                       ret.FilesPath = Path.Combine (Path.GetDirectoryName (file), ret.FilesPath);
+                       return ret;
+               }
+       
+               public override void PopulateTree (Tree tree)
+               {
+                       // everything is done in CloseTree so we can pack
+               }
+       
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+                       var entries = config.Compile (hs);
+                       MemoryStream ms = new MemoryStream ();
+                       XmlSerializer writer = new XmlSerializer (typeof (ErrorDocumentation));
+                       
+                       foreach (var de in entries) {
+                               ErrorDocumentation d = de.Value;
+                               string s = de.Key;
+
+                               tree.RootNode.GetOrCreateNode (s, "error:" + s);
+                               
+                               writer.Serialize (ms, d);
+                               ms.Position = 0;
+                               hs.Storage.Store (s, ms);
+                               ms.SetLength (0);
+                       }
+                       
+                       tree.RootNode.Sort ();
+               }
+       }
+       
+       public class ErrorHelpSource : HelpSource
+       {               
+               public ErrorHelpSource (string base_file, bool create) : base (base_file, create)
+               {
+               }
+
+               public override string GetText (string id)
+               {
+                       return TreeDumper.ExportToTocXml (Tree.RootNode, "Compiler Error Reference", "In this section:");
+               }
+               
+               protected override string UriPrefix {
+                       get {
+                               return "error:";
+                       }
+               }
+
+               public override bool IsGeneratedContent (string id)
+               {
+                       return id == "root:";
+               }
+
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+               {
+                       extraParams = null;
+                       return id == "root:" ? DocumentType.TocXml : DocumentType.ErrorXml;
+               }
+
+               public override string GetInternalIdForUrl (string url, out Node node)
+               {
+                       var result = base.GetInternalIdForUrl (url, out node);
+                       return result.ToLower ();
+               }
+               
+               public override void PopulateIndex (IndexMaker index_maker)
+               {
+                       foreach (Node n in Tree.RootNode.Nodes)
+                               index_maker.Add (n.Caption, n.Caption, n.Element);
+               }
+
+               public override void PopulateSearchableIndex (IndexWriter writer) 
+               {
+                       foreach (Node n in Tree.RootNode.Nodes) {
+                               XmlSerializer reader = new XmlSerializer (typeof (ErrorDocumentation));
+                               ErrorDocumentation d = (ErrorDocumentation)reader.Deserialize (GetHelpStream (n.Element.Substring (6)));
+                               SearchableDocument doc = new SearchableDocument ();
+                               doc.title = d.ErrorName;
+                               doc.url = n.Element;
+                               doc.text = d.Details != null ? d.Details.ToString () : string.Empty;
+                               doc.examples = d.Examples.Cast<string> ().Aggregate ((e1, e2) => e1 + Environment.NewLine + e2);
+                               doc.hottext = d.ErrorName;
+                               writer.AddDocument (doc.LuceneDoc);
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/man-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/man-provider.cs
new file mode 100755 (executable)
index 0000000..32b9c93
--- /dev/null
@@ -0,0 +1,106 @@
+//
+// A provider to display man pages
+//
+// Authors:
+//   Johannes Roith <johannes@roith.de>
+//   Jonathan Pryor <jpryor@novell.com>
+//
+// (C) 2008 Novell, Inc.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace MonkeyDoc.Providers
+{
+       public class ManProvider : Provider
+       {
+               string[] tocFiles;
+       
+               public ManProvider (string[] handbookTocFiles)
+               {
+                       tocFiles = handbookTocFiles;
+
+                       // huh...
+                       if (!File.Exists (tocFiles[0]))
+                               throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFiles[0]));
+               }
+
+               public override void PopulateTree (Tree tree)
+               {
+                       foreach(string TocFile in tocFiles) {
+                               XmlDocument doc = new XmlDocument();
+                               doc.Load (TocFile);
+
+                               XmlNodeList nodeList = doc.GetElementsByTagName("manpage");
+                               Node nodeToAddChildrenTo = tree.RootNode;
+                               var storage = nodeToAddChildrenTo.Tree.HelpSource.Storage;
+
+                               foreach (XmlNode node in nodeList) {
+
+                                       XmlAttribute name = node.Attributes["name"];
+                                       XmlAttribute page = node.Attributes["page"];
+
+                                       if (name == null || page == null) continue;
+
+                                       if (!File.Exists (page.Value))
+                                               continue;
+
+                                       string target = "man:" + name.Value;
+                                       nodeToAddChildrenTo.CreateNode (name.Value, target);
+
+                                       if (File.Exists (page.Value))
+                                               storage.Store (name.Value, File.OpenRead (page.Value));
+                               }
+                       }
+               }
+
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+               }
+       }
+
+       public class ManHelpSource : HelpSource
+       {
+               const string ManPrefix = "man:";
+               Dictionary<string, Node> nodesMap;
+
+               public ManHelpSource (string base_file, bool create) : base (base_file, create)
+               {
+                       nodesMap = Tree.RootNode.Nodes.ToDictionary (n => n.Element);
+               }
+
+               // Since man always has a flat tree and rather small amount of item
+               // we store them in a dictionary
+               public override Node MatchNode (string url)
+               {
+                       Node result;
+                       return nodesMap.TryGetValue (url, out result) ? result : null;
+               }
+
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraParams)
+               {
+                       extraParams = null;
+                       return id == "root:" ? DocumentType.TocXml : DocumentType.Man;
+               }
+
+               public override bool IsGeneratedContent (string id)
+               {
+                       return id == "root:";
+               }
+       
+               public override string GetText (string url)
+               {
+                       return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Documentation Library", "Available man pages:");
+               }
+
+               protected override string UriPrefix {
+                       get {
+                               return ManPrefix;
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/simple-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/simple-provider.cs
new file mode 100644 (file)
index 0000000..e567dc1
--- /dev/null
@@ -0,0 +1,153 @@
+//
+// The simple provider is an example provider
+//
+// Author:
+//   Miguel de Icaza (miguel@ximian.com)
+//
+// Use like this:
+//   mono assembler.exe --simple DIRECTORY --out name
+//
+// Then create a .source file in your sources directory, and copy
+// name.tree and name.zip to the sources directory.
+//
+// To view the tree generated, use:
+//   mono dump.exe name.tree
+//
+namespace Monodoc {
+using System;
+using System.IO;
+using System.Text;
+
+//
+// The simple provider generates the information source
+//
+public class SimpleProvider : Provider {
+       string basedir;
+       
+       public SimpleProvider (string base_directory)
+       {
+               basedir = base_directory;
+               if (!Directory.Exists (basedir))
+                       throw new FileNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
+       }
+
+       public override void PopulateTree (Tree tree)
+       {
+               Node top = tree.LookupNode ("Directory at: " + basedir, "simple:");
+               
+               foreach (string dir in Directory.GetDirectories (basedir)){
+                       string url = Path.GetFileName (dir);
+                       Node n = top.LookupNode ("Dir: " + url, url);
+                       PopulateDir (n, dir);
+               }
+       }
+
+#pragma warning disable 219
+       void PopulateDir (Node me, string dir)
+       {
+               Console.WriteLine ("Adding: " + dir);
+               foreach (string child_dir in Directory.GetDirectories (dir)){
+                       string url = Path.GetFileName (child_dir);
+                       Node n = me.LookupNode ("Dir: " + url, "simple-directory:" + url);
+                       PopulateDir (me, child_dir);
+               }
+
+               foreach (string file in Directory.GetFiles (dir)){
+                       Console.WriteLine ("   File: " + file);
+                       string file_code = me.tree.HelpSource.PackFile (file);
+
+                       //
+                       // The url element encoded for the file is:
+                       //  originalfilename#CODE
+                       //
+                       // The code is assigned to us after the file has been packaged
+                       // We use the original-filename later to render html or text files
+                       //
+                       Node n = me.LookupNode (Path.GetFileName (file), file + "#" + file_code);
+                       
+               }
+       }
+
+       public override void CloseTree (HelpSource hs, Tree tree)
+       {
+       }
+}
+
+//
+// The HelpSource is used during the rendering phase.
+//
+
+public class SimpleHelpSource : HelpSource {
+       Encoding enc;
+       
+       public SimpleHelpSource (string base_file, bool create) : base (base_file, create)
+       {
+               enc = new UTF8Encoding (false, false);
+       }
+
+       public override string GetText (string url, out Node match_node)
+       {
+               match_node = null;
+
+               string c = GetCachedText (url);
+               if (c != null)
+                       return c;
+
+               if (url.StartsWith ("simple:") || url.StartsWith ("simple-directory:"))
+                       return GetTextFromUrl (url);
+
+               return null;
+       }
+
+       string GetTextFromUrl (string url)
+       {
+               // Remove "simple:" prefix
+               url = url.Substring (7);
+
+               if (url.StartsWith ("simple-directory:"))
+                       return String.Format ("<html>This is a directory entry point: {0} </html>",
+                                             url.Substring (17));
+
+               // Otherwise the last element of the url is the file code we got.
+               int pound = url.LastIndexOf ("#");
+               string code;
+               if (pound == -1)
+                       code = url;
+               else
+                       code = url.Substring (pound+1);
+
+
+               Stream s = GetHelpStream (code);
+               if (s == null)
+                       return String.Format ("<html>No stream for this node: {0} </html>", url);
+
+               //
+               // Now, get the file type
+               //
+               int slash = url.LastIndexOf ("/");
+               string fname = url.Substring (slash + 1, pound - slash - 1).ToLower ();
+
+               if (fname.EndsWith (".html") || fname.EndsWith (".htm")){
+                       TextReader r = new StreamReader (s, enc);
+                       return r.ReadToEnd ();
+               }
+
+               if (fname.EndsWith (".png") || fname.EndsWith (".jpg") ||
+                   fname.EndsWith (".jpeg") || fname.EndsWith (".gif")){
+                       return "<html>Image file, have not implemented rendering this yet</html>";
+               }
+
+               // Convert text to HTML
+               StringBuilder result = new StringBuilder ("<html>");
+               TextReader reader = new StreamReader (s, enc);
+               string line;
+               
+               while ((line = reader.ReadLine ()) != null){
+                       result.Append (line);
+                       result.Append ("<br>");
+               }
+               result.Append ("<html>");
+               return result.ToString ();
+       }
+}
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/providers/xhtml-provider.cs b/mcs/tools/monkeydoc/Monkeydoc/providers/xhtml-provider.cs
new file mode 100644 (file)
index 0000000..ce74b01
--- /dev/null
@@ -0,0 +1,200 @@
+//
+// A provider that uses Windows help file xhtml TOC files and looks for the
+// referenced documents to create the help source. 
+//
+// Authors:
+// Copyright 2003 Lee Mallabone <gnome@fonicmonkey.net>
+//   Johannes Roith <johannes@roith.de>
+//   Miguel de Icaza <miguel@ximian.com>
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+namespace MonkeyDoc.Providers
+{
+       public class XhtmlProvider : Provider
+       {
+               string tocFile;
+       
+               public XhtmlProvider (string handbookTocFile)
+               {
+                       tocFile = handbookTocFile;
+                       if (!File.Exists (tocFile))
+                               throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFile));               
+               }
+
+               public override void PopulateTree (Tree tree)
+               {
+                       //new SimpleHandbookTOCParser(tree, tocFile);
+                       // TODO: port it
+               }
+
+               public override void CloseTree (HelpSource hs, Tree tree)
+               {
+               }
+       }
+
+       public class XhtmlHelpSource : HelpSource
+       {
+               public XhtmlHelpSource (string base_file, bool create) : base (base_file, create)
+               {
+
+               }
+
+               const string XhtmlPrefix = "xhtml:";
+
+               protected override string UriPrefix {
+                       get {
+                               return XhtmlPrefix;
+                       }
+               }
+               
+               public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraArgs)
+               {
+                       extraArgs = null;
+                       return id == "root:" ? DocumentType.TocXml : DocumentType.MonoBook;
+               }
+
+               public override bool IsGeneratedContent (string id)
+               {
+                       return id == "root:";
+               }
+       
+               public override string GetText (string url)
+               {
+                       return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Handbook", string.Empty);
+               }
+
+               public static string GetAbsoluteLink(string target, string url)
+               {
+                       
+                       string value = null;
+               
+                       if (target.StartsWith ("#") ||
+                           target.StartsWith ("T:") ||
+                           target.StartsWith ("M:") ||
+                           target.StartsWith ("P:") ||
+                           target.StartsWith ("T:") ||
+                           target.StartsWith ("E:") ||
+                           target.StartsWith ("F:") ||
+                           target.StartsWith ("O:") ||
+                           target.StartsWith ("N:") ||
+                           target.StartsWith ("api:"))
+                               return null;
+               
+                       int endp = target.IndexOf(':');
+               
+                       if (endp == -1)
+                               endp = 0;
+                       string protocol = target.Substring(0, endp);
+                       switch (protocol) {
+                       case "mailto": 
+                       case "http":
+                       case "https":
+                       case "ftp":
+                       case "news":
+                       case "irc":
+                               break;
+                       default:
+                               // handle absolute urls like: /html/en/images/empty.png
+                               if (!target.StartsWith("/")) {
+                               
+                                       // url is something like "gnome/bindings/mono.html"
+                                       // This will get the path "gnome/bindings"
+                               
+                                       int slash = url.LastIndexOf ("/");
+                                       string tmpurl = url;
+                               
+                                       if (slash != -1)
+                                               tmpurl  = url.Substring(0, slash);
+                               
+                                       // Count "../" in target and go one level down
+                                       // for each in tmpurl, eventually, then remove "../".
+                               
+                                       Regex reg1 = new Regex("../");
+                                       MatchCollection matches = reg1.Matches(target);
+                               
+                                       for(int i = 1; i < matches.Count; i++) {
+                                               slash = tmpurl.LastIndexOf ("/");
+                                               if (slash != -1) 
+                                                       tmpurl  = tmpurl.Substring(0, slash);
+                                       }
+                               
+                                       target = target.Replace("../", "");
+                               
+                                       value = tmpurl + "/" + target;
+                               
+                               } else {
+                                       value = target.Substring(1, target.Length - 1);
+                               }
+                               break;
+                       }
+                       return value;
+               }
+       
+               XmlDocument RewriteLinks(XmlDocument docToProcess, string url)
+               {
+                       XmlNodeList nodeList = docToProcess.GetElementsByTagName("a");
+               
+                       foreach(XmlNode node in nodeList) {
+                       
+                               XmlElement element = (XmlElement) node;
+                       
+                               if (element.HasAttribute("href") ){
+                               
+                                       XmlAttribute href = element.GetAttributeNode("href");
+                                       string target = href.Value;
+                               
+                                       target = GetAbsoluteLink(target, url);
+                                       if (target != null) {
+                                               string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
+                                               href.Value = newtarget;
+                                       }
+                               }
+                       }
+
+                       nodeList = docToProcess.GetElementsByTagName("img");
+
+                       foreach(XmlNode node in nodeList) {
+                                                                                                                                    
+                               XmlElement element = (XmlElement) node;
+                                                                                                                                    
+                               if (element.HasAttribute("src") ){
+                                                                                                                                    
+                                       XmlAttribute href = element.GetAttributeNode("src");
+                                       string target = href.Value;
+                                                                                                                                    
+                                       target = GetAbsoluteLink(target, url);
+                                       if (target != null) {
+                                               string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
+                                               href.Value = newtarget;
+                                       }
+                               }               
+                       }
+
+                       return docToProcess;
+               }
+
+               public override void PopulateIndex (IndexMaker index_maker)
+               {
+                       PopulateIndexFromNodes (Tree.RootNode);
+               }
+
+               void PopulateIndexFromNodes (Node start)
+               {
+                       var nodes = start.Nodes;
+               
+                       if (nodes == null)
+                               Console.WriteLine ("Leaf: " + start.Caption);
+                       else {
+                               Console.WriteLine ("Root: " + start.Caption);
+                               foreach (Node n in nodes)
+                                       PopulateIndexFromNodes (n);
+                       }
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Monkeydoc/storage.cs b/mcs/tools/monkeydoc/Monkeydoc/storage.cs
new file mode 100644 (file)
index 0000000..9085ff5
--- /dev/null
@@ -0,0 +1,53 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace MonkeyDoc
+{
+       // Define a storage mechanism for a help source
+       public interface IDocStorage : IDisposable
+       {
+               // Tell if the storage can store successive change to the doc as revision
+               bool SupportRevision { get; }
+               IDocRevisionManager RevisionManager { get; }
+
+               // Tell if the storage support modifying an existing data
+               bool SupportChange { get; }
+
+               /* Store data inside the storage backend
+                * if SupportChange is false and user try to store something with an existing id
+                * an exception will be thrown
+                * if id is null or empty, the storage will try to create an automatic id. In all
+                * case the id that has been used to store the content is returned by the method
+                */
+               string Store (string id, string text);
+               string Store (string id, byte[] data);
+               string Store (string id, Stream stream);
+
+               Stream Retrieve (string id);
+
+               IEnumerable<string> GetAvailableIds ();
+       }
+
+       public interface IDocRevisionManager
+       {
+               Stream RetrieveWithRevision (string id, string revision);
+
+               // This should be ordered by most recent first
+               IEnumerable<string> AvailableRevisionsForId (string id);
+               // This can simply be implemented with above property but it can also be
+               // a revision storage symbolic value like "HEAD"
+               string LatestRevisionForId (string id);
+
+               // A commit message for instance
+               string GetRevisionDescription (string revision);
+       }
+
+       public static class DocRevisionManagerExtensions
+       {
+               public static Stream RetrieveLatestRevision (this IDocRevisionManager revManager, string id)
+               {
+                       return revManager.RetrieveWithRevision (id, revManager.LatestRevisionForId (id));
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Monkeydoc/storage/ZipStorage.cs b/mcs/tools/monkeydoc/Monkeydoc/storage/ZipStorage.cs
new file mode 100644 (file)
index 0000000..81ed1c5
--- /dev/null
@@ -0,0 +1,131 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
+
+using ICSharpCode.SharpZipLib.Zip;
+
+namespace MonkeyDoc.Storage
+{
+       public class ZipStorage : IDocStorage
+       {
+               string zipFileName;
+               int code;
+               ZipOutputStream zipOutput;
+               ZipFile zipFile;
+               // SharpZipLib use linear search to map name to index, correct that a bit
+               Dictionary<string, int> entries = new Dictionary<string, int> ();
+
+               public ZipStorage (string zipFileName)
+               {
+                       this.zipFileName = zipFileName;
+               }
+
+               public bool SupportRevision {
+                       get {
+                               return false;
+                       }
+               }
+
+               public IDocRevisionManager RevisionManager {
+                       get {
+                               return null;
+                       }
+               }
+
+               public bool SupportChange {
+                       get {
+                               return true;
+                       }
+               }
+
+               public string Store (string id, string text)
+               {
+                       EnsureOutput ();
+                       SetupEntry (zipOutput, ref id);
+                       var writer = new StreamWriter (zipOutput);
+                       writer.Write (text);
+                       writer.Flush ();
+                       
+                       return id;
+               }
+
+               public string Store (string id, byte[] data)
+               {
+                       EnsureOutput ();
+                       SetupEntry (zipOutput, ref id);
+                       zipOutput.Write (data, 0, data.Length);
+                       return id;
+               }
+
+               public string Store (string id, Stream stream)
+               {
+                       EnsureOutput ();
+                       SetupEntry (zipOutput, ref id);
+                       stream.CopyTo (zipOutput);
+                       return id;
+               }
+
+               void SetupEntry (ZipOutputStream zipOutput, ref string id)
+               {
+                       if (string.IsNullOrEmpty (id))
+                               id = GetNewCode ();
+
+                       ZipEntry entry = new ZipEntry (id);
+                       zipOutput.PutNextEntry (entry);
+               }
+
+               public Stream Retrieve (string id)
+               {
+                       EnsureInput ();
+                       int index;
+                       ZipEntry entry;
+                       if (!entries.TryGetValue (id, out index) || (entry = zipFile[index]) == null)
+                               entry = zipFile.GetEntry (id);
+                       if (entry != null)
+                               return zipFile.GetInputStream (entry);
+                       else
+                               throw new ArgumentException ("id", string.Format ("'{0}' isn't a valid id for this storage", id));
+               }
+
+               public IEnumerable<string> GetAvailableIds ()
+               {
+                       EnsureInput ();
+                       return zipFile.Cast<ZipEntry> ().Select (ze => ze.Name);
+               }
+
+               void EnsureOutput ()
+               {
+                       if (zipFile != null)
+                               throw new InvalidOperationException ("This ZipStorage instance is already used in read-mode");
+                       if (zipOutput != null)
+                               return;
+                       zipOutput = new ZipOutputStream (File.Create (zipFileName));
+               }
+
+               void EnsureInput ()
+               {
+                       if (zipOutput != null)
+                               throw new InvalidOperationException ("This ZipStorage instance is already used in write-mode");
+                       if (zipFile != null)
+                               return;
+                       zipFile = new ZipFile (zipFileName);
+                       entries = Enumerable.Range (0, zipFile.Size).ToDictionary (i => zipFile[i].Name, i => i);
+               }
+
+               public void Dispose ()
+               {
+                       if (zipOutput != null)
+                               zipOutput.Dispose ();
+                       if (zipFile != null)
+                               zipFile.Close ();
+               }
+
+               string GetNewCode ()
+               {
+                       return String.Format ("{0}", code++);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Mono.Documentation/ManifestResourceResolver.cs b/mcs/tools/monkeydoc/Mono.Documentation/ManifestResourceResolver.cs
new file mode 100644 (file)
index 0000000..402d137
--- /dev/null
@@ -0,0 +1,42 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+
+namespace Mono.Documentation {
+       public class ManifestResourceResolver : XmlUrlResolver {
+               private string[] dirs;
+
+               public ManifestResourceResolver (params string[] dirs)
+               {
+                       this.dirs = (string[]) dirs.Clone ();
+               }
+
+               public override Uri ResolveUri (Uri baseUri, string relativeUri)
+               {
+                       if (Array.IndexOf (
+                                               Assembly.GetExecutingAssembly ().GetManifestResourceNames (), 
+                                               relativeUri) >= 0)
+                                       return new Uri ("x-resource:///" + relativeUri);
+                       foreach (var dir in dirs) {
+                               if (File.Exists (Path.Combine (dir, relativeUri)))
+                                       return base.ResolveUri (new Uri ("file://" + new DirectoryInfo (dir).FullName + "/"), 
+                                                       relativeUri);
+                       }
+                       return base.ResolveUri (baseUri, relativeUri);
+               }
+
+               public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
+               {
+                       if (ofObjectToReturn == null)
+                               ofObjectToReturn = typeof(Stream);
+                       if (ofObjectToReturn != typeof(Stream))
+                               throw new XmlException ("This object type is not supported.");
+                       if (absoluteUri.Scheme != "x-resource")
+                               return base.GetEntity (absoluteUri, role, ofObjectToReturn);
+                       return Assembly.GetExecutingAssembly().GetManifestResourceStream (
+                                       absoluteUri.Segments [1]);
+               }
+       }
+}
+
diff --git a/mcs/tools/monkeydoc/Mono.Documentation/XmlDocUtils.cs b/mcs/tools/monkeydoc/Mono.Documentation/XmlDocUtils.cs
new file mode 100644 (file)
index 0000000..2f4cd08
--- /dev/null
@@ -0,0 +1,200 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Xml;
+
+namespace Mono.Documentation {
+
+       public delegate XmlDocument DocLoader (string escapedTypeName);
+
+       public static class XmlDocUtils
+       {
+               public static XmlNodeList GetMemberGenericParameters (XmlNode member)
+               {
+                       return member.SelectNodes ("Docs/typeparam");
+               }
+
+               public static XmlNodeList GetTypeGenericParameters (XmlNode member)
+               {
+                       return member.SelectNodes ("/Type/TypeParameters/TypeParameter");
+               }
+
+               public static string ToTypeName (string type, XmlNode member)
+               {
+                       return ToTypeName (type, GetTypeGenericParameters (member), 
+                                       GetMemberGenericParameters (member));
+               }
+
+               public static string ToTypeName (string type, XmlNodeList typeGenParams, XmlNodeList memberGenParams)
+               {
+                       type = type.Replace ("&", "@").Replace ("<", "{").Replace (">", "}");
+                       for (int i = 0; i < typeGenParams.Count; ++i) {
+                               string name = typeGenParams [i].InnerText;
+                               type = Regex.Replace (type, @"\b" + name + @"\b", "`" + i);
+                       }
+                       for (int i = 0; i < memberGenParams.Count; ++i) {
+                               string name = memberGenParams [i].Attributes ["name"].Value;
+                               type = Regex.Replace (type, @"\b" + name + @"\b", "``" + i);
+                       }
+                       return type;
+               }
+
+               public static string ToEscapedTypeName (string name)
+               {
+                       return GetCountedName (name, "`");
+               }
+
+               private static string GetCountedName (string name, string escape)
+               {
+                       int lt = name.IndexOf ("<");
+                       if (lt == -1)
+                               return name;
+                       StringBuilder type = new StringBuilder (name.Length);
+                       int start = 0;
+                       do {
+                               type.Append (name.Substring (start, lt - start));
+                               type.Append (escape);
+                               type.Append (GetGenericCount (name, lt, out start));
+                       } while ((lt = name.IndexOf ('<', start)) >= 0);
+                       if (start < name.Length)
+                               type.Append (name.Substring (start));
+                       return type.ToString ().Replace ("+", ".");
+               }
+
+               private static int GetGenericCount (string name, int start, out int end)
+               {
+                       int n = 1;
+                       bool r = true;
+                       int i = start;
+                       int depth = 1;
+                       for ( ++i; r && i < name.Length; ++i) {
+                               switch (name [i]) {
+                                       case ',': if (depth == 1) ++n; break;
+                                       case '<': ++depth; break;
+                                       case '>': --depth; if (depth == 0) r = false; break;
+                               }
+                       }
+                       end = i;
+                       return n;
+               }
+
+               public static string ToEscapedMemberName (string member)
+               {
+                       // Explicitly implemented interface members contain '.'s in the member
+                       // name, e.g. System.Collections.Generic.IEnumerable<A>.GetEnumerator.
+                       // CSC does a s/\./#/g for these.
+                       member = member.Replace (".", "#");
+                       if (member [member.Length-1] == '>') {
+                               int i = member.LastIndexOf ("<");
+                               int ignore;
+                               return member.Substring (0, i).Replace ("<", "{").Replace (">", "}") + 
+                                       "``" + GetGenericCount (member, i, out ignore);
+                       }
+                       return member.Replace ("<", "{").Replace (">", "}");
+               }
+
+               public static void AddExtensionMethods (XmlDocument typexml, ArrayList/*<XmlNode>*/ extensions, DocLoader loader)
+               {
+                       // if no members (enum, delegate) don't add extensions
+                       XmlNode m = typexml.SelectSingleNode ("/Type/Members");
+                       if (m == null)
+                               return;
+
+                       // static classes can't be targets:
+                       if (typexml.SelectSingleNode (
+                                               "/Type/TypeSignature[@Language='C#']/@Value")
+                                       .Value.IndexOf (" static ") >= 0)
+                               return;
+
+                       foreach (string s in GetSupportedTypes (typexml, loader)) {
+                               foreach (XmlNode extension in extensions) {
+                                       bool add = false;
+                                       foreach (XmlNode target in extension.SelectNodes ("Targets/Target")) {
+                                               if (target.Attributes ["Type"].Value == s) {
+                                                       add = true;
+                                                       break;
+                                               }
+                                       }
+                                       if (!add) {
+                                               continue;
+                                       }
+                                       foreach (XmlNode c in extension.SelectNodes ("Member")) {
+                                               XmlNode cm = typexml.ImportNode (c, true);
+                                               m.AppendChild (cm);
+                                       }
+                               }
+                       }
+               }
+
+               private static IEnumerable GetSupportedTypes (XmlDocument type, DocLoader loader)
+               {
+                       yield return "System.Object";
+                       yield return GetEscapedPath (type, "Type/@FullName");
+
+                       Hashtable h = new Hashtable ();
+                       GetInterfaces (h, type, loader);
+
+                       string s = GetEscapedPath (type, "Type/Base/BaseTypeName");
+                       if (s != null) {
+                               yield return s;
+                               XmlDocument d;
+                               string p = s;
+                               while (s != null && (d = loader (s)) != null) {
+                                       GetInterfaces (h, d, loader);
+                                       s = GetEscapedPath (d, "Type/Base/BaseTypeName");
+                                       if (p == s)
+                                               break;
+                                       yield return s;
+                               }
+                       }
+
+                       foreach (object o in h.Keys)
+                               yield return o.ToString ();
+               }
+
+               private static string GetEscapedPath (XmlDocument d, string path)
+               {
+                       XmlNode n = d.SelectSingleNode (path);
+                       if (n == null)
+                               return null;
+                       return "T:" + ToEscapedTypeName (n.InnerText);
+               }
+
+               private static void GetInterfaces (Hashtable ifaces, XmlDocument doc, DocLoader loader)
+               {
+                       foreach (XmlNode n in doc.SelectNodes ("Type/Interfaces/Interface/InterfaceName")) {
+                               string t = ToEscapedTypeName (n.InnerText);
+                               string tk = "T:" + t;
+                               if (!ifaces.ContainsKey (tk)) {
+                                       ifaces.Add (tk, null);
+                                       try {
+                                               XmlDocument d = loader (t);
+                                               if (d != null)
+                                                       GetInterfaces (ifaces, d, loader);
+                                       }
+                                       catch (FileNotFoundException e) {
+                                               // ignore; interface documentation couldn't be found.
+                                       }
+                               }
+                       }
+               }
+
+               // Turns e.g. sources/netdocs into sources/cache/netdocs
+               public static string GetCacheDirectory (string assembledBase)
+               {
+                       return Path.Combine (
+                                               Path.Combine (Path.GetDirectoryName (assembledBase), "cache"),
+                                               Path.GetFileName (assembledBase));
+               }
+
+               public static string GetCachedFileName (string cacheDir, string url)
+               {
+                       return Path.Combine (cacheDir,
+                                            Uri.EscapeUriString (url).Replace ('/', '+').Replace ("*", "%2a"));
+               }
+       }
+}
+
diff --git a/mcs/tools/monkeydoc/Mono.Utilities/LRUCache.cs b/mcs/tools/monkeydoc/Mono.Utilities/LRUCache.cs
new file mode 100644 (file)
index 0000000..e479a96
--- /dev/null
@@ -0,0 +1,92 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Mono.Utilities
+{
+    public class LRUCache<TKey, TValue>
+    {
+           [ThreadStatic]
+           static LRUCache<TKey, TValue> deflt;
+
+           public static LRUCache<TKey, TValue> Default {
+                   get {
+                           return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
+                   }
+           }
+
+        int capacity;
+        LinkedList<ListValueEntry<TKey, TValue>> list;
+        Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
+        LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
+
+        public LRUCache (int capacity)
+        {
+            this.capacity = capacity;
+            this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
+            this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
+            this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
+        }
+
+        public void Put (TKey key, TValue value)
+        {
+            if (Get(key) == null) {
+                this.openNode.Value.ItemKey = key;
+                this.openNode.Value.ItemValue = value;
+                this.list.AddFirst (this.openNode);
+                this.lookup.Add (key, this.openNode);
+
+                if (this.list.Count > this.capacity) {
+                    // last node is to be removed and saved for the next addition to the cache
+                    this.openNode = this.list.Last;
+
+                    // remove from list & dictionary
+                    this.list.RemoveLast();
+                    this.lookup.Remove(this.openNode.Value.ItemKey);
+                } else {
+                    // still filling the cache, create a new open node for the next time
+                    this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue>(default(TKey), default(TValue)));
+                }
+            }
+        }
+
+        public TValue Get (TKey key)
+        {
+            LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
+            if (!this.lookup.TryGetValue (key, out node))
+                return default (TValue);
+            this.list.Remove (node);
+            this.list.AddFirst (node);
+            return node.Value.ItemValue;
+        }
+
+        class ListValueEntry<K, V> where K : TKey 
+                                   where V : TValue
+        {
+            internal V ItemValue;
+            internal K ItemKey;
+
+            internal ListValueEntry(K key, V value)
+            {
+                this.ItemKey = key;
+                this.ItemValue = value;
+            }
+        }
+    }
+}
diff --git a/mcs/tools/monkeydoc/Mono.Utilities/MemoryLRU.cs b/mcs/tools/monkeydoc/Mono.Utilities/MemoryLRU.cs
new file mode 100644 (file)
index 0000000..8b74861
--- /dev/null
@@ -0,0 +1,92 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Mono.Utilities
+{
+    public class LRUCache<TKey, TValue>
+    {
+           [ThreadStatic]
+           static LRUCache<TKey, TValue> deflt;
+
+           public static LRUCache<TKey, TValue> Default {
+                   get {
+                           return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
+                   }
+           }
+
+        int capacity;
+        LinkedList<ListValueEntry<TKey, TValue>> list;
+        Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
+        LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
+
+        public LRUCache (int capacity)
+        {
+            this.capacity = capacity;
+            this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
+            this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
+            this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
+        }
+
+        public void Put (TKey key, TValue value)
+        {
+            if (Get(key) == null) {
+                this.openNode.Value.Itemkey = key;
+                this.openNode.Value.Itemvalue = value;
+                this.list.AddFirst (this.openNode);
+                this.lookup.Add (key, this.openNode);
+
+                if (this.list.Count > this.capacity) {
+                    // last node is to be removed and saved for the next addition to the cache
+                    this.openNode = this.list.Last;
+
+                    // remove from list & dictionary
+                    this.list.RemoveLast();
+                    this.lookup.Remove(this.openNode.Value.Itemkey);
+                } else {
+                    // still filling the cache, create a new open node for the next time
+                    this.openNode = new LinkedListNode<ListValueEntry<Tkey, Tvalue>>(new ListValueEntry<Tkey, Tvalue>(default(Tkey), default(Tvalue)));
+                }
+            }
+        }
+
+        public TValue Get (TKey key)
+        {
+            LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
+            if (!this.lookup.TryGetValue (key, out node))
+                return default (TValue);
+            this.list.Remove (node);
+            this.list.AddFirst (node);
+            return node.Value.ItemValue;
+        }
+
+        class ListValueEntry<K, V> where K : TKey 
+                                   where V : TValue
+        {
+            internal V ItemValue;
+            internal K ItemKey;
+
+            internal ListValueEntry(K key, V value)
+            {
+                this.ItemKey = key;
+                this.ItemValue = value;
+            }
+        }
+    }
+}
diff --git a/mcs/tools/monkeydoc/Mono.Utilities/colorizer.cs b/mcs/tools/monkeydoc/Mono.Utilities/colorizer.cs
new file mode 100644 (file)
index 0000000..7444624
--- /dev/null
@@ -0,0 +1,171 @@
+using System;
+using System.Text.RegularExpressions;
+using System.Collections;
+
+namespace Mono.Utilities {
+       public class Colorizer {
+               //
+               // Syntax coloring
+               //
+
+               static string keywords_cs =
+                       "(\\babstract\\b|\\bevent\\b|\\bnew\\b|\\bstruct\\b|\\bas\\b|\\bexplicit\\b|\\bnull\\b|\\bswitch\\b|\\bbase\\b|\\bextern\\b|"
+                       +
+                       "\\bobject\\b|\\bthis\\b|\\bbool\\b|\\bfalse\\b|\\boperator\\b|\\bthrow\\b|\\bbreak\\b|\\bfinally\\b|\\bout\\b|\\btrue\\b|"
+                       +
+                       "\\bbyte\\b|\\bfixed\\b|\\boverride\\b|\\btry\\b|\\bcase\\b|\\bfloat\\b|\\bparams\\b|\\btypeof\\b|\\bcatch\\b|\\bfor\\b|"
+                       +
+                       "\\bprivate\\b|\\buint\\b|\\bchar\\b|\\bforeach\\b|\\bprotected\\b|\\bulong\\b|\\bchecked\\b|\\bgoto\\b|\\bpublic\\b|"
+                       +
+                       "\\bunchecked\\b|\\bclass\\b|\\bif\\b|\\breadonly\\b|\\bunsafe\\b|\\bconst\\b|\\bimplicit\\b|\\bref\\b|\\bushort\\b|"
+                       +
+                       "\\bcontinue\\b|\\bin\\b|\\breturn\\b|\\busing\\b|\\bdecimal\\b|\\bint\\b|\\bsbyte\\b|\\bvirtual\\b|\\bdefault\\b|"
+                       +
+                       "\\binterface\\b|\\bsealed\\b|\\bvolatile\\b|\\bdelegate\\b|\\binternal\\b|\\bshort\\b|\\bvoid\\b|\\bdo\\b|\\bis\\b|"
+                       +
+                       "\\bsizeof\\b|\\bwhile\\b|\\bdouble\\b|\\block\\b|\\bstackalloc\\b|\\belse\\b|\\blong\\b|\\bstatic\\b|\\benum\\b|"
+                       + "\\bnamespace\\b|\\bstring\\b)";
+
+#if false
+// currently not in use
+               static string keywords_vb =
+                       "(\\bAddHandler\\b|\\bAddressOf\\b|\\bAlias\\b|\\bAnd\\b|\\bAndAlso\\b|\\bAnsi\\b|\\bAs\\b|\\bAssembly\\b|"
+                       +
+                       "\\bAuto\\b|\\bBoolean\\b|\\bByRef\\b|\\bByte\\b|\\bByVal\\b|\\bCall\\b|\\bCase\\b|\\bCatch\\b|"
+                       +
+                       "\\bCBool\\b|\\bCByte\\b|\\bCChar\\b|\\bCDate\\b|\\bCDec\\b|\\bCDbl\\b|\\bChar\\b|\\bCInt\\b|"
+                       +
+                       "\\bClass\\b|\\bCLng\\b|\\bCObj\\b|\\bConst\\b|\\bCShort\\b|\\bCSng\\b|\\bCStr\\b|\\bCType\\b|"
+                       +
+                       "\\bDate\\b|\\bDecimal\\b|\\bDeclare\\b|\\bDefault\\b|\\bDelegate\\b|\\bDim\\b|\\bDirectCast\\b|\\bDo\\b|"
+                       +
+                       "\\bDouble\\b|\\bEach\\b|\\bElse\\b|\\bElseIf\\b|\\bEnd\\b|\\bEnum\\b|\\bErase\\b|\\bError\\b|"
+                       +
+                       "\\bEvent\\b|\\bExit\\b|\\bFalse\\b|\\bFinally\\b|\\bFor\\b|\\bFriend\\b|\\bFunction\\b|\\bGet\\b|"
+                       +
+                       "\\bGetType\\b|\\bGoSub\\b|\\bGoTo\\b|\\bHandles\\b|\\bIf\\b|\\bImplements\\b|\\bImports\\b|\\bIn\\b|"
+                       +
+                       "\\bInherits\\b|\\bInteger\\b|\\bInterface\\b|\\bIs\\b|\\bLet\\b|\\bLib\\b|\\bLike\\b|\\bLong\\b|"
+                       +
+                       "\\bLoop\\b|\\bMe\\b|\\bMod\\b|\\bModule\\b|\\bMustInherit\\b|\\bMustOverride\\b|\\bMyBase\\b|\\bMyClass\\b|"
+                       +
+                       "\\bNamespace\\b|\\bNew\\b|\\bNext\\b|\\bNot\\b|\\bNothing\\b|\\bNotInheritable\\b|\\bNotOverridable\\b|\\bObject\\b|"
+                       +
+                       "\\bOn\\b|\\bOption\\b|\\bOptional\\b|\\bOr\\b|\\bOrElse\\b|\\bOverloads\\b|\\bOverridable\\b|\\bOverrides\\b|"
+                       +
+                       "\\bParamArray\\b|\\bPreserve\\b|\\bPrivate\\b|\\bProperty\\b|\\bProtected\\b|\\bPublic\\b|\\bRaiseEvent\\b|\\bReadOnly\\b|"
+                       +
+                       "\\bReDim\\b|\\bREM\\b|\\bRemoveHandler\\b|\\bResume\\b|\\bReturn\\b|\\bSelect\\b|\\bSet\\b|\\bShadows\\b|"
+                       +
+                       "\\bShared\\b|\\bShort\\b|\\bSingle\\b|\\bStatic\\b|\\bStep\\b|\\bStop\\b|\\bString\\b|\\bStructure\\b|"
+                       +
+                       "\\bSub\\b|\\bSyncLock\\b|\\bThen\\b|\\bThrow\\b|\\bTo\\b|\\bTrue\\b|\\bTry\\b|\\bTypeOf\\b|"
+                       +
+                       "\\bUnicode\\b|\\bUntil\\b|\\bVariant\\b|\\bWhen\\b|\\bWhile\\b|\\bWith\\b|\\bWithEvents\\b|\\bWriteOnly\\b|\\bXor\\b)";
+#endif
+       
+               public static string Colorize(string text, string lang)
+               {
+                       lang = lang.Trim().ToLower();
+                       switch (lang) {
+                       case "xml":
+                               return ColorizeXml(text);
+                       case "cs": case "c#": case "csharp":
+                               return ColorizeCs(text);
+                       case "vb":
+                               return ColorizeVb(text);
+                       }
+                       return Escape (text);
+               }
+
+               static string ColorizeXml(string text)
+               {
+                       // Order is highly important.
+
+                       // s/ /&nbsp;/g must be first, as later substitutions add required spaces
+                       text = text.Replace(" ", "&nbsp;");
+
+                       // Find & mark XML elements
+                       Regex re = new Regex("<\\s*(\\/?)\\s*([\\s\\S]*?)\\s*(\\/?)\\s*>");
+                       text = re.Replace(text, "{blue:&lt;$1}{maroon:$2}{blue:$3&gt;}");
+
+                       // Colorize attribute strings; must be done before colorizing marked XML
+                       // elements so that we don't clobber the colorized XML tags.
+                       re = new Regex ("([\"'])(.*?)\\1");
+                       text = re.Replace (text, 
+                                       "$1<font color=\"purple\">$2</font>$1");
+
+                       // Colorize marked XML elements
+                       re = new Regex("\\{(\\w*):([\\s\\S]*?)\\}");
+                       //text = re.Replace(text, "<span style='color:$1'>$2</span>");
+                       text = re.Replace(text, "<font color=\"$1\">$2</font>");
+
+                       // Standard Structure
+                       text = text.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+                       re = new Regex("\r\n|\r|\n");
+                       text = re.Replace(text, "<br/>");
+
+                       return text;
+               }
+
+               static string ColorizeCs(string text)
+               {
+                       text = text.Replace(" ", "&nbsp;");
+
+                       text = text.Replace("<", "&lt;");
+                       text = text.Replace(">", "&gt;");
+
+                       Regex re = new Regex("\"((((?!\").)|\\\")*?)\"");
+
+                       text =
+                               re.Replace(text,
+                                               "<font color=\"purple\">\"$1\"</font>");
+                                               //"<span style='color:purple'>\"$1\"</span>");
+
+                       re = new
+                               Regex
+                               ("//(((.(?!\"</font>))|\"(((?!\").)*)\"</font>)*)(\r|\n|\r\n)");
+                               //("//(((.(?!\"</span>))|\"(((?!\").)*)\"</span>)*)(\r|\n|\r\n)");
+                       text =
+                               re.Replace(text,
+                                               "<font color=\"green\">//$1</font><br/>");
+                                       //      "<span style='color:green'>//$1</span><br/>");
+
+                       re = new Regex(keywords_cs);
+                       text = re.Replace(text, "<font color=\"blue\">$1</font>");
+                       //text = re.Replace(text, "<span style='color:blue'>$1</span>");
+
+                       text = text.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+                       text = text.Replace("\n", "<br/>");
+
+                       return text;
+               }
+
+               static string ColorizeVb(string text) {
+                       text = text.Replace(" ", "&nbsp;");
+
+                       /*      Regex re = new Regex ("\"((((?!\").)|\\\")*?)\"");
+                               text = re.Replace (text,"<span style='color:purple'>\"$1\"</span>");
+
+                               re = new Regex ("'(((.(?!\"\\<\\/span\\>))|\"(((?!\").)*)\"\\<\\/span\\>)*)(\r|\n|\r\n)");
+                               text = re.Replace (text,"<span style='color:green'>//$1</span><br/>");
+
+                               re = new Regex (keywords_vb);
+                               text = re.Replace (text,"<span style='color:blue'>$1</span>");
+                        */
+                       text = text.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+                       text = text.Replace("\n", "<br/>");
+                       return text;
+               }
+
+               static string Escape(string text)
+               {
+                       text = text.Replace("&", "&amp;");
+                       text = text.Replace(" ", "&nbsp;");
+                       text = text.Replace("<", "&lt;");
+                       text = text.Replace(">", "&gt;");
+                       text = text.Replace("\n", "<br/>");
+                       return text;
+               }
+       }
+}
diff --git a/mcs/tools/monkeydoc/Resources/.gitattributes b/mcs/tools/monkeydoc/Resources/.gitattributes
new file mode 100644 (file)
index 0000000..bfc0c0d
--- /dev/null
@@ -0,0 +1 @@
+/helper.js -crlf
diff --git a/mcs/tools/monkeydoc/Resources/Lminus.gif b/mcs/tools/monkeydoc/Resources/Lminus.gif
new file mode 100644 (file)
index 0000000..33c49d1
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/Lminus.gif differ
diff --git a/mcs/tools/monkeydoc/Resources/Lplus.gif b/mcs/tools/monkeydoc/Resources/Lplus.gif
new file mode 100644 (file)
index 0000000..9d2a2ac
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/Lplus.gif differ
diff --git a/mcs/tools/monkeydoc/Resources/base.css b/mcs/tools/monkeydoc/Resources/base.css
new file mode 100644 (file)
index 0000000..d264419
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+* base.css: CSS applied to all the docs 
+*
+* Author: Mario Sopena
+*/
+
+body, table {
+       margin: 0px;
+}
+
+body, table, pre, p {
+       font-family: @@FONT_FAMILY@@, sans-serif;
+       /* font-size: @@FONT_SIZE@@pt; */
+       font-size: 10pt;
+}
+
+div.header {
+    background-color: #FAFBFD;
+    font-size: 1.7em;
+    font-weight: bold;
+    padding: 8px 0 0 10px;
+    font-family: 'Segoe UI',Verdana,Arial;
+}
+
+div.title {
+       font-size: 130%;
+       font-weight: bolder;
+       margin-top: 0.3em;
+       margin-left: 0.2em;
+       margin-bottom: 0.1em;
+}
+
+.subtitle {
+       font-style: italic;
+}
+
diff --git a/mcs/tools/monkeydoc/Resources/ecmaspec-html-css.xsl b/mcs/tools/monkeydoc/Resources/ecmaspec-html-css.xsl
new file mode 100644 (file)
index 0000000..d9c4f7b
--- /dev/null
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<xsl:stylesheet 
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+       version="1.0"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+<xsl:output omit-xml-declaration="yes" />
+
+<xsl:template match="/clause">
+       <div class="header" id="ecmaspec">
+               <div class="subtitle">ECMA-334 C# Language Specification</div> 
+               <div class="title"><xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
+               <xsl:if test="@informative"> (informative) </xsl:if></div>
+       </div>
+       <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="paragraph">
+       <p>
+               <xsl:apply-templates />
+       </p>
+</xsl:template>
+
+<xsl:template match="keyword">
+        <span class="keyword"> <xsl:apply-templates/></span> <xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template match="hyperlink">
+       <a href="ecmaspec:{.}">
+               <xsl:value-of select="." />
+       </a>
+</xsl:template>
+
+<xsl:template match="list">
+       <ul>
+               <xsl:for-each select="list_item|list">
+                       <li><xsl:apply-templates /></li>
+               </xsl:for-each>
+       </ul>
+</xsl:template>
+
+<xsl:template match="code_example">
+       <div class="code_example">
+          <div class="code_ex_title">Code example</div>
+          <span class="code">
+                 <xsl:value-of select="monodoc:Colorize(string(descendant-or-self::text()), string('csharp'))" disable-output-escaping="yes" />
+          </span>
+       </div>
+</xsl:template>
+
+<xsl:template match="symbol">
+       <span class="symbol">
+               <xsl:apply-templates />
+       </span>
+</xsl:template>
+
+<xsl:template match="grammar_production">
+       <dl class="nt_{name/non_terminal/.}">
+               <dt><xsl:value-of select="name/non_terminal/." /></dt>
+               
+               <xsl:for-each select="rhs">
+               <dd>
+                       <xsl:apply-templates select="node()" />
+               </dd>
+               </xsl:for-each>
+       </dl>
+</xsl:template>
+
+<xsl:template match="non_terminal">
+       <span class="non_terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
+</xsl:template>
+
+<xsl:template match="terminal">
+       <span class="terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
+</xsl:template>
+
+<xsl:template match="opt">
+       <xsl:text> (</xsl:text><span class="opt">optional</span><xsl:text>) </xsl:text>
+</xsl:template>
+
+<xsl:template match="note|example">
+       <div class="note">
+               <xsl:apply-templates />
+       </div>
+</xsl:template>
+
+<xsl:template match="table_line">
+    <xsl:apply-templates /><br />
+</xsl:template>
+
+<xsl:template match="@*|node()">
+       <xsl:copy>
+               <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/ecmaspec-html.xsl b/mcs/tools/monkeydoc/Resources/ecmaspec-html.xsl
new file mode 100644 (file)
index 0000000..631ee03
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output omit-xml-declaration="yes" />
+
+<xsl:template match="/clause">
+       <table width="100%" cellpadding="5">
+               <tr bgcolor="#b0c4de"><td>
+               <i>ECMA-334 C# Language Specification</i>
+
+               <h3>
+                       <xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
+                       
+                       <xsl:if test="@informative">
+                               (informative)
+                       </xsl:if>
+               </h3>
+               </td></tr>
+       </table>
+       
+       <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="paragraph">
+       <p>
+               <xsl:apply-templates />
+       </p>
+</xsl:template>
+
+<xsl:template match="keyword">
+        <i> <xsl:apply-templates/></i> <xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template match="hyperlink">
+       <a href="ecmaspec:{.}">
+               <xsl:value-of select="." />
+       </a>
+</xsl:template>
+
+<xsl:template match="list">
+       <ul>
+               <xsl:for-each select="list_item|list">
+                       <li><xsl:apply-templates /></li>
+               </xsl:for-each>
+       </ul>
+</xsl:template>
+
+<xsl:template match="code_example">
+  <table bgcolor="#f5f5dd" border="1" cellpadding="5">
+       <tr>
+         <td>
+           <pre>
+                 <xsl:apply-templates />
+           </pre>
+         </td>
+       </tr>
+  </table>
+</xsl:template>
+
+<xsl:template match="symbol">
+       <code>
+               <xsl:apply-templates />
+       </code>
+</xsl:template>
+
+<xsl:template match="grammar_production">
+       <dl id="nt_{name/non_terminal/.}">
+               <dt><xsl:value-of select="name/non_terminal/." /></dt>
+               
+               <xsl:for-each select="rhs">
+               <dd>
+                       <xsl:apply-templates select="node()" />
+               </dd>
+               </xsl:for-each>
+       </dl>
+</xsl:template>
+
+<xsl:template match="non_terminal">
+
+       <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
+</xsl:template>
+
+<xsl:template match="terminal">
+       <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
+</xsl:template>
+
+<xsl:template match="opt">
+       <sub>opt</sub>
+</xsl:template>
+
+<xsl:template match="@*|node()">
+       <xsl:copy>
+               <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/ecmaspec.css b/mcs/tools/monkeydoc/Resources/ecmaspec.css
new file mode 100644 (file)
index 0000000..341f439
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+* ecmaspec.css: CSS applied to ECMA C# specs
+*
+* Author: Mario Sopena
+*/
+
+#ecmaspec {
+       background: #a4dda4; /*#83b183;*/
+       border: 2px solid #556655;
+}
+
+p {
+       text-align: justify;
+       margin-top: .5em;
+       margin-bottom: .5em;
+}
+
+span.keyword {
+   color: #a6563a;
+}
+
+a:link {
+       text-decoration: none;
+}
+
+a:hover {
+       text-decoration: underline;
+}
+
+div.code_example {
+   background: #f5f5dd;
+   border: 1px solid #cdcd82;
+   border: 1px solid black;
+   padding-left: 1em;
+   padding-bottom: 1em;
+   margin-top: 1em;
+   font-family: fixed;
+   white-space: pre;
+   margin-bottom: 1em;
+}
+div.code_ex_title {
+   position: relative;
+   top: -1em;
+   left: 30%;
+   background: #cdcd82;
+   border: 1px solid black;
+   color: black;
+   text-transform: uppercase;
+   width: 40%;
+   padding: 0.3em;
+   text-align: center;
+}
+
+span.symbol {
+       font-weight: bolder;
+}
+
+
+span.optional {
+       font-style: italic;
+}
+
+div.note {
+   background: #cdcd82;
+   border: 1px solid black;
+   padding: 1em;
+   margin-top: 1em;
+   margin-bottom: 1em;
+}
diff --git a/mcs/tools/monkeydoc/Resources/helper.js b/mcs/tools/monkeydoc/Resources/helper.js
new file mode 100755 (executable)
index 0000000..2889c1b
--- /dev/null
@@ -0,0 +1,12 @@
+function toggle_display (block) {\r
+  var w = document.getElementById (block);\r
+  var t = document.getElementById (block + ":toggle");\r
+  if (w.style.display == "none") {\r
+    w.style.display = "block";\r
+               t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lminus.gif"); // <img src="xtree/images/clean/Lminus.gif">\r
+  } else {\r
+    w.style.display = "none";\r
+               t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lplus.gif"); // <img src="xtree/images/clean/Lplus.gif">\r
+  }\r
+}\r
+\r
diff --git a/mcs/tools/monkeydoc/Resources/home.html b/mcs/tools/monkeydoc/Resources/home.html
new file mode 100644 (file)
index 0000000..2d748a7
--- /dev/null
@@ -0,0 +1,69 @@
+<head>
+<style type="text/css">
+/* GENERAL */
+
+body, table {
+       font-family: @@FONT_FAMILY@@, sans-serif;
+       font-size: @@FONT_SIZE@@%;
+}
+
+/* ECMA BLOCK */
+#docs {
+       margin-bottom: 1em;
+}
+
+/* CONTRIBUTIONS */
+#contrib {
+       margin-top: 2em;
+       width: 98%;
+       margin-left: 1%;
+       color: black;
+       background: #fff3f3;
+       border: 1px solid #ffc9c9;
+       @@EDITING_ENABLED@@
+       }
+#contribTitle {
+       text-align: left;
+       font-weight: bold;
+       padding: .4em;
+       font-size: 110%;
+       @@CONTRIB_DISP@@
+}
+#contrib #content {
+       padding: .4em;
+}
+#some-contrib {
+       @@CONTRIB_DISP@@
+}
+#no-contrib {
+       @@NO_CONTRIB_DISP@@
+}
+#contrib p {
+       text-indent: 1em;
+       text-align: justify;
+       }
+</style>
+<link type="text/css" rel="stylesheet" href="mono-ecma.css"/>
+</head>
+
+<div class="Content">
+  <p>The following documentation collections are available:
+  
+  <div id="docs">
+       <ul>
+           @@API_DOCS@@
+       </ul>
+  </div>
+  
+  <div id="contrib">
+       <div id="contribTitle">Contributions</div>
+       <div id="content">
+               <div id="some-contrib">
+                       @@CONTRIBS@@
+               </div>
+               <div id="no-contrib">
+                       <p><b>You have not made any contributions yet.</b></p>
+                       <p>The Documentation of the libraries is not complete and your contributions would be greatly appreciated. The procedure is easy, browse to the part of the documentation you want to contribute to and click on the <font color="blue">[Edit]</font> link to start writing documentation.</p>
+                       <p>When you are happy with your changes, use the Contributing--&gt; Upload Contribution--&gt; menu to send your contributions to our server.</p></div>  </div>
+  </div>
+</div>
diff --git a/mcs/tools/monkeydoc/Resources/images/bc_bg.png b/mcs/tools/monkeydoc/Resources/images/bc_bg.png
new file mode 100644 (file)
index 0000000..6f7bca7
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/bc_bg.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/bc_separator.png b/mcs/tools/monkeydoc/Resources/images/bc_separator.png
new file mode 100644 (file)
index 0000000..c137258
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/bc_separator.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/error.png b/mcs/tools/monkeydoc/Resources/images/error.png
new file mode 100644 (file)
index 0000000..628cf2d
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/error.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/hatch.png b/mcs/tools/monkeydoc/Resources/images/hatch.png
new file mode 100644 (file)
index 0000000..33bf2c2
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/hatch.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/headerbg.png b/mcs/tools/monkeydoc/Resources/images/headerbg.png
new file mode 100644 (file)
index 0000000..15575da
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/headerbg.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/help.png b/mcs/tools/monkeydoc/Resources/images/help.png
new file mode 100644 (file)
index 0000000..5c87017
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/help.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/house.png b/mcs/tools/monkeydoc/Resources/images/house.png
new file mode 100644 (file)
index 0000000..fed6221
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/house.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/members.png b/mcs/tools/monkeydoc/Resources/images/members.png
new file mode 100644 (file)
index 0000000..4a8672b
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/members.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/namespace.png b/mcs/tools/monkeydoc/Resources/images/namespace.png
new file mode 100644 (file)
index 0000000..2bc1624
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/namespace.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privclass.png b/mcs/tools/monkeydoc/Resources/images/privclass.png
new file mode 100644 (file)
index 0000000..bb0c871
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privclass.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privdelegate.png b/mcs/tools/monkeydoc/Resources/images/privdelegate.png
new file mode 100644 (file)
index 0000000..a5b470e
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privdelegate.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privenumeration.png b/mcs/tools/monkeydoc/Resources/images/privenumeration.png
new file mode 100644 (file)
index 0000000..df2c3c9
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privenumeration.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privevent.png b/mcs/tools/monkeydoc/Resources/images/privevent.png
new file mode 100644 (file)
index 0000000..e1d3887
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privevent.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privextension.png b/mcs/tools/monkeydoc/Resources/images/privextension.png
new file mode 100644 (file)
index 0000000..d336ddd
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privextension.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privfield.png b/mcs/tools/monkeydoc/Resources/images/privfield.png
new file mode 100644 (file)
index 0000000..0b246cf
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privfield.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privinterface.png b/mcs/tools/monkeydoc/Resources/images/privinterface.png
new file mode 100644 (file)
index 0000000..cde4b50
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privinterface.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privmethod.png b/mcs/tools/monkeydoc/Resources/images/privmethod.png
new file mode 100644 (file)
index 0000000..d698426
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privmethod.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privproperty.png b/mcs/tools/monkeydoc/Resources/images/privproperty.png
new file mode 100644 (file)
index 0000000..41a008d
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privproperty.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/privstructure.png b/mcs/tools/monkeydoc/Resources/images/privstructure.png
new file mode 100644 (file)
index 0000000..ff064e6
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/privstructure.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protclass.png b/mcs/tools/monkeydoc/Resources/images/protclass.png
new file mode 100644 (file)
index 0000000..0c32ce0
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protclass.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protdelegate.png b/mcs/tools/monkeydoc/Resources/images/protdelegate.png
new file mode 100644 (file)
index 0000000..ca44396
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protdelegate.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protenumeration.png b/mcs/tools/monkeydoc/Resources/images/protenumeration.png
new file mode 100644 (file)
index 0000000..14a4cf3
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protenumeration.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protevent.png b/mcs/tools/monkeydoc/Resources/images/protevent.png
new file mode 100644 (file)
index 0000000..613e88e
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protevent.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protextension.png b/mcs/tools/monkeydoc/Resources/images/protextension.png
new file mode 100644 (file)
index 0000000..f350d55
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protextension.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protfield.png b/mcs/tools/monkeydoc/Resources/images/protfield.png
new file mode 100644 (file)
index 0000000..6e08553
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protfield.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protinterface.png b/mcs/tools/monkeydoc/Resources/images/protinterface.png
new file mode 100644 (file)
index 0000000..4579a76
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protinterface.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protmethod.png b/mcs/tools/monkeydoc/Resources/images/protmethod.png
new file mode 100644 (file)
index 0000000..4ecb6ff
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protmethod.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protproperty.png b/mcs/tools/monkeydoc/Resources/images/protproperty.png
new file mode 100644 (file)
index 0000000..f79838a
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protproperty.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/protstructure.png b/mcs/tools/monkeydoc/Resources/images/protstructure.png
new file mode 100644 (file)
index 0000000..9b806cc
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/protstructure.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubclass.png b/mcs/tools/monkeydoc/Resources/images/pubclass.png
new file mode 100644 (file)
index 0000000..7531558
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubclass.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubdelegate.png b/mcs/tools/monkeydoc/Resources/images/pubdelegate.png
new file mode 100644 (file)
index 0000000..19368a6
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubdelegate.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubenumeration.png b/mcs/tools/monkeydoc/Resources/images/pubenumeration.png
new file mode 100644 (file)
index 0000000..9adab41
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubenumeration.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubevent.png b/mcs/tools/monkeydoc/Resources/images/pubevent.png
new file mode 100644 (file)
index 0000000..7abef63
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubevent.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubextension.png b/mcs/tools/monkeydoc/Resources/images/pubextension.png
new file mode 100644 (file)
index 0000000..0725306
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubextension.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubfield.png b/mcs/tools/monkeydoc/Resources/images/pubfield.png
new file mode 100644 (file)
index 0000000..c2fc5a2
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubfield.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubinterface.png b/mcs/tools/monkeydoc/Resources/images/pubinterface.png
new file mode 100644 (file)
index 0000000..050ea99
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubinterface.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubmethod.png b/mcs/tools/monkeydoc/Resources/images/pubmethod.png
new file mode 100644 (file)
index 0000000..50ad06d
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubmethod.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubproperty.png b/mcs/tools/monkeydoc/Resources/images/pubproperty.png
new file mode 100644 (file)
index 0000000..2f0ef15
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubproperty.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/pubstructure.png b/mcs/tools/monkeydoc/Resources/images/pubstructure.png
new file mode 100644 (file)
index 0000000..161f2fc
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/pubstructure.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/reference.png b/mcs/tools/monkeydoc/Resources/images/reference.png
new file mode 100644 (file)
index 0000000..9720bf8
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/reference.png differ
diff --git a/mcs/tools/monkeydoc/Resources/images/treebg.png b/mcs/tools/monkeydoc/Resources/images/treebg.png
new file mode 100644 (file)
index 0000000..a5588a9
Binary files /dev/null and b/mcs/tools/monkeydoc/Resources/images/treebg.png differ
diff --git a/mcs/tools/monkeydoc/Resources/mdoc-html-format.xsl b/mcs/tools/monkeydoc/Resources/mdoc-html-format.xsl
new file mode 100644 (file)
index 0000000..10acd9c
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<!--
+       mdoc-html-format.xsl: HTML pass-through formatting support
+
+       Author: Jonathan Pryor (jpryor@novell.com)
+
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       >
+
+       <!-- pass-through any other elements unchanged - they may be HTML -->
+       <xsl:template match="//format[@type='text/html']//*">
+               <xsl:copy>
+                       <xsl:copy-of select="@*" />
+                       <xsl:apply-templates select="*|node()" />
+               </xsl:copy>
+       </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/mcs/tools/monkeydoc/Resources/mdoc-html-utils.xsl b/mcs/tools/monkeydoc/Resources/mdoc-html-utils.xsl
new file mode 100644 (file)
index 0000000..4403d09
--- /dev/null
@@ -0,0 +1,2771 @@
+<?xml version="1.0"?>
+
+<!--
+       mdoc-html-utils.xsl: ECMA-style docs to HTML stylesheet transformation utils
+
+       Author: Joshua Tauberer (tauberer@for.net)
+       Author: Jonathan Pryor (jpryor@novell.com)
+
+       This file requires that including files define the following callable
+       templates:
+               - CreateCodeBlock (language, content)
+               - CreateEnumerationTable (content)
+               - CreateHeader (content)
+               - CreateListTable (header, content)
+               - CreateMembersTable (content)
+               - CreateSignature (content)
+               - CreateTypeDocumentationTable (content)
+               - GetLinkTarget (type, cref)
+               - CreateEditLink (e)
+
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:msxsl="urn:schemas-microsoft-com:xslt"
+       exclude-result-prefixes="msxsl"
+       >
+       <xsl:import href="mdoc-html-format.xsl" />
+       
+       <!-- TEMPLATE PARAMETERS -->
+       <xsl:param name="language" select="'C#'"/>
+       <xsl:param name="index" />
+       <xsl:param name="source-id"/>
+       
+       <xsl:variable name="ThisType" select="/Type"/>
+
+       <!-- The namespace that the current type belongs to. -->
+       <xsl:variable name="TypeNamespace" select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)"/>            
+
+       <!-- THE MAIN RENDERING TEMPLATE -->
+
+       <!-- TYPE OVERVIEW -->
+               
+       <xsl:template name="CreateTypeOverview">
+               <xsl:param name="implemented" />
+               <xsl:param name="show-members-link" />
+
+               <xsl:attribute name="id">
+                       <xsl:text>T:</xsl:text>
+                       <xsl:call-template name="GetEscapedTypeName">
+                               <xsl:with-param name="typename" select="@FullName" />
+                       </xsl:call-template>
+                       <xsl:text>:Summary</xsl:text>
+               </xsl:attribute>
+               <!-- summary -->
+               <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+               <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+
+               <xsl:if test="$implemented">
+                       <p><b>Mono Implementation Note: </b></p>
+                       <blockquote>
+                               <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
+                       </blockquote>
+               </xsl:if>
+
+               <xsl:if test="$show-members-link and not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate') and count(Members)">
+                       <p>
+                               See Also:
+                               <a>
+                                       <xsl:attribute name="href">
+                                               <xsl:text>T</xsl:text>
+                                               <xsl:call-template name="GetLinkId">
+                                                       <xsl:with-param name="type" select="." />
+                                                       <xsl:with-param name="member" select="." />
+                                               </xsl:call-template>
+                                               <xsl:text>/*</xsl:text>
+                                       </xsl:attribute>
+                                       <xsl:value-of select="translate(@Name, '+', '.')"/>
+                                       <xsl:value-of select="' '" />
+                                       <xsl:text>Members</xsl:text>
+                               </a>
+                       </p>
+               </xsl:if>
+               
+               <!--
+               Inheritance tree, but only for non-standard classes and not for interfaces
+               -->
+               <xsl:if test="not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.ValueType' or Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.MulticatDelegate' or count(Base/ParentType)=0)">
+                       <p>
+                       <xsl:for-each select="Base/ParentType">
+                               <xsl:sort select="@Order" order="descending"/>
+                               <xsl:variable name="p" select="position()" />
+                               <xsl:for-each select="parent::Base/ParentType[position() &lt; $p]">
+                                       <xsl:value-of select="'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'" disable-output-escaping="yes"/>
+                               </xsl:for-each>
+                               <a>
+                                       <xsl:attribute name="href">
+                                               <xsl:call-template name="GetLinkTargetHtml">
+                                                       <xsl:with-param name="type" select="@Type" />
+                                                       <xsl:with-param name="cref">
+                                                               <xsl:text>T:</xsl:text>
+                                                               <xsl:call-template name="GetEscapedTypeName">
+                                                                       <xsl:with-param name="typename" select="@Type" />
+                                                               </xsl:call-template>
+                                                       </xsl:with-param>
+                                               </xsl:call-template>
+                                       </xsl:attribute>
+                                       <xsl:value-of select="@Type"/>
+                               </a>
+                               <br/>
+                       </xsl:for-each>
+
+                       <xsl:for-each select="Base/ParentType">
+                               <xsl:value-of select="'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'" disable-output-escaping="yes"/>
+                       </xsl:for-each>
+                       <xsl:value-of select="@FullName"/>
+                       </p>
+               </xsl:if>
+               <!--
+               <xsl:if test="Base/BaseTypeName='System.Enum'">
+                       <br/>
+                       The type of the values in this enumeration is 
+                       <xsl:apply-templates select="Members/Member[@MemberName='value__']/ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
+               </xsl:if>
+               -->
+       </xsl:template>
+
+       <xsl:template name="CreateTypeSignature">
+                       <xsl:attribute name="id">
+                               <xsl:text>T:</xsl:text>
+                               <xsl:call-template name="GetEscapedTypeName">
+                                       <xsl:with-param name="typename" select="@FullName" />
+                               </xsl:call-template>
+                               <xsl:text>:Signature</xsl:text>
+                       </xsl:attribute>
+                       <!-- signature -->
+                       <xsl:call-template name="CreateSignature">
+                               <xsl:with-param name="content">
+                                       <xsl:choose>
+                                       <xsl:when test="$language='C#'">
+
+                                               <xsl:for-each select="Attributes/Attribute">
+                                                       <xsl:text>[</xsl:text>
+                                                       <xsl:value-of select="AttributeName"/>
+                                                       <xsl:text>]</xsl:text>
+                                                       <br/>
+                                               </xsl:for-each>
+
+                                               <xsl:for-each select="ReturnValue/Attributes/Attribute">
+                                                       <xsl:text>[return:</xsl:text>
+                                                       <xsl:value-of select="AttributeName"/>
+                                                       <xsl:text>]</xsl:text>
+                                                       <br/>
+                                               </xsl:for-each> 
+       
+                                               <xsl:choose>
+
+                                               <xsl:when test="Base/BaseTypeName='System.Enum'">
+                                                       <xsl:call-template name="getmodifiers">
+                                                               <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+                                                       </xsl:call-template>
+
+                                                       <xsl:text>enum </xsl:text>
+       
+                                                       <!-- member name, argument list -->
+                                                       <b>
+                                                       <xsl:value-of select="translate (@Name, '+', '.')"/>
+                                                       </b>
+                                               </xsl:when>
+       
+                                               <xsl:when test="Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate'">
+                                                       <xsl:choose>
+
+                                                       <xsl:when test="count(Parameters) &gt; 0 and count(ReturnValue) &gt; 0">
+                                                       <!-- Only recreate the delegate signature if the appropriate information
+                                                               is present in the XML file. -->
+
+                                                       <xsl:call-template name="getmodifiers">
+                                                               <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+                                                       </xsl:call-template>
+
+                                                       <xsl:text>delegate </xsl:text>
+       
+                                                       <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+       
+                                                       <!-- hard space -->
+                                                       <xsl:value-of select="' '"/>
+       
+                                                       <!-- member name, argument list -->
+                                                       <b>
+                                                               <xsl:call-template name="GetDefinitionName">
+                                                                       <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
+                                                                       <xsl:with-param name="TypeParameters" select="TypeParameters" />
+                                                               </xsl:call-template>
+                                                       </b>
+
+                                                       <!-- hard space -->
+                                                       <xsl:value-of select="' '"/>
+
+                                                       <xsl:value-of select="'('"/> <!-- prevents whitespace issues -->
+                                                       
+                                                       <xsl:for-each select="Parameters/Parameter">
+                                                               <xsl:call-template name="ShowParameter">
+                                                                       <xsl:with-param name="Param" select="."/>
+                                                                       <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                                               </xsl:call-template>
+
+                                                               <xsl:if test="not(position()=last())">, </xsl:if>
+                                                       </xsl:for-each>
+                                                       
+                                                       <xsl:value-of select="')'"/>
+
+                                                       </xsl:when>
+                                                       
+                                                       <xsl:otherwise>
+                                                               <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>       
+                                                       </xsl:otherwise>
+
+                                                       </xsl:choose>
+
+                                                       
+                                               </xsl:when>
+
+                                               <xsl:otherwise>
+                                                       <xsl:call-template name="getmodifiers">
+                                                               <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+                                                               <xsl:with-param name="typetype" select="true()"/>
+                                                       </xsl:call-template>
+               
+                                                       <xsl:value-of select="' '"/>
+               
+                                                       <b>
+                                                               <xsl:call-template name="GetDefinitionName">
+                                                                       <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
+                                                                       <xsl:with-param name="TypeParameters" select="TypeParameters" />
+                                                               </xsl:call-template>
+                                                       </b>
+               
+                                                       <xsl:variable name="HasStandardBaseType" select="Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.ValueType'"/>
+                                                       <xsl:variable name="HasBaseType" select="count(Base/BaseTypeName)>0"/>
+                                                       <xsl:if test="(($HasBaseType) and not($HasStandardBaseType)) or not(count(Interfaces/Interface)=0)">
+                                                               <xsl:text> : </xsl:text>
+               
+                                                               <xsl:if test="$HasBaseType and not($HasStandardBaseType)">
+                                                                       <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+                                                                       <xsl:if test="not(count(Interfaces/Interface)=0)">,     </xsl:if>
+                                                               </xsl:if>
+               
+                                                               <xsl:for-each select="Interfaces/Interface">
+                                                                       <xsl:if test="not(position()=1)">, </xsl:if>
+                                                                       <xsl:apply-templates select="InterfaceName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+                                                               </xsl:for-each>
+                                                       
+                                                       </xsl:if>
+                                               </xsl:otherwise>
+
+                                               </xsl:choose>
+
+                                               <xsl:call-template name="CreateGenericConstraints">
+                                                       <xsl:with-param name="TypeParameters" select="TypeParameters" />
+                                               </xsl:call-template>
+
+                                       </xsl:when>
+
+                                       <xsl:otherwise>
+                                               <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
+                                       </xsl:otherwise>
+                                       
+                                       </xsl:choose>
+                               </xsl:with-param>
+                       </xsl:call-template>
+       </xsl:template>
+
+       <xsl:template name="GetDefinitionName">
+               <xsl:param name="name" />
+               <xsl:param name="TypeParameters" />
+
+               <xsl:choose>
+                       <!-- do NOT process explicitly implemented generic interface members
+                            unless they're actually generic methods. -->
+                       <xsl:when test="contains ($name, '&gt;') and
+                                       '&gt;' = substring ($name, string-length ($name), 1)">
+                               <xsl:value-of select="substring-before ($name, '&lt;')" />
+                               <xsl:text>&lt;</xsl:text>
+                               <xsl:for-each select="$TypeParameters/TypeParameter">
+                                       <xsl:for-each select="Attributes/Attribute">
+                                               <xsl:text>[</xsl:text>
+                                               <xsl:value-of select="AttributeName"/>
+                                               <xsl:text>] </xsl:text>
+                                       </xsl:for-each>
+                                       <xsl:choose>
+                                               <xsl:when test="@Name">
+                                                       <xsl:value-of select="@Name" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="." />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                       <xsl:if test="not(position()=last())">, </xsl:if>
+                               </xsl:for-each>
+                               <xsl:text>&gt;</xsl:text>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$name" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="CreateGenericConstraints">
+               <xsl:param name="TypeParameters" />
+
+               <xsl:for-each select="$TypeParameters/TypeParameter">
+                       <xsl:variable name="constraintsCount" select="count(Constraints/*)" />
+                       <xsl:if test="$constraintsCount > 0 and count(Constraints/*[.='Contravariant' or .='Covariant']) != $constraintsCount">
+                               <xsl:call-template name="CreateGenericParameterConstraints">
+                                       <xsl:with-param name="constraints" select="Constraints" />
+                               </xsl:call-template>
+                       </xsl:if>
+               </xsl:for-each>
+       </xsl:template>
+
+       <xsl:template name="CreateGenericParameterConstraints">
+               <xsl:param name="constraints" />
+
+               <br />
+               <xsl:text> where </xsl:text>
+               <xsl:value-of select="@Name" />
+               <xsl:text> : </xsl:text>
+               <xsl:variable name="kind" 
+                       select="count($constraints[ParameterAttribute='ReferenceTypeConstraint'])+
+                               count($constraints[ParameterAttribute='NotNullableValueTypeConstraint'])" />
+               <xsl:variable name="base" select="count($constraints/BaseTypeName)" />
+               <xsl:variable name="iface" select="count($constraints/InterfaceName)" />
+               <xsl:variable name="struct" select="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'" />
+               <xsl:if test="$constraints/ParameterAttribute='ReferenceTypeConstraint'">
+                       <xsl:text>class</xsl:text>
+               </xsl:if>
+               <xsl:if test="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'">
+                       <xsl:text>struct</xsl:text>
+               </xsl:if>
+               <xsl:if test="$constraints/BaseTypeName and not($struct)">
+                       <xsl:if test="$kind">, </xsl:if>
+                       <xsl:apply-templates select="$constraints/BaseTypeName" mode="typelink" />
+               </xsl:if>
+               <xsl:for-each select="$constraints/InterfaceName">
+                       <xsl:if test="position()=1">
+                               <xsl:if test="$kind or $base">, </xsl:if>
+                       </xsl:if>
+                       <xsl:apply-templates select="." mode="typelink" />
+                       <xsl:if test="not(position()=last())">, </xsl:if>
+               </xsl:for-each>
+               <xsl:if test="$constraints/ParameterAttribute='DefaultConstructorConstraint' and not($struct)">
+                       <xsl:if test="$base or $iface">, </xsl:if>
+                       <xsl:text>new()</xsl:text>
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="CreateMemberOverview">
+               <xsl:param name="implemented" />
+
+               <p class="Summary">
+                       <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+                       <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+               </p>
+
+               <xsl:if test="$implemented">
+                       <p><b>Mono Implementation Note: </b></p>
+                       <blockquote>
+                               <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
+                       </blockquote>
+               </xsl:if>
+
+               <!-- member value -->
+               <xsl:if test="MemberValue">
+               <p><b>Value: </b>
+                       <xsl:value-of select="MemberValue"/>
+               </p>
+               </xsl:if>
+
+       </xsl:template>
+
+       <xsl:template name="CreateRelatedSection">
+         <xsl:param name="section" />
+         <xsl:param name="type" />
+         <xsl:if test="count(Docs/related[@type=$type])">
+               <h3 class="{$type}"><xsl:value-of select="$section" /></h3>
+               <ul class="{$type}">
+                 <xsl:for-each select="Docs/related[@type=$type]">
+                       <li><a href="{@href}"><xsl:value-of select="." /></a></li>
+                 </xsl:for-each>
+               </ul>
+         </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="CreatePlatformRequirements">
+         <!-- For now we only have that information in MonoTouch so only process that -->
+         <xsl:if test="starts-with(/Type/@FullName, 'MonoTouch')">
+               <xsl:choose>
+                 <!-- We first check if we have a [Since] at the member level -->
+                 <xsl:when test="count(Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+                       <b>Minimum iOS version: </b>
+                       <xsl:value-of select="translate(substring-before (substring-after (Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+                       <br />
+                 </xsl:when>
+                 <!-- If not, we then check at the type level -->
+                 <xsl:when test="count(/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
+                       <b>Minimum iOS version: </b> 
+                       <xsl:value-of select="translate(substring-before (substring-after (/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
+                       <br />
+                 </xsl:when>
+               </xsl:choose>
+         </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="CreateMemberSignature">
+               <xsl:param name="linkid" select="''" />
+
+               <xsl:call-template name="CreateSignature">
+                       <xsl:with-param name="content">
+                       <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
+                               <p><i>This is the default property for this class.</i></p>
+                       </xsl:if>
+
+                       <!-- recreate the signature -->
+               
+                       <xsl:for-each select="Attributes/Attribute[AttributeName != 'System.Runtime.CompilerServices.Extension']">
+                               <xsl:text>[</xsl:text>
+                               <xsl:value-of select="AttributeName"/>
+                               <xsl:text>]</xsl:text>
+                               <br/>
+                       </xsl:for-each> 
+
+                       <xsl:for-each select="ReturnValue/Attributes/Attribute">
+                               <xsl:text>[return:</xsl:text>
+                               <xsl:value-of select="AttributeName"/>
+                               <xsl:text>]</xsl:text>
+                               <br/>
+                       </xsl:for-each> 
+
+                       <xsl:call-template name="getmodifiers">
+                               <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
+                       </xsl:call-template>
+
+                       <xsl:if test="MemberType = 'Event'">
+                               <xsl:text>event </xsl:text>
+
+                               <xsl:if test="ReturnValue/ReturnType=''">
+                                       <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, 'event '), concat(' ', @MemberName))"/>
+                               </xsl:if>
+                       </xsl:if>
+
+                       <!-- return value (comes out "" where not applicable/available) -->
+                       <xsl:choose>
+                       <xsl:when test="@MemberName='op_Implicit'">
+                               <xsl:text>implicit operator</xsl:text>
+                       </xsl:when>
+                       <xsl:when test="@MemberName='op_Explicit'">
+                               <xsl:text>explicit operator</xsl:text>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
+                                       <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                               </xsl:apply-templates>
+                       </xsl:otherwise>                                        
+                       </xsl:choose>
+
+                       <!-- hard space -->
+                       <xsl:value-of select="' '"/>
+
+                       <!-- member name -->
+                       <xsl:choose>
+                       
+                       <!-- Constructors get the name of the class -->
+                       <xsl:when test="MemberType='Constructor'">
+                               <b>
+                                       <xsl:call-template name="GetConstructorName">
+                                               <xsl:with-param name="type" select="../.." />
+                                               <xsl:with-param name="ctor" select="." />
+                                       </xsl:call-template>
+                               </b>
+                       </xsl:when>
+                       
+                       <!-- Conversion operators get the return type -->
+                       <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
+                               <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
+                                       <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                               </xsl:apply-templates>
+                       </xsl:when>
+                       
+                       <!-- Regular operators get their symbol -->
+                       <xsl:when test="@MemberName='op_UnaryPlus'">operator+</xsl:when>
+                       <xsl:when test="@MemberName='op_UnaryNegation'">operator-</xsl:when>
+                       <xsl:when test="@MemberName='op_LogicalNot'">operator!</xsl:when>
+                       <xsl:when test="@MemberName='op_OnesComplement'">operator~</xsl:when>
+                       <xsl:when test="@MemberName='op_Increment'">operator++</xsl:when>
+                       <xsl:when test="@MemberName='op_Decrement'">operator--</xsl:when>
+                       <xsl:when test="@MemberName='op_True'">operator true</xsl:when>
+                       <xsl:when test="@MemberName='op_False'">operator false</xsl:when>
+                       <xsl:when test="@MemberName='op_Addition'">operator+</xsl:when>
+                       <xsl:when test="@MemberName='op_Subtraction'">operator-</xsl:when>
+                       <xsl:when test="@MemberName='op_Multiply'">operator*</xsl:when>
+                       <xsl:when test="@MemberName='op_Division'">operator/</xsl:when>
+                       <xsl:when test="@MemberName='op_Modulus'">operator%</xsl:when>
+                       <xsl:when test="@MemberName='op_BitwiseAnd'">operator&amp;</xsl:when>
+                       <xsl:when test="@MemberName='op_BitwiseOr'">operator|</xsl:when>
+                       <xsl:when test="@MemberName='op_ExclusiveOr'">operator^</xsl:when>
+                       <xsl:when test="@MemberName='op_LeftShift'">operator&lt;&lt;</xsl:when>
+                       <xsl:when test="@MemberName='op_RightShift'">operator&gt;&gt;</xsl:when>
+                       <xsl:when test="@MemberName='op_Equality'">operator==</xsl:when>
+                       <xsl:when test="@MemberName='op_Inequality'">operator!=</xsl:when>
+                       <xsl:when test="@MemberName='op_GreaterThan'">operator&gt;</xsl:when>
+                       <xsl:when test="@MemberName='op_LessThan'">operator&lt;</xsl:when>
+                       <xsl:when test="@MemberName='op_GreaterThanOrEqual'">operator&gt;=</xsl:when>
+                       <xsl:when test="@MemberName='op_LessThanOrEqual'">operator&lt;=</xsl:when>
+
+                       <xsl:when test="MemberType='Property' and count(Parameters/Parameter) &gt; 0">
+                               <!-- C# only permits indexer properties to have arguments -->
+                               <xsl:text>this</xsl:text>
+                       </xsl:when>
+                       
+                       <!-- Everything else just gets its name -->
+                       <xsl:when test="contains (@MemberName, '&lt;')">
+                               <b>
+                                       <xsl:call-template name="GetDefinitionName">
+                                               <xsl:with-param name="name" select="@MemberName" />
+                                               <xsl:with-param name="TypeParameters" select="TypeParameters" />
+                                       </xsl:call-template>
+                               </b>
+                       </xsl:when>
+
+                       <xsl:otherwise>
+                               <b><xsl:value-of select="@MemberName"/></b>
+                       </xsl:otherwise>
+                       </xsl:choose>
+
+                       <!-- hard space -->
+                       <xsl:value-of select="' '"/>
+
+                       <!-- argument list -->
+                       <xsl:if test="MemberType='Method' or MemberType='Constructor' or (MemberType='Property' and count(Parameters/Parameter))">
+                               <xsl:if test="not(MemberType='Property')">(</xsl:if>
+                               <xsl:if test="MemberType='Property'">[</xsl:if>
+
+                               <xsl:for-each select="Parameters/Parameter">
+                                       <xsl:call-template name="ShowParameter">
+                                               <xsl:with-param name="Param" select="."/>
+                                               <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                       </xsl:call-template>
+
+                                       <xsl:if test="not(position()=last())">, </xsl:if>
+                               </xsl:for-each>
+                               <xsl:if test="not(MemberType='Property')">)</xsl:if>
+                               <xsl:if test="MemberType='Property'">]</xsl:if>
+                       </xsl:if>
+
+                       <xsl:if test="MemberType='Property'">
+                               <xsl:value-of select="' '"/>
+                               <xsl:text>{</xsl:text>
+                               <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, '{'), '}')"/>
+                               <xsl:text>}</xsl:text>
+                       </xsl:if>
+                       <xsl:call-template name="CreateGenericConstraints">
+                               <xsl:with-param name="TypeParameters" select="TypeParameters" />
+                       </xsl:call-template>
+                       </xsl:with-param>
+               </xsl:call-template>
+               
+       </xsl:template>
+
+       <xsl:template name="GetConstructorName">
+               <xsl:param name="type" />
+               <xsl:param name="ctor" />
+
+               <xsl:choose>
+                       <xsl:when test="contains($type/@Name, '&lt;')">
+                               <xsl:value-of select="translate (substring-before ($type/@Name, '&lt;'), '+', '.')" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="translate ($type/@Name, '+', '.')" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="ShowParameter">
+               <xsl:param name="Param"/>
+               <xsl:param name="TypeNamespace"/>
+               <xsl:param name="prototype" select="false()"/>
+
+               <xsl:if test="not($prototype)">
+                       <xsl:for-each select="$Param/Attributes/Attribute[not(Exclude='1') and not(AttributeName='ParamArrayAttribute' or AttributeName='System.ParamArray')]">
+                               <xsl:text>[</xsl:text>
+                               <xsl:value-of select="AttributeName"/>
+                               <xsl:text>]</xsl:text>
+                               <xsl:value-of select="' '"/>
+                       </xsl:for-each>
+               </xsl:if>
+
+               <xsl:if test="count($Param/Attributes/Attribute/AttributeName[.='ParamArrayAttribute' or .='System.ParamArray'])">
+                       <b>params</b>
+                       <xsl:value-of select="' '"/>
+               </xsl:if>
+
+               <xsl:if test="$Param/@RefType">
+                       <i><xsl:value-of select="$Param/@RefType"/></i>
+                       <!-- hard space -->
+                       <xsl:value-of select="' '"/>
+               </xsl:if>
+
+               <!-- parameter type link -->
+               <xsl:apply-templates select="$Param/@Type" mode="typelink">
+                       <xsl:with-param name="wrt" select="$TypeNamespace"/>
+               </xsl:apply-templates>
+
+               <xsl:if test="not($prototype)">
+                       <!-- hard space -->
+                       <xsl:value-of select="' '"/>
+       
+                       <!-- parameter name -->
+                       <xsl:value-of select="$Param/@Name"/>
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="DisplayDocsInformation">
+               <xsl:param name="linkid" />
+
+               <!-- The namespace that the current type belongs to. -->
+               <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
+
+               <!-- alt member: not sure what these are for, actually -->
+
+               <xsl:if test="count(Docs/altmember)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'See Also'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':See Also')" />
+                               <xsl:with-param name="content">
+                                       <xsl:for-each select="Docs/altmember">
+                                               <div><xsl:apply-templates select="@cref" mode="cref"/></div>
+                                       </xsl:for-each>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- parameters & return & value -->
+
+               <xsl:if test="count(Docs/typeparam)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'Type Parameters'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Type Parameters')" />
+                               <xsl:with-param name="content">
+                                       <dl>
+                                       <xsl:for-each select="Docs/typeparam">
+                                               <dt><i><xsl:value-of select="@name"/></i></dt>
+                                               <dd>
+                                                       <xsl:apply-templates select="." mode="notoppara"/>
+                                                       <xsl:apply-templates select="." mode="editlink"/>
+                                               </dd>
+                                       </xsl:for-each>
+                                       </dl>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+               <xsl:if test="count(Docs/param)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'Parameters'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Parameters')" />
+                               <xsl:with-param name="content">
+                                       <dl>
+                                       <xsl:for-each select="Docs/param">
+                                               <dt><i><xsl:value-of select="@name"/></i></dt>
+                                               <dd>
+                                                       <xsl:apply-templates select="." mode="notoppara"/>
+                                                       <xsl:apply-templates select="." mode="editlink"/>
+                                               </dd>
+                                       </xsl:for-each>
+                                       </dl>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+               <xsl:if test="count(Docs/returns)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'Returns'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Returns')" />
+                               <xsl:with-param name="content">
+                                       <xsl:apply-templates select="Docs/returns" mode="notoppara"/>
+                                       <xsl:apply-templates select="Docs/returns" mode="editlink"/>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+               <xsl:if test="count(Docs/value)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'Value'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Value')" />
+                               <xsl:with-param name="content">
+                                       <xsl:apply-templates select="Docs/value" mode="notoppara"/>
+                                       <xsl:apply-templates select="Docs/value" mode="editlink"/>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- method/property/constructor exceptions -->
+
+               <xsl:if test="count(Docs/exception)">
+                       <xsl:call-template name="CreateH4Section">
+                               <xsl:with-param name="name" select="'Exceptions'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
+                               <xsl:with-param name="content">
+                                       <xsl:call-template name="CreateTypeDocumentationTable">
+                                       <xsl:with-param name="content">
+                                       <xsl:for-each select="Docs/exception">
+                                               <tr valign="top">
+                                               <td>
+                                                       <xsl:apply-templates select="@cref" mode="typelink">
+                                                               <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                                                       </xsl:apply-templates>
+                                               </td>
+                                               <td>
+                                                       <xsl:apply-templates select="." mode="notoppara"/>
+                                                       <xsl:apply-templates select="." mode="editlink"/>
+                                               </td>
+                                               </tr>
+                                       </xsl:for-each>
+                                       </xsl:with-param>
+                                       </xsl:call-template>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- remarks -->
+
+               <xsl:if test="count(Docs/remarks)">
+                       <xsl:call-template name="CreateH2Section">
+                               <xsl:with-param name="name" select="'Remarks'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
+                               <xsl:with-param name="content">
+                                       <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
+                                       <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- thread safety -->
+
+               <xsl:if test="count(ThreadingSafetyStatement)">
+                       <xsl:call-template name="CreateH2Section">
+                               <xsl:with-param name="name" select="'Thread Safety'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
+                               <xsl:with-param name="content">
+                                       <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+
+               <!-- permissions -->
+
+               <xsl:if test="count(Docs/permission)">
+                       <xsl:call-template name="CreateH2Section">
+                               <xsl:with-param name="name" select="'Permissions'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
+                               <xsl:with-param name="content">
+                                       <xsl:call-template name="CreateTypeDocumentationTable">
+                                       <xsl:with-param name="content">
+                                       <xsl:for-each select="Docs/permission">
+                                               <tr valign="top">
+                                               <td>
+                                                       <xsl:apply-templates select="@cref" mode="typelink">
+                                                               <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                                                       </xsl:apply-templates>
+                                                       <xsl:apply-templates select="." mode="editlink"/>
+                                               </td>
+                                               <td>
+                                                       <xsl:apply-templates select="." mode="notoppara"/>
+                                               </td>
+                                               </tr>
+                                       </xsl:for-each>
+                                       </xsl:with-param>
+                                       </xsl:call-template>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- enumeration values -->
+
+               <xsl:if test="Base/BaseTypeName = 'System.Enum'">
+                       <xsl:call-template name="CreateH2Section">
+                               <xsl:with-param name="name" select="'Members'"/>
+                               <xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
+                               <xsl:with-param name="content">
+                                       <xsl:call-template name="CreateEnumerationTable">
+                                       <xsl:with-param name="content">
+
+                                               <xsl:for-each select="Members/Member[MemberType='Field']">
+                                                       <xsl:if test="not(@MemberName='value__')">
+                                                               <tr valign="top"><td>
+                                                                       <xsl:attribute name="id">
+                                                                               <xsl:text>F:</xsl:text>
+                                                                               <xsl:value-of select="translate (/Type/@FullName, '+', '.')" />
+                                                                               <xsl:text>.</xsl:text>
+                                                                               <xsl:value-of select="@MemberName" />
+                                                                       </xsl:attribute>
+                                                                       <b>
+                                                                               <xsl:value-of select="@MemberName"/>
+                                                                       </b>
+                                                               </td>
+                                                               <td>
+                                                                       <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+                                                                       <xsl:apply-templates select="Docs/summary" mode="editlink"/>
+                                                               </td>
+                                                               </tr>
+                                                       </xsl:if>
+                                               </xsl:for-each>
+                                       </xsl:with-param>
+                                       </xsl:call-template>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+
+               <!-- examples -->
+
+               <xsl:if test="count(Docs/example)">
+                       <xsl:for-each select="Docs/example">
+                               <xsl:call-template name="CreateH2Section">
+                                       <xsl:with-param name="name" select="'Example'"/>
+                                       <xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
+                                       <xsl:with-param name="content">
+                                               <xsl:apply-templates select="." mode="notoppara"/>
+                                       </xsl:with-param>
+                               </xsl:call-template>
+                       </xsl:for-each>
+               </xsl:if>
+
+               <!-- related content -->
+               <xsl:if test="count(Docs/related)">
+                 <xsl:call-template name="CreateH2Section">
+                       <xsl:with-param name="name" select="'Related content'" />
+                       <xsl:with-param name="child-id" select="concat ($linkid, ':Related:')" />
+                       <xsl:with-param name="content">
+                         <div class="related">
+                               <xsl:call-template name="CreateRelatedSection">
+                                 <xsl:with-param name="section" select="'Articles'" />
+                                 <xsl:with-param name="type" select="'article'" />
+                               </xsl:call-template>
+                               <xsl:call-template name="CreateRelatedSection">
+                                 <xsl:with-param name="section" select="'Available Samples'" />
+                                 <xsl:with-param name="type" select="'sample'" />
+                               </xsl:call-template>
+                               <xsl:call-template name="CreateRelatedSection">
+                                 <xsl:with-param name="section" select="'Related specifications'" />
+                                 <xsl:with-param name="type" select="'specification'" />
+                               </xsl:call-template>
+                               <xsl:call-template name="CreateRelatedSection">
+                                 <xsl:with-param name="section" select="'External Documentation'" />
+                                 <xsl:with-param name="type" select="'externalDocumentation'" />
+                               </xsl:call-template>
+                         </div>
+                       </xsl:with-param>
+                 </xsl:call-template>
+               </xsl:if>
+
+               <xsl:call-template name="CreateH2Section">
+                       <xsl:with-param name="name" select="'Requirements'"/>
+                       <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
+                       <xsl:with-param name="content">
+                               <xsl:call-template name="CreatePlatformRequirements" />
+                               <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
+                               <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) &gt; 0">
+                                       <br />
+                                       <b>Assembly: </b>
+                                       <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
+                                       <xsl:text> (in </xsl:text>
+                                       <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
+                                       <xsl:text>.dll)</xsl:text>
+                               </xsl:if>
+                               <xsl:if test="count(AssemblyInfo/AssemblyVersion) &gt; 0">
+                                       <br />
+                                       <b>Assembly Versions: </b>
+                                       <xsl:for-each select="AssemblyInfo/AssemblyVersion">
+                                               <xsl:if test="not(position()=1)">, </xsl:if>
+                                                       <xsl:value-of select="."/>
+                                       </xsl:for-each>
+                               </xsl:if>
+                               <xsl:if test="count(Docs/since) &gt; 0">
+                                       <br />
+                                       <b>Since: </b>
+                                       <xsl:for-each select="Docs/since">
+                                               <xsl:if test="not(position()=1)">; </xsl:if>
+                                                       <xsl:value-of select="@version"/>
+                                       </xsl:for-each>
+                               </xsl:if>
+                               <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) &gt; 0">
+                                       <br />
+                                       <b>Since: </b>
+                                       <xsl:for-each select="/Type/Docs/since">
+                                               <xsl:if test="not(position()=1)">; </xsl:if>
+                                                       <xsl:value-of select="@version"/>
+                                       </xsl:for-each>
+                               </xsl:if>
+                       </xsl:with-param>
+               </xsl:call-template>
+       </xsl:template>
+
+       
+       <!-- Transforms the contents of the selected node into a hyperlink to the type named by the node.  The node can contain a type name (eg System.Object) or a type link (eg T:System.String). Use wrt parameter to specify the current namespace. -->
+
+       <xsl:template match="*|@*" mode="typelink">
+               <xsl:param name="wrt" select="'notset'"/>
+               
+               <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="."/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+               </xsl:call-template>
+       </xsl:template>
+
+       <xsl:template name="makenamespacelink">
+               <xsl:param name="cref" select="''"/>
+
+               <a>
+                       <xsl:attribute name="href">
+                               <xsl:call-template name="GetLinkTargetHtml">
+                                       <xsl:with-param name="cref" select="$cref" />
+                               </xsl:call-template>
+                       </xsl:attribute>
+       
+                       <xsl:value-of select="substring-after ($cref, 'N:')" />
+               </a>
+       </xsl:template>
+
+       <xsl:template name="maketypelink">
+               <xsl:param name="type" select="'notset'"/>
+               <xsl:param name="wrt" select="'notset'"/>
+               <xsl:param name="nested" select="0"/>
+
+               <xsl:variable name="btype">
+                       <xsl:call-template name="ToBrackets">
+                               <xsl:with-param name="s" select="$type" />
+                       </xsl:call-template>
+               </xsl:variable>
+
+               <xsl:variable name="array">
+                       <xsl:call-template name="GetArraySuffix">
+                               <xsl:with-param name="type" select="$type" />
+                       </xsl:call-template>
+               </xsl:variable>
+               
+               <xsl:choose>
+
+               <!-- chop off T: -->
+               <xsl:when test="starts-with($type, 'T:')">
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="substring($type, 3)"/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+                       </xsl:call-template>
+               </xsl:when>
+
+               <xsl:when test="contains ($type, '&amp;') and 
+                               '&amp;' = substring ($type, string-length ($type), 1)">
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+                       </xsl:call-template>
+               </xsl:when>
+
+               <xsl:when test="string($array)">
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+                       </xsl:call-template>
+                       <xsl:value-of select="$array"/>
+               </xsl:when>
+
+               <xsl:when test="contains ($type, '*') and
+                               '*' = substring ($type, string-length ($type), 1)">
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+                       </xsl:call-template>
+                       <xsl:value-of select="'*'"/>
+               </xsl:when>
+               
+               <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
+               <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] | 
+                               $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
+                               ancestor::Member/Docs/typeparam[@name=$type]) = 1">
+                       <!-- note that we check if it is a generic type using /Type/TypeParameters because that will have type parameters declared in an outer class if this is a nested class, but then we get the tooltip text from the type parameters documented in this file -->
+                       <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
+               </xsl:when>
+               
+               <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
+               <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
+                       <!-- note that an overridden type parameter may be referenced in a type parameter within $type, but we can't replace that nicely since we can't parse generic type names here -->
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
+                               <xsl:with-param name="wrt" select="$wrt"/>
+                       </xsl:call-template>
+               </xsl:when>
+               
+
+               <xsl:otherwise>
+                       <xsl:variable name="escaped-type">
+                               <xsl:call-template name="GetEscapedTypeName">
+                                       <xsl:with-param name="typename" select="$btype" />
+                               </xsl:call-template>
+                       </xsl:variable>
+                       <a>
+                               <xsl:attribute name="href">
+                                       <xsl:call-template name="GetLinkTargetHtml">
+                                               <xsl:with-param name="type" select="$escaped-type" />
+                                               <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
+                                       </xsl:call-template>
+                               </xsl:attribute>
+       
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T" select="$btype"/>
+                                       <xsl:with-param name="wrt" select="$wrt"/>
+                               </xsl:call-template>
+                       </a>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetArraySuffix">
+               <xsl:param name="type" />
+
+               <xsl:if test="contains ($type, ']') and 
+                               ']' = substring ($type, string-length ($type), 1)">
+                       <xsl:variable name="start">
+                               <xsl:call-template name="GetArraySuffixStart">
+                                       <xsl:with-param name="type" select="$type" />
+                                       <xsl:with-param name="i" select="string-length ($type) - 1" />
+                               </xsl:call-template>
+                       </xsl:variable>
+                       <xsl:value-of select="substring ($type, $start)" />
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="GetArraySuffixStart">
+               <xsl:param name="type" />
+               <xsl:param name="i" />
+
+               <xsl:choose>
+                       <xsl:when test="substring ($type, $i, 1) = '['">
+                               <xsl:value-of select="$i" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:call-template name="GetArraySuffixStart">
+                                       <xsl:with-param name="type" select="$type" />
+                                       <xsl:with-param name="i" select="$i - 1" />
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetTypeDisplayName">
+               <xsl:param name="T"/>
+               <xsl:param name="wrt"/>
+
+                               <!-- use C#-style names -->
+                               <xsl:choose>
+                                       <xsl:when test="$T='System.Object'">object</xsl:when>
+                                       <xsl:when test="$T='System.Boolean'">bool</xsl:when>
+                                       <xsl:when test="$T='System.Byte'">byte</xsl:when>
+                                       <xsl:when test="$T='System.Char'">char</xsl:when>
+                                       <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
+                                       <xsl:when test="$T='System.Double'">double</xsl:when>
+                                       <xsl:when test="$T='System.Int16'">short</xsl:when>
+                                       <xsl:when test="$T='System.Int32'">int</xsl:when>
+                                       <xsl:when test="$T='System.Int64'">long</xsl:when>
+                                       <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
+                                       <xsl:when test="$T='System.Single'">float</xsl:when>
+                                       <xsl:when test="$T='System.String'">string</xsl:when>
+                                       <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
+                                       <xsl:when test="$T='System.UInt32'">uint</xsl:when>
+                                       <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
+                                       <xsl:when test="$T='System.Void'">void</xsl:when>
+
+                                       <xsl:when test="contains($T, '&lt;')">
+                                               <xsl:call-template name="GetTypeDisplayName">
+                                                       <xsl:with-param name="T" select="substring-before ($T, '&lt;')" />
+                                                       <xsl:with-param name="wrt" select="$wrt" />
+                                               </xsl:call-template>
+                                               <xsl:text>&lt;</xsl:text>
+                                               <xsl:call-template name="GetMemberArgList">
+                                                       <xsl:with-param name="arglist" select="substring-after ($T, '&lt;')" />
+                                                       <xsl:with-param name="wrt" select="$wrt" />
+                                               </xsl:call-template>
+                                               <!-- don't need to append &gt; as GetMemberArgList (eventually) appends it -->
+                                       </xsl:when>
+       
+                                       <!-- if the type is in the wrt namespace, omit the namespace name -->
+                                       <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
+                                               <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
+                                       </xsl:when>
+       
+                                       <!-- if the type is in the System namespace, omit the namespace name -->
+                                       <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
+                                               <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
+                                       </xsl:when>
+       
+                                       <!-- if the type is in the System.Collections namespace, omit the namespace name -->
+                                       <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
+                                               <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
+                                       </xsl:when>
+
+                                       <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
+                                       <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
+                                               <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
+                                       </xsl:when>
+
+                                       <xsl:otherwise>
+                                               <xsl:value-of select="translate ($T, '+', '.')" />
+                                       </xsl:otherwise>
+                               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetMemberDisplayName">
+               <xsl:param name="memberName" />
+               <xsl:param name="isproperty" select="false()" />
+
+               <xsl:choose>
+                       <xsl:when test="contains($memberName, '.')">
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T">
+                                               <xsl:call-template name="GetTypeName">
+                                                       <xsl:with-param name="type" select="$memberName"/>
+                                               </xsl:call-template>
+                                       </xsl:with-param>
+                                       <xsl:with-param name="wrt" select="''" />
+                               </xsl:call-template>
+                               <xsl:text>.</xsl:text>
+                               <xsl:call-template name="GetMemberName">
+                                       <xsl:with-param name="type" select="$memberName" />
+                                       <xsl:with-param name="isproperty" select="$isproperty"/>
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$memberName" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="ToBrackets">
+               <xsl:param name="s" />
+               <xsl:value-of select="translate (translate ($s, '{', '&lt;'), '}', '&gt;')" />
+       </xsl:template>
+
+       <xsl:template name="ToBraces">
+               <xsl:param name="s" />
+               <xsl:value-of select="translate (translate ($s, '&lt;', '{'), '&gt;', '}')" />
+       </xsl:template>
+       
+       <xsl:template name="memberlinkprefix">
+               <xsl:param name="member" />
+               <xsl:choose>
+                       <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
+                       <xsl:when test="$member/MemberType='Method'">M</xsl:when>
+                       <xsl:when test="$member/MemberType='Property'">P</xsl:when>
+                       <xsl:when test="$member/MemberType='Field'">F</xsl:when>
+                       <xsl:when test="$member/MemberType='Event'">E</xsl:when>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="makememberlink">
+               <xsl:param name="cref"/>
+
+               <xsl:variable name="bcref">
+                       <xsl:call-template name="ToBrackets">
+                               <xsl:with-param name="s" select="$cref" />
+                       </xsl:call-template>
+               </xsl:variable>
+
+               <xsl:variable name="fullname">
+                       <xsl:choose>
+                               <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
+                                       <xsl:choose>
+                                               <xsl:when test="contains($bcref, '(')">
+                                                       <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="substring($bcref, 3)" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:call-template name="GetTypeName">
+                                               <xsl:with-param name="type" select="substring($bcref, 3)"/>
+                                       </xsl:call-template>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <xsl:variable name="memberName">
+                       <xsl:choose>
+                               <xsl:when test="starts-with($bcref, 'T:')" />
+                               <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
+                               <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
+                                       <xsl:text>(</xsl:text>
+                                       <xsl:call-template name="GetMemberArgList">
+                                               <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
+                                               <xsl:with-param name="wrt" select="$TypeNamespace" />
+                                       </xsl:call-template>
+                                       <xsl:text>)</xsl:text>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:text>.</xsl:text>
+                                       <xsl:call-template name="GetMemberName">
+                                               <xsl:with-param name="type" select="substring($bcref, 3)" />
+                                               <xsl:with-param name="wrt" select="$fullname"/>
+                                               <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
+                                       </xsl:call-template>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <xsl:variable name="escaped-type">
+                       <xsl:call-template name="GetEscapedTypeName">
+                               <xsl:with-param name="typename">
+                                       <xsl:call-template name="ToBrackets">
+                                               <xsl:with-param name="s" select="$fullname" />
+                                       </xsl:call-template>
+                               </xsl:with-param>
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="displayname">
+                       <xsl:call-template name="GetTypeDisplayName">
+                               <xsl:with-param name="T" select="$fullname" />
+                               <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                       </xsl:call-template>
+               </xsl:variable>
+               <a>
+                       <xsl:attribute name="href">
+                               <xsl:call-template name="GetLinkTargetHtml">
+                                       <xsl:with-param name="type" select="$escaped-type" />
+                                       <xsl:with-param name="cref">
+                                               <xsl:call-template name="ToBraces">
+                                                       <xsl:with-param name="s" select="$cref" />
+                                               </xsl:call-template>
+                                       </xsl:with-param>
+                               </xsl:call-template>
+                       </xsl:attribute>
+                       <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
+               </a>
+       </xsl:template>
+
+       <xsl:template name="GetTypeName">
+               <xsl:param name="type" />
+               <xsl:variable name="prefix" select="substring-before($type, '.')" />
+               <xsl:variable name="suffix" select="substring-after($type, '.')" />
+               <xsl:choose>
+                       <xsl:when test="contains($type, '(')">
+                               <xsl:call-template name="GetTypeName">
+                                       <xsl:with-param name="type" select="substring-before($type, '(')" />
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:when test="not(contains($suffix, '.'))">
+                               <xsl:value-of select="$prefix" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$prefix" />
+                               <xsl:text>.</xsl:text>
+                               <xsl:call-template name="GetTypeName">
+                                       <xsl:with-param name="type" select="$suffix" />
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetMemberName">
+               <xsl:param name="type" />
+               <xsl:param name="isproperty" select="0"/>
+               <xsl:variable name="prefix" select="substring-before($type, '.')" />
+               <xsl:variable name="suffix" select="substring-after($type, '.')" />
+               <xsl:choose>
+                       <xsl:when test="contains($type, '(')">
+                               <xsl:call-template name="GetMemberName">
+                                       <xsl:with-param name="type" select="substring-before($type, '(')" />
+                               </xsl:call-template>
+                               <xsl:text>(</xsl:text>
+                               <xsl:call-template name="GetMemberArgList">
+                                       <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
+                                       <xsl:with-param name="wrt" select="$TypeNamespace" />
+                               </xsl:call-template>
+                               <xsl:text>)</xsl:text>
+                       </xsl:when>
+                       <xsl:when test="not(contains($suffix, '.'))">
+                               <xsl:value-of select="$suffix" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:call-template name="GetMemberName">
+                                       <xsl:with-param name="type" select="$suffix" />
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetMemberArgList">
+               <xsl:param name="arglist" />
+               <xsl:param name="wrt" select="''"/>
+
+               <xsl:variable name="_arglist">
+                       <xsl:choose>
+                               <xsl:when test="starts-with ($arglist, ',')">
+                                       <xsl:value-of select="substring-after ($arglist, ',')" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:value-of select="$arglist" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <xsl:if test="starts-with ($arglist, ',')">
+                       <xsl:text>, </xsl:text>
+               </xsl:if>
+
+               <xsl:variable name="c"  select="substring-before ($_arglist, ',')" />
+               <xsl:variable name="lt" select="substring-before ($_arglist, '&lt;')" />
+               <xsl:variable name="gt" select="substring-before ($_arglist, '&gt;')" />
+
+               <xsl:choose>
+                       <!-- Need to insert ',' between type arguments -->
+                       <xsl:when test="
+                                       ($c != '' and $lt != '' and $gt != '' and 
+                                        string-length ($c) &lt; string-length ($lt) and 
+                                        string-length ($c) &lt; string-length ($gt)) or
+                                       ($c != '' and $lt != '' and $gt = '' and
+                                        string-length ($c) &lt; string-length ($lt)) or
+                                       ($c != '' and $lt = '' and $gt != '' and
+                                        string-length ($c) &lt; string-length ($gt)) or
+                                       ($c != '' and $lt = '' and $gt = '')">
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T" select="$c"/>
+                                       <xsl:with-param name="wrt" select="$wrt"/>
+                               </xsl:call-template>
+                               <xsl:text>, </xsl:text>
+                               <xsl:call-template name="GetMemberArgList">
+                                       <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
+                                       <xsl:with-param name="wrt" select="$wrt" />
+                               </xsl:call-template>
+                       </xsl:when>
+
+                       <!-- start of nested type argument list < -->
+                       <xsl:when test="
+                                       ($c != '' and $lt != '' and $gt != '' and 
+                                        string-length ($lt) &lt; string-length ($c) and 
+                                        string-length ($lt) &lt; string-length ($gt)) or
+                                       ($c != '' and $lt != '' and $gt = '' and
+                                        string-length ($lt) &lt; string-length ($c)) or
+                                       ($c = '' and $lt != '' and $gt != '' and
+                                        string-length ($lt) &lt; string-length ($gt))">
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T" select="$lt"/>
+                                       <xsl:with-param name="wrt" select="$wrt"/>
+                               </xsl:call-template>
+                               <xsl:text>&lt;</xsl:text>
+                               <xsl:call-template name="GetMemberArgList">
+                                       <xsl:with-param name="arglist" select="substring-after($_arglist, '&lt;')" />
+                                       <xsl:with-param name="wrt" select="$wrt" />
+                               </xsl:call-template>
+                       </xsl:when>
+
+                       <!-- end of (nested?) type argument list > -->
+                       <xsl:when test="
+                                       ($c != '' and $lt != '' and $gt != '' and 
+                                        string-length ($gt) &lt; string-length ($c) and 
+                                        string-length ($gt) &lt; string-length ($lt)) or
+                                       ($c != '' and $lt = '' and $gt = '' and
+                                        string-length ($gt) &lt; string-length ($c)) or
+                                       ($c = '' and $lt != '' and $gt != '' and
+                                        string-length ($gt) &lt; string-length ($lt)) or
+                                       ($c = '' and $lt = '' and $gt != '')">
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T" select="$gt"/>
+                                       <xsl:with-param name="wrt" select="$wrt"/>
+                               </xsl:call-template>
+                               <xsl:text>&gt;</xsl:text>
+                               <xsl:call-template name="GetMemberArgList">
+                                       <xsl:with-param name="arglist" select="substring-after($_arglist, '&gt;')" />
+                                       <xsl:with-param name="wrt" select="$wrt" />
+                               </xsl:call-template>
+                       </xsl:when>
+
+                       <!-- nothing left to do -->
+                       <xsl:otherwise>
+                               <xsl:call-template name="GetTypeDisplayName">
+                                       <xsl:with-param name="T" select="$_arglist"/>
+                                       <xsl:with-param name="wrt" select="$wrt"/>
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+       
+       <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
+       <xsl:template match="*|@*" mode="cref">
+               <xsl:call-template name="makememberlink">
+                       <xsl:with-param name="cref" select="."/>
+               </xsl:call-template>
+               <!--
+               <a>
+                       <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
+                       <xsl:value-of select="substring-after(., ':')"/></a>
+                       -->
+       </xsl:template>
+
+       <xsl:template name="membertypeplural">
+               <xsl:param name="name"/>
+               <xsl:choose>
+               <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
+               <xsl:when test="$name='Constructor'">Constructors</xsl:when>
+               <xsl:when test="$name='Property'">Properties</xsl:when>
+               <xsl:when test="$name='Method'">Methods</xsl:when>
+               <xsl:when test="$name='Field'">Fields</xsl:when>
+               <xsl:when test="$name='Event'">Events</xsl:when>
+               <xsl:when test="$name='Operator'">Operators</xsl:when>
+               <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
+               </xsl:choose>
+       </xsl:template>
+       <xsl:template name="membertypeplurallc">
+               <xsl:param name="name"/>
+               <xsl:choose>
+               <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
+               <xsl:when test="$name='Constructor'">constructors</xsl:when>
+               <xsl:when test="$name='Property'">properties</xsl:when>
+               <xsl:when test="$name='Method'">methods</xsl:when>
+               <xsl:when test="$name='Field'">fields</xsl:when>
+               <xsl:when test="$name='Event'">events</xsl:when>
+               <xsl:when test="$name='Operator'">operators</xsl:when>
+               <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
+               </xsl:choose>
+       </xsl:template>
+       <xsl:template name="gettypetype">
+               <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
+               <xsl:choose>
+               <xsl:when test="contains($sig,'class')">Class</xsl:when>
+               <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
+               <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
+               <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
+               </xsl:choose>
+       </xsl:template>
+
+       <!-- Ensures that the resuting node is not surrounded by a para tag. -->
+       <xsl:template match="*|@*" mode="editlink">
+               <xsl:call-template name="CreateEditLink">
+                       <xsl:with-param name="e" select="." />
+               </xsl:call-template>
+       </xsl:template>
+
+       <xsl:template match="*" mode="notoppara">
+               <xsl:choose>
+               <xsl:when test="starts-with (string(.), 'To be added')">
+                       <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+               </xsl:when>
+               <xsl:when test="count(*) = 1 and count(para)=1">
+                       <xsl:apply-templates select="para/node()"/>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:apply-templates select="."/>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template match="para">
+               <p>
+                       <xsl:apply-templates/>
+               </p>
+       </xsl:template>
+
+       <xsl:template match="paramref">
+               <i><xsl:value-of select="@name"/>
+                               <xsl:apply-templates/>
+               </i>
+       </xsl:template>
+
+       <xsl:template match="typeparamref">
+               <i><xsl:value-of select="@name"/>
+                               <xsl:apply-templates/>
+               </i>
+       </xsl:template>
+
+       <xsl:template match="block[@type='note']">
+               <div>
+               <i>Note: </i>
+                               <xsl:apply-templates/>
+               </div>
+       </xsl:template>
+       <xsl:template match="block[@type='behaviors']">
+               <h5 class="Subsection">Operation</h5>
+               <xsl:apply-templates/>
+       </xsl:template>
+       <xsl:template match="block[@type='overrides']">
+               <h5 class="Subsection">Note to Inheritors</h5>
+               <xsl:apply-templates/>
+       </xsl:template>
+       <xsl:template match="block[@type='usage']">
+               <h5 class="Subsection">Usage</h5>
+               <xsl:apply-templates/>
+       </xsl:template>
+
+       <xsl:template match="c">
+               <tt>
+                       <xsl:apply-templates/>  
+               </tt>
+       </xsl:template>
+       <xsl:template match="c//para">
+               <xsl:apply-templates/><br/>     
+       </xsl:template>
+       
+       <xsl:template match="code">
+               <xsl:call-template name="CreateCodeBlock">
+                       <xsl:with-param name="language" select="@lang" />
+                       <xsl:with-param name="content" select="string(descendant-or-self::text())" />
+               </xsl:call-template>
+       </xsl:template>
+       <xsl:template match="img">
+         <p>
+               <img src="source-id:{$source-id}:{@href}">
+                 <xsl:attribute name="class">
+                       <xsl:choose>
+                         <xsl:when test="count(@class)&gt;0">
+                               <xsl:value-of select="@class" />
+                         </xsl:when>
+                         <xsl:otherwise>picture</xsl:otherwise>
+                       </xsl:choose>
+                 </xsl:attribute>
+               </img>
+         </p>
+       </xsl:template>
+
+       <xsl:template match="onequarter">¼</xsl:template>
+       <xsl:template match="pi">π</xsl:template>
+       <xsl:template match="theta">θ</xsl:template>
+       <xsl:template match="leq">≤</xsl:template>
+       <xsl:template match="geq">≥</xsl:template>
+       <xsl:template match="subscript">
+               <sub><xsl:value-of select="@term"/></sub>
+       </xsl:template>
+       <xsl:template match="superscript">
+               <sup><xsl:value-of select="@term"/></sup>
+       </xsl:template>
+
+       <!-- tabular data
+               example:
+
+                       <list type="table">
+                               <listheader>
+                                       <term>First Col Header</term>
+                                       <description>Second Col Header</description>
+                                       <description>Third Col Header</description>
+                               </listheader>
+                               <item>
+                                       <term>First Row First Col</term>
+                                       <description>First Row Second Col</description>
+                                       <description>First Row Third Col</description>
+                               </item>
+                               <item>
+                                       <term>Second Row First Col</term>
+                                       <description>Second Row Second Col</description>
+                                       <description>Second Row Third Col</description>
+                               </item>
+                       </list>
+       -->
+
+       <xsl:template match="list[@type='table']">
+               <xsl:call-template name="CreateListTable">
+               <xsl:with-param name="header">
+                       <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
+                       <xsl:for-each select="listheader/description">
+                               <th><xsl:apply-templates mode="notoppara"/></th>
+                       </xsl:for-each>
+               </xsl:with-param>
+
+               <xsl:with-param name="content">
+               <xsl:for-each select="item">
+                       <tr valign="top">
+                       <td>
+                               <xsl:apply-templates select="term" mode="notoppara"/>
+                       </td>
+                       <xsl:for-each select="description">
+                               <td>
+                                       <xsl:apply-templates mode="notoppara"/>
+                               </td>
+                       </xsl:for-each>
+                       </tr>
+               </xsl:for-each>
+               </xsl:with-param>
+               </xsl:call-template>
+       </xsl:template>
+
+       <xsl:template match="list[@type='bullet']">
+               <ul>
+                       <xsl:for-each select="item">
+                               <li>
+                                       <xsl:apply-templates select="term" mode="notoppara"/>
+                               </li>
+                       </xsl:for-each>
+               </ul>
+       </xsl:template>
+       <xsl:template match="list[@type='number']">
+               <ol>
+                       <xsl:for-each select="item">
+                               <li>
+                                       <xsl:apply-templates select="term" mode="notoppara"/>
+                               </li>
+                       </xsl:for-each>
+               </ol>
+       </xsl:template>
+
+       <xsl:template match="list">
+               [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
+               
+               <xsl:message>
+               [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
+               </xsl:message>
+       </xsl:template>
+
+       <xsl:template match="see[@cref]">
+               <xsl:choose>
+               <xsl:when test="not(substring-after(@cref, 'T:')='')">
+                       <xsl:call-template name="maketypelink">
+                               <xsl:with-param name="type" select="normalize-space (@cref)"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="not(substring-after(@cref, 'N:')='')">
+                       <xsl:call-template name="makenamespacelink">
+                               <xsl:with-param name="cref" select="normalize-space (@cref)"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:call-template name="makememberlink">
+                               <xsl:with-param name="cref" select="normalize-space (@cref)"/>
+                       </xsl:call-template>
+               </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template match="see[@langword]">
+               <tt><xsl:value-of select="@langword"/></tt>
+       </xsl:template>
+       
+       <xsl:template name="GetInheritedMembers">
+               <xsl:param name="declaringtype"/>
+               <xsl:param name="generictypereplacements"/>
+               <xsl:param name="listmembertype"/>
+               <xsl:param name="showprotected"/>
+               <xsl:param name="overloads-mode" select="false()" />
+               <xsl:param name="showstatic" select='1'/>
+
+               <xsl:choose>
+               <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
+                       <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
+                               <Members Name="Link/@Type" FullName="Link/@Type">
+                                       <Member MemberName="{@MemberName}">
+                                               <xsl:attribute name="ExplicitMemberName">
+                                                       <xsl:call-template name="GetMemberNameWithoutGenericTypes">
+                                                               <xsl:with-param name="m" select="@MemberName" />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="TypeParameters">
+                                                       <xsl:call-template name="GetTypeParameterNames">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="Parameters">
+                                                       <xsl:call-template name="GetParameterTypes">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:copy-of select="./*" />
+                                       </Member>
+                               </Members>
+                       </xsl:for-each>
+               </xsl:when>
+               <xsl:otherwise>
+               <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
+               
+               <xsl:copy-of select="$generictypereplacements"/>
+
+               <!-- Get all members in this type that are of listmembertype and are either
+                       protected or not protected according to showprotected. -->
+               <xsl:choose>
+                       <xsl:when test="$listmembertype = 'Explicit'">
+                               <xsl:for-each select="$declaringtype/Members/Member
+                                               [MemberType != 'Constructor']
+                                               [contains (@MemberName, '.')]">
+                                       <Member MemberName="{@MemberName}">
+                                               <xsl:attribute name="ExplicitMemberName">
+                                                       <xsl:call-template name="GetMemberName">
+                                                               <xsl:with-param name="type" select="@MemberName" />
+                                                               <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="TypeParameters">
+                                                       <xsl:call-template name="GetTypeParameterNames">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="Parameters">
+                                                       <xsl:call-template name="GetParameterTypes">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:copy-of select="./*" />
+                                       </Member>
+                               </xsl:for-each>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:for-each select="$declaringtype/Members/Member
+                                       [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
+                                       [(not($overloads-mode) or @MemberName=$index or 
+                                               ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
+                                       [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
+                                       [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
+                                               or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
+                                               or (not($listmembertype='Method') and not($listmembertype='Operator'))]
+                                       [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
+                                       [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
+                                       ">
+                                       <Member MemberName="{@MemberName}">
+                                               <xsl:attribute name="ExplicitMemberName">
+                                                       <xsl:call-template name="GetMemberNameWithoutGenericTypes">
+                                                               <xsl:with-param name="m" select="@MemberName" />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="TypeParameters">
+                                                       <xsl:call-template name="GetTypeParameterNames">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:attribute name="Parameters">
+                                                       <xsl:call-template name="GetParameterTypes">
+                                                               <xsl:with-param name="member" select="." />
+                                                       </xsl:call-template>
+                                               </xsl:attribute>
+                                               <xsl:copy-of select="./*" />
+                                       </Member>
+                               </xsl:for-each>
+                       </xsl:otherwise>
+               </xsl:choose>
+
+               <Docs>
+                       <xsl:copy-of select="$declaringtype/Docs/typeparam" />
+               </Docs>
+                       
+               </Members>
+               </xsl:otherwise>
+               </xsl:choose>
+
+               <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
+                       <xsl:variable name="basedocsfile">
+                               <xsl:call-template name="GetLinkTarget">
+                                       <xsl:with-param name="type">
+                                               <xsl:call-template name="GetEscapedTypeName">
+                                                       <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
+                                               </xsl:call-template>
+                                       </xsl:with-param>
+                                       <xsl:with-param name="cref">
+                                       </xsl:with-param>
+                                       <xsl:with-param name="local-suffix" />
+                                       <xsl:with-param name="remote"/>
+                                       <xsl:with-param name="xmltarget" select='1'/>
+                               </xsl:call-template>
+                       </xsl:variable>
+
+                       <xsl:if test="not(string($basedocsfile) = '')">
+                               <xsl:call-template name="GetInheritedMembers">
+                                       <xsl:with-param name="listmembertype" select="$listmembertype"/>
+                                       <xsl:with-param name="showprotected" select="$showprotected"/>
+                                       <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
+                                       <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
+                                       <xsl:with-param name="showstatic" select='0'/>
+                               </xsl:call-template>
+                       </xsl:if>
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="GetMemberNameWithoutGenericTypes">
+               <xsl:param name="m" />
+               <xsl:choose>
+                       <xsl:when test="contains ($m, '&lt;')">
+                               <xsl:value-of select="substring-before ($m, '&lt;')" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$m" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+       
+       <xsl:template name="GetTypeParameterNames">
+               <xsl:param name="member" />
+
+               <xsl:for-each select="$member/TypeParameters/TypeParameter">
+                       <xsl:if test="not(position()=1)">, </xsl:if>
+                       <xsl:value-of select="@Name" />
+               </xsl:for-each>
+       </xsl:template>
+       
+       <xsl:template name="GetParameterTypes">
+               <xsl:param name="member" />
+
+               <xsl:for-each select="$member/Parameters/Parameter">
+                       <xsl:if test="not(position()=1)">, </xsl:if>
+                       <xsl:value-of select="@Type" />
+               </xsl:for-each>
+       </xsl:template>
+       
+       <xsl:template name="ListAllMembers">
+               <xsl:param name="html-anchor" select="false()" />
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Constructor'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Constructor'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Field'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Field'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Property'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Property'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Method'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Method'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Event'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Event'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Operator'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'Explicit'"/>
+                       <xsl:with-param name="showprotected" select="true()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+
+               <xsl:call-template name="ListMembers">
+                       <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
+                       <xsl:with-param name="showprotected" select="false()"/>
+                       <xsl:with-param name="html-anchor" select="$html-anchor" />
+               </xsl:call-template>
+       </xsl:template>
+
+       <!-- Lists the members in the current Type node.
+                Only lists members of type listmembertype.
+                Displays the signature in siglanguage.
+                showprotected = true() or false()
+       -->
+       <xsl:template name="ListMembers">
+               <xsl:param name="listmembertype"/>
+               <xsl:param name="showprotected"/>
+               <xsl:param name="overloads-mode" select="false()" />
+               <xsl:param name="html-anchor" select="false()" />
+
+               <!-- get name and namespace of current type -->
+               <xsl:variable name="TypeFullName" select="@FullName"/>
+               <xsl:variable name="TypeName" select="@Name"/>          
+               <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
+               
+               <xsl:variable name="MEMBERS-rtf">
+                       <xsl:call-template name="GetInheritedMembers">
+                               <xsl:with-param name="listmembertype" select="$listmembertype"/>
+                               <xsl:with-param name="showprotected" select="$showprotected"/>
+                               <xsl:with-param name="declaringtype" select="."/>
+                               <xsl:with-param name="overloads-mode" select="$overloads-mode" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
+               
+               <!--
+               <xsl:variable name="MEMBERS" select="
+                       $ALLMEMBERS/Member
+                       [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
+                       [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
+                       [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
+                               or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
+                               or (not($listmembertype='Method') and not($listmembertype='Operator'))]
+                       "/>
+               -->
+               
+               <!-- if there aren't any, skip this -->
+               <xsl:if test="count($MEMBERS//Member)">
+
+               <xsl:variable name="SectionName">
+                       <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
+                               <xsl:if test="$showprotected">Protected </xsl:if>
+                               <xsl:if test="not($showprotected)">Public </xsl:if>
+                       </xsl:if>
+                       <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
+               </xsl:variable>
+
+               <!-- header -->
+               <xsl:call-template name="CreateH2Section">
+                       <xsl:with-param name="name" select="$SectionName" />
+                       <xsl:with-param name="child-id" select="$SectionName" />
+                       <xsl:with-param name="content">
+                               <div class="SubsectionBox">
+                               <xsl:call-template name="CreateMembersTable">
+                               <xsl:with-param name="content">
+
+                               <xsl:for-each select="$MEMBERS/Members/Member">
+                                       <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
+                                       <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
+                                       <xsl:sort select="@ExplicitMemberName" data-type="text"/>
+                                       <xsl:sort select="count(TypeParameters/TypeParameter)"/>
+                                       <xsl:sort select="@TypeParameters"/>
+                                       <xsl:sort select="count(Parameters/Parameter)"/>
+                                       <xsl:sort select="@Parameters"/>
+                                       
+                                       <xsl:variable name="local-id">
+                                               <xsl:choose>
+                                                       <xsl:when test="count(Link) = 1">
+                                                               <xsl:value-of select="Link/@Member" />
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:call-template name="GetLinkId" >
+                                                                       <xsl:with-param name="type" select="parent::Members" />
+                                                                       <xsl:with-param name="member" select="." />
+                                                               </xsl:call-template>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </xsl:variable>
+
+                                       <xsl:variable name="linkfile">
+                                               <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
+                                                       <xsl:call-template name="GetLinkTargetHtml">
+                                                               <xsl:with-param name="type">
+                                                                       <xsl:choose>
+                                                                               <xsl:when test="count(Link) = 1">
+                                                                                       <xsl:value-of select="Link/@Type"/>
+                                                                               </xsl:when>
+                                                                               <xsl:otherwise>
+                                                                                       <xsl:call-template name="GetEscapedTypeName">
+                                                                                               <xsl:with-param name="typename" select="parent::Members/@FullName" />
+                                                                                       </xsl:call-template>
+                                                                               </xsl:otherwise>
+                                                                       </xsl:choose>
+                                                               </xsl:with-param>
+                                                               <xsl:with-param name="cref" />
+                                                       </xsl:call-template>
+                                               </xsl:if>
+                                       </xsl:variable>
+
+                                       <xsl:variable name="linkid">
+                                               <xsl:if test="$html-anchor">
+                                                       <xsl:value-of select="$linkfile" />
+                                                       <xsl:text>#</xsl:text>
+                                               </xsl:if>
+                                               <xsl:value-of select="$local-id" />
+                                       </xsl:variable>
+                                       
+                                       <xsl:variable name="isinherited">
+                                               <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
+                                                       <xsl:text> (</xsl:text>
+                                                       <i>
+                                                       <xsl:text>Inherited from </xsl:text>
+                                                       <xsl:call-template name="maketypelink">
+                                                               <xsl:with-param name="type" select="parent::Members/@FullName"/>
+                                                               <xsl:with-param name="wrt" select="$TypeNamespace"/>
+                                                       </xsl:call-template>
+                                                       <xsl:text>.</xsl:text>
+                                                       </i>
+                                                       <xsl:text>)</xsl:text>
+                                               </xsl:if>
+                                       </xsl:variable>
+
+                                       <tr valign="top">
+                                               <td>
+                                                       <!-- random info -->
+
+                                                       <!-- check if it has get and set accessors -->
+                                                       <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
+                                                               <xsl:text>[read-only]</xsl:text>
+                                                       </xsl:if>
+                                                       <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
+                                                               <xsl:text>[write-only]</xsl:text>
+                                                       </xsl:if>
+
+                                                       <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
+                                                               <div><i>default property</i></div>
+                                                       </xsl:if>
+
+                                                       <div>
+                                                       <xsl:call-template name="getmodifiers">
+                                                               <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
+                                                               <xsl:with-param name="protection" select="false()"/>
+                                                               <xsl:with-param name="inheritance" select="true()"/>
+                                                               <xsl:with-param name="extra" select="false()"/>
+                                                       </xsl:call-template>
+                                                       </div>
+                                               </td>
+
+                                       <xsl:choose>
+                                               <!-- constructor listing -->
+                                               <xsl:when test="MemberType='Constructor'">
+                                                       <!-- link to constructor page -->
+                                                       <td>
+                                                       <div>
+                                                       <b>
+                                                       <a href="{$linkid}">
+                                                               <xsl:call-template name="GetConstructorName">
+                                                                       <xsl:with-param name="type" select="parent::Members" />
+                                                                       <xsl:with-param name="ctor" select="." />
+                                                               </xsl:call-template>
+                                                       </a>
+                                                       </b>
+
+                                                       <!-- argument list -->
+                                                       <xsl:value-of select="'('"/>
+                                                               <xsl:for-each select="Parameters/Parameter">
+                                                                       <xsl:if test="not(position()=1)">, </xsl:if>
+                                                                       
+                                                                       <xsl:call-template name="ShowParameter">
+                                                                               <xsl:with-param name="Param" select="."/>
+                                                                               <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                                                               <xsl:with-param name="prototype" select="true()"/>
+                                                                       </xsl:call-template>
+                                                               </xsl:for-each>
+                                                       <xsl:value-of select="')'"/>
+                                                       </div>
+
+                                                       <!-- TODO: $implemented? -->
+
+                                                       </td>
+                                               </xsl:when>
+
+                                               <xsl:when test="$listmembertype = 'Explicit'">
+                                                       <td>
+                                                               <a href="{$linkid}">
+                                                                       <b>
+                                                                               <xsl:call-template name="GetMemberDisplayName">
+                                                                                       <xsl:with-param name="memberName" select="@MemberName" />
+                                                                                       <xsl:with-param name="isproperty" select="MemberType='Property'" />
+                                                                               </xsl:call-template>
+                                                                       </b>
+                                                               </a>
+                                                       </td>
+                                               </xsl:when>
+
+                                               <!-- field, property and event listing -->
+                                               <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
+                                                       <td>
+
+                                                       <!-- link to member page -->
+                                                       <b>
+                                                       <a href="{$linkid}">
+                                                               <xsl:call-template name="GetMemberDisplayName">
+                                                                       <xsl:with-param name="memberName" select="@MemberName" />
+                                                                       <xsl:with-param name="isproperty" select="MemberType='Property'" />
+                                                               </xsl:call-template>
+                                                       </a>
+                                                       </b>
+
+                                                       <!-- argument list for accessors -->
+                                                       <xsl:if test="Parameters/Parameter">
+                                                       <xsl:value-of select="'('"/>
+                                                               <xsl:for-each select="Parameters/Parameter">
+                                                                       <xsl:if test="not(position()=1)">, </xsl:if>
+                                                                       
+                                                                       <xsl:call-template name="ShowParameter">
+                                                                               <xsl:with-param name="Param" select="."/>
+                                                                               <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                                                               <xsl:with-param name="prototype" select="true()"/>
+                                                                       </xsl:call-template>
+
+                                                               </xsl:for-each>
+                                                       <xsl:value-of select="')'"/>
+                                                       </xsl:if>
+
+                                                       </td>
+                                               </xsl:when>
+
+                                               <!-- method listing -->
+                                               <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
+                                                       <td colspan="2">
+
+                                                       <!-- link to method page -->
+                                                       <b>
+                                                       <a href="{$linkid}">
+                                                               <xsl:call-template name="GetMemberDisplayName">
+                                                                       <xsl:with-param name="memberName" select="@MemberName" />
+                                                                       <xsl:with-param name="isproperty" select="MemberType='Property'" />
+                                                               </xsl:call-template>
+                                                       </a>
+                                                       </b>
+
+                                                       <!-- argument list -->
+                                                       <xsl:value-of select="'('"/>
+                                                               <xsl:for-each select="Parameters/Parameter">
+                                                                       <xsl:if test="not(position()=1)">, </xsl:if>
+                                                                       
+                                                                       <xsl:call-template name="ShowParameter">
+                                                                               <xsl:with-param name="Param" select="."/>
+                                                                               <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                                                               <xsl:with-param name="prototype" select="true()"/>
+                                                                       </xsl:call-template>
+
+                                                               </xsl:for-each>
+                                                       <xsl:value-of select="')'"/>
+
+                                                       <!-- return type -->
+                                                       <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
+                                                               <nobr>
+                                                               <xsl:text> : </xsl:text>
+                                                               <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
+                                                               </nobr>
+                                                       </xsl:if>
+
+                                                       <blockquote>
+                                                               <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+                                                               <xsl:copy-of select="$isinherited"/>
+                                                       </blockquote>
+                                                       </td>
+                                               </xsl:when>
+
+                                               <xsl:when test="$listmembertype='Operator'">
+                                                       <td>
+
+                                                       <!-- link to operator page -->
+                                                       <xsl:choose>
+                                                       <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
+                                                               <b>
+                                                               <a href="{$linkid}">
+                                                                       <xsl:text>Conversion</xsl:text>
+                                                                       <xsl:choose>
+                                                                       <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
+                                                                               <xsl:text> From </xsl:text>
+                                                                               <xsl:value-of select="Parameters/Parameter/@Type"/>
+                                                                       </xsl:when>
+                                                                       <xsl:otherwise>
+                                                                               <xsl:text> to </xsl:text>
+                                                                               <xsl:value-of select="ReturnValue/ReturnType"/>
+                                                                       </xsl:otherwise>
+                                                                       </xsl:choose>
+                                                               </a>
+                                                               </b>                                            
+
+                                                               <xsl:choose>
+                                                               <xsl:when test="@MemberName='op_Implicit'">
+                                                                       <xsl:text>(Implicit)</xsl:text>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <xsl:text>(Explicit)</xsl:text>
+                                                               </xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </xsl:when>
+                                                       <xsl:when test="count(Parameters/Parameter)=1">
+                                                               <b>
+                                                               <a href="{$linkid}">
+                                                                       <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
+                                                               </a>
+                                                               </b>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <b>
+                                                               <a href="{$linkid}">
+                                                                       <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
+                                                               </a>
+                                                               </b>
+                                                               <xsl:value-of select="'('"/>
+                                                                       <xsl:for-each select="Parameters/Parameter">
+                                                                               <xsl:if test="not(position()=1)">, </xsl:if>
+                                                                               
+                                                                               <xsl:call-template name="ShowParameter">
+                                                                                       <xsl:with-param name="Param" select="."/>
+                                                                                       <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
+                                                                                       <xsl:with-param name="prototype" select="true()"/>
+                                                                               </xsl:call-template>
+                       
+                                                                       </xsl:for-each>
+                                                               <xsl:value-of select="')'"/>
+                                                       </xsl:otherwise>
+                                                       </xsl:choose>
+                                                       </td>
+                                               </xsl:when>
+                                               
+                                               <xsl:otherwise>
+                                                       <!-- Other types: just provide a link -->
+                                                       <td>
+                                                       <a href="{$linkid}">
+                                                               <xsl:call-template name="GetMemberDisplayName">
+                                                                       <xsl:with-param name="memberName" select="@MemberName" />
+                                                                       <xsl:with-param name="isproperty" select="MemberType='Property'" />
+                                                               </xsl:call-template>
+                                                       </a>
+                                                       </td>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+
+                                       <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
+                                               <td>
+                                                       <!-- description -->
+                                                       <xsl:if test="MemberType='Field' or MemberType = 'Property'">
+                                                               <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
+                                                               <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
+                                                               <xsl:text>. </xsl:text>
+                                                       </xsl:if>
+
+                                                       <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
+                                                       <xsl:copy-of select="$isinherited"/>
+                                               </td>
+                                       </xsl:if>
+                                       
+                                       </tr>
+                               </xsl:for-each>
+
+                               </xsl:with-param>
+                               </xsl:call-template>
+                               </div>
+                       </xsl:with-param>
+               </xsl:call-template>
+
+               </xsl:if>
+
+       </xsl:template>
+
+       <xsl:template name="GetLinkName">
+               <xsl:param name="type"/>
+               <xsl:param name="member"/>
+               <xsl:call-template name="memberlinkprefix">
+                       <xsl:with-param name="member" select="$member"/>
+               </xsl:call-template>
+               <xsl:text>:</xsl:text>
+               <xsl:call-template name="GetEscapedTypeName">
+                       <xsl:with-param name="typename" select="$type/@FullName" />
+               </xsl:call-template>
+               <xsl:if test="$member/MemberType != 'Constructor'">
+                       <xsl:text>.</xsl:text>
+                       <xsl:variable name="memberName">
+                               <xsl:call-template name="GetGenericName">
+                                       <xsl:with-param name="membername" select="$member/@MemberName" />
+                                       <xsl:with-param name="member" select="$member" />
+                               </xsl:call-template>
+                       </xsl:variable>
+                       <xsl:call-template name="Replace">
+                               <xsl:with-param name="s">
+                                       <xsl:call-template name="ToBraces">
+                                               <xsl:with-param name="s" select="$memberName" />
+                                       </xsl:call-template>
+                               </xsl:with-param>
+                               <xsl:with-param name="from">.</xsl:with-param>
+                               <xsl:with-param name="to">#</xsl:with-param>
+                       </xsl:call-template>
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="GetGenericName">
+               <xsl:param name="membername" />
+               <xsl:param name="member" />
+               <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
+               <xsl:choose>
+                       <xsl:when test="$numgenargs = 0">
+                               <xsl:value-of select="$membername" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:if test="contains($membername, '&lt;')">
+                                       <xsl:value-of select="substring-before ($membername, '&lt;')" />
+                               </xsl:if>
+                               <xsl:text>``</xsl:text>
+                               <xsl:value-of select="$numgenargs" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetEscapedTypeName">
+               <xsl:param name="typename" />
+               <xsl:variable name="base" select="substring-before ($typename, '&lt;')" />
+
+               <xsl:choose>
+                       <xsl:when test="$base != ''">
+                               <xsl:value-of select="translate ($base, '+', '.')" />
+                               <xsl:text>`</xsl:text>
+                               <xsl:call-template name="GetGenericArgumentCount">
+                                       <xsl:with-param name="arglist" select="substring-after ($typename, '&lt;')" />
+                                       <xsl:with-param name="count">1</xsl:with-param>
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetGenericArgumentCount">
+               <xsl:param name="arglist" />
+               <xsl:param name="count" />
+
+               <xsl:variable name="rest-rtf">
+                       <xsl:call-template name="SkipTypeArgument">
+                               <xsl:with-param name="s" select="$arglist" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="rest" select="string($rest-rtf)" />
+
+               <xsl:choose>
+                       <xsl:when test="$arglist != '' and $rest = ''">
+                               <xsl:value-of select="$count" />
+                       </xsl:when>
+                       <xsl:when test="$arglist = '' and $rest = ''">
+                               <xsl:message terminate="yes">
+!WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
+                               </xsl:message>
+                       </xsl:when>
+                       <xsl:when test="starts-with ($rest, '>')">
+                               <xsl:value-of select="$count" />
+                               <xsl:call-template name="GetEscapedTypeName">
+                                       <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:when test="starts-with ($rest, ',')">
+                               <xsl:call-template name="GetGenericArgumentCount">
+                                       <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
+                                       <xsl:with-param name="count" select="$count+1" />
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:message terminate="yes">
+!WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
+                               </xsl:message>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="SkipTypeArgument">
+               <xsl:param name="s" />
+
+               <xsl:variable name="p-rtf">
+                       <xsl:call-template name="GetCLtGtPositions">
+                               <xsl:with-param name="s" select="$s" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
+
+               <xsl:choose>
+                       <!--
+                       Have to select between three `s' patterns:
+                       A,B>: need to return ",B>"
+                       Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
+                       Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
+                       -->
+                       <xsl:when test="starts-with ($s, '>')">
+                               <xsl:message terminate="yes">
+SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
+                               </xsl:message>
+                       </xsl:when>
+                       <xsl:when test="$p/Comma/@Length > 0 and 
+                                       ($p/Lt/@Length = 0 or $p/Comma/@Length &lt; $p/Lt/@Length) and 
+                                       ($p/Gt/@Length > 0 and $p/Comma/@Length &lt; $p/Gt/@Length)">
+                               <xsl:text>,</xsl:text>
+                               <xsl:value-of select="substring-after ($s, ',')" />
+                       </xsl:when>
+                       <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
+                               <xsl:variable name="r">
+                                       <xsl:call-template name="SkipGenericArgument">
+                                               <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
+                                       </xsl:call-template>
+                               </xsl:variable>
+                               <xsl:choose>
+                                       <xsl:when test="starts-with ($r, '>') or starts-with ($r, '+')">
+                                               <xsl:value-of select="substring-after ($r, '&gt;')" />
+                                       </xsl:when>
+                                       <xsl:when test="starts-with ($r, ',')">
+                                               <xsl:value-of select="$r" />
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:message>
+! WTF3: s=<xsl:value-of select="$s" />; r=<xsl:value-of select="$r" />
+                                               </xsl:message>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </xsl:when>
+                       <xsl:when test="$p/Gt/@Length > 0">
+                               <xsl:text>&gt;</xsl:text>
+                               <xsl:value-of select="substring-after ($s, '&gt;')" />
+                       </xsl:when>
+                       <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetCLtGtPositions">
+               <xsl:param name="s" />
+
+               <xsl:variable name="c"  select="substring-before ($s, ',')" />
+               <xsl:variable name="lt" select="substring-before ($s, '&lt;')" />
+               <xsl:variable name="gt" select="substring-before ($s, '&gt;')" />
+
+                       <Comma String="{$c}" Length="{string-length ($c)}" />
+                       <Lt String="{$lt}" Length="{string-length ($lt)}" />
+                       <Gt String="{$gt}" Length="{string-length ($gt)}" />
+       </xsl:template>
+
+       <!--
+       when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
+       when given 'Bar<C>+Nested>', returns '>'
+       when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
+       (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
+         -->
+       <xsl:template name="SkipGenericArgument">
+               <xsl:param name="s" />
+
+               <xsl:variable name="p-rtf">
+                       <xsl:call-template name="GetCLtGtPositions">
+                               <xsl:with-param name="s" select="$s" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
+
+               <xsl:choose>
+                       <xsl:when test="starts-with ($s, '>')">
+                               <xsl:message terminate="yes">
+SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
+                               </xsl:message>
+                       </xsl:when>
+                       <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
+                               <!-- within 'Foo<A...'; look for matching '>' -->
+                               <xsl:variable name="r">
+                                       <xsl:call-template name="SkipGenericArgument">
+                                               <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
+                                       </xsl:call-template>
+                               </xsl:variable>
+                               <xsl:value-of select="substring-after ($r, '&gt;')" />
+                       </xsl:when>
+                       <xsl:when test="$p/Gt/@Length > 0">
+                               <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
+                               <xsl:value-of select="substring-after ($s, '&gt;')" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$s" />
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetEscapedParameter">
+               <xsl:param name="orig-parameter-type" />
+               <xsl:param name="parameter-type" />
+               <xsl:param name="parameter-types" />
+               <xsl:param name="escape" />
+               <xsl:param name="index" />
+
+               <xsl:choose>
+                       <xsl:when test="$index &gt; count($parameter-types)">
+                               <xsl:if test="$parameter-type != $orig-parameter-type">
+                                       <xsl:value-of select="$parameter-type" />
+                               </xsl:if>
+                               <!-- ignore -->
+                       </xsl:when>
+                       <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
+                               <xsl:value-of select="concat ($escape, $index - 1)" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
+                               <xsl:call-template name="GetEscapedParameter">
+                                       <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
+                                       <xsl:with-param name="parameter-type">
+                                               <xsl:call-template name="Replace">
+                                                       <xsl:with-param name="s">
+                                                               <xsl:call-template name="Replace">
+                                                                       <xsl:with-param name="s">
+                                                                               <xsl:call-template name="Replace">
+                                                                                       <xsl:with-param name="s">
+                                                                                               <xsl:call-template name="Replace">
+                                                                                                       <xsl:with-param name="s" select="$parameter-type"/>
+                                                                                                       <xsl:with-param name="from" select="concat('&lt;', $typeparam, '&gt;')" />
+                                                                                                       <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, '&gt;')" />
+                                                                                               </xsl:call-template>
+                                                                                       </xsl:with-param>
+                                                                                       <xsl:with-param name="from" select="concat('&lt;', $typeparam, ',')" />
+                                                                                       <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, ',')" />
+                                                                               </xsl:call-template>
+                                                                       </xsl:with-param>
+                                                                       <xsl:with-param name="from" select="concat (',', $typeparam, '&gt;')" />
+                                                                       <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '&gt;')" />
+                                                               </xsl:call-template>
+                                                       </xsl:with-param>
+                                                       <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
+                                                       <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
+                                               </xsl:call-template>
+                                       </xsl:with-param>
+                                       <xsl:with-param name="parameter-types" select="$parameter-types" />
+                                       <xsl:with-param name="typeparam" select="$typeparam" />
+                                       <xsl:with-param name="escape" select="$escape" />
+                                       <xsl:with-param name="index" select="$index + 1" />
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="GetLinkId">
+               <xsl:param name="type"/>
+               <xsl:param name="member"/>
+               <xsl:call-template name="GetLinkName">
+                       <xsl:with-param name="type" select="$type" />
+                       <xsl:with-param name="member" select="$member" />
+               </xsl:call-template>
+               <xsl:if test="count($member/Parameters/Parameter) &gt; 0">
+                       <xsl:text>(</xsl:text>
+                       <xsl:for-each select="Parameters/Parameter">
+                               <xsl:if test="not(position()=1)">,</xsl:if>
+                               <xsl:call-template name="GetParameterType">
+                                       <xsl:with-param name="type" select="$type" />
+                                       <xsl:with-param name="member" select="$member" />
+                                       <xsl:with-param name="parameter" select="." />
+                               </xsl:call-template>
+                       </xsl:for-each>
+                       <xsl:text>)</xsl:text>
+               </xsl:if>
+               <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
+                       <xsl:text>~</xsl:text>
+                       <xsl:variable name="parameter-rtf">
+                               <Parameter Type="{$member/ReturnValue/ReturnType}" />
+                       </xsl:variable>
+                       <xsl:call-template name="GetParameterType">
+                               <xsl:with-param name="type" select="$type" />
+                               <xsl:with-param name="member" select="$member" />
+                               <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
+                       </xsl:call-template>
+               </xsl:if>
+       </xsl:template>
+
+       <!-- 
+         - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
+               - generics enter the picture, since a parameter type could come from the
+               - type itelf (becoming `N) or from the method (becoming ``N).
+         -->
+       <xsl:template name="GetParameterType">
+               <xsl:param name="type" />
+               <xsl:param name="member" />
+               <xsl:param name="parameter" />
+
+               <!-- the actual parameter type -->
+               <xsl:variable name="ptype">
+                       <xsl:choose>
+                               <xsl:when test="contains($parameter/@Type, '[')">
+                                       <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
+                               </xsl:when>
+                               <xsl:when test="contains($parameter/@Type, '&amp;')">
+                                       <xsl:value-of select="substring-before ($parameter/@Type, '&amp;')" />
+                               </xsl:when>
+                               <xsl:when test="contains($parameter/@Type, '*')">
+                                       <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:value-of select="$parameter/@Type" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <!-- parameter modifiers -->
+               <xsl:variable name="pmodifier">
+                       <xsl:call-template name="Replace">
+                               <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
+                               <xsl:with-param name="from">&amp;</xsl:with-param>
+                               <xsl:with-param name="to">@</xsl:with-param>
+                       </xsl:call-template>
+               </xsl:variable>
+
+               <xsl:variable name="gen-type">
+                       <xsl:call-template name="GetEscapedParameter">
+                               <xsl:with-param name="orig-parameter-type" select="$ptype" />
+                               <xsl:with-param name="parameter-type">
+                                       <xsl:variable name="nested">
+                                               <xsl:call-template name="GetEscapedParameter">
+                                                       <xsl:with-param name="orig-parameter-type" select="$ptype" />
+                                                       <xsl:with-param name="parameter-type" select="$ptype" />
+                                                       <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
+                                                       <xsl:with-param name="escape" select="'`'" />
+                                                       <xsl:with-param name="index" select="1" />
+                                               </xsl:call-template>
+                                       </xsl:variable>
+                                       <xsl:choose>
+                                               <xsl:when test="$nested != ''">
+                                                       <xsl:value-of select="$nested" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="$ptype" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:with-param>
+                               <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
+                               <xsl:with-param name="escape" select="'``'" />
+                               <xsl:with-param name="index" select="1" />
+                       </xsl:call-template>
+               </xsl:variable>
+
+               <!-- the actual parameter type -->
+               <xsl:variable name="parameter-type">
+                       <xsl:choose>
+                               <xsl:when test="$gen-type != ''">
+                                       <xsl:value-of select="$gen-type" />
+                                       <xsl:value-of select="$pmodifier" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:value-of select="concat($ptype, $pmodifier)" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:variable>
+
+               <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
+               <xsl:call-template name="Replace">
+                       <xsl:with-param name="s">
+                               <xsl:call-template name="Replace">
+                                       <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
+                                       <xsl:with-param name="from">&gt;</xsl:with-param>
+                                       <xsl:with-param name="to">}</xsl:with-param>
+                               </xsl:call-template>
+                       </xsl:with-param>
+                       <xsl:with-param name="from">&lt;</xsl:with-param>
+                       <xsl:with-param name="to">{</xsl:with-param>
+               </xsl:call-template>
+       </xsl:template>
+
+       <xsl:template name="Replace">
+               <xsl:param name="s" />
+               <xsl:param name="from" />
+               <xsl:param name="to" />
+               <xsl:choose>
+                       <xsl:when test="not(contains($s, $from))">
+                               <xsl:value-of select="$s" />
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:variable name="prefix" select="substring-before($s, $from)"/>
+                               <xsl:variable name="suffix" select="substring-after($s, $from)" />
+                               <xsl:value-of select="$prefix" />
+                               <xsl:value-of select="$to" />
+                               <xsl:call-template name="Replace">
+                                       <xsl:with-param name="s" select="$suffix" />
+                                       <xsl:with-param name="from" select="$from" />
+                                       <xsl:with-param name="to" select="$to" />
+                               </xsl:call-template>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+       <xsl:template name="getmodifiers">
+               <xsl:param name="sig"/>
+               <xsl:param name="protection" select="true()"/>
+               <xsl:param name="inheritance" select="true()"/>
+               <xsl:param name="extra" select="true()"/>
+               <xsl:param name="typetype" select="false()"/>
+
+               <xsl:variable name="Sig">
+                       <xsl:text> </xsl:text>
+                       <xsl:choose>
+                               <xsl:when test="contains($sig, '{')">
+                                       <xsl:value-of select="substring-before ($sig, '{')" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:value-of select="$sig" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+                       <xsl:text> </xsl:text>
+               </xsl:variable>
+
+               <xsl:if test="$protection">
+                       <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
+                       <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
+                       <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
+                       <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
+               </xsl:if>
+
+               <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
+               <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
+               <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
+
+               <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
+               <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
+
+               <xsl:if test="$inheritance">
+                       <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
+                       <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
+               </xsl:if>
+
+               <xsl:if test="$extra">
+                       <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
+                       <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
+
+                       <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
+                       <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
+                       <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
+                       <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
+                       <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
+                       <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
+               </xsl:if>
+
+               <xsl:if test="$typetype">
+                       <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
+                       <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
+                       <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
+                       <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
+                       <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
+               </xsl:if>
+       </xsl:template>
+
+       <xsl:template name="GetTypeDescription">
+               <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
+               <xsl:choose>
+                       <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
+                       <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
+                       <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
+                       <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
+                       <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
+               </xsl:choose>
+       </xsl:template>
+       
+       <xsl:template match="since">
+               <p>
+                       <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />
+                       and later.</i>
+               </p>
+       </xsl:template>
+
+       <xsl:template name="GetLinkTargetHtml">
+               <xsl:param name="type" />
+               <xsl:param name="cref" />
+
+               <xsl:variable name="href">
+                       <xsl:call-template name="GetLinkTarget">
+                               <xsl:with-param name="type" select="$type" />
+                               <xsl:with-param name="cref" select="$cref" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="string($href) = ''">
+                               <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
+                       </xsl:when>
+                       <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/mdoc-sections-css.xsl b/mcs/tools/monkeydoc/Resources/mdoc-sections-css.xsl
new file mode 100644 (file)
index 0000000..ab31043
--- /dev/null
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+
+<!--
+       mdoc-sections-css.xsl: Common CSS implementation of mdoc-html-utils.xsl
+                              required functions.
+
+
+       Including XSLT files need to provide the following functions:
+
+               - CreateExpandedToggle()
+
+       Author: Jonathan Pryor  <jpryor@novell.com>
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+
+       <xsl:template name="CreateH2Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h2 class="Section">
+                       <xsl:if test="$id != ''">
+                               <xsl:attribute name="id">
+                                       <xsl:value-of select="$id" />
+                               </xsl:attribute>
+                       </xsl:if>
+                       <xsl:value-of select="$name" />
+               </h2>
+               <div class="SectionBox" id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </div>
+       </xsl:template>
+
+       <xsl:template name="CreateH3Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="class" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h3>
+                       <xsl:if test="$class != ''">
+                               <xsl:attribute name="class">
+                                       <xsl:value-of select="$class" />
+                               </xsl:attribute>
+                       </xsl:if>
+                       <xsl:if test="$id != ''">
+                               <xsl:attribute name="id">
+                                       <xsl:value-of select="$id" />
+                               </xsl:attribute>
+                       </xsl:if>
+                       <xsl:value-of select="$name" />
+               </h3>
+               <blockquote id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </blockquote>
+       </xsl:template>
+
+       <xsl:template name="CreateH4Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h4 class="Subsection">
+                       <xsl:if test="$id != ''">
+                               <xsl:attribute name="id">
+                                       <xsl:value-of select="$id" />
+                               </xsl:attribute>
+                       </xsl:if>
+                       <xsl:value-of select="$name" />
+               </h4>
+               <blockquote class="SubsectionBox" id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </blockquote>
+       </xsl:template>
+
+       <xsl:template name="CreateEnumerationTable">
+               <xsl:param name="content" />
+               <table class="Enumeration">
+                       <tr><th>Member Name</th><th>Description</th></tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateHeader">
+               <xsl:param name="content" />
+               <xsl:copy-of select="$content" />
+       </xsl:template>
+
+       <xsl:template name="CreateListTable">
+               <xsl:param name="header" />
+               <xsl:param name="content" />
+               <table class="Documentation">
+                       <tr><xsl:copy-of select="$header" /></tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateMembersTable">
+               <xsl:param name="content" />
+               <table class="TypeMembers">
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateSignature">
+               <xsl:param name="content" />
+               <h2>Syntax</h2>
+               <div class="Signature">
+                       <xsl:copy-of select="$content" />
+               </div>
+       </xsl:template>
+
+       <xsl:template name="CreateTypeDocumentationTable">
+               <xsl:param name="content" />
+               <table class="TypeDocumentation">
+               <tr><th>Type</th><th>Reason</th></tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/mcs/tools/monkeydoc/Resources/mdoc-sections.xsl b/mcs/tools/monkeydoc/Resources/mdoc-sections.xsl
new file mode 100644 (file)
index 0000000..03d8383
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+
+<!--
+       mdoc-sections.xsl: Common non-CSS implementation of mdoc-html-utils.xsl
+                          required functions.
+
+       Author: Jonathan Pryor  <jpryor@novell.com>
+
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+       <xsl:template name="CreateH2Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h2 class="Section">
+                       <xsl:value-of select="$name" />
+               </h2>
+               <blockquote id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </blockquote>
+       </xsl:template>
+
+       <xsl:template name="CreateH3Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="class" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h3>
+                       <xsl:value-of select="$name" />
+               </h3>
+               <blockquote id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </blockquote>
+       </xsl:template>
+
+       <xsl:template name="CreateH4Section">
+               <xsl:param name="name" />
+               <xsl:param name="id" select="''" />
+               <xsl:param name="child-id" select="generate-id (.)" />
+               <xsl:param name="content" />
+
+               <h4 class="Subsection">
+                       <xsl:value-of select="$name" />
+               </h4>
+               <blockquote class="SubsectionBox" id="{$child-id}">
+                       <xsl:copy-of select="$content" />
+               </blockquote>
+       </xsl:template>
+
+       <xsl:template name="CreateEnumerationTable">
+               <xsl:param name="content" />
+               <table class="EnumerationsTable" border="1" cellpadding="10" width="100%">
+                       <tr bgcolor="#f2f2f2">
+                               <th>Member Name</th>
+                               <th>Description</th>
+                       </tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateHeader">
+               <xsl:param name="content" />
+               <table class="HeaderTable" width="100%" cellpadding="5">
+                       <tr bgcolor="#b0c4de">
+                               <td>
+                                       <xsl:copy-of select="$content" />
+                               </td>
+                       </tr>
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateListTable">
+               <xsl:param name="header" />
+               <xsl:param name="content" />
+               <table border="1" cellpadding="3" width="100%">
+                       <tr bgcolor="#f2f2f2" valign="top">
+                               <xsl:copy-of select="$header" />
+                       </tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateMembersTable">
+               <xsl:param name="content" />
+               <table border="1" cellpadding="6" width="100%">
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+       <xsl:template name="CreateSignature">
+               <xsl:param name="content" />
+               <table class="SignatureTable" bgcolor="#c0c0c0" cellspacing="0" width="100%">
+               <tr><td>
+                       <table class="InnerSignatureTable" cellpadding="10" cellspacing="0" width="100%">
+                       <tr bgcolor="#f2f2f2">
+                               <td>
+                               <xsl:copy-of select="$content" />
+                       </td></tr>
+                       </table>
+               </td></tr>
+               </table>
+               <br />
+       </xsl:template>
+       
+       <xsl:template name="CreateTypeDocumentationTable">
+               <xsl:param name="content" />
+               <table class="TypePermissionsTable" border="1" cellpadding="6" width="100%">
+               <tr bgcolor="#f2f2f2"><th>Type</th><th>Reason</th></tr>
+                       <xsl:copy-of select="$content" />
+               </table>
+       </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/mono-ecma-css.xsl b/mcs/tools/monkeydoc/Resources/mono-ecma-css.xsl
new file mode 100644 (file)
index 0000000..017699d
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+       mono-ecma-css.xsl: ECMA-style docs to HTML+CSS stylesheet trasformation
+       based on mono-ecma.xsl by Joshua Tauberer
+
+       Author: Joshua Tauberer (tauberer@for.net)
+       Author: Mario Sopena Novales (mario.sopena@gmail.com)
+
+       TODO:
+               split this into multiple files
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+       <xsl:include href="mdoc-sections-css.xsl" />
+       <xsl:include href="mono-ecma-impl.xsl" />
+       
+       <xsl:output omit-xml-declaration="yes" />
+
+       <xsl:template name="CreateExpandedToggle">
+               <img src="xtree/images/clean/Lminus.gif" border="0" align="top"/>
+       </xsl:template>
+
+       <xsl:template name="CreateCodeBlock">
+               <xsl:param name="language" />
+               <xsl:param name="content" />
+
+               <div class="CodeExample">
+                       <p><b><xsl:value-of select="$language"/> Example</b></p>
+                       <div>
+                       <pre>
+                               <!--
+                               <xsl:value-of select="monodoc:Colorize($content, string($language))" 
+                                       disable-output-escaping="yes" />
+                                 -->
+                               <xsl:value-of select="$content" />
+                       </pre>
+                       </div>
+               </div>
+       </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/mono-ecma-impl.xsl b/mcs/tools/monkeydoc/Resources/mono-ecma-impl.xsl
new file mode 100644 (file)
index 0000000..61d827e
--- /dev/null
@@ -0,0 +1,540 @@
+<?xml version="1.0"?>
+
+<!--
+       mono-ecma-impl.xsl: ECMA-style docs to HTML stylesheet trasformation
+
+       Author: Joshua Tauberer (tauberer@for.net)
+       Author: Jonathan Pryor (jpryor@novell.com)
+
+       This file requires that including files define the following callable
+       templates:
+               - CreateCodeBlock (language, content)
+               - CreateEnumerationTable (content)
+               - CreateHeader (content)
+               - CreateListTable (header, content)
+               - CreateMembersTable (content)
+               - CreateSignature (content)
+               - CreateTypeDocumentationTable (content)
+
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+       <xsl:include href="mdoc-html-utils.xsl" />
+       
+       <!-- TEMPLATE PARAMETERS -->
+
+       <xsl:param name="show"/>
+       <xsl:param name="membertype"/>
+       <xsl:param name="namespace"/>
+
+       <!-- THE MAIN RENDERING TEMPLATE -->
+
+       <xsl:template match="Type|elements">
+               <!-- The namespace that the current type belongs to. -->
+               <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
+
+               <!-- HEADER -->
+
+               <xsl:variable name="typename" select="translate (@FullName, '+', '.')" />
+               <xsl:variable name="typelink">
+                       <xsl:call-template name="GetEscapedTypeName">
+                               <xsl:with-param name="typename" select="@FullName" />
+                       </xsl:call-template>
+               </xsl:variable>
+               <xsl:variable name="basename">
+                       <xsl:if test="Base/BaseTypeName">
+                               <xsl:value-of select="translate (Base/BaseTypeName, '+', '.')" />
+                       </xsl:if>
+               </xsl:variable>
+               <xsl:variable name="baselink">
+                       <xsl:if test="Base/BaseTypeName">
+                               <xsl:call-template name="GetEscapedTypeName">
+                                       <xsl:with-param name="typename" select="Base/BaseTypeName" />
+                               </xsl:call-template>
+                       </xsl:if>
+               </xsl:variable>
+
+               <xsl:call-template name="CreateHeader">
+                       <xsl:with-param name="content">
+                         <ul class="breadcrumb">
+                               <xsl:choose>
+                                       <xsl:when test="$show='masteroverview'">
+                                               <li class="namespace">
+                                                 <xsl:text>Namespaces in this Collection</xsl:text>
+                                               </li>
+                                       </xsl:when>
+                                       <xsl:when test="$show='typeoverview'">
+                                               <li class="namespace">
+                                               <a>
+                                                       <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+                                                       <xsl:value-of select="$TypeNamespace"/></a>
+                                               </li>
+                                               <li class="pubclass">
+                                                       <xsl:value-of select="@Name"/>
+                                               </li>
+                                       </xsl:when>
+                                       <xsl:when test="$show='members'">
+                                               <li class="namespace">
+                                                 <a>
+                                                   <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+                                                   <xsl:value-of select="$TypeNamespace"/>
+                                                 </a>
+                                               </li>
+                                               <li class="pubclass">
+                                                 <a>
+                                                       <xsl:attribute name="href">
+                                                               <xsl:text>T:</xsl:text>
+                                                               <xsl:value-of select="$typelink" />
+                                                       </xsl:attribute>                                                  
+                                                       <xsl:value-of select="@Name"/>
+                                                 </a>
+                                               </li>
+                                               <li class="members">
+                                                 Members
+                                               </li>
+                                       </xsl:when>
+                                       <xsl:when test="$show='member' or $show='overloads'">
+                                               <li class="namespace">
+                                               <a>
+                                                       <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
+                                                       <xsl:value-of select="$TypeNamespace"/></a>
+                                               </li>
+                                               <li class="pubclass">
+                                                 <a>
+                                                       <xsl:attribute name="href">
+                                                               <xsl:text>T:</xsl:text>
+                                                               <xsl:value-of select="$typelink" />
+                                                       </xsl:attribute>                                                  
+                                                       <xsl:value-of select="@Name"/>
+                                                 </a>
+                                               </li>
+                                               <li class="pubproperty">
+                                                 <xsl:choose>
+                                                 <xsl:when test="$membertype='Operator'">
+                                                       <xsl:value-of select="$typename"/>
+                                                       <xsl:value-of select="' '"/> <!-- hard space -->
+                                                       <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
+                                                 </xsl:when>
+                                                 <xsl:when test="$membertype='Constructor'">
+                                                       <xsl:value-of select="$typename"/>
+                                                 </xsl:when>
+                                                 <xsl:otherwise>
+                                                       <xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
+                                                 </xsl:otherwise>
+                                                 </xsl:choose>
+                                               </li>
+                                       </xsl:when>
+                                       <xsl:when test="$show='namespace'">
+                                               <li class="namespace">
+                                                 <xsl:value-of select="$namespace"/>
+                                               </li>
+                                       </xsl:when>
+                               </xsl:choose>
+                       </ul>
+                       <div class="named-header">
+                               <xsl:choose>
+                                       <xsl:when test="$show='masteroverview'">
+                                               <xsl:text>Master Overview</xsl:text>
+                                       </xsl:when>
+                                       <xsl:when test="$show='typeoverview'">
+                                               <xsl:value-of select="$typename"/>
+                                               <xsl:value-of select="' '"/>
+                                               <xsl:call-template name="gettypetype"/>
+                                       </xsl:when>
+                                       <xsl:when test="$show='members' and $membertype='All'">
+                                               <xsl:value-of select="$typename"/>
+                                               <xsl:text> Members</xsl:text>
+                                       </xsl:when>
+                                       <xsl:when test="$show='members'">
+                                               <xsl:value-of select="$typename"/>
+                                               <xsl:text>: </xsl:text>
+                                               <xsl:value-of select="$membertype"/>
+                                               <xsl:text> Members</xsl:text>
+                                       </xsl:when>
+                                       <xsl:when test="$show='member'">
+                                               <xsl:choose>
+                                               <xsl:when test="$membertype='Operator'">
+                                                       <xsl:value-of select="$typename"/>
+                                                       <xsl:value-of select="' '"/> <!-- hard space -->
+                                                       <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
+                                               </xsl:when>
+                                               <xsl:when test="$membertype='Constructor'">
+                                                       <xsl:value-of select="$typename"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="$typename"/>.<xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
+                                               </xsl:otherwise>
+                                               </xsl:choose>
+                                               <xsl:value-of select="' '"/>
+                                               <xsl:value-of select="$membertype"/>
+                                       </xsl:when>
+
+                                       <xsl:when test="$show='namespace'">
+                                               <xsl:value-of select="$namespace"/>
+                                               <xsl:text> Namespace</xsl:text>
+                                       </xsl:when>
+                                       
+                                       <xsl:when test="$show='overloads'">
+                                               <xsl:value-of select="$typename"/>.<xsl:value-of select="$index"/> Overloads
+                                       </xsl:when>
+
+                               </xsl:choose>
+                       </div>
+                       </xsl:with-param>
+               </xsl:call-template>
+
+               <!-- SELECT WHAT TYPE OF VIEW:
+                               typeoverview
+                               members
+                               member
+                               -->
+               <div class="Content">
+               <xsl:choose>
+               <xsl:when test="$show='masteroverview'">
+               
+                       <xsl:for-each select="namespace">
+                               <xsl:sort select="@ns"/>
+                               
+                               <!-- Don't display the namespace if it is a sub-namespace of another one.
+                                    But don't consider namespaces without periods, e.g. 'System', to be
+                                        parent namespaces because then most everything will get grouped under it. -->
+                               <xsl:variable name="ns" select="@ns"/>
+                               <xsl:if test="count(parent::*/namespace[not(substring-before(@ns, '.')='') and starts-with($ns, concat(@ns, '.'))])=0">
+
+                               <p>
+                                       <b><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></b>
+                               </p>
+                               <blockquote>
+                                       <div>
+                                       <xsl:apply-templates select="summary" mode="notoppara"/>
+                                       </div>
+                                       
+                                       <!-- Display the sub-namespaces of this namespace -->
+                                       <xsl:if test="not(substring-before($ns, '.')='')">
+                                       <xsl:for-each select="parent::*/namespace[starts-with(@ns, concat($ns, '.'))]">
+                                               <br/>
+                                               <div><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></div>
+                                               <div><xsl:apply-templates select="summary" mode="notoppara"/></div>                                             
+                                       </xsl:for-each>
+                                       </xsl:if>
+                               </blockquote>
+                               
+                               </xsl:if>
+                       </xsl:for-each>
+                       
+               </xsl:when>
+               <!-- TYPE OVERVIEW -->
+               <xsl:when test="$show='typeoverview'">
+                       <xsl:variable name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
+                       <xsl:call-template name="CreateTypeOverview">
+                               <xsl:with-param name="implemented" select="$implemented" />
+                               <xsl:with-param name="show-members-link" select="true()" />
+                       </xsl:call-template>
+                       
+
+                       <!-- signature -->
+                       <xsl:call-template name="CreateTypeSignature" />
+
+                       <xsl:call-template name="DisplayDocsInformation">
+                               <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+                       </xsl:call-template>
+               </xsl:when>
+
+               <!-- MEMBER LISTING -->
+               <xsl:when test="$show='members'">
+                       <xsl:if test="$membertype='All'">
+                               <p>
+                                       The members of <xsl:value-of select="$typename"/> are listed below.
+                               </p>
+
+                               <xsl:if test="Base/BaseTypeName">
+                                       <p>
+                                               <xsl:text>See Also: </xsl:text>
+                                               <a>
+                                                       <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
+                                                       <xsl:text>Inherited members from </xsl:text>
+                                                       <xsl:value-of select="$basename"/>
+                                               </a>
+                                       </p>
+                               </xsl:if>
+
+                               <ul class="TypeMembersIndex">
+                                       <xsl:if test="count(Members/Member[MemberType='Constructor'])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/C</xsl:attribute>Constructors</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='Field'])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/F</xsl:attribute>Fields</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='Property'])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/P</xsl:attribute>Properties</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='Method' and not(starts-with(@MemberName,'op_'))])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/M</xsl:attribute>Methods</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='Event'])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='Method' and starts-with(@MemberName,'op_')])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
+                                               </li>
+                                       </xsl:if>
+                                       <xsl:if test="count(Members/Member[MemberType='ExtensionMethod'])">
+                                               <li>
+                                                       <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/X</xsl:attribute>Extension Methods</a>
+                                               </li>
+                                       </xsl:if>
+                               </ul>
+
+                               <!-- list each type of member (public, then protected) -->
+
+                               <xsl:call-template name="ListAllMembers" />
+                       </xsl:if>
+
+                       <xsl:if test="not($membertype='All')">
+                               <!-- list the members of this type (public, then protected) -->
+
+                               <p>
+                                       The
+                                       <xsl:call-template name="membertypeplurallc"><xsl:with-param name="name" select="$membertype"/></xsl:call-template>
+                                       of <xsl:value-of select="$typename"/> are listed below.  For a list of all members, see the <a>
+                                       <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
+                                       <xsl:value-of select="@Name"/> Members</a> list.
+                               </p>
+                               
+                               <xsl:if test="Base/BaseTypeName">
+                                       <p>
+                                               <xsl:text>See Also: </xsl:text>
+                                               <a>
+                                                       <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
+                                                       <xsl:text>Inherited members from </xsl:text>
+                                                       <xsl:value-of select="$basename"/>
+                                               </a>
+                                       </p>
+                               </xsl:if>
+
+                               <xsl:call-template name="ListMembers">
+                                       <xsl:with-param name="listmembertype" select="$membertype"/>
+                                       <xsl:with-param name="showprotected" select="false()"/>
+                               </xsl:call-template>
+
+                               <xsl:call-template name="ListMembers">
+                                       <xsl:with-param name="listmembertype" select="$membertype"/>
+                                       <xsl:with-param name="showprotected" select="true()"/>
+                               </xsl:call-template>
+                       </xsl:if>
+
+               </xsl:when>
+               
+               <xsl:when test="$show='overloads'">
+                               <p>
+                                       The overloads of <xsl:value-of select="$index"/>
+                                       are listed below.  For a list of all members, see the <a>
+                                       <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
+                                       <xsl:value-of select="@Name"/> Members</a> list.
+                               </p>
+                               
+                               <!-- TODO: can we make this actually test if there are any overloads
+                               <xsl:if test="Base/BaseTypeName">
+                                       <p>
+                                               See Also: <a>
+                                       <xsl:attribute name="href">T:<xsl:value-of select="Base/BaseTypeName"/>/*</xsl:attribute>
+                                       Inherited members</a> from <xsl:value-of select="Base/BaseTypeName"/>
+                                       </p>
+                               </xsl:if>
+                                -->
+                                
+                               <xsl:call-template name="ListMembers">
+                                       <xsl:with-param name="listmembertype" select="$membertype"/>
+                                       <xsl:with-param name="showprotected" select="false()"/>
+                                       <xsl:with-param name="overloads-mode" select="true()"/>
+                               </xsl:call-template>
+
+                               <xsl:call-template name="ListMembers">
+                                       <xsl:with-param name="listmembertype" select="$membertype"/>
+                                       <xsl:with-param name="showprotected" select="true()"/>
+                                       <xsl:with-param name="overloads-mode" select="true()"/>
+                               </xsl:call-template>
+               </xsl:when>
+               <!-- MEMBER DETAILS -->
+               <xsl:when test="$show='member'">
+                       <xsl:variable name="Type" select="."/>
+
+                       <!-- select the member, this just loops through the one member that we are to display -->
+                       <xsl:for-each select="Members/Member[MemberType=$membertype or ($membertype='Operator' and MemberType='Method')][position()=$index+1]">
+
+                               <!-- summary -->
+                               
+                               <xsl:call-template name="CreateMemberOverview">
+                                       <xsl:with-param name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
+                               </xsl:call-template>
+
+                               <xsl:call-template name="CreateMemberSignature">
+                                       <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+                               </xsl:call-template>
+
+                               <div class="MemberBox">
+                                       <xsl:call-template name="DisplayDocsInformation">
+                                               <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
+                                       </xsl:call-template>
+                               </div>
+
+                       </xsl:for-each>
+
+               </xsl:when>
+
+               <!-- NAMESPACE SUMMARY -->
+               <xsl:when test="$show='namespace'">
+
+                       <!-- summary -->
+
+                       <p>
+                               <xsl:apply-templates select="summary" mode="notoppara"/>
+                               <xsl:if test="monodoc:MonoEditing()">
+                                       <xsl:value-of select="' '" />
+                                       [<a href="{monodoc:EditUrlNamespace (., $namespace, 'summary')}">Edit</a>]
+                               </xsl:if>
+                       </p>
+
+                       <!-- remarks -->
+
+                       <xsl:if test="not(remarks = '')">
+                               <h2>Remarks</h2>
+                               <div class="SectionBox">
+                                       <xsl:apply-templates select="remarks"/>
+                                       <xsl:if test="monodoc:MonoEditing()">
+                                               <xsl:value-of select="' '" />
+                                               [<a href="{monodoc:EditUrlNamespace (., $namespace, 'remarks')}">Edit</a>]
+                                       </xsl:if>
+                               </div>
+                       </xsl:if>
+               
+                       <xsl:call-template name="namespacetypes">
+                               <xsl:with-param name="typetype" select="'class'"/>
+                               <xsl:with-param name="typetitle" select="'Classes'"/>
+                       </xsl:call-template>
+
+                       <xsl:call-template name="namespacetypes">
+                               <xsl:with-param name="typetype" select="'interface'"/>
+                               <xsl:with-param name="typetitle" select="'Interfaces'"/>
+                       </xsl:call-template>
+
+                       <xsl:call-template name="namespacetypes">
+                               <xsl:with-param name="typetype" select="'struct'"/>
+                               <xsl:with-param name="typetitle" select="'Structs'"/>
+                       </xsl:call-template>
+
+                       <xsl:call-template name="namespacetypes">
+                               <xsl:with-param name="typetype" select="'delegate'"/>
+                               <xsl:with-param name="typetitle" select="'Delegates'"/>
+                       </xsl:call-template>
+
+                       <xsl:call-template name="namespacetypes">
+                               <xsl:with-param name="typetype" select="'enum'"/>
+                               <xsl:with-param name="typetitle" select="'Enumerations'"/>
+                       </xsl:call-template>
+
+                       
+               </xsl:when>
+
+               <!-- don't know what kind of page this is -->
+               <xsl:otherwise>
+                       Don't know what to do!
+               </xsl:otherwise>
+
+               </xsl:choose>
+               </div>
+               
+               <!-- FOOTER -->
+               
+               <div class="Footer">
+               </div>
+
+       </xsl:template>
+
+       <xsl:template name="GetLinkTarget">
+               <xsl:param name="type" />
+               <xsl:param name="cref" />
+
+               <xsl:value-of select="$cref" />
+       </xsl:template>
+
+       <xsl:template name="namespacetypes">
+               <xsl:param name="typetype"/>
+               <xsl:param name="typetitle"/>
+
+               <xsl:variable name="NODES" select="*[name()=$typetype]"/>
+
+               <xsl:if test="count($NODES)">
+
+               <xsl:call-template name="CreateH2Section">
+                       <xsl:with-param name="name" select="$typetitle" />
+                       <xsl:with-param name="child-id" select="$typetitle" />
+                       <xsl:with-param name="content">
+               
+               <xsl:call-template name="CreateTypeDocumentationTable">
+               <xsl:with-param name="content">
+                       <xsl:for-each select="$NODES">
+                               <xsl:sort select="@name"/>
+
+                               <tr>
+                                       <td>
+                                               <a>
+                                                       <xsl:attribute name="href">
+                                                               <xsl:text>T:</xsl:text>
+                                                               <xsl:call-template name="GetEscapedTypeName">
+                                                                       <xsl:with-param name="typename" select="@fullname" />
+                                                               </xsl:call-template>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of select="@name"/>
+                                               </a>
+
+                                               <xsl:variable name="containingtype" select="substring-before(@fullname, concat('+',@name))"/>
+                                               <xsl:if test="$containingtype">
+                                               <br/>(in
+                                                       <xsl:call-template name="maketypelink">
+                                                               <xsl:with-param name="type" select="$containingtype"/>
+                                                               <xsl:with-param name="wrt" select="$namespace"/>
+                                                       </xsl:call-template>)
+                                               </xsl:if>
+                                       </td>
+                                       <td>
+                                               <xsl:apply-templates select="summary" mode="notoppara"/>
+
+                                               <xsl:variable name="MonoImplInfo" select="monodoc:MonoImpInfo(string(@assembly), string(@fullname), false())"/>
+                                               <xsl:if test="$MonoImplInfo"><br/><b><xsl:value-of disable-output-escaping="yes" select="$MonoImplInfo"/></b></xsl:if>
+                                       </td>
+                               </tr>
+                       </xsl:for-each>
+               </xsl:with-param>
+               </xsl:call-template>
+                       </xsl:with-param>
+               </xsl:call-template>
+
+               </xsl:if>
+       </xsl:template>
+       
+       <xsl:template name="CreateEditLink">
+               <xsl:param name="e" />
+               <xsl:if test="monodoc:MonoEditing()">
+                       <xsl:value-of select="' '" />
+                       [<a href="{monodoc:EditUrl ($e)}">Edit</a>]
+               </xsl:if>
+       </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/mono-ecma.css b/mcs/tools/monkeydoc/Resources/mono-ecma.css
new file mode 100644 (file)
index 0000000..2ffa1d2
--- /dev/null
@@ -0,0 +1,596 @@
+body
+{
+    font-family: "Lucida Grande", Geneva, Helvetica, Arial, Verdana, Sans-Serif;
+    margin: 0;
+    padding: 0;
+    color: #333333;
+}
+
+a:link
+{
+    color: #034af3;
+    text-decoration: underline;
+}
+a:visited
+{
+    color: #505abc;
+}
+a:hover
+{
+    color: #1d60ff;
+    text-decoration: none;
+}
+a:active
+{
+    color: #12eb87;
+}
+
+pre
+{
+    font-family: Consolas, "Courier New", Monospace;
+    border: 1px solid #CCCCCC;
+    background-color: #F7F7F7;
+    padding: 7px;
+    margin: 0 20px 0 20px;
+    line-height: 1.3em;
+    -moz-border-radius: 3px;
+    -webkit-border-radius: 3px;
+    border-radius: 3px;
+}
+
+img
+{
+    border: 0px;
+}
+
+/* HEADINGS   
+----------------------------------------------------------*/
+h1, h2, h3, h4, h5, h6
+{
+    color: #000;
+    font-family: Arial, Helvetica, sans-serif;
+}
+
+h1
+{
+    font-size: 16pt;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+h2
+{
+    font-size: 14pt;
+    padding: 0 0 1px 0;
+    border-bottom: 1px solid #DDDDDD;
+    margin-top: 20px;
+}
+h3
+{
+    font-size: 12pt;
+    margin-top: 20px;
+    margin-bottom: 5px;
+}
+h4
+{
+    font-size: 11pt;
+}
+h5, h6
+{
+    font-size: 10pt;
+}
+
+/* this rule styles <h2> tags that are the 
+first child of the left and right table columns */
+.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
+{
+    margin-top: 0;
+}
+
+/* PRIMARY LAYOUT ELEMENTS   
+----------------------------------------------------------*/
+
+/* you can specify a greater or lesser percentage for the 
+page width. Or, you can specify an exact pixel width. */
+.page
+{
+    padding: 0;
+    margin: 0;
+}
+
+#header
+{
+    position: relative;
+    margin-bottom: 0px;
+    color: #000;
+    padding: 0 0 0 15px;
+    background: url('mdocimages/headerbg.png');
+    background-position: right;
+    background-repeat: no-repeat;
+    background-color: #679EF1;
+    height: 40px;
+    border-bottom: 1px solid #98C2F7;
+    border-bottom: 1px dotted #3363BD;
+}
+
+#header h1
+{
+    font-weight: bold;
+    padding: 0;
+    margin: 0;
+    color: #fff;
+    border: none;
+    line-height: 1.8em;
+    font-family: Arial, Helvetica, sans-serif;
+    font-size: 22px !important;
+}
+
+#main
+{
+    padding: 0px 0px 15px 0px;
+    background-color: #fff;
+    margin-bottom: 30px;
+    _height: 1px; /* only IE6 applies CSS properties starting with an underscore */
+}
+
+#footer
+{
+    color: #999;
+    padding: 10px 0;
+    text-align: center;
+    line-height: normal;
+    margin: 0;
+    font-size: 8pt;
+}
+
+#line-background
+{
+    background-image: url('mdocimages/treebg.png');
+    background-repeat: repeat-y;
+    height: 100%;
+}
+
+#left-content
+{
+    float: left;
+    width: 186px;
+    padding-top: 5px;
+    margin-right: 5px;
+    overflow: hidden;
+}
+
+#right-content
+{
+    padding-top: 0px;
+    overflow: auto;
+    height: 100%;
+}
+
+.right-content-pad
+{
+    margin: 6px 10px 0px 10px;
+}
+
+.named-header
+{
+    background: url('mdocimages/hatch.png') repeat-x left bottom;
+    height: 48px;
+    background-color: #FAFBFD;
+    font-size: 16pt;
+    font-weight: bold;
+    padding: 8px 0 0 10px;
+    font-family: 'Segoe UI',Verdana,Arial, sans-serif;
+}
+
+.member-list
+{
+    border-spacing: 0px;
+}
+
+.member-list td
+{
+    padding: 4px;
+    margin: 0px;
+    border-bottom: 1px dotted #CCCCCC;
+}
+
+.member-list
+{
+    
+}
+/* TAB MENU   
+----------------------------------------------------------*/
+ul#menu
+{
+    border-bottom: 1px #5C87B2 solid;
+    padding: 0 0 2px;
+    position: relative;
+    margin: 0;
+    text-align: right;
+}
+
+ul#menu li
+{
+    display: inline;
+    list-style: none;
+}
+
+ul#menu li#greeting
+{
+    padding: 10px 20px;
+    font-weight: bold;
+    text-decoration: none;
+    line-height: 2.8em;
+    color: #fff;
+}
+
+ul#menu li a
+{
+    padding: 10px 20px;
+    font-weight: bold;
+    text-decoration: none;
+    line-height: 2.8em;
+    background-color: #e8eef4;
+    color: #034af3;
+}
+
+ul#menu li a:hover
+{
+    background-color: #fff;
+    text-decoration: none;
+}
+
+ul#menu li a:active
+{
+    background-color: #a6e2a6;
+    text-decoration: none;
+}
+
+ul#menu li.selected a
+{
+    background-color: #fff;
+    color: #000;
+}
+
+/* FORM LAYOUT ELEMENTS   
+----------------------------------------------------------*/
+
+fieldset 
+{
+    margin: 1em 0;
+    padding: 1em;
+    border: 1px solid #CCC;
+}
+
+fieldset p 
+{
+    margin: 2px 12px 10px 10px;
+}
+
+legend 
+{
+    font-size: 11pt;
+    font-weight: 600;
+    padding: 2px 4px 8px 4px;
+}
+
+input[type="text"] 
+{
+    width: 200px;
+    border: 1px solid #CCC;
+}
+
+input[type="password"] 
+{
+    width: 200px;
+    border: 1px solid #CCC;
+}
+
+/* TABLE
+----------------------------------------------------------*/
+
+table 
+{
+/*  border: solid 1px #e8eef4;
+  border-collapse: collapse;*/
+}
+
+table td 
+{
+  padding: 5px;   
+/*  border: solid 1px #e8eef4;*/
+}
+
+table th
+{
+  padding: 6px 5px;
+  text-align: left;
+  background-color: #e8eef4; 
+  border: solid 1px #e8eef4;   
+}
+
+/* MISC  
+----------------------------------------------------------*/
+.clear
+{
+    clear: both;
+}
+
+.error
+{
+    color:Red;
+}
+
+.indent
+{
+    margin-left: 20px;
+    margin-right: 20px;
+}
+
+#menucontainer
+{
+    margin-top:40px;
+}
+
+div#title
+{
+    display:block;
+    float:left;
+    text-align:left;
+}
+
+#logindisplay
+{
+    font-size:11pt;
+    display:block;
+    text-align:right;
+    margin:0px;
+    color:White;
+}
+
+#logindisplay a:link
+{
+    color: white;
+    text-decoration: underline;
+}
+
+#logindisplay a:visited
+{
+    color: white;
+    text-decoration: underline;
+}
+
+#logindisplay a:hover
+{
+    color: white;
+    text-decoration: none;
+}
+
+/* Styles for validation helpers
+-----------------------------------------------------------*/
+.field-validation-error
+{
+    color: #ff0000;
+}
+
+.field-validation-valid
+{
+    display: none;
+}
+
+.input-validation-error
+{
+    border: 1px solid #ff0000;
+    background-color: #ffeeee;
+}
+
+.validation-summary-errors
+{
+    font-weight: bold;
+    color: #ff0000;
+}
+
+.validation-summary-valid
+{
+    display: none;
+}
+
+/* Styles for editor and display helpers
+----------------------------------------------------------*/
+.display-label,
+.editor-label,
+.display-field,
+.editor-field
+{
+    margin: 0.5em 0;
+}
+
+.text-box
+{
+    width: 30em;
+}
+
+.text-box.multi-line
+{
+    height: 6.5em;
+}
+
+.tri-state
+{
+    width: 6em;
+}
+
+/* Breadcrumb Bar */
+.breadcrumb
+{
+    border-left: 1px solid #cacaca;
+    border-right: 1px solid #cacaca;
+    border-bottom: 1px solid #cacaca;
+    background-image: url('mdocimages/bc_bg.png');
+    background-repeat: repeat-x;
+    height: 25px;
+    line-height: 25px;
+    color: #454545;
+    border-top: 0px;
+    width: 100%;
+    overflow: hidden;
+    margin-left: -2px;
+    padding: 0px;
+    font-style: normal;
+    font-variant: normal;
+    font-weight: normal;
+    font-size: 11px;
+    font-family: Arial, Helvetica, sans-serif;
+    margin-right: 0px;
+    margin-top: 0px;
+    margin-bottom: 0px;
+}
+
+.breadcrumb li
+{
+    list-style-type: none;
+    float: left;
+    padding-left: 25px;
+    background-position: 5px center;
+    background-repeat: no-repeat;
+}
+
+.breadcrumb li.pubclass { background-image: url('mdocimages/pubclass.png'); }
+.breadcrumb li.pubdelegate { background-image: url('mdocimages/pubdelegate.png'); }
+.breadcrumb li.pubenumeration { background-image: url('mdocimages/pubenumeration.png'); }
+.breadcrumb li.pubevent { background-image: url('mdocimages/pubevent.png'); }
+.breadcrumb li.pubextension { background-image: url('mdocimages/pubextension.png'); }
+.breadcrumb li.pubfield { background-image: url('mdocimages/pubfield.png'); }
+.breadcrumb li.pubinterface { background-image: url('mdocimages/pubinterface.png'); }
+.breadcrumb li.pubmethod { background-image: url('mdocimages/pubmethod.png'); }
+.breadcrumb li.pubproperty { background-image: url('mdocimages/pubproperty.png'); }
+.breadcrumb li.pubstructure { background-image: url('mdocimages/pubstructure.png'); }
+
+.breadcrumb li.protclass { background-image: url('mdocimages/protclass.png'); }
+.breadcrumb li.protdelegate { background-image: url('mdocimages/protdelegate.png'); }
+.breadcrumb li.protenumeration { background-image: url('mdocimages/protenumeration.png'); }
+.breadcrumb li.protevent { background-image: url('mdocimages/protevent.png'); }
+.breadcrumb li.protextension { background-image: url('mdocimages/protextension.png'); }
+.breadcrumb li.protfield { background-image: url('mdocimages/protfield.png'); }
+.breadcrumb li.protinterface { background-image: url('mdocimages/protinterface.png'); }
+.breadcrumb li.protmethod { background-image: url('mdocimages/protmethod.png'); }
+.breadcrumb li.protproperty { background-image: url('mdocimages/protproperty.png'); }
+.breadcrumb li.protstructure { background-image: url('mdocimages/protstructure.png'); }
+
+.breadcrumb li.privclass { background-image: url('mdocimages/privclass.png'); }
+.breadcrumb li.privdelegate { background-image: url('mdocimages/privdelegate.png'); }
+.breadcrumb li.privenumeration { background-image: url('mdocimages/privenumeration.png'); }
+.breadcrumb li.privevent { background-image: url('mdocimages/privevent.png'); }
+.breadcrumb li.privextension { background-image: url('mdocimages/privextension.png'); }
+.breadcrumb li.privfield { background-image: url('mdocimages/privfield.png'); }
+.breadcrumb li.privinterface { background-image: url('mdocimages/privinterface.png'); }
+.breadcrumb li.privmethod { background-image: url('mdocimages/privmethod.png'); }
+.breadcrumb li.privproperty { background-image: url('mdocimages/privproperty.png'); }
+.breadcrumb li.privstructure { background-image: url('mdocimages/privstructure.png'); }
+
+.breadcrumb li.namespace 
+{
+    padding-left: 26px;
+    background-image: url('mdocimages/namespace.png');
+}
+
+.breadcrumb li.reference 
+{
+    padding-left: 26px;
+    background-image: url('mdocimages/reference.png');
+}
+
+.breadcrumb li.members 
+{
+    padding-left: 24px;
+    background-image: url('mdocimages/members.png');
+}
+
+.breadcrumb li.home 
+{
+    padding-left: 31px;
+    background-image: url('mdocimages/house.png');
+    background-position: 8px center;
+}
+
+.breadcrumb li.help 
+{
+    background-image: url('mdocimages/help.png');
+}
+
+.breadcrumb li.unrecognized 
+{
+    background-image: url('mdocimages/error.png');
+}
+
+.breadcrumb a
+{
+    height: 25px;
+    display: block;
+    background-image: url('mdocimages/bc_separator.png');
+    background-repeat: no-repeat;
+    background-position: right;
+    padding-right: 15px;
+    color: #454545;
+    text-decoration: none;
+}
+
+.breadcrumb a:hover
+{
+    text-decoration: underline;
+}
+
+.clearer
+{
+    clear: both;
+}
+
+div.Signature {
+  border: 1px solid #C0C0C0;
+  background: #F2F2F2;
+  padding: 1em;
+  margin-left: 1em;
+}
+
+div.Content {
+    margin-left: 1em;
+}
+
+.SectionBox {
+    margin-left: 1em;
+}
+
+/* Salvaged from the old style */
+table.Documentation, table.Enumeration, table.TypeDocumentation {
+  border-collapse: collapse;
+  width: 100%;
+}
+
+table.Documentation tr th, table.TypeMembers tr th, table.Enumeration tr th, table.TypeDocumentation tr th {
+  background: whitesmoke;
+  padding: 0.8em;
+  border: 1px solid gray;
+  text-align: left;
+  vertical-align: bottom;
+}
+
+table.Documentation tr td, table.TypeMembers tr td, table.Enumeration tr td, table.TypeDocumentation tr td {
+  padding: 0.5em;
+  border: 1px solid gray;
+  text-align: left;
+  vertical-align: top;
+}
+
+table.TypeMembers {
+  border: 1px solid #C0C0C0;
+  width: 100%;
+}
+
+table.TypeMembers tr td {
+  background: #F8F8F8;
+  border: white;
+}
+
+span.NotEntered /* Documentation for this section has not yet been entered */ {
+       font-style: italic;
+       color: #aaa;    
+}
diff --git a/mcs/tools/monkeydoc/Resources/mono-ecma.xsl b/mcs/tools/monkeydoc/Resources/mono-ecma.xsl
new file mode 100644 (file)
index 0000000..76356d2
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+
+<!--
+       mono-ecma.xsl: ECMA-style docs to HTML stylesheet trasformation
+
+       Author: Joshua Tauberer (tauberer@for.net)
+
+       TODO:
+               split this into multiple files
+-->
+
+<xsl:stylesheet
+       version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+       xmlns:monodoc="monodoc:///extensions"
+       exclude-result-prefixes="monodoc"
+       >
+       <xsl:import href="mdoc-sections.xsl" />
+       <xsl:import href="mono-ecma-impl.xsl" />
+       
+       <xsl:output omit-xml-declaration="yes" />
+
+       <xsl:template name="CreateCodeBlock">
+               <xsl:param name="language" />
+               <xsl:param name="content" />
+               <table class="CodeExampleTable" bgcolor="#f5f5dd" border="1" cellpadding="5" width="100%">
+                       <tr><td><b><xsl:value-of select="$language"/> Example</b></td></tr>
+                       <tr>
+                               <td>
+                                       <!--
+                                       <xsl:value-of select="monodoc:Colorize($content, string($language))" 
+                                               disable-output-escaping="yes" />
+                                               -->
+                                       <pre>
+                                               <xsl:value-of select="$content" />
+                                       </pre>
+                               </td>
+                       </tr>
+               </table>
+       </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/monkeydoc/Resources/toc-html.xsl b/mcs/tools/monkeydoc/Resources/toc-html.xsl
new file mode 100644 (file)
index 0000000..ea4d564
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html" />
+
+  <xsl:template match="/toc">
+       <table bgcolor="#b0c4de" width="100%" cellpadding="5"><tr><td><h3><xsl:value-of select="@title" /></h3></td></tr></table>
+       <xsl:apply-templates />
+  </xsl:template>
+
+  <xsl:template match="description">
+       <p><xsl:value-of select="." /></p>
+  </xsl:template>
+
+  <xsl:template match="list">
+       <ul>
+         <xsl:apply-templates />
+       </ul>
+  </xsl:template>
+
+  <xsl:template match="item">
+       <xsl:choose>
+         <xsl:when test="list">
+               <li>
+               <xsl:apply-templates select="list" />
+               </li>
+         </xsl:when>
+         <xsl:otherwise>
+               <li><a href="{@url}"><xsl:value-of select="." /></a></li>
+         </xsl:otherwise>
+       </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Test/Monkeydoc.Ecma/EcmaUrlTests.cs b/mcs/tools/monkeydoc/Test/Monkeydoc.Ecma/EcmaUrlTests.cs
new file mode 100644 (file)
index 0000000..611e105
--- /dev/null
@@ -0,0 +1,444 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using MonkeyDoc;
+using Monkeydoc.Ecma;
+
+namespace MonoTests.MonkeyDoc.Ecma
+{
+       [TestFixture]
+       public class EcmaUrlTests
+       {
+               EcmaUrlParser parser;
+
+               [SetUp]
+               public void Setup ()
+               {
+                       parser = new EcmaUrlParser ();
+               }
+               
+               void AssertValidUrl (string url)
+               {
+                       try {
+                               parser.IsValid (url);
+                       } catch {
+                               Assert.Fail (string.Format ("URL '{0}' deemed not valid", url));
+                       }
+               }
+
+               void AssertInvalidUrl (string url)
+               {
+                       try {
+                               parser.IsValid (url);
+                       } catch {
+                               return;
+                       }
+                       Assert.Fail (string.Format ("URL '{0}' deemed valid", url));
+               }
+
+               void AssertUrlDesc (EcmaDesc expected, string url)
+               {
+                       EcmaDesc actual = null;
+                       try {
+                               actual = parser.Parse (url);
+                       } catch (Exception e) {
+                               Assert.Fail (string.Format ("URL '{0}' deemed not valid: {1}{2}", url, Environment.NewLine, e.ToString ()));
+                       }
+
+                       Assert.AreEqual (expected, actual, "Converted URL differs");
+               }
+
+               [Test]
+               public void CommonMethodUrlIsValidTest ()
+               {
+                       AssertValidUrl ("M:System.String.FooBar()");
+                       AssertValidUrl ("M:System.String.FooBar(System.String, Int32)");
+                       AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo()");
+                       AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh,Bar)");
+                       AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh<V>,Bar)");
+                       AssertValidUrl ("M:Gendarme.Framework.Helpers.Log.WriteLine(string,string,object[])");
+                       AssertValidUrl ("M:Mono.Security.X509.Extensions.SubjectKeyIdentifierExtension.Decode");
+                       AssertValidUrl ("M:Mono.Security.PKCS7.IssuerAndSerialNumber");
+               }
+
+               [Test]
+               public void CommonTypeUrlIsValidTest ()
+               {
+                       AssertValidUrl ("T:Int32");
+                       AssertValidUrl ("T:System.Foo.Int32");
+                       AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar`1>");
+                       AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
+                       AssertValidUrl ("T:System.Foo.Int32<T>");
+                       AssertValidUrl ("T:System.Foo.Int32<T,U>");
+                       AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
+                       AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>");
+               }
+
+               [Test]
+               public void CommonTypeUrlNotValidTest ()
+               {
+                       AssertInvalidUrl ("TInt32");
+                       AssertInvalidUrl ("K:Int32");
+                       AssertInvalidUrl ("T:System..Foo.Int32");
+                       AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBar`1");
+                       AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBarSystem.Blop<T, U>>>");
+                       AssertInvalidUrl ("T:System.Foo.Int32<T,>");
+                       AssertInvalidUrl ("T:System.Foo.Int32<+FooBar<System.Blop<T, U>>>");
+               }
+
+               [Test]
+               public void NamespaceValidTest ()
+               {
+                       AssertValidUrl ("N:Foo.Bar");
+                       AssertValidUrl ("N:Foo");
+                       AssertValidUrl ("N:Foo.Bar.Baz");
+                       AssertValidUrl ("N:A.B.C");
+
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Namespace,
+                                                   Namespace = "Foo.Bar.Blop" };
+                       AssertUrlDesc (ast, "N:Foo.Bar.Blop");
+               }
+
+               [Test]
+               public void ConstructorValidTest ()
+               {
+                       AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule");
+                       AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule()");
+                       AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule(System.String)");
+                       AssertValidUrl ("C:Gendarme.Framework.Helpers.MethodSignature.MethodSignature(string,string,string[],System.Func<Mono.Cecil.MethodReference,System.Boolean>)");
+                       AssertValidUrl ("C:System.Collections.Generic.Dictionary<TKey,TValue>+KeyCollection.KeyCollection(System.Collections.Generic.Dictionary<TKey,TValue>)");
+               }
+
+               [Test]
+               public void SlashExpressionValidTest ()
+               {
+                       AssertValidUrl ("T:Foo.Bar.Type/*");
+                       AssertValidUrl ("T:Foo.Bar.Type/M");
+                       AssertValidUrl ("T:Gendarme.Framework.Bitmask<T>/M/Equals");
+                       AssertValidUrl ("T:Gendarme.Framework.Helpers.Log/M/WriteLine<T>");
+                       AssertValidUrl ("T:System.Windows.Forms.AxHost/M/System.ComponentModel.ICustomTypeDescriptor.GetEvents");
+               }
+
+               [Test]
+               public void MethodWithArgModValidTest ()
+               {
+                       AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging&)");
+                       AssertValidUrl ("M:Foo.Bar.FooBar(int@, System.Drawing.Imaging)");
+                       AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging*)");
+                       AssertValidUrl ("M:Foo.Bar.FooBar(int*, System.Drawing.Imaging&)");
+                       AssertValidUrl ("M:Atk.NoOpObject.GetRunAttributes(int,int&,int&)");
+               }
+
+               [Test]
+               public void MethodWithJaggedArrayArgsValidTest ()
+               {
+                       AssertValidUrl ("M:System.Reflection.Emit.SignatureHelper.GetPropertySigHelper(System.Reflection.Module,System.Reflection.CallingConventions,Type,Type[],Type[],Type[],Type[][],Type[][])");
+               }
+
+               [Test]
+               public void MethodWithInnerTypeValidTest ()
+               {
+                       AssertValidUrl ("M:System.TimeZoneInfo+AdjustmentRule.CreateAdjustmentRule");
+               }
+
+               [Test]
+               public void FieldValidTest ()
+               {
+                       AssertValidUrl ("F:Mono.Terminal.Curses.KeyF10");
+                       AssertValidUrl ("F:Novell.Directory.Ldap.Utilclass.ExceptionMessages.NOT_IMPLEMENTED");
+                       AssertValidUrl ("F:Novell.Directory.Ldap.LdapException.NOT_ALLOWED_ON_NONLEAF");
+               }
+
+               [Test]
+               public void PropertyValidTest ()
+               {
+                       AssertValidUrl ("P:System.Foo.Bar");
+                       AssertValidUrl ("P:System.ArraySegment<T>.Array");
+               }
+
+               [Test]
+               public void IndexPropertyValidTest ()
+               {
+                       AssertValidUrl ("P:System.ComponentModel.PropertyDescriptorCollection.Item(int)");
+                       AssertValidUrl ("P:System.ComponentModel.AttributeCollection.Item(Type)");
+                       AssertValidUrl ("P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
+                       AssertValidUrl ("P:System.Collections.Specialized.BitVector32.Item(System.Collections.Specialized.BitVector32+Section)");
+               }
+
+               [Test]
+               public void ExplicitMethodImplValidTest ()
+               {
+                       AssertValidUrl ("M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
+               }
+
+               [Test]
+               public void MetaEtcNodeTest ()
+               {
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+                                                   Namespace = "Foo.Bar",
+                                                   TypeName = "Type",
+                                                   Etc = '*' };
+                       AssertUrlDesc (ast, "T:Foo.Bar.Type/*");
+               }
+
+               [Test]
+               public void MetaEtcWithInnerTypeTest ()
+               {
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+                                                   Namespace = "Novell.Directory.Ldap",
+                                                   TypeName = "Connection",
+                                                   NestedType = new EcmaDesc { DescKind = EcmaDesc.Kind.Type, TypeName = "ReaderThread" },
+                                                   Etc = '*' };
+                       AssertUrlDesc (ast, "T:Novell.Directory.Ldap.Connection+ReaderThread/*");
+               }
+
+               [Test]
+               public void SimpleTypeUrlParseTest ()
+               {
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+                                                   TypeName = "String",
+                                                   Namespace = "System" };
+                       AssertUrlDesc (ast, "T:System.String");
+               }
+
+               [Test]
+               public void TypeWithOneGenericUrlParseTest ()
+               {
+                       var generics = new[] {
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       Namespace = string.Empty,
+                                       TypeName = "T"
+                               }
+                       };
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+                                                   TypeName = "String",
+                                                   Namespace = "System",
+                                                   GenericTypeArguments = generics,
+                       };
+
+                       AssertUrlDesc (ast, "T:System.String<T>");
+               }
+
+               [Test]
+               public void TypeWithNestedGenericUrlParseTest ()
+               {
+                       var generics = new[] {
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       TypeName = "T",
+                                       Namespace = string.Empty
+                               },
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       Namespace = "System.Collections.Generic",
+                                       TypeName = "List",
+                                       GenericTypeArguments = new[] {
+                                               new EcmaDesc {
+                                                       DescKind = EcmaDesc.Kind.Type,
+                                                       TypeName = "V",
+                                                       Namespace = string.Empty
+                                               }
+                                       }
+                               }
+                       };
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
+                                                   TypeName = "String",
+                                                   Namespace = "System",
+                                                   GenericTypeArguments = generics,
+                       };
+
+                       AssertUrlDesc (ast, "T:System.String<T, System.Collections.Generic.List<V>>");
+               }
+
+               [Test]
+               public void SimpleMethodUrlParseTest ()
+               {
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+                                                   TypeName = "String",
+                                                   Namespace = "System",
+                                                   MemberName = "FooBar"
+                       };
+                       AssertUrlDesc (ast, "M:System.String.FooBar()");
+               }
+
+               [Test]
+               public void MethodWithArgsUrlParseTest ()
+               {
+                       var args = new[] {
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       Namespace = "System",
+                                       TypeName = "String"
+                               },
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       TypeName = "Int32",
+                                       Namespace = string.Empty
+                               }
+                       };
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+                                                   TypeName = "String",
+                                                   Namespace = "System",
+                                                   MemberName = "FooBar",
+                                                   MemberArguments = args
+                       };
+                       AssertUrlDesc (ast, "M:System.String.FooBar(System.String, Int32)");
+               }
+
+               [Test]
+               public void MethodWithArgsAndGenericsUrlParseTest ()
+               {
+                       var args = new[] {
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       Namespace = "System",
+                                       TypeName = "String"
+                               },
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       Namespace = "System.Collections.Generic",
+                                       TypeName = "Dictionary",
+                                       GenericTypeArguments = new[] {
+                                               new EcmaDesc {
+                                                       DescKind = EcmaDesc.Kind.Type,
+                                                       TypeName = "K",
+                                                       Namespace = string.Empty
+                                               },
+                                               new EcmaDesc {
+                                                       DescKind = EcmaDesc.Kind.Type,
+                                                       TypeName = "V",
+                                                       Namespace = string.Empty
+                                               }
+                                       }
+                               }
+                       };
+
+                       var generics = new[] {
+                               new EcmaDesc {
+                                       DescKind = EcmaDesc.Kind.Type,
+                                       TypeName = "Action",
+                                       Namespace = string.Empty,
+                                       GenericTypeArguments = new[] {
+                                               new EcmaDesc {
+                                                       DescKind = EcmaDesc.Kind.Type,
+                                                       Namespace = "System",
+                                                       TypeName = "Single",
+                                               },
+                                               new EcmaDesc {
+                                                       DescKind = EcmaDesc.Kind.Type,
+                                                       TypeName = "int",
+                                                       Namespace = string.Empty
+                                               },
+                                       }
+                               }
+                       };
+
+                       var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
+                                                   TypeName = "String",
+                                                   Namespace = "System",
+                                                   MemberName = "FooBar",
+                                                   MemberArguments = args,
+                                                   GenericMemberArguments = generics
+                       };
+                       AssertUrlDesc (ast, "M:System.String.FooBar<Action<System.Single, int>>(System.String, System.Collections.Generic.Dictionary<K, V>)");
+               }
+
+               [Test]
+               public void ExplicitMethodImplementationParseTest ()
+               {
+                       var inner = new EcmaDesc {
+                               MemberName = "Dispose",
+                               TypeName = "IDisposable",
+                               Namespace = "System"
+                       };
+                       var ast = new EcmaDesc {
+                               DescKind = EcmaDesc.Kind.Method,
+                               TypeName = "RegistryKey",
+                               Namespace = "Microsoft.Win32",
+                               ExplicitImplMember = inner
+                       };
+                       AssertUrlDesc (ast, "M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
+               }
+
+               [Test]
+               public void SimpleMethodWithNumberInType ()
+               {
+                       var ast = new EcmaDesc {
+                               DescKind = EcmaDesc.Kind.Method,
+                               TypeName = "ASN1",
+                               Namespace = "Mono.Security",
+                               MemberName = "Add"
+                       };
+                       AssertUrlDesc (ast, "M:Mono.Security.ASN1.Add");
+               }
+
+               [Test]
+               public void JaggedArrayWithDimensions ()
+               {
+                       var ast = new EcmaDesc {
+                               DescKind = EcmaDesc.Kind.Type,
+                               TypeName = "Int32",
+                               Namespace = "System",
+                               ArrayDimensions = new int[] { 3, 1, 1 }
+                       };
+                       AssertUrlDesc (ast, "T:System.Int32[,,][][]");
+               }
+
+               [Test]
+               public void ExplicitIndexerImplementation ()
+               {
+                       var explicitImpl = new EcmaDesc {
+                               Namespace = "System.Web.SessionState",
+                               TypeName = "IHttpSessionState",
+                               MemberName = "Item",
+                               MemberArguments = new [] { new EcmaDesc { DescKind = EcmaDesc.Kind.Type, Namespace = "System", TypeName = "Int32" } },
+                       };
+                       var ast = new EcmaDesc {
+                               DescKind = EcmaDesc.Kind.Property,
+                               TypeName = "HttpSessionStateContainer",
+                               Namespace = "System.Web.SessionState",
+                               ExplicitImplMember = explicitImpl,
+                       };
+                       AssertUrlDesc (ast, "P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
+               }
+
+               /*              [Test]
+               public void TreeParsabilityTest ()
+               {
+                       var rootTree = RootTree.LoadTree ("/home/jeremie/monodoc/");
+                       Node result;
+                       var generator = new CheckGenerator ();
+
+                       foreach (var leaf in GetLeaves (rootTree.RootNode).Where (IsEcmaNode))
+                               AssertUrl (leaf.PublicUrl);
+               }
+
+               IEnumerable<Node> GetLeaves (Node node)
+               {
+                       if (node == null)
+                               yield break;
+
+                       if (node.IsLeaf)
+                               yield return node;
+                       else {
+                               foreach (var child in node.Nodes) {
+                                       if (!string.IsNullOrEmpty (child.Element) && !child.Element.StartsWith ("root:/"))
+                                               yield return child;
+                                       foreach (var childLeaf in GetLeaves (child))
+                                               yield return childLeaf;
+                               }
+                       }
+               }
+
+               bool IsEcmaNode (Node node)
+               {
+                       var url = node.PublicUrl;
+                       return url != null && url.Length > 2 && url[1] == ':';
+               }*/
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Test/Monkeydoc/HelpSourceTests.cs b/mcs/tools/monkeydoc/Test/Monkeydoc/HelpSourceTests.cs
new file mode 100644 (file)
index 0000000..354fe91
--- /dev/null
@@ -0,0 +1,99 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using MonkeyDoc;
+
+namespace MonoTests.MonkeyDoc
+{
+       [TestFixture]
+       public class HelpSourceTest
+       {
+               const string BaseDir = "../../tools/monkeydoc/Test/monodoc/";
+
+               class CheckGenerator : IDocGenerator<bool>
+               {
+                       public string LastCheckMessage { get; set; }
+
+                       public bool Generate (HelpSource hs, string id)
+                       {
+                               LastCheckMessage = string.Format ("#1 : {0} {1}", hs, id);
+                               if (hs == null || string.IsNullOrEmpty (id))
+                                       return false;
+
+                               // Stripe the arguments parts since we don't need it
+                               var argIdx = id.LastIndexOf ('?');
+                               if (argIdx != -1)
+                                       id = id.Substring (0, argIdx);
+
+                               LastCheckMessage = string.Format ("#2 : {0} {1}", hs, id);
+                               if (hs.IsRawContent (id))
+                                       return hs.GetText (id) != null;
+
+                               IEnumerable<string> parts;
+                               if (hs.IsMultiPart (id, out parts)) {
+                                       LastCheckMessage = string.Format ("#4 : {0} {1} ({2})", hs, id, string.Join (", ", parts));
+                                       foreach (var partId in parts)
+                                               if (!Generate (hs, partId))
+                                                       return false;
+                               }
+
+                               LastCheckMessage = string.Format ("#3 : {0} {1}", hs, id);
+                               if (hs.IsGeneratedContent (id))
+                                       return hs.GetCachedText (id) != null;
+                               else {
+                                       var s = hs.GetCachedHelpStream (id);
+                                       if (s != null) {
+                                               s.Close ();
+                                               return true;
+                                       } else {
+                                               return false;
+                                       }
+                               }
+                       }
+               }
+
+               /* This test verifies that for every node in our tree that possed a PublicUrl,
+                * we can correctly access it back through RenderUrl
+                */
+               [Test]
+               public void ReachabilityTest ()
+               {
+                       var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
+                       Node result;
+                       var generator = new CheckGenerator ();
+                       int errorCount = 0;
+                       int testCount = 0;
+
+                       foreach (var leaf in GetLeaves (rootTree.RootNode)) {
+                               if (!rootTree.RenderUrl (leaf.PublicUrl, generator, out result) || leaf != result) {
+                                       Console.WriteLine ("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name);
+                                       errorCount++;
+                               }
+                               testCount++;
+                       }
+
+                       Assert.AreEqual (0, errorCount, errorCount + " / " + testCount.ToString ());
+               }
+
+               IEnumerable<Node> GetLeaves (Node node)
+               {
+                       if (node == null)
+                               yield break;
+
+                       if (node.IsLeaf)
+                               yield return node;
+                       else {
+                               foreach (var child in node.Nodes) {
+                                       if (!string.IsNullOrEmpty (child.Element) && !child.Element.StartsWith ("root:/"))
+                                               yield return child;
+                                       foreach (var childLeaf in GetLeaves (child))
+                                               yield return childLeaf;
+                               }
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/tools/monkeydoc/Test/monodoc/monodoc.xml b/mcs/tools/monkeydoc/Test/monodoc/monodoc.xml
new file mode 100644 (file)
index 0000000..94a4b22
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<node label="Mono Documentation" name="libraries">
+  <node label="Commands and Files" name="man" />
+  <node label="Languages" name="languages" />
+  <node label="Tools" name="tools" />
+  <node label="Various" name="various" />
+</node>
diff --git a/mcs/tools/monkeydoc/monkeydoc.dll.config.in b/mcs/tools/monkeydoc/monkeydoc.dll.config.in
new file mode 100644 (file)
index 0000000..251f778
--- /dev/null
@@ -0,0 +1,6 @@
+<config>
+        <appSettings>
+                <add key="docPath" value="@monodoc_refdir@" />
+                <add key="docExternalPath" value="" />
+        </appSettings>
+</config>
diff --git a/mcs/tools/monkeydoc/monkeydoc.dll.sources b/mcs/tools/monkeydoc/monkeydoc.dll.sources
new file mode 100644 (file)
index 0000000..53ee97f
--- /dev/null
@@ -0,0 +1,463 @@
+Assembly/AssemblyInfo.cs
+Monkeydoc/SearchableIndex.cs
+Monkeydoc/SearchableDocument.cs
+Monkeydoc/storage/ZipStorage.cs
+Monkeydoc/providers/man-provider.cs
+Monkeydoc/providers/ecmaspec-provider.cs
+Monkeydoc/providers/error-provider.cs
+Monkeydoc/providers/xhtml-provider.cs
+Monkeydoc/providers/ecma-provider.cs
+Monkeydoc/providers/addins-provider.cs
+Monkeydoc/HelpSource.cs
+Monkeydoc/Tree.cs
+Monkeydoc/Node.cs
+Monkeydoc/generator.cs
+Monkeydoc/caches/NullCache.cs
+Monkeydoc/caches/FileCache.cs
+Monkeydoc/storage.cs
+Monkeydoc/Provider.cs
+Monkeydoc/cache.cs
+Monkeydoc/index.cs
+Monkeydoc/RootTree.cs
+Monkeydoc/TypeUtils.cs
+Monkeydoc/generators/html/Man2Html.cs
+Monkeydoc/generators/html/Toc2Html.cs
+Monkeydoc/generators/html/Ecmaspec2Html.cs
+Monkeydoc/generators/html/Error2Html.cs
+Monkeydoc/generators/html/MonoBook2Html.cs
+Monkeydoc/generators/html/Ecma2Html.cs
+Monkeydoc/generators/html/Addin2Html.cs
+Monkeydoc/generators/html/Idem.cs
+Monkeydoc/generators/HtmlGenerator.cs
+Mono.Utilities/colorizer.cs
+Mono.Utilities/LRUCache.cs
+Monkeydoc.Ecma/EcmaUrlParser.cs
+Monkeydoc.Ecma/EcmaUrlTokenizer.cs
+Monkeydoc.Ecma/EcmaDesc.cs
+Mono.Documentation/ManifestResourceResolver.cs
+Mono.Documentation/XmlDocUtils.cs
+../../../external/Lucene.Net/src/core/Analysis/Analyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/ASCIIFoldingFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/BaseCharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CachingTokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CharArraySet.cs
+../../../external/Lucene.Net/src/core/Analysis/CharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/CharReader.cs
+../../../external/Lucene.Net/src/core/Analysis/CharStream.cs
+../../../external/Lucene.Net/src/core/Analysis/CharTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/ISOLatin1AccentFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/KeywordAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/KeywordTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/LengthFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/LetterTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/LowerCaseFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/LowerCaseTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/MappingCharFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/NormalizeCharMap.cs
+../../../external/Lucene.Net/src/core/Analysis/NumericTokenStream.cs
+../../../external/Lucene.Net/src/core/Analysis/PerFieldAnalyzerWrapper.cs
+../../../external/Lucene.Net/src/core/Analysis/PorterStemFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/PorterStemmer.cs
+../../../external/Lucene.Net/src/core/Analysis/SimpleAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/Standard/StandardTokenizerImpl.cs
+../../../external/Lucene.Net/src/core/Analysis/StopAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/StopFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/TeeSinkTokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Token.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IFlagsAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IOffsetAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IPayloadAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/IPositionIncrementAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/ITermAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/ITypeAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/OffsetAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/PayloadAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/PositionIncrementAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/TermAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenattributes/TypeAttribute.cs
+../../../external/Lucene.Net/src/core/Analysis/TokenFilter.cs
+../../../external/Lucene.Net/src/core/Analysis/Tokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/TokenStream.cs
+../../../external/Lucene.Net/src/core/Analysis/WhitespaceAnalyzer.cs
+../../../external/Lucene.Net/src/core/Analysis/WhitespaceTokenizer.cs
+../../../external/Lucene.Net/src/core/Analysis/WordlistLoader.cs
+../../../external/Lucene.Net/src/core/Document/AbstractField.cs
+../../../external/Lucene.Net/src/core/Document/CompressionTools.cs
+../../../external/Lucene.Net/src/core/Document/DateField.cs
+../../../external/Lucene.Net/src/core/Document/DateTools.cs
+../../../external/Lucene.Net/src/core/Document/Document.cs
+../../../external/Lucene.Net/src/core/Document/Field.cs
+../../../external/Lucene.Net/src/core/Document/Fieldable.cs
+../../../external/Lucene.Net/src/core/Document/FieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/FieldSelectorResult.cs
+../../../external/Lucene.Net/src/core/Document/LoadFirstFieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/MapFieldSelector.cs
+../../../external/Lucene.Net/src/core/Document/NumberTools.cs
+../../../external/Lucene.Net/src/core/Document/NumericField.cs
+../../../external/Lucene.Net/src/core/Document/SetBasedFieldSelector.cs
+../../../external/Lucene.Net/src/core/Index/AbstractAllTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/AllTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/BufferedDeletes.cs
+../../../external/Lucene.Net/src/core/Index/ByteBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/ByteSliceReader.cs
+../../../external/Lucene.Net/src/core/Index/ByteSliceWriter.cs
+../../../external/Lucene.Net/src/core/Index/CharBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/CheckIndex.cs
+../../../external/Lucene.Net/src/core/Index/CompoundFileReader.cs
+../../../external/Lucene.Net/src/core/Index/CompoundFileWriter.cs
+../../../external/Lucene.Net/src/core/Index/ConcurrentMergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/CorruptIndexException.cs
+../../../external/Lucene.Net/src/core/Index/DefaultSkipListReader.cs
+../../../external/Lucene.Net/src/core/Index/DefaultSkipListWriter.cs
+../../../external/Lucene.Net/src/core/Index/DirectoryReader.cs
+../../../external/Lucene.Net/src/core/Index/DocConsumer.cs
+../../../external/Lucene.Net/src/core/Index/DocConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumer.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumers.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumersPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldConsumersPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessor.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessorPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocFieldProcessorPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocInverter.cs
+../../../external/Lucene.Net/src/core/Index/DocInverterPerField.cs
+../../../external/Lucene.Net/src/core/Index/DocInverterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/DocumentsWriter.cs
+../../../external/Lucene.Net/src/core/Index/DocumentsWriterThreadState.cs
+../../../external/Lucene.Net/src/core/Index/FieldInfo.cs
+../../../external/Lucene.Net/src/core/Index/FieldInfos.cs
+../../../external/Lucene.Net/src/core/Index/FieldInvertState.cs
+../../../external/Lucene.Net/src/core/Index/FieldReaderException.cs
+../../../external/Lucene.Net/src/core/Index/FieldSortedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/FieldsReader.cs
+../../../external/Lucene.Net/src/core/Index/FieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FilterIndexReader.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsDocsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsDocsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsFieldsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsFieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsPositionsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsPositionsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsTermsConsumer.cs
+../../../external/Lucene.Net/src/core/Index/FormatPostingsTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxFieldMergeState.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/FreqProxTermsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/IndexCommit.cs
+../../../external/Lucene.Net/src/core/Index/IndexDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileDeleter.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileNameFilter.cs
+../../../external/Lucene.Net/src/core/Index/IndexFileNames.cs
+../../../external/Lucene.Net/src/core/Index/IndexReader.cs
+../../../external/Lucene.Net/src/core/Index/IndexWriter.cs
+../../../external/Lucene.Net/src/core/Index/IntBlockPool.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumer.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumer.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/InvertedDocEndConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogByteSizeMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogDocMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/LogMergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/MergeDocIDRemapper.cs
+../../../external/Lucene.Net/src/core/Index/MergePolicy.cs
+../../../external/Lucene.Net/src/core/Index/MergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/MultiLevelSkipListReader.cs
+../../../external/Lucene.Net/src/core/Index/MultiLevelSkipListWriter.cs
+../../../external/Lucene.Net/src/core/Index/MultipleTermPositions.cs
+../../../external/Lucene.Net/src/core/Index/MultiReader.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriter.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/NormsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/ParallelReader.cs
+../../../external/Lucene.Net/src/core/Index/Payload.cs
+../../../external/Lucene.Net/src/core/Index/PositionBasedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/RawPostingList.cs
+../../../external/Lucene.Net/src/core/Index/ReadOnlyDirectoryReader.cs
+../../../external/Lucene.Net/src/core/Index/ReadOnlySegmentReader.cs
+../../../external/Lucene.Net/src/core/Index/ReusableStringReader.cs
+../../../external/Lucene.Net/src/core/Index/SegmentInfo.cs
+../../../external/Lucene.Net/src/core/Index/SegmentInfos.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMergeInfo.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMergeQueue.cs
+../../../external/Lucene.Net/src/core/Index/SegmentMerger.cs
+../../../external/Lucene.Net/src/core/Index/SegmentReader.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermDocs.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermEnum.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermPositions.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermPositionVector.cs
+../../../external/Lucene.Net/src/core/Index/SegmentTermVector.cs
+../../../external/Lucene.Net/src/core/Index/SegmentWriteState.cs
+../../../external/Lucene.Net/src/core/Index/SerialMergeScheduler.cs
+../../../external/Lucene.Net/src/core/Index/SnapshotDeletionPolicy.cs
+../../../external/Lucene.Net/src/core/Index/SortedTermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/StaleReaderException.cs
+../../../external/Lucene.Net/src/core/Index/StoredFieldsWriter.cs
+../../../external/Lucene.Net/src/core/Index/StoredFieldsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/Term.cs
+../../../external/Lucene.Net/src/core/Index/TermBuffer.cs
+../../../external/Lucene.Net/src/core/Index/TermDocs.cs
+../../../external/Lucene.Net/src/core/Index/TermEnum.cs
+../../../external/Lucene.Net/src/core/Index/TermFreqVector.cs
+../../../external/Lucene.Net/src/core/Index/TermInfo.cs
+../../../external/Lucene.Net/src/core/Index/TermInfosReader.cs
+../../../external/Lucene.Net/src/core/Index/TermInfosWriter.cs
+../../../external/Lucene.Net/src/core/Index/TermPositions.cs
+../../../external/Lucene.Net/src/core/Index/TermPositionVector.cs
+../../../external/Lucene.Net/src/core/Index/TermsHash.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumer.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumerPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashConsumerPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermsHashPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorEntry.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorEntryFreqSortedComparator.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorMapper.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorOffsetInfo.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsReader.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriter.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriterPerField.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsTermsWriterPerThread.cs
+../../../external/Lucene.Net/src/core/Index/TermVectorsWriter.cs
+../../../external/Lucene.Net/src/core/LucenePackage.cs
+../../../external/Lucene.Net/src/core/LZOCompressor.cs
+../../../external/Lucene.Net/src/core/Messages/INLSException.cs
+../../../external/Lucene.Net/src/core/Messages/Message.cs
+../../../external/Lucene.Net/src/core/Messages/MessageImpl.cs
+../../../external/Lucene.Net/src/core/Messages/NLS.cs
+../../../external/Lucene.Net/src/core/QueryParser/CharStream.cs
+../../../external/Lucene.Net/src/core/QueryParser/FastCharStream.cs
+../../../external/Lucene.Net/src/core/QueryParser/MultiFieldQueryParser.cs
+../../../external/Lucene.Net/src/core/QueryParser/ParseException.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParser.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParserConstants.cs
+../../../external/Lucene.Net/src/core/QueryParser/QueryParserTokenManager.cs
+../../../external/Lucene.Net/src/core/QueryParser/Token.cs
+../../../external/Lucene.Net/src/core/QueryParser/TokenMgrError.cs
+../../../external/Lucene.Net/src/core/Search/BooleanClause.cs
+../../../external/Lucene.Net/src/core/Search/BooleanQuery.cs
+../../../external/Lucene.Net/src/core/Search/BooleanScorer.cs
+../../../external/Lucene.Net/src/core/Search/BooleanScorer2.cs
+../../../external/Lucene.Net/src/core/Search/CachingSpanFilter.cs
+../../../external/Lucene.Net/src/core/Search/CachingWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/Collector.cs
+../../../external/Lucene.Net/src/core/Search/ComplexExplanation.cs
+../../../external/Lucene.Net/src/core/Search/ConjunctionScorer.cs
+../../../external/Lucene.Net/src/core/Search/ConstantScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/DefaultSimilarity.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionMaxQuery.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionMaxScorer.cs
+../../../external/Lucene.Net/src/core/Search/DisjunctionSumScorer.cs
+../../../external/Lucene.Net/src/core/Search/DocIdSet.cs
+../../../external/Lucene.Net/src/core/Search/DocIdSetIterator.cs
+../../../external/Lucene.Net/src/core/Search/ExactPhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/Explanation.cs
+../../../external/Lucene.Net/src/core/Search/FieldCache.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheImpl.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/FieldCacheTermsFilter.cs
+../../../external/Lucene.Net/src/core/Search/FieldComparator.cs
+../../../external/Lucene.Net/src/core/Search/FieldComparatorSource.cs
+../../../external/Lucene.Net/src/core/Search/FieldDoc.cs
+../../../external/Lucene.Net/src/core/Search/FieldDocSortedHitQueue.cs
+../../../external/Lucene.Net/src/core/Search/FieldValueHitQueue.cs
+../../../external/Lucene.Net/src/core/Search/Filter.cs
+../../../external/Lucene.Net/src/core/Search/FilteredDocIdSet.cs
+../../../external/Lucene.Net/src/core/Search/FilteredDocIdSetIterator.cs
+../../../external/Lucene.Net/src/core/Search/FilteredQuery.cs
+../../../external/Lucene.Net/src/core/Search/FilteredTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/FilterManager.cs
+../../../external/Lucene.Net/src/core/Search/Function/ByteFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/CustomScoreProvider.cs
+../../../external/Lucene.Net/src/core/Search/Function/CustomScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/Function/DocValues.cs
+../../../external/Lucene.Net/src/core/Search/Function/FieldCacheSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/FieldScoreQuery.cs
+../../../external/Lucene.Net/src/core/Search/Function/FloatFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/IntFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/OrdFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ReverseOrdFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ShortFieldSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ValueSource.cs
+../../../external/Lucene.Net/src/core/Search/Function/ValueSourceQuery.cs
+../../../external/Lucene.Net/src/core/Search/FuzzyQuery.cs
+../../../external/Lucene.Net/src/core/Search/FuzzyTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/HitQueue.cs
+../../../external/Lucene.Net/src/core/Search/IndexSearcher.cs
+../../../external/Lucene.Net/src/core/Search/MatchAllDocsQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiPhraseQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiSearcher.cs
+../../../external/Lucene.Net/src/core/Search/MultiTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/MultiTermQueryWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/NumericRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/NumericRangeQuery.cs
+../../../external/Lucene.Net/src/core/Search/ParallelMultiSearcher.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/AveragePayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/MaxPayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/MinPayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadFunction.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadNearQuery.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadSpanUtil.cs
+../../../external/Lucene.Net/src/core/Search/Payloads/PayloadTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/PhrasePositions.cs
+../../../external/Lucene.Net/src/core/Search/PhraseQuery.cs
+../../../external/Lucene.Net/src/core/Search/PhraseQueue.cs
+../../../external/Lucene.Net/src/core/Search/PhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/PositiveScoresOnlyCollector.cs
+../../../external/Lucene.Net/src/core/Search/PrefixFilter.cs
+../../../external/Lucene.Net/src/core/Search/PrefixQuery.cs
+../../../external/Lucene.Net/src/core/Search/PrefixTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/Query.cs
+../../../external/Lucene.Net/src/core/Search/QueryTermVector.cs
+../../../external/Lucene.Net/src/core/Search/QueryWrapperFilter.cs
+../../../external/Lucene.Net/src/core/Search/ReqExclScorer.cs
+../../../external/Lucene.Net/src/core/Search/ReqOptSumScorer.cs
+../../../external/Lucene.Net/src/core/Search/ScoreCachingWrappingScorer.cs
+../../../external/Lucene.Net/src/core/Search/ScoreDoc.cs
+../../../external/Lucene.Net/src/core/Search/Scorer.cs
+../../../external/Lucene.Net/src/core/Search/Searchable.cs
+../../../external/Lucene.Net/src/core/Search/Searcher.cs
+../../../external/Lucene.Net/src/core/Search/Similarity.cs
+../../../external/Lucene.Net/src/core/Search/SimilarityDelegator.cs
+../../../external/Lucene.Net/src/core/Search/SingleTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/SloppyPhraseScorer.cs
+../../../external/Lucene.Net/src/core/Search/Sort.cs
+../../../external/Lucene.Net/src/core/Search/SortField.cs
+../../../external/Lucene.Net/src/core/Search/SpanFilter.cs
+../../../external/Lucene.Net/src/core/Search/SpanFilterResult.cs
+../../../external/Lucene.Net/src/core/Search/SpanQueryFilter.cs
+../../../external/Lucene.Net/src/core/Search/Spans/FieldMaskingSpanQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/NearSpansOrdered.cs
+../../../external/Lucene.Net/src/core/Search/Spans/NearSpansUnordered.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanFirstQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanNearQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanNotQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanOrQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/Spans.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanScorer.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanTermQuery.cs
+../../../external/Lucene.Net/src/core/Search/Spans/SpanWeight.cs
+../../../external/Lucene.Net/src/core/Search/Spans/TermSpans.cs
+../../../external/Lucene.Net/src/core/Search/TermQuery.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeFilter.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeQuery.cs
+../../../external/Lucene.Net/src/core/Search/TermRangeTermEnum.cs
+../../../external/Lucene.Net/src/core/Search/TermScorer.cs
+../../../external/Lucene.Net/src/core/Search/TimeLimitingCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopDocs.cs
+../../../external/Lucene.Net/src/core/Search/TopDocsCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopFieldCollector.cs
+../../../external/Lucene.Net/src/core/Search/TopFieldDocs.cs
+../../../external/Lucene.Net/src/core/Search/TopScoreDocCollector.cs
+../../../external/Lucene.Net/src/core/Search/Weight.cs
+../../../external/Lucene.Net/src/core/Search/WildcardQuery.cs
+../../../external/Lucene.Net/src/core/Search/WildcardTermEnum.cs
+../../../external/Lucene.Net/src/core/Store/AlreadyClosedException.cs
+../../../external/Lucene.Net/src/core/Store/BufferedIndexInput.cs
+../../../external/Lucene.Net/src/core/Store/BufferedIndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/CheckSumIndexInput.cs
+../../../external/Lucene.Net/src/core/Store/CheckSumIndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/Directory.cs
+../../../external/Lucene.Net/src/core/Store/FileSwitchDirectory.cs
+../../../external/Lucene.Net/src/core/Store/FSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/FSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/IndexInput.cs
+../../../external/Lucene.Net/src/core/Store/IndexOutput.cs
+../../../external/Lucene.Net/src/core/Store/Lock.cs
+../../../external/Lucene.Net/src/core/Store/LockFactory.cs
+../../../external/Lucene.Net/src/core/Store/LockObtainFailedException.cs
+../../../external/Lucene.Net/src/core/Store/LockReleaseFailedException.cs
+../../../external/Lucene.Net/src/core/Store/LockStressTest.cs
+../../../external/Lucene.Net/src/core/Store/LockVerifyServer.cs
+../../../external/Lucene.Net/src/core/Store/MMapDirectory.cs
+../../../external/Lucene.Net/src/core/Store/NativeFSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/NIOFSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/NoLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/NoSuchDirectoryException.cs
+../../../external/Lucene.Net/src/core/Store/RAMDirectory.cs
+../../../external/Lucene.Net/src/core/Store/RAMFile.cs
+../../../external/Lucene.Net/src/core/Store/RAMInputStream.cs
+../../../external/Lucene.Net/src/core/Store/RAMOutputStream.cs
+../../../external/Lucene.Net/src/core/Store/SimpleFSDirectory.cs
+../../../external/Lucene.Net/src/core/Store/SimpleFSLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/SingleInstanceLockFactory.cs
+../../../external/Lucene.Net/src/core/Store/VerifyingLockFactory.cs
+../../../external/Lucene.Net/src/core/Support/AppSettings.cs
+../../../external/Lucene.Net/src/core/Support/AttributeImplItem.cs
+../../../external/Lucene.Net/src/core/Support/BitSetSupport.cs
+../../../external/Lucene.Net/src/core/Support/BuildType.cs
+../../../external/Lucene.Net/src/core/Support/Character.cs
+../../../external/Lucene.Net/src/core/Support/CloseableThreadLocalProfiler.cs
+../../../external/Lucene.Net/src/core/Support/CollectionsHelper.cs
+../../../external/Lucene.Net/src/core/Support/Compare.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ConcurrentDictionary.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/Func.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ISet.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/SetFactory.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/SortedSet.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/ThreadLocal.cs
+../../../external/Lucene.Net/src/core/Support/Compatibility/WrappedHashSet.cs
+../../../external/Lucene.Net/src/core/Support/CRC32.cs
+../../../external/Lucene.Net/src/core/Support/Cryptography.cs
+../../../external/Lucene.Net/src/core/Support/Deflater.cs
+../../../external/Lucene.Net/src/core/Support/Double.cs
+../../../external/Lucene.Net/src/core/Support/EquatableList.cs
+../../../external/Lucene.Net/src/core/Support/FileSupport.cs
+../../../external/Lucene.Net/src/core/Support/GeneralKeyedCollection.cs
+../../../external/Lucene.Net/src/core/Support/HashMap.cs
+../../../external/Lucene.Net/src/core/Support/IChecksum.cs
+../../../external/Lucene.Net/src/core/Support/Inflater.cs
+../../../external/Lucene.Net/src/core/Support/IThreadRunnable.cs
+../../../external/Lucene.Net/src/core/Support/Number.cs
+../../../external/Lucene.Net/src/core/Support/OS.cs
+../../../external/Lucene.Net/src/core/Support/SharpZipLib.cs
+../../../external/Lucene.Net/src/core/Support/Single.cs
+../../../external/Lucene.Net/src/core/Support/TextSupport.cs
+../../../external/Lucene.Net/src/core/Support/ThreadClass.cs
+../../../external/Lucene.Net/src/core/Support/ThreadLock.cs
+../../../external/Lucene.Net/src/core/Support/WeakDictionary.cs
+../../../external/Lucene.Net/src/core/Util/ArrayUtil.cs
+../../../external/Lucene.Net/src/core/Util/Attribute.cs
+../../../external/Lucene.Net/src/core/Util/AttributeSource.cs
+../../../external/Lucene.Net/src/core/Util/AverageGuessMemoryModel.cs
+../../../external/Lucene.Net/src/core/Util/BitUtil.cs
+../../../external/Lucene.Net/src/core/Util/BitVector.cs
+../../../external/Lucene.Net/src/core/Util/Cache/Cache.cs
+../../../external/Lucene.Net/src/core/Util/Cache/SimpleLRUCache.cs
+../../../external/Lucene.Net/src/core/Util/Cache/SimpleMapCache.cs
+../../../external/Lucene.Net/src/core/Util/CloseableThreadLocal.cs
+../../../external/Lucene.Net/src/core/Util/Constants.cs
+../../../external/Lucene.Net/src/core/Util/DocIdBitSet.cs
+../../../external/Lucene.Net/src/core/Util/FieldCacheSanityChecker.cs
+../../../external/Lucene.Net/src/core/Util/IAttribute.cs
+../../../external/Lucene.Net/src/core/Util/IdentityDictionary.cs
+../../../external/Lucene.Net/src/core/Util/IndexableBinaryStringTools.cs
+../../../external/Lucene.Net/src/core/Util/MapOfSets.cs
+../../../external/Lucene.Net/src/core/Util/MemoryModel.cs
+../../../external/Lucene.Net/src/core/Util/NumericUtils.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSet.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSetDISI.cs
+../../../external/Lucene.Net/src/core/Util/OpenBitSetIterator.cs
+../../../external/Lucene.Net/src/core/Util/PriorityQueue.cs
+../../../external/Lucene.Net/src/core/Util/RamUsageEstimator.cs
+../../../external/Lucene.Net/src/core/Util/ReaderUtil.cs
+../../../external/Lucene.Net/src/core/Util/ScorerDocQueue.cs
+../../../external/Lucene.Net/src/core/Util/SimpleStringInterner.cs
+../../../external/Lucene.Net/src/core/Util/SmallFloat.cs
+../../../external/Lucene.Net/src/core/Util/SortedVIntList.cs
+../../../external/Lucene.Net/src/core/Util/SorterTemplate.cs
+../../../external/Lucene.Net/src/core/Util/StringHelper.cs
+../../../external/Lucene.Net/src/core/Util/StringInterner.cs
+../../../external/Lucene.Net/src/core/Util/ToStringUtils.cs
+../../../external/Lucene.Net/src/core/Util/UnicodeUtil.cs
+../../../external/Lucene.Net/src/core/Util/Version.cs
diff --git a/mcs/tools/monkeydoc/monkeydoc_test.dll.sources b/mcs/tools/monkeydoc/monkeydoc_test.dll.sources
new file mode 100644 (file)
index 0000000..d57ee1e
--- /dev/null
@@ -0,0 +1,2 @@
+Monkeydoc/HelpSourceTests.cs
+Monkeydoc.Ecma/EcmaUrlTests.cs
\ No newline at end of file
index 700a975405bab740c709b3ce974b3d5d627996b8..d4e38ad059b403f75b72f2807ac7ef2579bde00b 100644 (file)
@@ -158,3 +158,10 @@ clean-local: cleanup
 cleanup:
        -rm -f Test/man-provider-test.exe*
 
+API_SERVER = root@api.xamarin.com
+
+push:
+       make PROFILE=net_4_0 MCS_FLAGS=/debug
+       scp "../../class/lib/net_4_0/monodoc.dll*" $(API_SERVER):/srv/monodoc/
+       ssh $(API_SERVER) "/etc/init.d/apache2 reload"
+       ssh $(API_SERVER) "echo On `date -u +"%F %R"` UTC by `whoami` based on revision: `git log -n1 --oneline` >> /srv/monodoc/Changelog"
index 0033472a8ad0104c41c6f9922d1100770d22c7cc..e0e52691b17fc19ae98151c65717519b391b951a 100644 (file)
@@ -845,7 +845,7 @@ public class EcmaHelpSource : HelpSource {
                
                if ((membername == "op_Implicit" || membername == "op_Explicit") && argtypes.Length == 2) {
                        isoperator = true;
-                       membername = "Conversion";
+                       membername = membername.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
                        member = argtypes[0] + " to " + argtypes[1];
                } else if (membername.StartsWith("op_")) {
                        isoperator = true;
@@ -991,7 +991,7 @@ public class EcmaHelpSource : HelpSource {
                        // conversion operators: overloading based on parameter and return type [ECMA-335 §10.3.3]
                        case "op_Implicit":                    // static implicit operator R (T)
                        case "op_Explicit":                    // static explicit operator R (T)
-                               nicename = "Conversion";
+                               nicename = name.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
                                string arg = n.SelectSingleNode("Parameters/Parameter/@Type").InnerText;
                                string ret = n.SelectSingleNode("ReturnValue/ReturnType").InnerText;
                                sig = EcmaDoc.ConvertCTSName(arg) + " to " + EcmaDoc.ConvertCTSName(ret);
@@ -2183,8 +2183,8 @@ public class EcmaHelpSource : HelpSource {
                                                                .Concat (ncnodes.Where (n => n.Nodes.Count > 0).SelectMany (n => n.Nodes.Cast<Node> ()));
                                                } else if (c.Caption == "Operators") {
                                                        ncnodes = ncnodes
-                                                               .Where (n => n.Caption != "Conversion")
-                                                               .Concat (ncnodes.Where (n => n.Caption == "Conversion").SelectMany (n => n.Nodes.Cast<Node> ()));
+                                                               .Where (n => !n.Caption.EndsWith ("Conversion"))
+                                                               .Concat (ncnodes.Where (n => n.Caption.EndsWith ("Conversion")).SelectMany (n => n.Nodes.Cast<Node> ()));
                                                }
                                                foreach (Node nc in ncnodes) {
                                                        //xpath to the docs xml node
index d79ce079e192b68c007443df35e503136f3997f1..180ae0d1f4eb2c6b158cba2780a5221680099aca 100644 (file)
@@ -132,7 +132,6 @@ public class Node : IComparable {
        Node parent;
        protected ArrayList nodes;
        protected internal int position;
-       string compare_key;
 
        static ArrayList empty = ArrayList.ReadOnly(new ArrayList(0));
 
@@ -394,19 +393,25 @@ public class Node : IComparable {
                        LoadNode ();
                if (other.position < 0)
                        other.LoadNode ();
-               if (compare_key == null || other.compare_key == null) {
-                       Regex digits = new Regex (@"([\d]+)|([^\d]+)");
-                       MatchEvaluator eval = delegate (Match m) {
-                               return (m.Value.Length > 0 && char.IsDigit (m.Value [0]))
-                               ? m.Value.PadLeft (System.Math.Max (caption.Length, other.caption.Length)) 
-                               : m.Value;
-                       };
-                       if (compare_key == null)
-                               compare_key = digits.Replace (caption, eval);
-                       if (other.compare_key == null)
-                               other.compare_key = digits.Replace (other.caption, eval);
-               }
-               return compare_key.CompareTo (other.compare_key);
+
+               var cap1 = caption;
+               var cap2 = other.caption;
+
+               /* Some node (notably from ecmaspec) have number prepended to them
+                * which we need to sort better by padding them to the same number
+                * of digits
+                */
+               if (char.IsDigit (cap1[0]) && char.IsDigit (cap2[0])) {
+                       int c1 = cap1.TakeWhile (char.IsDigit).Count ();
+                       int c2 = cap2.TakeWhile (char.IsDigit).Count ();
+
+                       if (c1 != c2) {
+                               cap1 = cap1.PadLeft (cap1.Length + Math.Max (0, c2 - c1), '0');
+                               cap2 = cap2.PadLeft (cap2.Length + Math.Max (0, c1 - c2), '0');
+                       }
+               }
+
+               return string.Compare (cap1, cap2, StringComparison.OrdinalIgnoreCase);
        }
 }
 
index 3f0da1895d090b40b1707126c3ecef96b94ce2e1..59077e0417695200f41421cb893f36c18cc20b1c 100644 (file)
@@ -47,6 +47,12 @@ namespace Mono.Tuner {
 
                bool IsSkipped (AssemblyDefinition assembly)
                {
+                       if (assembly.HasCustomAttributes) {
+                               foreach (var ca in assembly.CustomAttributes) {
+                                       if (ca.AttributeType.Name == "PreserveAttribute")
+                                               return true;
+                               }
+                       }
                        return skipped_assemblies.Contains (assembly.Name.Name);
                }
 
index 7c9dfe8e92b6c8e9da848327310fb880b581b0d2..751e6efc371615e9f7f89d781d529942222a5ac8 100644 (file)
@@ -217,6 +217,7 @@ rm -rf %buildroot
 %_prefix/lib/mono/2.0/System.Xml.Linq.dll
 %_prefix/lib/mono/2.0/System.Xml.dll
 %_prefix/lib/mono/2.0/System.dll
+%_prefix/lib/mono/2.0/System.Json.dll
 %_prefix/lib/mono/2.0/al.exe*
 %_prefix/lib/mono/2.0/cscompmgd.dll
 %_prefix/lib/mono/2.0/gacutil.exe*
@@ -244,6 +245,7 @@ rm -rf %buildroot
 %_prefix/lib/mono/4.0/System.Drawing.dll
 %_prefix/lib/mono/4.0/System.Dynamic.dll
 %_prefix/lib/mono/4.0/System.Json.dll
+%_prefix/lib/mono/4.0/System.Json.Microsoft.dll
 %_prefix/lib/mono/4.0/System.Net.dll
 %_prefix/lib/mono/4.0/System.Numerics.dll
 %_prefix/lib/mono/4.0/System.Security.dll
@@ -290,6 +292,7 @@ rm -rf %buildroot
 %_prefix/lib/mono/4.5/System.Drawing.dll
 %_prefix/lib/mono/4.5/System.Dynamic.dll
 %_prefix/lib/mono/4.5/System.Json.dll
+%_prefix/lib/mono/4.5/System.Json.Microsoft.dll
 %_prefix/lib/mono/4.5/System.Net.dll
 %_prefix/lib/mono/4.5/System.Net.Http.dll
 %_prefix/lib/mono/4.5/System.Numerics.dll
@@ -334,6 +337,7 @@ rm -rf %buildroot
 %_prefix/lib/mono/gac/System.Xml
 %_prefix/lib/mono/gac/System.Xml.Linq
 %_prefix/lib/mono/gac/System.Json
+%_prefix/lib/mono/gac/System.Json.Microsoft
 %_prefix/lib/mono/gac/cscompmgd
 %_prefix/lib/mono/mono-configuration-crypto
 
index 2d796f1c480105b4658f3f3cb75993c6ee6a9e85..0345c9ddd82d3832a9b3b0ca5dd5d7b5bca3e504 100644 (file)
@@ -1,5 +1,30 @@
 if CROSS_COMPILING
-SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis
+SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis profiler
+else
+if INSTALL_MONOTOUCH
+SUBDIRS = utils io-layer metadata arch mini profiler
+
+monotouch-do-build:
+       @list='$(SUBDIRS)'; for subdir in $$list; do \
+         case "x$$subdir" in \
+               xmetadata ) target="monotouch-do-build" ;; \
+               xmini ) target="monotouch-do-build" ;; \
+               * ) target="all" ;; \
+         esac; \
+         echo "Making $$target in $$subdir"; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+    done;
+
+monotouch-do-clean:
+       @list='$(SUBDIRS)'; for subdir in $$list; do \
+         case "x$$subdir" in \
+               xmetadata ) target="monotouch-do-clean" ;; \
+               xmini ) target="monotouch-do-clean" ;; \
+               * ) target="clean" ;; \
+         esac; \
+         echo "Making $$target in $$subdir"; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
+    done;
 else
 if MOONLIGHT
 SUBDIRS = arch utils io-layer metadata mini
@@ -30,4 +55,5 @@ else
 SUBDIRS = arch utils io-layer cil metadata $(interpreter_dir) mini dis monograph tests benchmark profiler
 endif
 endif
+endif
 DIST_SUBDIRS = arch utils io-layer cil metadata interpreter mini dis monograph tests benchmark profiler
index d0fdb29b8e7795843e4ca584fdf10f01e1381e97..c4c5e3e2252b21e5318e0d3ebf4c78bb7653228e 100644 (file)
@@ -172,7 +172,7 @@ enum {
 #define ARM_FSTMD(p,first_reg,nregs,base)              \
        ARM_FSTMD_COND(p,first_reg,nregs,base,ARMCOND_AL)
 
-#include "arm_vfpmacros.h"
+#include <mono/arch/arm/arm_vfpmacros.h>
 
 /* coprocessor register transfer */
 #define ARM_FMSR(p,freg,reg)   \
index 477af4641a764914a1d86cef5c7ddbb54af2e174..fd581ff5514d8c6a5cbe0dfb7a2b18098cae22a1 100644 (file)
@@ -24,10 +24,14 @@ endif
 if DISABLE_EXECUTABLES
 bin_PROGRAMS =
 else
+if DISABLE_LIBRARIES
+bin_PROGRAMS =
+else
 if SUPPORT_BOEHM
 bin_PROGRAMS = monodis
 endif
 endif
+endif
 
 noinst_LIBRARIES = libmonodis.a
 
index 586b54715db7a0e7c97551fa4a862145efd39597..ab0f1195cf0cb88dba8707d7a342610a6ad11427 100644 (file)
@@ -33,6 +33,7 @@
 
 /* sys/resource.h (for rusage) is required when using osx 10.3 (but not 10.4) */
 #ifdef __APPLE__
+#include <TargetConditionals.h>
 #include <sys/resource.h>
 #ifdef HAVE_LIBPROC_H
 /* proc_name */
@@ -2136,7 +2137,7 @@ static gchar *get_process_name_from_proc (pid_t pid)
        }
        g_free (filename);
 #elif defined(PLATFORM_MACOSX)
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !defined (__mono_ppc__) && !defined(__arm__)
+#if !defined (__mono_ppc__) && defined (TARGET_OSX)
        /* No proc name on OSX < 10.5 nor ppc nor iOS */
        memset (buf, '\0', sizeof(buf));
        proc_name (pid, buf, sizeof(buf));
index 41f271ec4cfeab7f19be3291d245893cd6d605db..0a42235637809a483740b933501bc01ff08ba8ff 100644 (file)
@@ -927,7 +927,7 @@ guint32 QueueUserAPC (WapiApcProc apc_callback, gpointer handle,
                return (0);
        }
 
-       g_assert (thread_handle->id == GetCurrentThreadId ());
+       g_assert (thread_handle->id == (pthread_t)GetCurrentThreadId ());
        /* No locking/memory barriers are needed here */
        thread_handle->has_apc = TRUE;
        return(1);
index e026bdde5800834196049f8a1c01ea4bb7094591..6f04f32df6c816bdb67cd5d1398c097612e26121 100644 (file)
@@ -39,16 +39,24 @@ endif
 # convenience lib, so we have to do it ourselves
 #
 if SUPPORT_SGEN
+if DISABLE_EXECUTABLES
+shared_sgen_libraries = libmonoruntimesgen.la 
+else
 if SHARED_MONO
 shared_sgen_libraries = libmonoruntimesgen.la 
 endif
+endif
 sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la 
 endif
 
 if SUPPORT_BOEHM
+if DISABLE_EXECUTABLES
+shared_boehm_libraries = libmonoruntime.la
+else
 if SHARED_MONO
 shared_boehm_libraries = libmonoruntime.la
 endif
+endif
 boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la
 endif
 
@@ -257,7 +265,7 @@ sgen_sources = \
        sgen-stw.c                              \
        sgen-fin-weak-hash.c
 
-libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources) $(boehm_sources)
+libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(boehm_sources)
 libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
 
 if MOONLIGHT
@@ -269,14 +277,14 @@ libmonoruntimemoon_la_CFLAGS = $(MOONLIGHT_DEFINES) $(SGEN_DEFINES)
 endif
 endif
 
-libmonoruntimesgen_la_SOURCES = $(libmonoruntime_la_SOURCES)
+libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
 libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
 
 libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
 libmonoruntime_static_la_LDFLAGS = -static
 libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
 
-libmonoruntimesgen_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
+libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
 libmonoruntimesgen_static_la_LDFLAGS = -static
 libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
 
index 819cf392bfa9febd5902d5a6afeadfff776ae2a3..78caa2c2a2f4ddf6267d2a329e763c308389dd4a 100644 (file)
@@ -114,6 +114,7 @@ static const AssemblyVersionMap framework_assemblies [] = {
        {"System.Management", 0},
        {"System.Messaging", 0},
        {"System.Runtime.Remoting", 0},
+       {"System.Runtime.Serialization", 3},
        {"System.Runtime.Serialization.Formatters.Soap", 0},
        {"System.Security", 0},
        {"System.ServiceProcess", 0},
index 0defba28ec3168a287b7855f6b2a85008d379cba..b7a5c79e5d9be9d7151a5d9fd724a6b18886cfc7 100644 (file)
@@ -208,7 +208,9 @@ mono_gc_collect (int generation)
 {
        MONO_GC_BEGIN (generation);
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_induced++;
+#endif
        GC_gcollect ();
        
        MONO_GC_END (generation);
@@ -410,11 +412,14 @@ on_gc_notification (GCEventType event)
                mono_thread_info_suspend_unlock ();
        
        if (e == MONO_GC_EVENT_START) {
+#ifndef DISABLE_PERFCOUNTERS
                if (mono_perfcounters)
                        mono_perfcounters->gc_collections0++;
+#endif
                gc_stats.major_gc_count ++;
                gc_start_time = mono_100ns_ticks ();
        } else if (e == MONO_GC_EVENT_END) {
+#ifndef DISABLE_PERFCOUNTERS
                if (mono_perfcounters) {
                        guint64 heap_size = GC_get_heap_size ();
                        guint64 used_size = heap_size - GC_get_free_bytes ();
@@ -423,6 +428,7 @@ on_gc_notification (GCEventType event)
                        mono_perfcounters->gc_reserved_bytes = heap_size;
                        mono_perfcounters->gc_gen0size = heap_size;
                }
+#endif
                gc_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10;
                mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10);
        }
@@ -433,11 +439,13 @@ static void
 on_gc_heap_resize (size_t new_size)
 {
        guint64 heap_size = GC_get_heap_size ();
+#ifndef DISABLE_PERFCOUNTERS
        if (mono_perfcounters) {
                mono_perfcounters->gc_committed_bytes = heap_size;
                mono_perfcounters->gc_reserved_bytes = heap_size;
                mono_perfcounters->gc_gen0size = heap_size;
        }
+#endif
        mono_profiler_gc_heap_resize (new_size);
 }
 
index f2dc35ea5de901d831ede5c8809f4774cbd6a083..bd74d47a72a8e023a39aaa20437d9da3b1e4a109 100644 (file)
@@ -1070,11 +1070,13 @@ typedef struct {
        MonoClass *internals_visible_class;
        MonoClass *generic_ilist_class;
        MonoClass *generic_nullable_class;
+#ifndef DISABLE_COM
        MonoClass *variant_class;
        MonoClass *com_object_class;
        MonoClass *com_interop_proxy_class;
        MonoClass *iunknown_class;
        MonoClass *idispatch_class;
+#endif
        MonoClass *safehandle_class;
        MonoClass *handleref_class;
        MonoClass *attribute_class;
index 933cd46c942c8caf2be635d3d208c79a2b0ac0a7..6378847ba3a2e998f671ead8e91fd11819112c69 100644 (file)
@@ -67,11 +67,77 @@ static char* mono_assembly_name_from_token (MonoImage *image, guint32 type_token
 static void mono_field_resolve_type (MonoClassField *field, MonoError *error);
 static guint32 mono_field_resolve_flags (MonoClassField *field);
 static void mono_class_setup_vtable_full (MonoClass *class, GList *in_setup);
+static void mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gklass);
 
 
 void (*mono_debugger_class_init_func) (MonoClass *klass) = NULL;
 void (*mono_debugger_class_loaded_methods_func) (MonoClass *klass) = NULL;
 
+
+/*
+We use gclass recording to allow recursive system f types to be referenced by a parent.
+
+Given the following type hierarchy:
+
+class TextBox : TextBoxBase<TextBox> {}
+class TextBoxBase<T> : TextInput<TextBox> where T : TextBoxBase<T> {}
+class TextInput<T> : Input<T> where T: TextInput<T> {}
+class Input<T> {}
+
+The runtime tries to load TextBoxBase<>.
+To load TextBoxBase<> to do so it must resolve the parent which is TextInput<TextBox>.
+To instantiate TextInput<TextBox> it must resolve TextInput<> and TextBox.
+To load TextBox it must resolve the parent which is TextBoxBase<TextBox>.
+
+At this point the runtime must instantiate TextBoxBase<TextBox>. Both types are partially loaded 
+at this point, iow, both are registered in the type map and both and a NULL parent. This means
+that the resulting generic instance will have a NULL parent, which is wrong and will cause breakage.
+
+To fix that what we do is to record all generic instantes created while resolving the parent of
+any generic type definition and, after resolved, correct the parent field if needed.
+
+*/
+static int record_gclass_instantiation;
+static GSList *gclass_recorded_list;
+typedef gboolean (*gclass_record_func) (MonoClass*, void*);
+
+/* 
+ * LOCKING: loader lock must be held until pairing disable_gclass_recording is called.
+*/
+static void
+enable_gclass_recording (void)
+{
+       ++record_gclass_instantiation;
+}
+
+/* 
+ * LOCKING: loader lock must be held since pairing enable_gclass_recording was called.
+*/
+static void
+disable_gclass_recording (gclass_record_func func, void *user_data)
+{
+       GSList **head = &gclass_recorded_list;
+
+       g_assert (record_gclass_instantiation > 0);
+       --record_gclass_instantiation;
+
+       while (*head) {
+               GSList *node = *head;
+               if (func ((MonoClass*)node->data, user_data)) {
+                       *head = node->next;
+                       g_slist_free_1 (node);
+               } else {
+                       head = &node->next;
+               }
+       }
+
+       /* We automatically discard all recorded gclasses when disabled. */
+       if (!record_gclass_instantiation && gclass_recorded_list) {
+               g_slist_free (gclass_recorded_list);
+               gclass_recorded_list = NULL;
+       }
+}
+
 /*
  * mono_class_from_typeref:
  * @image: a MonoImage
@@ -5189,6 +5255,7 @@ mono_class_setup_mono_type (MonoClass *class)
 
 }
 
+#ifndef DISABLE_COM
 /*
  * COM initialization (using mono_init_com_types) is delayed until needed. 
  * However when a [ComImport] attribute is present on a type it will trigger
@@ -5212,6 +5279,7 @@ init_com_from_comimport (MonoClass *class)
        /* FIXME : we should add an extra checks to ensure COM can be initialized properly before continuing */
        mono_init_com_types ();
 }
+#endif /*DISABLE_COM*/
 
 /*
  * LOCKING: this assumes the loader lock is held
@@ -5238,11 +5306,13 @@ mono_class_setup_parent (MonoClass *class, MonoClass *parent)
 
        if (!MONO_CLASS_IS_INTERFACE (class)) {
                /* Imported COM Objects always derive from __ComObject. */
+#ifndef DISABLE_COM
                if (MONO_CLASS_IS_IMPORT (class)) {
                        init_com_from_comimport (class);
                        if (parent == mono_defaults.object_class)
                                parent = mono_defaults.com_object_class;
                }
+#endif
                if (!parent) {
                        /* set the parent to something useful and safe, but mark the type as broken */
                        parent = mono_defaults.object_class;
@@ -5288,8 +5358,10 @@ mono_class_setup_parent (MonoClass *class, MonoClass *parent)
                /*class->enumtype = class->parent->enumtype; */
        } else {
                /* initialize com types if COM interfaces are present */
+#ifndef DISABLE_COM
                if (MONO_CLASS_IS_IMPORT (class))
                        init_com_from_comimport (class);
+#endif
                class->parent = NULL;
        }
 
@@ -5337,6 +5409,21 @@ mono_class_setup_supertypes (MonoClass *class)
        mono_atomic_store_release (&class->supertypes, supertypes);
 }
 
+static gboolean
+fix_gclass_incomplete_instantiation (MonoClass *gclass, void *user_data)
+{
+       MonoClass *gtd = (MonoClass*)user_data;
+       /* Only try to fix generic instances of @gtd */
+       if (gclass->generic_class->container_class != gtd)
+               return FALSE;
+
+       /* Check if the generic instance has no parent. */
+       if (gtd->parent && !gclass->parent)
+               mono_generic_class_setup_parent (gclass, gtd);
+
+       return TRUE;
+}
+
 /**
  * mono_class_create_from_typedef:
  * @image: image where the token is valid
@@ -5402,6 +5489,9 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
                context = &class->generic_container->context;
        }
 
+       if (class->generic_container)
+               enable_gclass_recording ();
+
        if (cols [MONO_TYPEDEF_EXTENDS]) {
                MonoClass *tmp;
                guint32 parent_token = mono_metadata_token_from_dor (cols [MONO_TYPEDEF_EXTENDS]);
@@ -5439,6 +5529,9 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
        /* uses ->valuetype, which is initialized by mono_class_setup_parent above */
        mono_class_setup_mono_type (class);
 
+       if (class->generic_container)
+               disable_gclass_recording (fix_gclass_incomplete_instantiation, class);
+
        /* 
         * This might access class->byval_arg for recursion generated by generic constraints,
         * so it has to come after setup_mono_type ().
@@ -5575,6 +5668,31 @@ mono_class_get_nullable_param (MonoClass *klass)
        return mono_class_from_mono_type (klass->generic_class->context.class_inst->type_argv [0]);
 }
 
+static void
+mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gtd)
+{
+       if (gtd->parent) {
+               MonoError error;
+               MonoGenericClass *gclass = klass->generic_class;
+
+               klass->parent = mono_class_inflate_generic_class_checked (gtd->parent, mono_generic_class_get_context (gclass), &error);
+               if (!mono_error_ok (&error)) {
+                       /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/
+                       klass->parent = mono_defaults.object_class;
+                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+                       mono_error_cleanup (&error);
+               }
+       }
+       if (klass->parent)
+               mono_class_setup_parent (klass, klass->parent);
+
+       if (klass->enumtype) {
+               klass->cast_class = gtd->cast_class;
+               klass->element_class = gtd->element_class;
+       }
+}
+
+
 /*
  * Create the `MonoClass' for an instantiation of a generic type.
  * We only do this if we actually need it.
@@ -5597,6 +5715,9 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
 
        gklass = gclass->container_class;
 
+       if (record_gclass_instantiation > 0)
+               gclass_recorded_list = g_slist_append (gclass_recorded_list, klass);
+
        if (gklass->nested_in) {
                /* The nested_in type should not be inflated since it's possible to produce a nested type with less generic arguments*/
                klass->nested_in = gklass->nested_in;
@@ -5631,24 +5752,7 @@ mono_generic_class_get_class (MonoGenericClass *gclass)
         * We use the generic type definition to look for nested classes.
         */
 
-       if (gklass->parent) {
-               MonoError error;
-               klass->parent = mono_class_inflate_generic_class_checked (gklass->parent, mono_generic_class_get_context (gclass), &error);
-               if (!mono_error_ok (&error)) {
-                       /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/
-                       klass->parent = mono_defaults.object_class;
-                       mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
-                       mono_error_cleanup (&error);
-               }
-       }
-
-       if (klass->parent)
-               mono_class_setup_parent (klass, klass->parent);
-
-       if (klass->enumtype) {
-               klass->cast_class = gklass->cast_class;
-               klass->element_class = gklass->element_class;
-       }
+       mono_generic_class_setup_parent (klass, gklass);
 
        if (gclass->is_dynamic) {
                klass->inited = 1;
index f6adfcd1ce07c3ca3923a3a0db0de8237d5a4fa4..b13e311cbb6b8a0f656f24a364eb59d6b206ef3f 100644 (file)
 #include <string.h>
 #include <errno.h>
 
+/*
+Code shared between the DISABLE_COM and !DISABLE_COM
+*/
+static void
+register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
+{
+       MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
+
+       mono_register_jit_icall (func, name, sig, save);
+}
+
 #ifndef DISABLE_COM
 
 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
@@ -502,14 +513,6 @@ cominterop_type_from_handle (MonoType *handle)
        return mono_type_get_object (domain, handle);
 }
 
-static void
-register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
-{
-       MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
-
-       mono_register_jit_icall (func, name, sig, save);
-}
-
 void
 mono_cominterop_init (void)
 {
@@ -3142,6 +3145,19 @@ void mono_marshal_safearray_free_indices (gpointer indices)
 void
 mono_cominterop_init (void)
 {
+       /*FIXME
+       
+       This icalls are used by the marshal code when doing PtrToStructure and StructureToPtr and pinvoke.
+
+       If we leave them out and the FullAOT compiler finds the need to emit one of the above 3 wrappers it will
+       g_assert.
+
+       The proper fix would be to emit warning, remove them from marshal.c when DISABLE_COM is used and
+       emit an exception in the generated IL.
+       */
+       register_icall (mono_string_to_bstr, "mono_string_to_bstr", "ptr obj", FALSE);
+       register_icall (mono_string_from_bstr, "mono_string_from_bstr", "obj ptr", FALSE);
+       register_icall (mono_free_bstr, "mono_free_bstr", "void ptr", FALSE);
 }
 
 void
index b9930878c3ef1b8ecb2e66ecd004212b87920ff1..02c3d5270359348fba84d00fbcbd87a12079e1d7 100644 (file)
@@ -373,7 +373,6 @@ struct _MonoDomain {
 
        /* Used by threadpool.c */
        MonoImage *system_image;
-       MonoImage *system_net_dll;
        MonoClass *corlib_asyncresult_class;
        MonoClass *socket_class;
        MonoClass *ad_unloaded_ex_class;
@@ -394,7 +393,7 @@ typedef struct  {
 typedef struct  {
        const char runtime_version [12];
        const char framework_version [4];
-       const AssemblyVersionSet version_sets [3];
+       const AssemblyVersionSet version_sets [4];
 } MonoRuntimeInfo;
 
 #define mono_domain_lock(domain) mono_locks_acquire(&(domain)->lock, DomainLock)
index 66bebd13c88c292d8d00fdd5f8c077d7cadb29c0..79f67061db8b16a2afd82ea1eb7166eb22b14fe4 100644 (file)
@@ -121,12 +121,12 @@ static MonoAotModuleInfoTable *aot_modules = NULL;
 /* This is the list of runtime versions supported by this JIT.
  */
 static const MonoRuntimeInfo supported_runtimes[] = {
-       {"v2.0.50215","2.0", { {2,0,0,0},    {8,0,0,0}, { 3, 5, 0, 0 } }        },
-       {"v2.0.50727","2.0", { {2,0,0,0},    {8,0,0,0}, { 3, 5, 0, 0 } }        },
-       {"v4.0.30319","4.5", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
-       {"v4.0.30128","4.0", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
-       {"v4.0.20506","4.0", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
-       {"moonlight", "2.1", { {2,0,5,0},    {9,0,0,0}, { 3, 5, 0, 0 } }    },
+       {"v2.0.50215","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
+       {"v2.0.50727","2.0", { {2,0,0,0}, { 8,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
+       {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+       {"v4.0.30128","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+       {"v4.0.20506","4.0", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+       {"moonlight", "2.1", { {2,0,5,0}, { 9,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
 };
 
 
@@ -1227,8 +1227,10 @@ mono_domain_create (void)
        domain_id_alloc (domain);
        mono_appdomains_unlock ();
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_appdomains++;
        mono_perfcounters->loader_total_appdomains++;
+#endif
 
        mono_debug_domain_create (domain);
 
@@ -1274,7 +1276,9 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        wapi_init ();
 #endif
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
+#endif
 
        mono_counters_register ("Max native code in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_size);
        mono_counters_register ("Max code space allocated in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_alloc);
@@ -1608,11 +1612,13 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
                mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
 
        /* these are initialized lazily when COM features are used */
+#ifndef DISABLE_COM
        mono_defaults.variant_class = NULL;
        mono_defaults.com_object_class = NULL;
        mono_defaults.com_interop_proxy_class = NULL;
        mono_defaults.iunknown_class = NULL;
        mono_defaults.idispatch_class = NULL;
+#endif
 
        /*
         * Note that mono_defaults.generic_*_class is only non-NULL if we're
@@ -1688,6 +1694,7 @@ mono_init_version (const char *domain_name, const char *version)
        return mono_init_internal (domain_name, NULL, version);
 }
 
+#ifndef DISABLE_COM
 /**
  * mono_init_com_types:
  *
@@ -1727,6 +1734,7 @@ mono_init_com_types (void)
 
        initialized = TRUE;
 }
+#endif /*DISABLE_COM*/
 
 /**
  * mono_cleanup:
@@ -2050,7 +2058,9 @@ mono_domain_free (MonoDomain *domain, gboolean force)
        mono_mempool_invalidate (domain->mp);
        mono_code_manager_invalidate (domain->code_mp);
 #else
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (domain->mp);
+#endif
        mono_mempool_destroy (domain->mp);
        domain->mp = NULL;
        mono_code_manager_destroy (domain->code_mp);
@@ -2094,7 +2104,9 @@ mono_domain_free (MonoDomain *domain, gboolean force)
 
        mono_gc_free_fixed (domain);
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_appdomains--;
+#endif
 
        if (domain == mono_root_domain)
                mono_root_domain = NULL;
@@ -2138,7 +2150,9 @@ mono_domain_alloc (MonoDomain *domain, guint size)
        gpointer res;
 
        mono_domain_lock (domain);
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += size;
+#endif
        res = mono_mempool_alloc (domain->mp, size);
        mono_domain_unlock (domain);
 
@@ -2156,7 +2170,9 @@ mono_domain_alloc0 (MonoDomain *domain, guint size)
        gpointer res;
 
        mono_domain_lock (domain);
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += size;
+#endif
        res = mono_mempool_alloc0 (domain->mp, size);
        mono_domain_unlock (domain);
 
index 88483bd0855310566bd12bb2071329de757c25a1..ac7b0c41cc3f4bac4f2aa4e50c6bf68ef12d9c7b 100644 (file)
@@ -1218,7 +1218,7 @@ void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
 
 //Support for io-layer free mmap'd files.
 
-#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+#if defined (TARGET_IOS) || defined (TARGET_ANDROID)
 
 gint64
 mono_filesize_from_path (MonoString *string)
index f0b98183a5a2327d2a44f85b8057495ed7a0a867..c6e01da6f6ef32d68c6ae1474bb227da0ac1b85c 100644 (file)
@@ -733,7 +733,9 @@ alloc_handle (HandleData *handles, MonoObject *obj, gboolean track)
                        mono_gc_weak_link_add (&(handles->entries [slot]), obj, track);
        }
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_num_handles++;
+#endif
        unlock_handles (handles);
        /*g_print ("allocated entry %d of type %d to object %p (in slot: %p)\n", slot, handles->type, obj, handles->entries [slot]);*/
        res = (slot << 3) | (handles->type + 1);
@@ -941,7 +943,9 @@ mono_gchandle_free (guint32 gchandle)
        } else {
                /* print a warning? */
        }
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_num_handles--;
+#endif
        /*g_print ("freed entry %d of type %d\n", slot, handles->type);*/
        unlock_handles (handles);
        mono_profiler_gc_handle (MONO_PROFILER_GC_HANDLE_DESTROYED, handles->type, gchandle, NULL);
@@ -1134,6 +1138,16 @@ finalizer_thread (gpointer unused)
        return 0;
 }
 
+#ifndef LAZY_GC_THREAD_CREATION
+static
+#endif
+void
+mono_gc_init_finalizer_thread (void)
+{
+       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0);
+       ves_icall_System_Threading_Thread_SetName_internal (gc_thread, mono_string_new (mono_domain_get (), "Finalizer"));
+}
+
 void
 mono_gc_init (void)
 {
@@ -1168,8 +1182,9 @@ mono_gc_init (void)
        MONO_SEM_INIT (&finalizer_sem, 0);
 #endif
 
-       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0);
-       ves_icall_System_Threading_Thread_SetName_internal (gc_thread, mono_string_new (mono_domain_get (), "Finalizer"));
+#ifndef LAZY_GC_THREAD_CREATION
+       mono_gc_init_finalizer_thread ();
+#endif
 }
 
 void
index 4173b721b160ff3aeac7cd995764ba7a0b5c1e61..f0756b4d71207b2d0bf90c139d61416ccd9845a8 100644 (file)
@@ -177,10 +177,10 @@ ICALL(DEBUGR_3, "Log", ves_icall_System_Diagnostics_Debugger_Log)
 ICALL_TYPE(TRACEL, "System.Diagnostics.DefaultTraceListener", TRACEL_1)
 ICALL(TRACEL_1, "WriteWindowsDebugString", ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString)
 
-#ifndef DISABLE_PROCESS_HANDLING
 ICALL_TYPE(FILEV, "System.Diagnostics.FileVersionInfo", FILEV_1)
 ICALL(FILEV_1, "GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal)
 
+#ifndef DISABLE_PROCESS_HANDLING
 ICALL_TYPE(PERFCTR, "System.Diagnostics.PerformanceCounter", PERFCTR_1)
 ICALL(PERFCTR_1, "FreeData", mono_perfcounter_free_data)
 ICALL(PERFCTR_2, "GetImpl", mono_perfcounter_get_impl)
@@ -315,7 +315,7 @@ ICALL(INOW_1, "AddWatch", ves_icall_System_IO_InotifyWatcher_AddWatch)
 ICALL(INOW_2, "GetInotifyInstance", ves_icall_System_IO_InotifyWatcher_GetInotifyInstance)
 ICALL(INOW_3, "RemoveWatch", ves_icall_System_IO_InotifyWatcher_RemoveWatch)
 
-#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+#if defined (TARGET_IOS) || defined (TARGET_ANDROID)
 ICALL_TYPE(MMAPIMPL, "System.IO.MemoryMappedFiles.MemoryMapImpl", MMAPIMPL_1)
 ICALL(MMAPIMPL_1, "mono_filesize_from_fd", mono_filesize_from_fd)
 ICALL(MMAPIMPL_2, "mono_filesize_from_path", mono_filesize_from_path)
index 8747f4c6baa558d74baa8725c9954cf9aac2e39f..0719d4883841175cf8bc4a5ebe2bcd3c917a1d8e 100644 (file)
@@ -6254,6 +6254,10 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, Mo
 
        MONO_ARCH_SAVE_REGS;
 
+       /* This is called directly from the class libraries without going through the managed wrapper */
+       MONO_CHECK_ARG_NULL (src);
+       MONO_CHECK_ARG_NULL (dest);
+
        /* watch out for integer overflow */
        if ((src_offset > mono_array_get_byte_length (src) - count) || (dest_offset > mono_array_get_byte_length (dest) - count))
                return FALSE;
index 3cf7ee51666bb2aa01099f990da7b2bd0876cd3a..763aa720af865f9428450a77e42d9d7ba2eff358 100644 (file)
@@ -1729,7 +1729,9 @@ mono_image_close_finish (MonoImage *image)
        if (image->modules)
                g_free (image->modules);
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes -= mono_mempool_get_allocated (image->mempool);
+#endif
 
        if (!image->dynamic) {
                if (debug_assembly_unload)
@@ -2225,7 +2227,9 @@ mono_image_alloc (MonoImage *image, guint size)
 {
        gpointer res;
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += size;
+#endif
        mono_image_lock (image);
        res = mono_mempool_alloc (image->mempool, size);
        mono_image_unlock (image);
@@ -2238,7 +2242,9 @@ mono_image_alloc0 (MonoImage *image, guint size)
 {
        gpointer res;
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += size;
+#endif
        mono_image_lock (image);
        res = mono_mempool_alloc0 (image->mempool, size);
        mono_image_unlock (image);
@@ -2251,7 +2257,9 @@ mono_image_strdup (MonoImage *image, const char *s)
 {
        char *res;
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += strlen (s);
+#endif
        mono_image_lock (image);
        res = mono_mempool_strdup (image->mempool, s);
        mono_image_unlock (image);
index e890bab6019a7194e6c52de6e24e0143b30143e1..259c5f2f54877a74b399e8414c7ae0c513761240 100644 (file)
@@ -835,9 +835,11 @@ mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 to
        if (method->klass->generic_class)
                return mono_method_signature (method);
 
+#ifndef DISABLE_REFLECTION_EMIT
        if (image->dynamic) {
                sig = mono_reflection_lookup_signature (image, method, token);
        } else {
+#endif
                mono_metadata_decode_row (&image->tables [MONO_TABLE_MEMBERREF], idx-1, cols, MONO_MEMBERREF_SIZE);
                sig_idx = cols [MONO_MEMBERREF_SIGNATURE];
 
@@ -866,7 +868,9 @@ mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 to
                        mono_loader_set_error_bad_image (g_strdup_printf ("Incompatible method signature class token 0x%08x field name %s token 0x%08x on image %s", class, fname, token, image->name));
                        return NULL;
                }
+#ifndef DISABLE_REFLECTION_EMIT
        }
+#endif
 
 
        if (context) {
index d6f921d6114980ec25a49ab1c1275f2486ab5500..d62ea3699c18a2edc17edbb21fbedb36c63e18ec 100644 (file)
@@ -1962,6 +1962,7 @@ emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_obje
                                break;
                        }
                        case MONO_TYPE_OBJECT: {
+#ifndef DISABLE_COM
                                mono_init_com_types ();
                                if (to_object) {
                                        static MonoMethod *variant_clear = NULL;
@@ -1989,7 +1990,11 @@ emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_obje
                                        mono_mb_emit_byte(mb, CEE_LDIND_REF);
                                        mono_mb_emit_ldloc (mb, 1);
                                        mono_mb_emit_managed_call (mb, get_native_variant_for_object, NULL);
-                                       }
+                               }
+#else
+                               char *msg = g_strdup_printf ("COM support was disabled at compilation time.");
+                               mono_mb_emit_exception_marshal_directive (mb, msg);
+#endif
                                break;
                        }
 
@@ -2920,18 +2925,16 @@ mono_marshal_get_remoting_invoke (MonoMethod *method)
                return method;
 
        /* this seems to be the best plase to put this, as all remoting invokes seem to get filtered through here */
+#ifndef DISABLE_COM
        if (method->klass->is_com_object || method->klass == mono_defaults.com_object_class) {
                MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass);
                g_assert (vtable); /*FIXME do proper error handling*/
 
                if (!vtable->remote) {
-#ifndef DISABLE_COM
                        return mono_cominterop_get_invoke (method);
-#else
-                       g_assert_not_reached ();
-#endif
                }
        }
+#endif
 
        sig = mono_signature_no_pinvoke (method);
 
@@ -6965,6 +6968,9 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
        return conv_arg;
 }
 
+
+#ifndef DISABLE_COM
+
 static int
 emit_marshal_variant (EmitMarshalContext *m, int argnum, MonoType *t,
                     MonoMarshalSpec *spec, 
@@ -7080,6 +7086,8 @@ emit_marshal_variant (EmitMarshalContext *m, int argnum, MonoType *t,
        return conv_arg;
 }
 
+#endif /* DISABLE_COM */
+
 static gboolean
 mono_pinvoke_is_unicode (MonoMethodPInvoke *piinfo)
 {
@@ -8076,10 +8084,10 @@ emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t,
                return emit_marshal_string (m, argnum, t, spec, conv_arg, conv_arg_type, action);
        case MONO_TYPE_CLASS:
        case MONO_TYPE_OBJECT:
+#ifndef DISABLE_COM
                if (spec && spec->native == MONO_NATIVE_STRUCT)
                        return emit_marshal_variant (m, argnum, t, spec, conv_arg, conv_arg_type, action);
 
-#ifndef DISABLE_COM
                if (spec && (spec->native == MONO_NATIVE_IUNKNOWN ||
                        spec->native == MONO_NATIVE_IDISPATCH ||
                        spec->native == MONO_NATIVE_INTERFACE))
index ba794c6b3de32c8a307dcb0913a0192a41a30a37..72991f977fa567f2167123bdefe4cb6c15f6323e 100644 (file)
@@ -138,7 +138,7 @@ const static unsigned char coded_index_desc[] = {
        5, /*tables*/
        MONO_TABLE_TYPEDEF,
        MONO_TABLE_TYPEREF,
-       MONO_TABLE_MODULE,
+       MONO_TABLE_MODULEREF,
        MONO_TABLE_METHOD,
        MONO_TABLE_TYPESPEC,
 
index bd07b1ff97ccddd0469b7ab81db09e709a124cac..7f5a1757a1b20e18db2f9fe52e09f0936f592e36 100644 (file)
@@ -757,7 +757,6 @@ mono_metadata_compute_size (MonoImage *meta, int tableindex, guint32 *result_bit
                        n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
                        n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
                        n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
-                       n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
 
                        /* 3 bits to encode */
                        field_size = rtsize (n, 16 - 3);
index 5b2d7ecfb5b5f38a081db19a5de2fdeaf0d29159..2d1f0545623a772254ed06526fe9714b6dad4adf 100644 (file)
@@ -242,7 +242,9 @@ mon_finalize (MonoThreadsSync *mon)
 
        mon->data = monitor_freelist;
        monitor_freelist = mon;
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_sync_blocks--;
+#endif
 }
 
 /* LOCKING: this is called with monitor_mutex held */
@@ -310,7 +312,9 @@ mon_new (gsize id)
        new->owner = id;
        new->nest = 1;
        
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_sync_blocks++;
+#endif
        return new;
 }
 
@@ -536,7 +540,9 @@ retry:
        }
 
        /* The object must be locked by someone else... */
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->thread_contentions++;
+#endif
 
        /* If ms is 0 we don't block, but just fail straight away */
        if (ms == 0) {
@@ -612,8 +618,10 @@ retry_contended:
        
        InterlockedIncrement (&mon->entry_count);
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->thread_queue_len++;
        mono_perfcounters->thread_queue_max++;
+#endif
        thread = mono_thread_internal_current ();
 
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
@@ -627,7 +635,9 @@ retry_contended:
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
        
        InterlockedDecrement (&mon->entry_count);
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->thread_queue_len--;
+#endif
 
        if (ms != INFINITE) {
                now = mono_msec_ticks ();
index 0391408b6d3586c229b0d15edc1ea03b2cf786de..9743232da1b45a4b9093d06621170279423fb85f 100644 (file)
@@ -198,7 +198,10 @@ lookup_data_table (MonoDomain *domain)
        MonoDebugDataTable *table;
 
        table = g_hash_table_lookup (data_table_hash, domain);
-       g_assert (table);
+       if (!table) {
+               g_error ("lookup_data_table () failed for %p\n", domain);
+               g_assert (table);
+       }
        return table;
 }
 
index dfe7b4b4d3dc837f4c5fbc35061e66931203128e..700cd9e498abc011709e879426d4189357fb14bf 100644 (file)
@@ -52,6 +52,7 @@ struct _MonoCounterSample {
        int counterType;
 };
 
+#ifndef DISABLE_PERFCOUNTERS
 /* map of PerformanceCounterType.cs */
 enum {
        NumberOfItemsHEX32=0x00000000,
@@ -1689,4 +1690,77 @@ mono_perfcounter_instance_names (MonoString *category, MonoString *machine)
                return mono_array_new (mono_domain_get (), mono_get_string_class (), 0);
        }
 }
+#else
+void*
+mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, MonoString* machine, int *type, MonoBoolean *custom)
+{
+       g_assert_not_reached ();
+}
+
+MonoBoolean
+mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample)
+{
+       g_assert_not_reached ();
+}
+
+gint64
+mono_perfcounter_update_value (void *impl, MonoBoolean do_incr, gint64 value)
+{
+       g_assert_not_reached ();
+}
+
+void
+mono_perfcounter_free_data (void *impl)
+{
+       g_assert_not_reached ();
+}
+
+/* Category icalls */
+MonoBoolean
+mono_perfcounter_category_del (MonoString *name)
+{
+       g_assert_not_reached ();
+}
+
+MonoString*
+mono_perfcounter_category_help (MonoString *category, MonoString *machine)
+{
+       g_assert_not_reached ();
+}
 
+MonoBoolean
+mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine)
+{
+       g_assert_not_reached ();
+}
+
+MonoBoolean
+mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items)
+{
+       g_assert_not_reached ();
+}
+
+int
+mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine)
+{
+       g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_category_names (MonoString *machine)
+{
+       g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_counter_names (MonoString *category, MonoString *machine)
+{
+       g_assert_not_reached ();
+}
+
+MonoArray*
+mono_perfcounter_instance_names (MonoString *category, MonoString *machine)
+{
+       g_assert_not_reached ();
+}
+#endif
index d83c59afe16bbff3cd9001356cbf9e136491ff4c..e59a4d4eb9c1fa0f3f34b670cc58009f646b86e3 100644 (file)
@@ -83,7 +83,7 @@
 #endif
 
 #define MONO_CHECK_ARG(arg, expr)              G_STMT_START{             \
-     if (!(expr))                                                        \
+               if (G_UNLIKELY (!(expr)))                                                         \
        {                                                                 \
                MonoException *ex;                                        \
                char *msg = g_strdup_printf ("assertion `%s' failed",     \
@@ -95,7 +95,7 @@
        };                              }G_STMT_END
 
 #define MONO_CHECK_ARG_NULL(arg)           G_STMT_START{                 \
-     if (arg == NULL)                                                    \
+               if (G_UNLIKELY (arg == NULL))                                             \
        {                                                                 \
                MonoException *ex;                                        \
                if (arg) {} /* check if the name exists */                \
index a1e1f884125bda056e5e0019dec2fa92c7404f80..48ced0faa557ffa8dadb067608dd54e67db2053e 100644 (file)
@@ -2538,7 +2538,9 @@ mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_
        rc->default_vtable = NULL;
        rc->xdomain_vtable = NULL;
        rc->proxy_class_name = name;
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->loader_bytes += mono_string_length (class_name) + 1;
+#endif
 
        g_hash_table_insert (domain->proxy_vtable_hash, key, rc);
 
@@ -2617,9 +2619,11 @@ mono_remote_class_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mon
                MonoClass *klass;
                type = ((MonoReflectionType *)rp->class_to_proxy)->type;
                klass = mono_class_from_mono_type (type);
+#ifndef DISABLE_COM
                if ((klass->is_com_object || (mono_defaults.com_object_class && klass == mono_defaults.com_object_class)) && !mono_class_vtable (mono_domain_get (), klass)->remote)
                        remote_class->default_vtable = mono_class_proxy_vtable (domain, remote_class, MONO_REMOTING_TARGET_COMINTEROP);
                else
+#endif
                        remote_class->default_vtable = mono_class_proxy_vtable (domain, remote_class, MONO_REMOTING_TARGET_UNKNOWN);
        }
        
index d6c159dcf300fd2eb5e69f45d392edf4280a7ed5..ee7af61a57a81ff7d451ae04addf5cc6d6beecc5 100644 (file)
@@ -649,7 +649,9 @@ main (int argc, char *argv [])
        if (!file)
                usage ();
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
+#endif
        mono_metadata_init ();
        mono_images_init ();
        mono_assemblies_init ();
index 1f21fdd2febae7286a7c13ba423d40144d462907..c923c6322bc5f2b0f447b2229307c3a22718161e 100644 (file)
@@ -8,25 +8,20 @@
  * Copyright 2005-2011 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
  * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /*
@@ -223,7 +218,7 @@ mono_gc_alloc_obj_nolock (MonoVTable *vtable, size_t size)
                         * visible before the vtable store.
                         */
 
-                       DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+                       SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
                        binary_protocol_alloc (p , vtable, size);
                        if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ()))
                                MONO_GC_NURSERY_OBJ_ALLOC ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
@@ -284,7 +279,7 @@ mono_gc_alloc_obj_nolock (MonoVTable *vtable, size_t size)
                        } else {
                                size_t alloc_size = 0;
                                if (TLAB_START)
-                                       DEBUG (3, fprintf (gc_debug_file, "Retire TLAB: %p-%p [%ld]\n", TLAB_START, TLAB_REAL_END, (long)(TLAB_REAL_END - TLAB_NEXT - size)));
+                                       SGEN_LOG (3, "Retire TLAB: %p-%p [%ld]", TLAB_START, TLAB_REAL_END, (long)(TLAB_REAL_END - TLAB_NEXT - size));
                                sgen_nursery_retire_region (p, available_in_tlab);
 
                                do {
@@ -325,12 +320,12 @@ mono_gc_alloc_obj_nolock (MonoVTable *vtable, size_t size)
                        sgen_set_nursery_scan_start ((char*)p);
                        /* we just bump tlab_temp_end as well */
                        TLAB_TEMP_END = MIN (TLAB_REAL_END, TLAB_NEXT + SGEN_SCAN_START_SIZE);
-                       DEBUG (5, fprintf (gc_debug_file, "Expanding local alloc: %p-%p\n", TLAB_NEXT, TLAB_TEMP_END));
+                       SGEN_LOG (5, "Expanding local alloc: %p-%p", TLAB_NEXT, TLAB_TEMP_END);
                }
        }
 
        if (G_LIKELY (p)) {
-               DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+               SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
                binary_protocol_alloc (p, vtable, size);
                if (G_UNLIKELY (MONO_GC_MAJOR_OBJ_ALLOC_LARGE_ENABLED ()|| MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ())) {
                        if (size > SGEN_MAX_SMALL_OBJ_SIZE)
@@ -387,7 +382,7 @@ mono_gc_try_alloc_obj_nolock (MonoVTable *vtable, size_t size)
                                sgen_set_nursery_scan_start (new_next);
                                /* we just bump tlab_temp_end as well */
                                TLAB_TEMP_END = MIN (TLAB_REAL_END, TLAB_NEXT + SGEN_SCAN_START_SIZE);
-                               DEBUG (5, fprintf (gc_debug_file, "Expanding local alloc: %p-%p\n", TLAB_NEXT, TLAB_TEMP_END));         
+                               SGEN_LOG (5, "Expanding local alloc: %p-%p", TLAB_NEXT, TLAB_TEMP_END);
                        }
                } else if (available_in_tlab > SGEN_MAX_NURSERY_WASTE) {
                        /* Allocate directly from the nursery */
@@ -422,7 +417,7 @@ mono_gc_try_alloc_obj_nolock (MonoVTable *vtable, size_t size)
        HEAVY_STAT (++stat_objects_alloced);
        HEAVY_STAT (stat_bytes_alloced += size);
 
-       DEBUG (6, fprintf (gc_debug_file, "Allocated object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+       SGEN_LOG (6, "Allocated object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
        binary_protocol_alloc (p, vtable, size);
        if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ()))
                MONO_GC_NURSERY_OBJ_ALLOC ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
@@ -574,11 +569,11 @@ mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size)
                /* large objects are always pinned anyway */
                p = sgen_los_alloc_large_inner (vtable, size);
        } else {
-               DEBUG (9, g_assert (vtable->klass->inited));
+               SGEN_ASSERT (9, vtable->klass->inited, "class %s:%s is not initialized", vtable->klass->name_space, vtable->klass->name);
                p = major_collector.alloc_small_pinned_obj (size, SGEN_VTABLE_HAS_REFERENCES (vtable));
        }
        if (G_LIKELY (p)) {
-               DEBUG (6, fprintf (gc_debug_file, "Allocated pinned object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
+               SGEN_LOG (6, "Allocated pinned object %p, vtable: %p (%s), size: %zd", p, vtable, vtable->klass->name, size);
                if (size > SGEN_MAX_SMALL_OBJ_SIZE)
                        MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)p, size, vtable->klass->name_space, vtable->klass->name);
                else
index 5da555bf5b4bfba3c0ed7e0c740a60f760196e6c..c41e73808e6bf7367058b665c72e0a31795495b6 100644 (file)
@@ -1,34 +1,39 @@
 /*
- * SGen is licensed under the terms of the MIT X11 license
+ * sgen-archdep.h: Architecture dependent parts of SGen.
  *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #ifndef __MONO_SGENARCHDEP_H__
 #define __MONO_SGENARCHDEP_H__
 
 #include <mono/utils/mono-sigcontext.h>
 
-#if defined(__i386__) || defined(TARGET_X86)
+#if defined(MONO_CROSS_COMPILE)
+
+#define REDZONE_SIZE   0
+
+#define ARCH_NUM_REGS 0
+#define ARCH_STORE_REGS(ptr)
+#define ARCH_SIGCTX_SP(ctx) NULL
+#define ARCH_SIGCTX_IP(ctx) NULL
+#define ARCH_COPY_SIGCTX_REGS(a,ctx)
+
+#elif defined(TARGET_X86)
 
 #include <mono/utils/mono-context.h>
 
@@ -71,7 +76,7 @@
 #define ARCH_SIGCTX_SP(ctx)    (UCONTEXT_REG_ESP ((ctx)))
 #define ARCH_SIGCTX_IP(ctx)    (UCONTEXT_REG_EIP ((ctx)))
 
-#elif defined(__x86_64__) || defined(TARGET_AMD64)
+#elif defined(TARGET_AMD64)
 
 #include <mono/utils/mono-context.h>
 
@@ -84,7 +89,7 @@
 #define ARCH_SIGCTX_SP(ctx)    (UCONTEXT_REG_RSP (ctx))
 #define ARCH_SIGCTX_IP(ctx)    (UCONTEXT_REG_RIP (ctx))
 
-#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__)
+#elif defined(TARGET_PPC)
 
 #define REDZONE_SIZE   224
 
                ((a)[__i]) = UCONTEXT_REG_Rn((ctx), __i);       \
        } while (0)
 
-#elif defined(__arm__)
+#elif defined(TARGET_ARM)
 
 #define REDZONE_SIZE   0
+#define USE_MONO_CTX
 
 /* We dont store ip, sp */
 #define ARCH_NUM_REGS 14
index 4fad8b6678afb2e45404160fd6ecdcfc9b653e7d..3976a0d833ebb893dc372315d38b64058ec2b15e 100644 (file)
@@ -599,7 +599,7 @@ LOOP_HEAD:
 #ifdef CARDTABLE_STATS
 
 typedef struct {
-       int total, marked, remarked;    
+       int total, marked, remarked, gc_marked; 
 } card_stats;
 
 static card_stats major_stats, los_stats;
@@ -610,9 +610,12 @@ count_marked_cards (mword start, mword size)
 {
        mword end = start + size;
        while (start <= end) {
+               guint8 card = *sgen_card_table_get_card_address (start);
                ++cur_stats->total;
-               if (sgen_card_table_address_is_marked (start))
+               if (card)
                        ++cur_stats->marked;
+               if (card == 2)
+                       ++cur_stats->gc_marked;
                start += CARD_SIZE_IN_BYTES;
        }
 }
@@ -622,8 +625,10 @@ count_remarked_cards (mword start, mword size)
 {
        mword end = start + size;
        while (start <= end) {
-               if (sgen_card_table_address_is_marked (start))
+               if (sgen_card_table_address_is_marked (start)) {
                        ++cur_stats->remarked;
+                       *sgen_card_table_get_card_address (start) = 2;
+               }
                start += CARD_SIZE_IN_BYTES;
        }
 }
@@ -643,12 +648,12 @@ sgen_card_tables_collect_stats (gboolean begin)
                sgen_los_iterate_live_block_ranges (count_marked_cards);
        } else {
                cur_stats = &major_stats;
-               sgen_major_collector_iterate_live_block_ranges (count_marked_cards);
+               sgen_major_collector_iterate_live_block_ranges (count_remarked_cards);
                cur_stats = &los_stats;
                sgen_los_iterate_live_block_ranges (count_remarked_cards);
-               printf ("cards major (t %d m %d r %d)  los (t %d m %d r %d) major_scan %.2fms los_scan %.2fms\n", 
-                       major_stats.total, major_stats.marked, major_stats.remarked,
-                       los_stats.total, los_stats.marked, los_stats.remarked,
+               printf ("cards major (t %d m %d g %d r %d)  los (t %d m %d g %d r %d) major_scan %.2fms los_scan %.2fms\n", 
+                       major_stats.total, major_stats.marked, major_stats.gc_marked, major_stats.remarked,
+                       los_stats.total, los_stats.marked, los_stats.gc_marked, los_stats.remarked,
                        last_major_scan_time / 1000.0, last_los_scan_time / 1000.0);
        }
 #endif
index 19f28cde038411ae6f1248b73232c3353d8942d7..2eb703e9abc0f2457bd70ff27784b5be58833c6e 100644 (file)
@@ -1,26 +1,23 @@
 /*
+ * sgen-conf.h: Tunable parameters and debugging switches.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #ifndef __MONO_SGENCONF_H__
 #define __MONO_SGENCONF_H__
@@ -82,11 +79,17 @@ typedef guint64 mword;
 
 /*
  * Maximum level of debug to enable on this build.
- * Making this a static variable enables us to put logging in a lot of places.
- * FIXME decouple logging from assertions
+ * Making this a constant enables us to put logging in a lot of places and
+ * not pay its cost on release builds.
  */
 #define SGEN_MAX_DEBUG_LEVEL 2
 
+/*
+ * Maximum level of asserts to enable on this build.
+ * FIXME replace all magic numbers with defines.
+ */
+#define SGEN_MAX_ASSERT_LEVEL 2
+
 
 #define GC_BITS_PER_WORD (sizeof (mword) * 8)
 
index c1404df194360413fae4fdea5a88c38c6ff19cdc..76a00e281ac167469aa0d29a5e5376d791058913 100644 (file)
@@ -1,25 +1,22 @@
 /*
+ * sgen-copy-object.h: This is where objects are copied.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 extern long long stat_copy_object_called_nursery;
 extern long long stat_objects_copied_nursery;
@@ -41,8 +38,8 @@ par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword o
        static const void *copy_labels [] = { &&LAB_0, &&LAB_1, &&LAB_2, &&LAB_3, &&LAB_4, &&LAB_5, &&LAB_6, &&LAB_7, &&LAB_8 };
 #endif
 
-       DEBUG (9, g_assert (vt->klass->inited));
-       DEBUG (9, fprintf (gc_debug_file, " (to %p, %s size: %lu)\n", destination, ((MonoObject*)obj)->vtable->klass->name, (unsigned long)objsize));
+       SGEN_ASSERT (9, vt->klass->inited, "vtable %p for class %s:%s was not initialized", vt, vt->klass->name_space, vt->klass->name);
+       SGEN_LOG (9, " (to %p, %s size: %lu)", destination, ((MonoObject*)obj)->vtable->klass->name, (unsigned long)objsize);
        binary_protocol_copy (obj, destination, vt, objsize);
 
        if (G_UNLIKELY (MONO_GC_OBJ_MOVED_ENABLED ())) {
@@ -81,21 +78,25 @@ par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword o
                mono_gc_memmove (destination + sizeof (mword), (char*)obj + sizeof (mword), objsize - sizeof (mword));
 #endif
        /* adjust array->bounds */
-       DEBUG (9, g_assert (vt->gc_descr));
+       SGEN_ASSERT (9, vt->gc_descr, "vtable %p for class %s:%s has no gc descriptor", vt, vt->klass->name_space, vt->klass->name);
+
        if (G_UNLIKELY (vt->rank && ((MonoArray*)obj)->bounds)) {
                MonoArray *array = (MonoArray*)destination;
                array->bounds = (MonoArrayBounds*)((char*)destination + ((char*)((MonoArray*)obj)->bounds - (char*)obj));
-               DEBUG (9, fprintf (gc_debug_file, "Array instance %p: size: %lu, rank: %d, length: %lu\n", array, (unsigned long)objsize, vt->rank, (unsigned long)mono_array_length (array)));
+               SGEN_LOG (9, "Array instance %p: size: %lu, rank: %d, length: %lu", array, (unsigned long)objsize, vt->rank, (unsigned long)mono_array_length (array));
        }
        if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES))
                sgen_register_moved_object (obj, destination);
        obj = destination;
        if (queue) {
-               DEBUG (9, fprintf (gc_debug_file, "Enqueuing gray object %p (%s)\n", obj, sgen_safe_name (obj)));
+               SGEN_LOG (9, "Enqueuing gray object %p (%s)", obj, sgen_safe_name (obj));
                GRAY_OBJECT_ENQUEUE (queue, obj);
        }
 }
 
+/*
+ * This can return OBJ itself on OOM.
+ */
 #ifdef _MSC_VER
 static __declspec(noinline) void*
 #else
@@ -106,7 +107,7 @@ copy_object_no_checks (void *obj, SgenGrayQueue *queue)
        MonoVTable *vt = ((MonoObject*)obj)->vtable;
        gboolean has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
        mword objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
-       char *destination = collector_serial_alloc_for_promotion (obj, objsize, has_references);
+       char *destination = COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION (obj, objsize, has_references);
 
        if (G_UNLIKELY (!destination)) {
                collector_pin_object (obj, queue);
@@ -122,176 +123,3 @@ copy_object_no_checks (void *obj, SgenGrayQueue *queue)
 
        return destination;
 }
-
-#ifdef GENERATE_COPY_FUNCTIONS
-
-extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
-
-#if defined(SGEN_SIMPLE_NURSERY)
-#define serial_copy_object simple_nursery_serial_copy_object
-#define parallel_copy_object simple_nursery_parallel_copy_object
-
-#elif defined (SGEN_SPLIT_NURSERY)
-
-#define serial_copy_object split_nursery_serial_copy_object
-#define parallel_copy_object split_nursery_parallel_copy_object
-
-#else
-#error "Please define GC_CONF_NAME"
-#endif
-
-/*
- * This is how the copying happens from the nursery to the old generation.
- * We assume that at this time all the pinned objects have been identified and
- * marked as such.
- * We run scan_object() for each pinned object so that each referenced
- * objects if possible are copied. The new gray objects created can have
- * scan_object() run on them right away, too.
- * Then we run copy_object() for the precisely tracked roots. At this point
- * all the roots are either gray or black. We run scan_object() on the gray
- * objects until no more gray objects are created.
- * At the end of the process we walk again the pinned list and we unmark
- * the pinned flag. As we go we also create the list of free space for use
- * in the next allocation runs.
- *
- * We need to remember objects from the old generation that point to the new one
- * (or just addresses?).
- *
- * copy_object could be made into a macro once debugged (use inline for now).
- */
-
-#ifdef _MSC_VER
-static __forceinline void
-#else
-static inline void __attribute__((always_inline))
-#endif
-serial_copy_object (void **obj_slot, SgenGrayQueue *queue) 
-{
-       char *forwarded;
-       char *obj = *obj_slot;
-
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_NURSERY));
-
-       HEAVY_STAT (++stat_copy_object_called_nursery);
-
-       if (!sgen_ptr_in_nursery (obj)) {
-               HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
-               return;
-       }
-
-       DEBUG (9, fprintf (gc_debug_file, "Precise copy of %p from %p", obj, obj_slot));
-
-       /*
-        * Before we can copy the object we must make sure that we are
-        * allowed to, i.e. that the object not pinned, not already
-        * forwarded or belongs to the nursery To Space.
-        */
-
-       if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
-               DEBUG (9, g_assert ((*(MonoVTable**)SGEN_LOAD_VTABLE(obj))->gc_descr));
-               DEBUG (9, fprintf (gc_debug_file, " (already forwarded to %p)\n", forwarded));
-               HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
-               *obj_slot = forwarded;
-               return;
-       }
-       if (SGEN_OBJECT_IS_PINNED (obj)) {
-               DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
-               DEBUG (9, fprintf (gc_debug_file, " (pinned, no change)\n"));
-               HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
-               return;
-       }
-
-       if (sgen_nursery_is_to_space (obj)) {
-               DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
-               DEBUG (9, fprintf (gc_debug_file, " (tospace, no change)\n"));
-               HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);                
-               return;
-       }
-
-       HEAVY_STAT (++stat_objects_copied_nursery);
-
-       *obj_slot = copy_object_no_checks (obj, queue);
-}
-
-static void
-parallel_copy_object (void **obj_slot, SgenGrayQueue *queue)
-{
-       char *obj = *obj_slot;
-       mword vtable_word, objsize;
-       MonoVTable *vt;
-       void *destination;
-       gboolean has_references;
-
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_NURSERY));
-
-       HEAVY_STAT (++stat_copy_object_called_nursery);
-
-       if (!sgen_ptr_in_nursery (obj)) {
-               HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
-               return;
-       }
-
-       vtable_word = *(mword*)obj;
-       vt = (MonoVTable*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
-
-       /*
-        * Before we can copy the object we must make sure that we are
-        * allowed to, i.e. that the object not pinned, not already
-        * forwarded and not in the nursery To Space.
-        */
-
-       if (vtable_word & SGEN_FORWARDED_BIT) {
-               HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
-               *obj_slot = vt;
-               return;
-       }
-       if (vtable_word & SGEN_PINNED_BIT) {
-               HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
-               return;
-       }
-
-       if (sgen_nursery_is_to_space (obj)) {
-               HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);                
-               return;
-       }
-
-       HEAVY_STAT (++stat_objects_copied_nursery);
-
-       objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
-       has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
-
-       destination = collector_parallel_alloc_for_promotion (obj, objsize, has_references);
-
-       if (G_UNLIKELY (!destination)) {
-               sgen_parallel_pin_or_update (obj_slot, obj, vt, queue);
-               return;
-       }
-
-       *(MonoVTable**)destination = vt;
-
-       if (SGEN_CAS_PTR ((void*)obj, (void*)((mword)destination | SGEN_FORWARDED_BIT), vt) == vt) {
-               par_copy_object_no_checks (destination, vt, obj, objsize, has_references ? queue : NULL);
-               obj = destination;
-               *obj_slot = obj;
-       } else {
-               /* FIXME: unify with code in major_copy_or_mark_object() */
-
-               /* FIXME: Give destination back to the allocator. */
-               /*The major collector only needs the first word zeroed and nursery requires all bits to be. */
-               if (!sgen_ptr_in_nursery (destination))
-                       *(void**)destination = NULL;
-               else
-                       memset (destination, 0, objsize);
-
-               vtable_word = *(mword*)obj;
-               g_assert (vtable_word & SGEN_FORWARDED_BIT);
-
-               obj = (void*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
-
-               *obj_slot = obj;
-
-               HEAVY_STAT (++stat_slots_allocated_in_vain);
-       }
-}
-
-#endif
index bbc3478a95ef4e40838839410634a2dbd8df3c45..b1255a6748dce1ff0ae17cd2a476e63ade024bfd 100644 (file)
@@ -8,25 +8,20 @@
  * Copyright 2005-2011 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
  * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -81,8 +76,15 @@ describe_ptr (char *ptr)
                        else
                                printf ("Pointer is at offset 0x%x of object %p in LOS space.\n", (int)(ptr - start), start);
                        ptr = start;
-               } else if (major_collector.ptr_is_in_non_pinned_space (ptr)) {
-                       printf ("Pointer inside oldspace.\n");
+               } else if (major_collector.ptr_is_in_non_pinned_space (ptr, &start)) {
+                       if (ptr == start)
+                               printf ("Pointer is the start of object %p in oldspace.\n", start);
+                       else if (start)
+                               printf ("Pointer is at offset 0x%x of object %p in oldspace.\n", (int)(ptr - start), start);
+                       else
+                               printf ("Pointer inside oldspace.\n");
+                       if (start)
+                               ptr = start;
                } else if (major_collector.obj_is_from_pinned_alloc (ptr)) {
                        printf ("Pointer is inside a pinned chunk.\n");
                } else {
@@ -130,7 +132,7 @@ static gboolean missing_remsets;
 #define HANDLE_PTR(ptr,obj)    do {    \
        if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) { \
                if (!sgen_get_remset ()->find_address ((char*)(ptr))) { \
-                       fprintf (gc_debug_file, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
+                       SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), ((MonoObject*)(obj))->vtable->klass->name_space, ((MonoObject*)(obj))->vtable->klass->name); \
                        binary_protocol_missing_remset ((obj), (gpointer)LOAD_VTABLE ((obj)), (char*)(ptr) - (char*)(obj), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
                        if (!object_is_pinned (*(ptr)))                                                         \
                                missing_remsets = TRUE;                                                                 \
@@ -146,7 +148,7 @@ static void
 check_consistency_callback (char *start, size_t size, void *dummy)
 {
        GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
-       DEBUG (8, fprintf (gc_debug_file, "Scanning object %p, vtable: %p (%s)\n", start, vt, vt->klass->name));
+       SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, vt->klass->name);
 
 #define SCAN_OBJECT_ACTION
 #include "sgen-scan-object.h"
@@ -164,14 +166,14 @@ sgen_check_consistency (void)
 
        missing_remsets = FALSE;
 
-       DEBUG (1, fprintf (gc_debug_file, "Begin heap consistency check...\n"));
+       SGEN_LOG (1, "Begin heap consistency check...");
 
        // Check that oldspace->newspace pointers are registered with the collector
        major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_consistency_callback, NULL);
 
        sgen_los_iterate_objects ((IterateObjectCallbackFunc)check_consistency_callback, NULL);
 
-       DEBUG (1, fprintf (gc_debug_file, "Heap consistency check done.\n"));
+       SGEN_LOG (1, "Heap consistency check done.");
 
        if (!binary_protocol_is_enabled ())
                g_assert (!missing_remsets);
@@ -255,24 +257,23 @@ describe_nursery_ptr (char *ptr)
 {
        int i;
 
-       fprintf (gc_debug_file, "nursery-ptr ");
        for (i = 0; i < valid_nursery_object_count; ++i) {
                if (valid_nursery_objects [i] >= ptr)
                        break;
        }
 
        if (i >= valid_nursery_object_count || valid_nursery_objects [i] + safe_object_get_size ((MonoObject *)valid_nursery_objects [i]) < ptr) {
-               fprintf (gc_debug_file, "(unalloc'd-memory)");
+               SGEN_LOG (1, "nursery-ptr (unalloc'd-memory)");
        } else {
                char *obj = valid_nursery_objects [i];
                MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
                int size = safe_object_get_size ((MonoObject *)obj);
 
                if (obj == ptr)
-                       fprintf (gc_debug_file, "(object %s.%s size %d)", 
+                       SGEN_LOG (1, "nursery-ptr (object %s.%s size %d)", 
                                vtable->klass->name_space, vtable->klass->name, size);
                else
-                       fprintf (gc_debug_file, "(interior-ptr offset %td of %p (%s.%s) size %d)",
+                       SGEN_LOG (1, "nursery-ptr (interior-ptr offset %td of %p (%s.%s) size %d)",
                                ptr - obj, obj,
                                vtable->klass->name_space, vtable->klass->name, size);
        }
@@ -301,7 +302,7 @@ describe_pointer (char *ptr)
        } else if (major_collector.describe_pointer (ptr)) {
                //Nothing really
        } else if (!mono_sgen_los_describe_pointer (ptr)) {
-               fprintf (gc_debug_file, "non-heap-ptr");
+               SGEN_LOG (1, "\tnon-heap-ptr");
        }
 }
 
@@ -311,11 +312,10 @@ bad_pointer_spew (char *obj, char **slot)
        char *ptr = *slot;
        MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
 
-       fprintf (gc_debug_file, "Invalid object pointer %p [", ptr);
-       describe_pointer (ptr);
-       fprintf (gc_debug_file, "] at offset %td in object %p (%s.%s).\n",
+       SGEN_LOG (1, "Invalid object pointer %p at offset %td in object %p (%s.%s):", ptr,
                (char*)slot - obj,
                obj, vtable->klass->name_space, vtable->klass->name);
+       describe_pointer (ptr);
        broken_heap = TRUE;
 }
 
@@ -325,7 +325,7 @@ missing_remset_spew (char *obj, char **slot)
        char *ptr = *slot;
        MonoVTable *vtable = (MonoVTable*)LOAD_VTABLE (obj);
 
-    fprintf (gc_debug_file,  "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.\n",
+    SGEN_LOG (1, "Oldspace->newspace reference %p at offset %td in object %p (%s.%s) not found in remsets.",
                ptr, (char*)slot - obj, obj, 
                vtable->klass->name_space, vtable->klass->name);
 
@@ -413,7 +413,7 @@ find_pinning_ref_from_thread (char *obj, size_t size)
                        continue;
                while (start < (char**)info->stack_end) {
                        if (*start >= obj && *start < endobj) {
-                               DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p\n", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end));
+                               SGEN_LOG (1, "Object %p referenced in thread %p (id %p) at %p, stack: %p-%p", obj, info, (gpointer)mono_thread_info_get_tid (info), start, info->stack_start, info->stack_end);
                        }
                        start++;
                }
@@ -426,7 +426,7 @@ find_pinning_ref_from_thread (char *obj, size_t size)
 #endif
 
                        if (w >= (mword)obj && w < (mword)obj + size)
-                               DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in saved reg %d of thread %p (id %p)\n", obj, j, info, (gpointer)mono_thread_info_get_tid (info)));
+                               SGEN_LOG (1, "Object %p referenced in saved reg %d of thread %p (id %p)", obj, j, info, (gpointer)mono_thread_info_get_tid (info));
                } END_FOREACH_THREAD
        }
 }
@@ -446,7 +446,7 @@ find_pinning_reference (char *obj, size_t size)
                if (!root->root_desc) {
                        while (start < (char**)root->end_root) {
                                if (*start >= obj && *start < endobj) {
-                                       DEBUG (0, fprintf (gc_debug_file, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root));
+                                       SGEN_LOG (1, "Object %p referenced in pinned roots %p-%p\n", obj, start, root->end_root);
                                }
                                start++;
                        }
index 13d0e117233afe920a69d93bdc3299bf6f3a6178..286c186cf3ca8ce777f79e84f5a660aafcc2a2d9 100644 (file)
@@ -1,26 +1,23 @@
 /*
+ * sgen-descriptor.c: GC descriptors describe object layout.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include "config.h"
 #ifdef HAVE_SGEN_GC
@@ -97,12 +94,12 @@ alloc_complex_descriptor (gsize *bitmap, int numbits)
                complex_descriptors = g_realloc (complex_descriptors, new_size * sizeof (gsize));
                complex_descriptors_size = new_size;
        }
-       DEBUG (6, fprintf (gc_debug_file, "Complex descriptor %d, size: %d (total desc memory: %d)\n", res, nwords, complex_descriptors_size));
+       SGEN_LOG (6, "Complex descriptor %d, size: %d (total desc memory: %d)", res, nwords, complex_descriptors_size);
        complex_descriptors_next += nwords;
        complex_descriptors [res] = nwords;
        for (i = 0; i < nwords - 1; ++i) {
                complex_descriptors [res + 1 + i] = bitmap [i];
-               DEBUG (6, fprintf (gc_debug_file, "\tvalue: %p\n", (void*)complex_descriptors [res + 1 + i]));
+               SGEN_LOG (6, "\tvalue: %p", (void*)complex_descriptors [res + 1 + i]);
        }
        sgen_gc_unlock ();
        return res;
@@ -143,7 +140,7 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
        }
 
        if (first_set < 0) {
-               DEBUG (6, fprintf (gc_debug_file, "Ptrfree descriptor %p, size: %zd\n", (void*)desc, stored_size));
+               SGEN_LOG (6, "Ptrfree descriptor %p, size: %zd", (void*)desc, stored_size);
                if (stored_size <= MAX_RUNLEN_OBJECT_SIZE)
                        return (void*)(DESC_TYPE_RUN_LENGTH | stored_size);
                return (void*)DESC_TYPE_COMPLEX_PTRFREE;
@@ -158,7 +155,7 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
                 */
                if (first_set < 256 && num_set < 256 && (first_set + num_set == last_set + 1)) {
                        desc = DESC_TYPE_RUN_LENGTH | stored_size | (first_set << 16) | (num_set << 24);
-                       DEBUG (6, fprintf (gc_debug_file, "Runlen descriptor %p, size: %zd, first set: %d, num set: %d\n", (void*)desc, stored_size, first_set, num_set));
+                       SGEN_LOG (6, "Runlen descriptor %p, size: %zd, first set: %d, num set: %d", (void*)desc, stored_size, first_set, num_set);
                        return (void*) desc;
                }
        }
@@ -166,14 +163,14 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
        /* we know the 2-word header is ptr-free */
        if (last_set < SMALL_BITMAP_SIZE + OBJECT_HEADER_WORDS) {
                desc = DESC_TYPE_SMALL_BITMAP | stored_size | ((*bitmap >> OBJECT_HEADER_WORDS) << SMALL_BITMAP_SHIFT);
-               DEBUG (6, fprintf (gc_debug_file, "Smallbitmap descriptor %p, size: %zd, last set: %d\n", (void*)desc, stored_size, last_set));
+               SGEN_LOG (6, "Smallbitmap descriptor %p, size: %zd, last set: %d", (void*)desc, stored_size, last_set);
                return (void*) desc;
        }
 
        /* we know the 2-word header is ptr-free */
        if (last_set < LARGE_BITMAP_SIZE + OBJECT_HEADER_WORDS) {
                desc = DESC_TYPE_LARGE_BITMAP | ((*bitmap >> OBJECT_HEADER_WORDS) << LOW_TYPE_BITS);
-               DEBUG (6, fprintf (gc_debug_file, "Largebitmap descriptor %p, size: %zd, last set: %d\n", (void*)desc, stored_size, last_set));
+               SGEN_LOG (6, "Largebitmap descriptor %p, size: %zd, last set: %d", (void*)desc, stored_size, last_set);
                return (void*) desc;
        }
        /* it's a complex object ... */
index 4ce0de328e160d44ebe4e4642d49e33a7a97a255..cd53a862c3d42e7db2249e3fb96ba2c0702e8f90 100644 (file)
@@ -1,26 +1,24 @@
 /*
+ * sgen-descriptor.h: GC descriptors describe object layout.
+
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #ifndef __MONO_SGEN_DESCRIPTOR_H__
 #define __MONO_SGEN_DESCRIPTOR_H__
@@ -163,6 +161,8 @@ sgen_gc_descr_has_references (mword desc)
                        void **_objptr = (void**)(obj); \
                        _objptr += ((desc) >> 16) & 0xff;       \
                        _objptr_end = _objptr + (((desc) >> 24) & 0xff);        \
+                       HANDLE_PTR (_objptr, (obj)); \
+                       _objptr ++; \
                        while (_objptr < _objptr_end) { \
                                HANDLE_PTR (_objptr, (obj));    \
                                _objptr++;      \
@@ -170,19 +170,42 @@ sgen_gc_descr_has_references (mword desc)
                }       \
        } while (0)
 
+#ifdef __GNUC__
 #define OBJ_BITMAP_FOREACH_PTR(desc,obj)       do {    \
                /* there are pointers */        \
                void **_objptr = (void**)(obj); \
                gsize _bmap = (desc) >> 16;     \
                _objptr += OBJECT_HEADER_WORDS; \
+               { \
+                       int _index = __builtin_ctz (_bmap); \
+                       _objptr += _index; \
+                       _bmap >>= (_index + 1);                         \
+                       HANDLE_PTR (_objptr, (obj));            \
+                       _objptr ++;                                                     \
+                       } \
                while (_bmap) { \
-                       if ((_bmap & 1)) {      \
-                               HANDLE_PTR (_objptr, (obj));    \
-                       }       \
-                       _bmap >>= 1;    \
-                       ++_objptr;      \
-                       }       \
+                       int _index = __builtin_ctz (_bmap); \
+                       _objptr += _index; \
+                       _bmap >>= (_index + 1);                         \
+                       HANDLE_PTR (_objptr, (obj));            \
+                       _objptr ++;                                                     \
+               }                                                                               \
+       } while (0)
+#else
+#define OBJ_BITMAP_FOREACH_PTR(desc,obj)       do {    \
+               /* there are pointers */        \
+               void **_objptr = (void**)(obj); \
+               gsize _bmap = (desc) >> 16;     \
+               _objptr += OBJECT_HEADER_WORDS; \
+               while (_bmap) {                                            \
+                       if ((_bmap & 1)) {                                                                 \
+                               HANDLE_PTR (_objptr, (obj));                               \
+                       }                                                                                                  \
+                       _bmap >>= 1;                                                                       \
+                       ++_objptr;                                                                                 \
+               }                                                                                                          \
        } while (0)
+#endif
 
 /* a bitmap desc means that there are pointer references or we'd have
  * choosen run-length, instead: add an assert to check.
index 9f3526815cf1463d31fed2806c2c8084363e3200..20cff63039a77c4293e249e340f461435492a2ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * sgen-fin-weak-hash.c:
+ * sgen-fin-weak-hash.c: Finalizers and weak links.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
@@ -8,25 +8,20 @@
  * Copyright 2005-2011 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
  * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -151,12 +146,12 @@ sgen_collect_bridge_objects (CopyOrMarkObjectFunc copy_func, char *start, char *
                        /* insert it into the major hash */
                        sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
 
-                       DEBUG (5, fprintf (gc_debug_file, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy, sgen_safe_name (copy), object));
+                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_safe_name (copy), object);
 
                        continue;
                } else {
                        /* update pointer */
-                       DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", copy, sgen_safe_name (copy), object));
+                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_safe_name (copy), object);
                        SGEN_HASH_TABLE_FOREACH_SET_KEY (tagged_object_apply (copy, tag));
                }
        } SGEN_HASH_TABLE_FOREACH_END;
@@ -186,7 +181,7 @@ sgen_finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end,
                                num_ready_finalizers++;
                                sgen_queue_finalization_entry (copy);
                                /* Make it survive */
-                               DEBUG (5, fprintf (gc_debug_file, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy, sgen_safe_name (copy), object, num_ready_finalizers, sgen_hash_table_num_entries (hash_table)));
+                               SGEN_LOG (5, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)", copy, sgen_safe_name (copy), object, num_ready_finalizers, sgen_hash_table_num_entries (hash_table));
                                continue;
                        } else {
                                if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
@@ -196,12 +191,12 @@ sgen_finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end,
                                        /* insert it into the major hash */
                                        sgen_hash_table_replace (&major_finalizable_hash, tagged_object_apply (copy, tag), NULL, NULL);
 
-                                       DEBUG (5, fprintf (gc_debug_file, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy, sgen_safe_name (copy), object));
+                                       SGEN_LOG (5, "Promoting finalization of object %p (%s) (was at %p) to major table", copy, sgen_safe_name (copy), object);
 
                                        continue;
                                } else {
                                        /* update pointer */
-                                       DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", copy, sgen_safe_name (copy), object));
+                                       SGEN_LOG (5, "Updating object for finalization: %p (%s) (was at %p)", copy, sgen_safe_name (copy), object);
                                        SGEN_HASH_TABLE_FOREACH_SET_KEY (tagged_object_apply (copy, tag));
                                }
                        }
@@ -222,10 +217,10 @@ register_for_finalization (MonoObject *obj, void *user_data, int generation)
 
        if (user_data) {
                if (sgen_hash_table_replace (hash_table, obj, NULL, NULL))
-                       DEBUG (5, fprintf (gc_debug_file, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, obj->vtable->klass->name, hash_table->num_entries, sgen_generation_name (generation)));
+                       SGEN_LOG (5, "Added finalizer for object: %p (%s) (%d) to %s table", obj, obj->vtable->klass->name, hash_table->num_entries, sgen_generation_name (generation));
        } else {
                if (sgen_hash_table_remove (hash_table, obj, NULL))
-                       DEBUG (5, fprintf (gc_debug_file, "Removed finalizer for object: %p (%s) (%d)\n", obj, obj->vtable->klass->name, hash_table->num_entries));
+                       SGEN_LOG (5, "Removed finalizer for object: %p (%s) (%d)", obj, obj->vtable->klass->name, hash_table->num_entries);
        }
 }
 
@@ -356,7 +351,7 @@ finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size,
                        /* remove and put in out_array */
                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                        out_array [count ++] = object;
-                       DEBUG (5, fprintf (gc_debug_file, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, sgen_safe_name (object), num_ready_finalizers, sgen_hash_table_num_entries (hash_table)));
+                       SGEN_LOG (5, "Collecting object for finalization: %p (%s) (%d/%d)", object, sgen_safe_name (object), num_ready_finalizers, sgen_hash_table_num_entries (hash_table));
                        if (count == out_size)
                                return count;
                        continue;
@@ -416,15 +411,15 @@ add_or_remove_disappearing_link (MonoObject *obj, void **link, int generation)
 
        if (!obj) {
                if (sgen_hash_table_remove (hash_table, link, NULL)) {
-                       DEBUG (5, fprintf (gc_debug_file, "Removed dislink %p (%d) from %s table\n",
-                                       link, hash_table->num_entries, sgen_generation_name (generation)));
+                       SGEN_LOG (5, "Removed dislink %p (%d) from %s table",
+                                       link, hash_table->num_entries, sgen_generation_name (generation));
                }
                return;
        }
 
        sgen_hash_table_replace (hash_table, link, NULL, NULL);
-       DEBUG (5, fprintf (gc_debug_file, "Added dislink for object: %p (%s) at %p to %s table\n",
-                       obj, obj->vtable->klass->name, link, sgen_generation_name (generation)));
+       SGEN_LOG (5, "Added dislink for object: %p (%s) at %p to %s table",
+                       obj, obj->vtable->klass->name, link, sgen_generation_name (generation));
 }
 
 /* LOCKING: requires that the GC lock is held */
@@ -454,7 +449,7 @@ sgen_null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end,
                        if (object >= start && object < end && !major_collector.is_object_live (object)) {
                                if (sgen_gc_is_object_ready_for_finalization (object)) {
                                        *link = NULL;
-                                       DEBUG (5, fprintf (gc_debug_file, "Dislink nullified at %p to GCed object %p\n", link, object));
+                                       SGEN_LOG (5, "Dislink nullified at %p to GCed object %p", link, object);
                                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                                        continue;
                                } else {
@@ -476,12 +471,12 @@ sgen_null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end,
                                                *link = HIDE_POINTER (copy, track);
                                                add_or_remove_disappearing_link ((MonoObject*)copy, link, GENERATION_OLD);
 
-                                               DEBUG (5, fprintf (gc_debug_file, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy));
+                                               SGEN_LOG (5, "Upgraded dislink at %p to major because object %p moved to %p", link, object, copy);
 
                                                continue;
                                        } else {
                                                *link = HIDE_POINTER (copy, track);
-                                               DEBUG (5, fprintf (gc_debug_file, "Updated dislink at %p to %p\n", link, DISLINK_OBJECT (link)));
+                                               SGEN_LOG (5, "Updated dislink at %p to %p", link, DISLINK_OBJECT (link));
                                        }
                                }
                        }
@@ -508,7 +503,7 @@ sgen_null_links_for_domain (MonoDomain *domain, int generation)
                                 * This can happen if finalizers are not ran, i.e. Environment.Exit ()
                                 * is called from finalizer like in finalizer-abort.cs.
                                 */
-                               DEBUG (5, fprintf (gc_debug_file, "Disappearing link %p not freed", link));
+                               SGEN_LOG (5, "Disappearing link %p not freed", link);
                        }
 
                        SGEN_HASH_TABLE_FOREACH_REMOVE (free);
@@ -525,19 +520,13 @@ sgen_null_links_with_predicate (int generation, WeakLinkAlivePredicateFunc predi
        void **link;
        gpointer dummy;
        SgenHashTable *hash = get_dislink_hash_table (generation);
-       fprintf (stderr, "**** nulling links with predicate\n");
        SGEN_HASH_TABLE_FOREACH (hash, link, dummy) {
                char *object = DISLINK_OBJECT (link);
                mono_bool is_alive = predicate ((MonoObject*)object, data);
 
-               if (is_alive)
-                       fprintf (stderr, "ALIVE %p %s\n", object, sgen_safe_name (object));
-               else
-                       fprintf (stderr, "DEAD %p %s\n", object, sgen_safe_name (object));
-
                if (!is_alive) {
                        *link = NULL;
-                       DEBUG (5, fprintf (gc_debug_file, "Dislink nullified by predicate at %p to GCed object %p\n", link, object));
+                       SGEN_LOG (5, "Dislink nullified by predicate at %p to GCed object %p", link, object);
                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                        continue;
                }
@@ -555,7 +544,7 @@ sgen_remove_finalizers_for_domain (MonoDomain *domain, int generation)
                object = tagged_object_get_object (object);
 
                if (mono_object_domain (object) == domain) {
-                       DEBUG (5, fprintf (gc_debug_file, "Unregistering finalizer for object: %p (%s)\n", object, sgen_safe_name (object)));
+                       SGEN_LOG (5, "Unregistering finalizer for object: %p (%s)", object, sgen_safe_name (object));
 
                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
                        continue;
index e9de61702b318adef344a2109bb39123a77d22d5..52bcbd5daa4b47caae8ef01f3d96ffc15934caa4 100644 (file)
  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
  * Copyright (c) 2000-2004 by Hewlett-Packard Company.  All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
  *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  * Important: allocation provides always zeroed memory, having to do
  * a memset after allocation is deadly for performance.
@@ -487,7 +470,7 @@ add_profile_gc_root (GCRootReport *report, void *object, int rtype, uintptr_t ex
 MonoNativeTlsKey thread_info_key;
 
 #ifdef HAVE_KW_THREAD
-__thread SgenThreadInfo *thread_info;
+__thread SgenThreadInfo *sgen_thread_info;
 __thread gpointer *store_remset_buffer;
 __thread long store_remset_buffer_index;
 __thread char *stack_end;
@@ -848,7 +831,7 @@ static gboolean
 need_remove_object_for_domain (char *start, MonoDomain *domain)
 {
        if (mono_object_domain (start) == domain) {
-               DEBUG (4, fprintf (gc_debug_file, "Need to cleanup object %p\n", start));
+               SGEN_LOG (4, "Need to cleanup object %p", start);
                binary_protocol_cleanup (start, (gpointer)LOAD_VTABLE (start), safe_object_get_size ((MonoObject*)start));
                return TRUE;
        }
@@ -869,8 +852,7 @@ process_object_for_domain_clearing (char *start, MonoDomain *domain)
                /* The server could already have been zeroed out, so
                   we need to check for that, too. */
                if (server && (!LOAD_VTABLE (server) || mono_object_domain (server) == domain)) {
-                       DEBUG (4, fprintf (gc_debug_file, "Cleaning up remote pointer in %p to object %p\n",
-                                       start, server));
+                       SGEN_LOG (4, "Cleaning up remote pointer in %p to object %p", start, server);
                        ((MonoRealProxy*)start)->unwrapped_server = NULL;
                }
        }
@@ -1060,8 +1042,7 @@ mono_gc_clear_domain (MonoDomain * domain)
                        else
                                los_object_list = bigobj->next;
                        bigobj = bigobj->next;
-                       DEBUG (4, fprintf (gc_debug_file, "Freeing large object %p\n",
-                                       bigobj->data));
+                       SGEN_LOG (4, "Freeing large object %p", bigobj->data);
                        sgen_los_free_object (to_free);
                        continue;
                }
@@ -1112,7 +1093,7 @@ sgen_drain_gray_stack (GrayQueue *queue, int max_objs)
                        GRAY_OBJECT_DEQUEUE (queue, obj);
                        if (!obj)
                                return TRUE;
-                       DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
+                       SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, safe_name (obj));
                        scan_func (obj, queue);
                }
        } else {
@@ -1123,7 +1104,7 @@ sgen_drain_gray_stack (GrayQueue *queue, int max_objs)
                                GRAY_OBJECT_DEQUEUE (queue, obj);
                                if (!obj)
                                        return TRUE;
-                               DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
+                               SGEN_LOG (9, "Precise gray object scan %p (%s)", obj, safe_name (obj));
                                scan_func (obj, queue);
                        }
                } while (max_objs < 0);
@@ -1156,7 +1137,7 @@ pin_objects_from_addresses (GCMemSection *section, void **start, void **end, voi
                addr = *start;
                /* the range check should be reduntant */
                if (addr != last && addr >= start_nursery && addr < end_nursery) {
-                       DEBUG (5, fprintf (gc_debug_file, "Considering pinning addr %p\n", addr));
+                       SGEN_LOG (5, "Considering pinning addr %p", addr);
                        /* multiple pointers to the same object */
                        if (addr >= last_obj && (char*)addr < (char*)last_obj + last_obj_size) {
                                start++;
@@ -1200,9 +1181,9 @@ pin_objects_from_addresses (GCMemSection *section, void **start, void **end, voi
                                if (((MonoObject*)last_obj)->synchronisation == GINT_TO_POINTER (-1)) {
                                        /* Marks the beginning of a nursery fragment, skip */
                                } else {
-                                       DEBUG (8, fprintf (gc_debug_file, "Pinned try match %p (%s), size %zd\n", last_obj, safe_name (last_obj), last_obj_size));
+                                       SGEN_LOG (8, "Pinned try match %p (%s), size %zd", last_obj, safe_name (last_obj), last_obj_size);
                                        if (addr >= search_start && (char*)addr < (char*)last_obj + last_obj_size) {
-                                               DEBUG (4, fprintf (gc_debug_file, "Pinned object %p, vtable %p (%s), count %d\n", search_start, *(void**)search_start, safe_name (search_start), count));
+                                               SGEN_LOG (4, "Pinned object %p, vtable %p (%s), count %d\n", search_start, *(void**)search_start, safe_name (search_start), count);
                                                binary_protocol_pin (search_start, (gpointer)LOAD_VTABLE (search_start), safe_object_get_size (search_start));
                                                if (G_UNLIKELY (MONO_GC_OBJ_PINNED_ENABLED ())) {
                                                        int gen = sgen_ptr_in_nursery (search_start) ? GENERATION_NURSERY : GENERATION_OLD;
@@ -1371,6 +1352,11 @@ static void
 conservatively_pin_objects_from (void **start, void **end, void *start_nursery, void *end_nursery, int pin_type)
 {
        int count = 0;
+
+#ifdef VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE
+       VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE (start, (char*)end - (char*)start);
+#endif
+
        while (start < end) {
                if (*start >= start_nursery && *start < end_nursery) {
                        /*
@@ -1392,18 +1378,20 @@ conservatively_pin_objects_from (void **start, void **end, void *start_nursery,
                         */
                        mword addr = (mword)*start;
                        addr &= ~(ALLOC_ALIGN - 1);
-                       if (addr >= (mword)start_nursery && addr < (mword)end_nursery)
+                       if (addr >= (mword)start_nursery && addr < (mword)end_nursery) {
+                               SGEN_LOG (6, "Pinning address %p from %p", (void*)addr, start);
                                sgen_pin_stage_ptr ((void*)addr);
+                               count++;
+                       }
                        if (G_UNLIKELY (do_pin_stats)) { 
                                if (ptr_in_nursery ((void*)addr))
                                        sgen_pin_stats_register_address ((char*)addr, pin_type);
                        }
-                       DEBUG (6, if (count) fprintf (gc_debug_file, "Pinning address %p from %p\n", (void*)addr, start));
-                       count++;
                }
                start++;
        }
-       DEBUG (7, if (count) fprintf (gc_debug_file, "found %d potential pinned heap pointers\n", count));
+       if (count)
+               SGEN_LOG (7, "found %d potential pinned heap pointers", count);
 }
 
 /*
@@ -1416,10 +1404,10 @@ pin_from_roots (void *start_nursery, void *end_nursery, GrayQueue *queue)
 {
        void **start_root;
        RootRecord *root;
-       DEBUG (2, fprintf (gc_debug_file, "Scanning pinned roots (%d bytes, %d/%d entries)\n", (int)roots_size, roots_hash [ROOT_TYPE_NORMAL].num_entries, roots_hash [ROOT_TYPE_PINNED].num_entries));
+       SGEN_LOG (2, "Scanning pinned roots (%d bytes, %d/%d entries)", (int)roots_size, roots_hash [ROOT_TYPE_NORMAL].num_entries, roots_hash [ROOT_TYPE_PINNED].num_entries);
        /* objects pinned from the API are inside these roots */
        SGEN_HASH_TABLE_FOREACH (&roots_hash [ROOT_TYPE_PINNED], start_root, root) {
-               DEBUG (6, fprintf (gc_debug_file, "Pinned roots %p-%p\n", start_root, root->end_root));
+               SGEN_LOG (6, "Pinned roots %p-%p", start_root, root->end_root);
                conservatively_pin_objects_from (start_root, (void**)root->end_root, start_nursery, end_nursery, PIN_TYPE_OTHER);
        } SGEN_HASH_TABLE_FOREACH_END;
        /* now deal with the thread stacks
@@ -1476,7 +1464,7 @@ precisely_scan_objects_from (CopyOrMarkObjectFunc copy_func, void** start_root,
                while (desc) {
                        if ((desc & 1) && *start_root) {
                                copy_func (start_root, queue);
-                               DEBUG (9, fprintf (gc_debug_file, "Overwrote root at %p with %p\n", start_root, *start_root));
+                               SGEN_LOG (9, "Overwrote root at %p with %p", start_root, *start_root);
                                sgen_drain_gray_stack (queue, -1);
                        }
                        desc >>= 1;
@@ -1494,7 +1482,7 @@ precisely_scan_objects_from (CopyOrMarkObjectFunc copy_func, void** start_root,
                        while (bmap) {
                                if ((bmap & 1) && *objptr) {
                                        copy_func (objptr, queue);
-                                       DEBUG (9, fprintf (gc_debug_file, "Overwrote root at %p with %p\n", objptr, *objptr));
+                                       SGEN_LOG (9, "Overwrote root at %p with %p", objptr, *objptr);
                                        sgen_drain_gray_stack (queue, -1);
                                }
                                bmap >>= 1;
@@ -1558,7 +1546,7 @@ alloc_nursery (void)
 
        if (nursery_section)
                return;
-       DEBUG (2, fprintf (gc_debug_file, "Allocating nursery size: %lu\n", (unsigned long)sgen_nursery_size));
+       SGEN_LOG (2, "Allocating nursery size: %lu", (unsigned long)sgen_nursery_size);
        /* later we will alloc a larger area for the nursery but only activate
         * what we need. The rest will be used as expansion if we have too many pinned
         * objects in the existing nursery.
@@ -1577,7 +1565,7 @@ alloc_nursery (void)
        data = major_collector.alloc_heap (alloc_size, 0, DEFAULT_NURSERY_BITS);
 #endif
        sgen_update_heap_boundaries ((mword)data, (mword)(data + sgen_nursery_size));
-       DEBUG (4, fprintf (gc_debug_file, "Expanding nursery size (%p-%p): %lu, total: %lu\n", data, data + alloc_size, (unsigned long)sgen_nursery_size, (unsigned long)mono_gc_get_heap_size ()));
+       SGEN_LOG (4, "Expanding nursery size (%p-%p): %lu, total: %lu", data, data + alloc_size, (unsigned long)sgen_nursery_size, (unsigned long)mono_gc_get_heap_size ());
        section->data = section->next_data = data;
        section->size = alloc_size;
        section->end_data = data + sgen_nursery_size;
@@ -1625,7 +1613,7 @@ mono_gc_precise_stack_mark_enabled (void)
 FILE *
 mono_gc_get_logfile (void)
 {
-       return sgen_get_logfile ();
+       return gc_debug_file;
 }
 
 static void
@@ -1713,7 +1701,7 @@ report_registered_roots_by_type (int root_type)
        RootRecord *root;
        report.count = 0;
        SGEN_HASH_TABLE_FOREACH (&roots_hash [root_type], start_root, root) {
-               DEBUG (6, fprintf (gc_debug_file, "Precise root scan %p-%p (desc: %p)\n", start_root, root->end_root, (void*)root->root_desc));
+               SGEN_LOG (6, "Precise root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc);
                precisely_report_roots_from (&report, start_root, (void**)root->end_root, root->root_desc);
        } SGEN_HASH_TABLE_FOREACH_END;
        notify_gc_roots (&report);
@@ -1734,7 +1722,7 @@ scan_finalizer_entries (CopyOrMarkObjectFunc copy_func, FinalizeReadyEntry *list
        for (fin = list; fin; fin = fin->next) {
                if (!fin->object)
                        continue;
-               DEBUG (5, fprintf (gc_debug_file, "Scan of fin ready object: %p (%s)\n", fin->object, safe_name (fin->object)));
+               SGEN_LOG (5, "Scan of fin ready object: %p (%s)\n", fin->object, safe_name (fin->object));
                copy_func (&fin->object, queue);
        }
 }
@@ -1784,7 +1772,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
         */
        sgen_drain_gray_stack (queue, -1);
        TV_GETTIME (atv);
-       DEBUG (2, fprintf (gc_debug_file, "%s generation done\n", generation_name (generation)));
+       SGEN_LOG (2, "%s generation done", generation_name (generation));
 
        /*
        Reset bridge data, we might have lingering data from a previous collection if this is a major
@@ -1841,7 +1829,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
        if (generation == GENERATION_OLD)
                sgen_finalize_in_range (copy_func, sgen_get_nursery_start (), sgen_get_nursery_end (), GENERATION_NURSERY, queue);
        /* drain the new stack that might have been created */
-       DEBUG (6, fprintf (gc_debug_file, "Precise scan of gray area post fin\n"));
+       SGEN_LOG (6, "Precise scan of gray area post fin");
        sgen_drain_gray_stack (queue, -1);
 
        /*
@@ -1861,7 +1849,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
        clear_unreachable_ephemerons (copy_func, start_addr, end_addr, queue);
 
        TV_GETTIME (btv);
-       DEBUG (2, fprintf (gc_debug_file, "Finalize queue handling scan for %s generation: %d usecs %d ephemeron roundss\n", generation_name (generation), TV_ELAPSED (atv, btv), ephemeron_rounds));
+       SGEN_LOG (2, "Finalize queue handling scan for %s generation: %d usecs %d ephemeron rounds", generation_name (generation), TV_ELAPSED (atv, btv), ephemeron_rounds);
 
        /*
         * handle disappearing links
@@ -1911,7 +1899,7 @@ scan_from_registered_roots (CopyOrMarkObjectFunc copy_func, char *addr_start, ch
        void **start_root;
        RootRecord *root;
        SGEN_HASH_TABLE_FOREACH (&roots_hash [root_type], start_root, root) {
-               DEBUG (6, fprintf (gc_debug_file, "Precise root scan %p-%p (desc: %p)\n", start_root, root->end_root, (void*)root->root_desc));
+               SGEN_LOG (6, "Precise root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc);
                precisely_scan_objects_from (copy_func, start_root, (void**)root->end_root, addr_start, addr_end, root->root_desc, queue);
        } SGEN_HASH_TABLE_FOREACH_END;
 }
@@ -2221,7 +2209,7 @@ verify_scan_starts (char *start, char *end)
        for (i = 0; i < nursery_section->num_scan_start; ++i) {
                char *addr = nursery_section->scan_starts [i];
                if (addr > start && addr < end)
-                       fprintf (gc_debug_file, "NFC-BAD SCAN START [%d] %p for obj [%p %p]\n", i, addr, start, end);
+                       SGEN_LOG (1, "NFC-BAD SCAN START [%d] %p for obj [%p %p]", i, addr, start, end);
        }
 }
 
@@ -2248,22 +2236,21 @@ verify_nursery (void)
                }
 
                if (object_is_forwarded (cur))
-                       fprintf (gc_debug_file, "FORWARDED OBJ %p\n", cur);
+                       SGEN_LOG (1, "FORWARDED OBJ %p", cur);
                else if (object_is_pinned (cur))
-                       fprintf (gc_debug_file, "PINNED OBJ %p\n", cur);
+                       SGEN_LOG (1, "PINNED OBJ %p", cur);
 
                ss = safe_object_get_size ((MonoObject*)cur);
                size = ALIGN_UP (safe_object_get_size ((MonoObject*)cur));
                verify_scan_starts (cur, cur + size);
                if (do_dump_nursery_content) {
                        if (cur > hole_start)
-                               fprintf (gc_debug_file, "HOLE [%p %p %d]\n", hole_start, cur, (int)(cur - hole_start));
-                       fprintf (gc_debug_file, "OBJ  [%p %p %d %d %s %d]\n", cur, cur + size, (int)size, (int)ss, sgen_safe_name ((MonoObject*)cur), (gpointer)LOAD_VTABLE (cur) == sgen_get_array_fill_vtable ());
+                               SGEN_LOG (1, "HOLE [%p %p %d]", hole_start, cur, (int)(cur - hole_start));
+                       SGEN_LOG (1, "OBJ  [%p %p %d %d %s %d]", cur, cur + size, (int)size, (int)ss, sgen_safe_name ((MonoObject*)cur), (gpointer)LOAD_VTABLE (cur) == sgen_get_array_fill_vtable ());
                }
                cur += size;
                hole_start = cur;
        }
-       fflush (gc_debug_file);
 }
 
 /*
@@ -2293,7 +2280,9 @@ collect_nursery (void)
 
        verify_nursery ();
 
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_collections0++;
+#endif
 
        current_collection_generation = GENERATION_NURSERY;
        if (sgen_collection_is_parallel ())
@@ -2314,7 +2303,7 @@ collect_nursery (void)
        /* FIXME: optimize later to use the higher address where an object can be present */
        nursery_next = MAX (nursery_next, sgen_get_nursery_end ());
 
-       DEBUG (1, fprintf (gc_debug_file, "Start nursery collection %d %p-%p, size: %d\n", stat_minor_gcs, sgen_get_nursery_start (), nursery_next, (int)(nursery_next - sgen_get_nursery_start ())));
+       SGEN_LOG (1, "Start nursery collection %d %p-%p, size: %d", stat_minor_gcs, sgen_get_nursery_start (), nursery_next, (int)(nursery_next - sgen_get_nursery_start ()));
        max_garbage_amount = nursery_next - sgen_get_nursery_start ();
        g_assert (nursery_section->size >= max_garbage_amount);
 
@@ -2360,8 +2349,8 @@ collect_nursery (void)
 
        TV_GETTIME (atv);
        time_minor_pinning += TV_ELAPSED (btv, atv);
-       DEBUG (2, fprintf (gc_debug_file, "Finding pinned pointers: %d in %d usecs\n", sgen_get_pinned_count (), TV_ELAPSED (btv, atv)));
-       DEBUG (4, fprintf (gc_debug_file, "Start scan with %d pinned objects\n", sgen_get_pinned_count ()));
+       SGEN_LOG (2, "Finding pinned pointers: %d in %d usecs", sgen_get_pinned_count (), TV_ELAPSED (btv, atv));
+       SGEN_LOG (4, "Start scan with %d pinned objects", sgen_get_pinned_count ());
 
        if (whole_heap_check_before_collection)
                sgen_check_whole_heap ();
@@ -2386,7 +2375,7 @@ collect_nursery (void)
        /* we don't have complete write barrier yet, so we scan all the old generation sections */
        TV_GETTIME (btv);
        time_minor_scan_remsets += TV_ELAPSED (atv, btv);
-       DEBUG (2, fprintf (gc_debug_file, "Old generation scan: %d usecs\n", TV_ELAPSED (atv, btv)));
+       SGEN_LOG (2, "Old generation scan: %d usecs", TV_ELAPSED (atv, btv));
 
        if (!sgen_collection_is_parallel ())
                sgen_drain_gray_stack (&gray_queue, -1);
@@ -2474,7 +2463,7 @@ collect_nursery (void)
        mono_profiler_gc_event (MONO_GC_EVENT_RECLAIM_END, 0);
        TV_GETTIME (btv);
        time_minor_fragment_creation += TV_ELAPSED (atv, btv);
-       DEBUG (2, fprintf (gc_debug_file, "Fragment creation: %d usecs, %lu bytes available\n", TV_ELAPSED (atv, btv), (unsigned long)fragment_total));
+       SGEN_LOG (2, "Fragment creation: %d usecs, %lu bytes available", TV_ELAPSED (atv, btv), (unsigned long)fragment_total);
 
        if (consistency_check_at_minor_collection)
                sgen_check_major_refs ();
@@ -2490,7 +2479,7 @@ collect_nursery (void)
        /* prepare the pin queue for the next collection */
        sgen_finish_pinning ();
        if (fin_ready_list || critical_fin_list) {
-               DEBUG (4, fprintf (gc_debug_file, "Finalizer-thread wakeup: ready %d\n", num_ready_finalizers));
+               SGEN_LOG (4, "Finalizer-thread wakeup: ready %d", num_ready_finalizers);
                mono_gc_finalize_notify ();
        }
        sgen_pin_stats_reset ();
@@ -2537,7 +2526,9 @@ major_do_collection (const char *reason)
        MONO_GC_BEGIN (GENERATION_OLD);
 
        current_collection_generation = GENERATION_OLD;
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_collections1++;
+#endif
 
        current_object_ops = major_collector.major_ops;
 
@@ -2556,7 +2547,7 @@ major_do_collection (const char *reason)
        sgen_nursery_alloc_prepare_for_major ();
 
        degraded_mode = 0;
-       DEBUG (1, fprintf (gc_debug_file, "Start major collection %d\n", stat_major_gcs));
+       SGEN_LOG (1, "Start major collection %d", stat_major_gcs);
        stat_major_gcs++;
        gc_stats.major_gc_count ++;
 
@@ -2597,7 +2588,7 @@ major_do_collection (const char *reason)
 
        TV_GETTIME (atv);
        sgen_init_pinning ();
-       DEBUG (6, fprintf (gc_debug_file, "Collecting pinned addresses\n"));
+       SGEN_LOG (6, "Collecting pinned addresses");
        pin_from_roots ((void*)lowest_heap_address, (void*)highest_heap_address, WORKERS_DISTRIBUTE_GRAY_QUEUE);
        sgen_optimize_pin_queue (0);
 
@@ -2613,12 +2604,12 @@ major_do_collection (const char *reason)
         * The second, destructive, pass is to reduce the section
         * areas to pointers to the actually pinned objects.
         */
-       DEBUG (6, fprintf (gc_debug_file, "Pinning from sections\n"));
+       SGEN_LOG (6, "Pinning from sections");
        /* first pass for the sections */
        sgen_find_section_pin_queue_start_end (nursery_section);
        major_collector.find_pin_queue_start_ends (WORKERS_DISTRIBUTE_GRAY_QUEUE);
        /* identify possible pointers to the insize of large objects */
-       DEBUG (6, fprintf (gc_debug_file, "Pinning from large objects\n"));
+       SGEN_LOG (6, "Pinning from large objects");
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next) {
                int dummy;
                gboolean profile_roots = mono_profiler_get_events () & MONO_PROFILE_GC_ROOTS;
@@ -2635,7 +2626,7 @@ major_do_collection (const char *reason)
                        GRAY_OBJECT_ENQUEUE (WORKERS_DISTRIBUTE_GRAY_QUEUE, bigobj->data);
                        if (G_UNLIKELY (do_pin_stats))
                                sgen_pin_stats_register_object ((char*) bigobj->data, safe_object_get_size ((MonoObject*) bigobj->data));
-                       DEBUG (6, fprintf (gc_debug_file, "Marked large object %p (%s) size: %lu from roots\n", bigobj->data, safe_name (bigobj->data), (unsigned long)bigobj->size));
+                       SGEN_LOG (6, "Marked large object %p (%s) size: %lu from roots", bigobj->data, safe_name (bigobj->data), (unsigned long)bigobj->size);
                        
                        if (profile_roots)
                                add_profile_gc_root (&report, bigobj->data, MONO_PROFILE_GC_ROOT_PINNING | MONO_PROFILE_GC_ROOT_MISC, 0);
@@ -2650,8 +2641,8 @@ major_do_collection (const char *reason)
 
        TV_GETTIME (btv);
        time_major_pinning += TV_ELAPSED (atv, btv);
-       DEBUG (2, fprintf (gc_debug_file, "Finding pinned pointers: %d in %d usecs\n", sgen_get_pinned_count (), TV_ELAPSED (atv, btv)));
-       DEBUG (4, fprintf (gc_debug_file, "Start scan with %d pinned objects\n", sgen_get_pinned_count ()));
+       SGEN_LOG (2, "Finding pinned pointers: %d in %d usecs", sgen_get_pinned_count (), TV_ELAPSED (atv, btv));
+       SGEN_LOG (4, "Start scan with %d pinned objects", sgen_get_pinned_count ());
 
        major_collector.init_to_space ();
 
@@ -2706,7 +2697,7 @@ major_do_collection (const char *reason)
 
        TV_GETTIME (atv);
        time_major_scan_finalized += TV_ELAPSED (btv, atv);
-       DEBUG (2, fprintf (gc_debug_file, "Root scan: %d usecs\n", TV_ELAPSED (btv, atv)));
+       SGEN_LOG (2, "Root scan: %d usecs", TV_ELAPSED (btv, atv));
 
        TV_GETTIME (btv);
        time_major_scan_big_objects += TV_ELAPSED (atv, btv);
@@ -2808,7 +2799,7 @@ major_do_collection (const char *reason)
        sgen_finish_pinning ();
 
        if (fin_ready_list || critical_fin_list) {
-               DEBUG (4, fprintf (gc_debug_file, "Finalizer-thread wakeup: ready %d\n", num_ready_finalizers));
+               SGEN_LOG (4, "Finalizer-thread wakeup: ready %d", num_ready_finalizers);
                mono_gc_finalize_notify ();
        }
        sgen_pin_stats_reset ();
@@ -2924,12 +2915,12 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
                mono_profiler_gc_event (MONO_GC_EVENT_END, overflow_generation_to_collect);
        }
 
-       DEBUG (2, fprintf (gc_debug_file, "Heap size: %lu, LOS size: %lu\n", (unsigned long)mono_gc_get_heap_size (), (unsigned long)los_memory_usage));
+       SGEN_LOG (2, "Heap size: %lu, LOS size: %lu", (unsigned long)mono_gc_get_heap_size (), (unsigned long)los_memory_usage);
 
        /* this also sets the proper pointers for the next allocation */
        if (generation_to_collect == GENERATION_NURSERY && !sgen_can_alloc_size (requested_size)) {
                /* TypeBuilder and MonoMethod are killing mcs with fragmentation */
-               DEBUG (1, fprintf (gc_debug_file, "nursery collection didn't find enough room for %zd alloc (%d pinned)\n", requested_size, sgen_get_pinned_count ()));
+               SGEN_LOG (1, "nursery collection didn't find enough room for %zd alloc (%d pinned)", requested_size, sgen_get_pinned_count ());
                sgen_dump_pin_queue ();
                degraded_mode = 1;
        }
@@ -3079,7 +3070,7 @@ clear_unreachable_ephemerons (CopyOrMarkObjectFunc copy_func, char *start, char
                if (!object_is_reachable (object, start, end)) {
                        EphemeronLinkNode *tmp = current;
 
-                       DEBUG (5, fprintf (gc_debug_file, "Dead Ephemeron array at %p\n", object));
+                       SGEN_LOG (5, "Dead Ephemeron array at %p", object);
 
                        if (prev)
                                prev->next = current->next;
@@ -3099,7 +3090,7 @@ clear_unreachable_ephemerons (CopyOrMarkObjectFunc copy_func, char *start, char
                /*The array was promoted, add global remsets for key/values left behind in nursery.*/
                was_promoted = was_in_nursery && !ptr_in_nursery (object);
 
-               DEBUG (5, fprintf (gc_debug_file, "Clearing unreachable entries for ephemeron array at %p\n", object));
+               SGEN_LOG (5, "Clearing unreachable entries for ephemeron array at %p", object);
 
                array = (MonoArray*)object;
                cur = mono_array_addr (array, Ephemeron, 0);
@@ -3112,9 +3103,9 @@ clear_unreachable_ephemerons (CopyOrMarkObjectFunc copy_func, char *start, char
                        if (!key || key == tombstone)
                                continue;
 
-                       DEBUG (5, fprintf (gc_debug_file, "[%td] key %p (%s) value %p (%s)\n", cur - mono_array_addr (array, Ephemeron, 0),
+                       SGEN_LOG (5, "[%td] key %p (%s) value %p (%s)", cur - mono_array_addr (array, Ephemeron, 0),
                                key, object_is_reachable (key, start, end) ? "reachable" : "unreachable",
-                               cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable"));
+                               cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable");
 
                        if (!object_is_reachable (key, start, end)) {
                                cur->key = tombstone;
@@ -3124,11 +3115,11 @@ clear_unreachable_ephemerons (CopyOrMarkObjectFunc copy_func, char *start, char
 
                        if (was_promoted) {
                                if (ptr_in_nursery (key)) {/*key was not promoted*/
-                                       DEBUG (5, fprintf (gc_debug_file, "\tAdded remset to key %p\n", key));
+                                       SGEN_LOG (5, "\tAdded remset to key %p", key);
                                        sgen_add_to_global_remset (&cur->key);
                                }
                                if (ptr_in_nursery (cur->value)) {/*value was not promoted*/
-                                       DEBUG (5, fprintf (gc_debug_file, "\tAdded remset to value %p\n", cur->value));
+                                       SGEN_LOG (5, "\tAdded remset to value %p", cur->value);
                                        sgen_add_to_global_remset (&cur->value);
                                }
                        }
@@ -3150,7 +3141,7 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end
 
        for (current = ephemeron_list; current; current = current->next) {
                char *object = current->array;
-               DEBUG (5, fprintf (gc_debug_file, "Ephemeron array at %p\n", object));
+               SGEN_LOG (5, "Ephemeron array at %p", object);
 
                /*
                For now we process all ephemerons during all collections.
@@ -3164,7 +3155,7 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end
 
                /*It has to be alive*/
                if (!object_is_reachable (object, start, end)) {
-                       DEBUG (5, fprintf (gc_debug_file, "\tnot reachable\n"));
+                       SGEN_LOG (5, "\tnot reachable");
                        continue;
                }
 
@@ -3181,9 +3172,9 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end
                        if (!key || key == tombstone)
                                continue;
 
-                       DEBUG (5, fprintf (gc_debug_file, "[%td] key %p (%s) value %p (%s)\n", cur - mono_array_addr (array, Ephemeron, 0),
+                       SGEN_LOG (5, "[%td] key %p (%s) value %p (%s)", cur - mono_array_addr (array, Ephemeron, 0),
                                key, object_is_reachable (key, start, end) ? "reachable" : "unreachable",
-                               cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable"));
+                               cur->value, cur->value && object_is_reachable (cur->value, start, end) ? "reachable" : "unreachable");
 
                        if (object_is_reachable (key, start, end)) {
                                char *value = cur->value;
@@ -3198,7 +3189,7 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end
                }
        }
 
-       DEBUG (5, fprintf (gc_debug_file, "Ephemeron run finished. Is it done %d\n", nothing_marked));
+       SGEN_LOG (5, "Ephemeron run finished. Is it done %d", nothing_marked);
        return nothing_marked;
 }
 
@@ -3247,7 +3238,7 @@ mono_gc_invoke_finalizers (void)
                        num_ready_finalizers--;
                        obj = entry->object;
                        entry->object = NULL;
-                       DEBUG (7, fprintf (gc_debug_file, "Finalizing object %p (%s)\n", obj, safe_name (obj)));
+                       SGEN_LOG (7, "Finalizing object %p (%s)", obj, safe_name (obj));
                }
 
                UNLOCK_GC;
@@ -3308,7 +3299,7 @@ mono_gc_register_root_inner (char *start, size_t size, void *descr, int root_typ
        sgen_hash_table_replace (&roots_hash [root_type], start, &new_root, NULL);
        roots_size += size;
 
-       DEBUG (3, fprintf (gc_debug_file, "Added root for range: %p-%p, descr: %p  (%d/%d bytes)\n", start, new_root.end_root, descr, (int)size, (int)roots_size));
+       SGEN_LOG (3, "Added root for range: %p-%p, descr: %p  (%d/%d bytes)", start, new_root.end_root, descr, (int)size, (int)roots_size);
 
        UNLOCK_GC;
        return TRUE;
@@ -3403,20 +3394,20 @@ scan_thread_data (void *start_nursery, void *end_nursery, gboolean precise, Gray
 
        FOREACH_THREAD (info) {
                if (info->skip) {
-                       DEBUG (3, fprintf (gc_debug_file, "Skipping dead thread %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+                       SGEN_LOG (3, "Skipping dead thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
                        continue;
                }
                if (info->gc_disabled) {
-                       DEBUG (3, fprintf (gc_debug_file, "GC disabled for thread %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+                       SGEN_LOG (3, "GC disabled for thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
                        continue;
                }
 
                if (!info->joined_stw) {
-                       DEBUG (3, fprintf (gc_debug_file, "Skipping thread not seen in STW %p, range: %p-%p, size: %td\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start));
+                       SGEN_LOG (3, "Skipping thread not seen in STW %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
                        continue;
                }
                
-               DEBUG (3, fprintf (gc_debug_file, "Scanning thread %p, range: %p-%p, size: %td, pinned=%d\n", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start, sgen_get_pinned_count ()));
+               SGEN_LOG (3, "Scanning thread %p, range: %p-%p, size: %td, pinned=%d", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start, sgen_get_pinned_count ());
                if (!info->thread_is_dying) {
                        if (gc_callbacks.thread_mark_func && !conservative_stack_mark) {
                                UserCopyOrMarkData data = { NULL, queue };
@@ -3465,7 +3456,7 @@ sgen_thread_register (SgenThreadInfo* info, void *addr)
        g_assert (!mono_native_tls_get_value (thread_info_key));
        mono_native_tls_set_value (thread_info_key, info);
 #else
-       thread_info = info;
+       sgen_thread_info = info;
 #endif
 
 #if !defined(__MACH__)
@@ -3527,7 +3518,7 @@ sgen_thread_register (SgenThreadInfo* info, void *addr)
        if (remset.register_thread)
                remset.register_thread (info);
 
-       DEBUG (3, fprintf (gc_debug_file, "registered thread %p (%p) stack end %p\n", info, (gpointer)mono_thread_info_get_tid (info), info->stack_end));
+       SGEN_LOG (3, "registered thread %p (%p) stack end %p", info, (gpointer)mono_thread_info_get_tid (info), info->stack_end);
 
        if (gc_callbacks.thread_attach_func)
                info->runtime_data = gc_callbacks.thread_attach_func ();
@@ -3588,7 +3579,7 @@ sgen_thread_unregister (SgenThreadInfo *p)
 #endif
 
        binary_protocol_thread_unregister ((gpointer)mono_thread_info_get_tid (p));
-       DEBUG (3, fprintf (gc_debug_file, "unregister thread %p (%p)\n", p, (gpointer)mono_thread_info_get_tid (p)));
+       SGEN_LOG (3, "unregister thread %p (%p)", p, (gpointer)mono_thread_info_get_tid (p));
 
        if (gc_callbacks.thread_detach_func) {
                gc_callbacks.thread_detach_func (p->runtime_data);
@@ -3687,7 +3678,7 @@ mono_gc_wbarrier_set_field (MonoObject *obj, gpointer field_ptr, MonoObject* val
                *(void**)field_ptr = value;
                return;
        }
-       DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", field_ptr));
+       SGEN_LOG (8, "Adding remset at %p", field_ptr);
        if (value)
                binary_protocol_wbarrier (field_ptr, value, value->vtable);
 
@@ -3702,7 +3693,7 @@ mono_gc_wbarrier_set_arrayref (MonoArray *arr, gpointer slot_ptr, MonoObject* va
                *(void**)slot_ptr = value;
                return;
        }
-       DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", slot_ptr));
+       SGEN_LOG (8, "Adding remset at %p", slot_ptr);
        if (value)
                binary_protocol_wbarrier (slot_ptr, value, value->vtable);
 
@@ -3799,11 +3790,11 @@ mono_gc_wbarrier_generic_nostore (gpointer ptr)
                binary_protocol_wbarrier (ptr, *(gpointer*)ptr, (gpointer)LOAD_VTABLE (*(gpointer*)ptr));
 
        if (ptr_in_nursery (ptr) || ptr_on_stack (ptr) || !ptr_in_nursery (*(gpointer*)ptr)) {
-               DEBUG (8, fprintf (gc_debug_file, "Skipping remset at %p\n", ptr));
+               SGEN_LOG (8, "Skipping remset at %p", ptr);
                return;
        }
 
-       DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p\n", ptr));
+       SGEN_LOG (8, "Adding remset at %p", ptr);
 
        remset.wbarrier_generic_nostore (ptr);
 }
@@ -3811,7 +3802,7 @@ mono_gc_wbarrier_generic_nostore (gpointer ptr)
 void
 mono_gc_wbarrier_generic_store (gpointer ptr, MonoObject* value)
 {
-       DEBUG (8, fprintf (gc_debug_file, "Wbarrier store at %p to %p (%s)\n", ptr, value, value ? safe_name (value) : "null"));
+       SGEN_LOG (8, "Wbarrier store at %p to %p (%s)", ptr, value, value ? safe_name (value) : "null");
        *(void**)ptr = value;
        if (ptr_in_nursery (value))
                mono_gc_wbarrier_generic_nostore (ptr);
@@ -3859,7 +3850,7 @@ mono_gc_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass *
        HEAVY_STAT (++stat_wbarrier_value_copy);
        g_assert (klass->valuetype);
 
-       DEBUG (8, fprintf (gc_debug_file, "Adding value remset at %p, count %d, descr %p for class %s (%p)\n", dest, count, klass->gc_descr, klass->name, klass));
+       SGEN_LOG (8, "Adding value remset at %p, count %d, descr %p for class %s (%p)", dest, count, klass->gc_descr, klass->name, klass);
 
        if (ptr_in_nursery (dest) || ptr_on_stack (dest) || !SGEN_CLASS_HAS_REFERENCES (klass)) {
                size_t element_size = mono_class_value_size (klass, NULL);
@@ -4132,7 +4123,7 @@ mono_gc_ephemeron_array_add (MonoObject *obj)
        node->next = ephemeron_list;
        ephemeron_list = node;
 
-       DEBUG (5, fprintf (gc_debug_file, "Registered ephemeron array %p\n", obj));
+       SGEN_LOG (5, "Registered ephemeron array %p", obj);
 
        UNLOCK_GC;
        return TRUE;
@@ -4459,7 +4450,7 @@ mono_gc_base_init (void)
                        fprintf (stderr, "  max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
                        fprintf (stderr, "  soft-heap-limit=n (where N is an integer, possibly with a k, m or a g suffix)\n");
                        fprintf (stderr, "  nursery-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
-                       fprintf (stderr, "  major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-par' or `copying')\n");
+                       fprintf (stderr, "  major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-par', 'marksweep-fixed', 'marksweep-fixed-par' or `copying')\n");
                        fprintf (stderr, "  minor=COLLECTOR (where COLLECTOR is `simple' or `split')\n");
                        fprintf (stderr, "  wbarrier=WBARRIER (where WBARRIER is `remset' or `cardtable')\n");
                        fprintf (stderr, "  stack-mark=MARK-METHOD (where MARK-METHOD is 'precise' or 'conservative')\n");
@@ -4909,25 +4900,6 @@ mono_gc_is_disabled (void)
        return FALSE;
 }
 
-void
-sgen_debug_printf (int level, const char *format, ...)
-{
-       va_list ap;
-
-       if (level > gc_debug_level)
-               return;
-
-       va_start (ap, format);
-       vfprintf (gc_debug_file, format, ap);
-       va_end (ap);
-}
-
-FILE*
-sgen_get_logfile (void)
-{
-       return gc_debug_file;
-}
-
 #ifdef HOST_WIN32
 BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved)
 {
index 0a946d0b2afdadef834986954894056a70e77f0d..7af57d698660730e9d9b4c2a7730a22fc9758239 100644 (file)
@@ -1,26 +1,23 @@
 /*
+ * sgen-gc.c: Simple generational GC.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #ifndef __MONO_SGENGC_H__
 #define __MONO_SGENGC_H__
@@ -41,6 +38,7 @@ typedef struct _SgenThreadInfo SgenThreadInfo;
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/dtrace.h>
+#include <mono/utils/mono-logger-internal.h>
 #include <mono/io-layer/mono-mutex.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/object-internals.h>
@@ -242,7 +240,27 @@ extern long long stat_objects_copied_major;
 #define HEAVY_STAT(x)
 #endif
 
-#define DEBUG(level,a) do {if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { a; fflush (gc_debug_file); } } while (0)
+#define SGEN_ASSERT(level, a, ...) do {        \
+       if (G_UNLIKELY ((level) <= SGEN_MAX_ASSERT_LEVEL && !(a))) {    \
+               g_error (__VA_ARGS__);  \
+} } while (0)
+
+
+#define SGEN_LOG(level, format, ...) do {      \
+       if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {        \
+               mono_gc_printf (gc_debug_file, format, ##__VA_ARGS__);  \
+} } while (0)
+
+#define SGEN_COND_LOG(level, cond, format, ...) do {   \
+       if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {        \
+               if (cond)       \
+                       mono_gc_printf (gc_debug_file, format, ##__VA_ARGS__);  \
+} } while (0)
+
+#define SGEN_LOG_DO(level, fun) do {   \
+       if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {        \
+               fun;    \
+} } while (0)
 
 extern int gc_debug_level;
 extern FILE* gc_debug_file;
@@ -501,9 +519,6 @@ void sgen_free_internal_dynamic (void *addr, size_t size, int type) MONO_INTERNA
 void* sgen_alloc_pinned (SgenPinnedAllocator *allocator, size_t size) MONO_INTERNAL;
 void sgen_free_pinned (SgenPinnedAllocator *allocator, void *addr, size_t size) MONO_INTERNAL;
 
-
-void sgen_debug_printf (int level, const char *format, ...) MONO_INTERNAL;
-
 gboolean sgen_parse_environment_string_extract_number (const char *str, glong *out) MONO_INTERNAL;
 
 void sgen_pinned_scan_objects (SgenPinnedAllocator *alc, IterateObjectCallbackFunc callback, void *callback_data) MONO_INTERNAL;
@@ -591,8 +606,8 @@ sgen_nursery_is_to_space (char *object)
        int byte = idx / 8;
        int bit = idx & 0x7;
 
-       DEBUG (4, g_assert (sgen_ptr_in_nursery (object)));
-       DEBUG (4, g_assert (byte < sgen_space_bitmap_size));
+       SGEN_ASSERT (4, sgen_ptr_in_nursery (object), "object %p is not in nursery [%p - %p]", object, sgen_get_nursery_start (), sgen_get_nursery_end ());
+       SGEN_ASSERT (4, byte < sgen_space_bitmap_size, "byte index %d out of range", byte, sgen_space_bitmap_size);
 
        return (sgen_space_bitmap [byte] & (1 << bit)) != 0;
 }
@@ -683,7 +698,7 @@ struct _SgenMajorCollector {
        void (*start_major_collection) (void);
        void (*finish_major_collection) (void);
        void (*have_computed_minor_collection_allowance) (void);
-       gboolean (*ptr_is_in_non_pinned_space) (char *ptr);
+       gboolean (*ptr_is_in_non_pinned_space) (char *ptr, char **start);
        gboolean (*obj_is_from_pinned_alloc) (char *obj);
        void (*report_pinned_memory_usage) (void);
        int (*get_num_major_sections) (void);
@@ -892,7 +907,6 @@ void sgen_los_iterate_objects (IterateObjectCallbackFunc cb, void *user_data) MO
 void sgen_los_iterate_live_block_ranges (sgen_cardtable_block_callback callback) MONO_INTERNAL;
 void sgen_los_scan_card_table (SgenGrayQueue *queue) MONO_INTERNAL;
 void sgen_major_collector_scan_card_table (SgenGrayQueue *queue) MONO_INTERNAL;
-FILE *sgen_get_logfile (void) MONO_INTERNAL;
 gboolean sgen_los_is_valid_object (char *object) MONO_INTERNAL;
 gboolean mono_sgen_los_describe_pointer (char *ptr) MONO_INTERNAL;
 
@@ -923,7 +937,7 @@ char* sgen_par_alloc_for_promotion (char *obj, size_t objsize, gboolean has_refe
 extern MonoNativeTlsKey thread_info_key;
 
 #ifdef HAVE_KW_THREAD
-extern __thread SgenThreadInfo *thread_info;
+extern __thread SgenThreadInfo *sgen_thread_info;
 extern __thread gpointer *store_remset_buffer;
 extern __thread long store_remset_buffer_index;
 extern __thread char *stack_end;
@@ -935,7 +949,7 @@ extern __thread long *store_remset_buffer_index_addr;
 #define REMEMBERED_SET remembered_set
 #define STORE_REMSET_BUFFER    store_remset_buffer
 #define STORE_REMSET_BUFFER_INDEX      store_remset_buffer_index
-#define IN_CRITICAL_REGION thread_info->in_critical_region
+#define IN_CRITICAL_REGION sgen_thread_info->in_critical_region
 #else
 #define TLAB_ACCESS_INIT       SgenThreadInfo *__thread_info__ = mono_native_tls_get_value (thread_info_key)
 #define REMEMBERED_SET (__thread_info__->remset)
@@ -947,7 +961,7 @@ extern __thread long *store_remset_buffer_index_addr;
 #ifndef DISABLE_CRITICAL_REGION
 
 #ifdef HAVE_KW_THREAD
-#define IN_CRITICAL_REGION thread_info->in_critical_region
+#define IN_CRITICAL_REGION sgen_thread_info->in_critical_region
 #else
 #define IN_CRITICAL_REGION (__thread_info__->in_critical_region)
 #endif
index b1459bca2aa52e0b791ba1cc98b7f6a05ba8184a..cb89c3bfda19c58ef3ec495f30ef8666d0ff785e 100644 (file)
@@ -1,25 +1,22 @@
 /*
+ * sgen-gray.c: Gray queue management.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include "config.h"
 #ifdef HAVE_SGEN_GC
@@ -68,14 +65,14 @@ sgen_gray_object_free_queue_section (GrayQueueSection *section)
 void
 sgen_gray_object_enqueue (SgenGrayQueue *queue, char *obj)
 {
-       DEBUG (9, g_assert (obj));
+       SGEN_ASSERT (9, obj, "enqueueing a null object");
        //sgen_check_objref (obj);
        if (G_UNLIKELY (!queue->first || queue->first->end == SGEN_GRAY_QUEUE_SECTION_SIZE))
                sgen_gray_object_alloc_queue_section (queue);
-       DEBUG (9, g_assert (queue->first && queue->first->end < SGEN_GRAY_QUEUE_SECTION_SIZE));
+       SGEN_ASSERT (9, queue->first->end < SGEN_GRAY_QUEUE_SECTION_SIZE, "gray queue %p overflow, first %p, end %d", queue, queue->first, queue->first->end);
        queue->first->objects [queue->first->end++] = obj;
 
-       DEBUG (9, ++queue->balance);
+       SGEN_LOG_DO (9, ++queue->balance);
 }
 
 char*
@@ -86,7 +83,7 @@ sgen_gray_object_dequeue (SgenGrayQueue *queue)
        if (sgen_gray_object_queue_is_empty (queue))
                return NULL;
 
-       DEBUG (9, g_assert (queue->first->end));
+       SGEN_ASSERT (9, queue->first->end, "gray queue %p underflow, first %p, end %d", queue, queue->first, queue->first->end);
 
        obj = queue->first->objects [--queue->first->end];
 
@@ -97,7 +94,7 @@ sgen_gray_object_dequeue (SgenGrayQueue *queue)
                queue->free_list = section;
        }
 
-       DEBUG (9, --queue->balance);
+       SGEN_LOG_DO (9, --queue->balance);
 
        return obj;
 }
@@ -132,7 +129,7 @@ sgen_gray_object_queue_init (SgenGrayQueue *queue)
        int i;
 
        g_assert (sgen_gray_object_queue_is_empty (queue));
-       DEBUG (9, g_assert (queue->balance == 0));
+       SGEN_ASSERT (9, queue->balance == 0, "unbalanced queue on init %d", queue->balance);
 
        /* Free the extra sections allocated during the last collection */
        i = 0;
index f794d0b2912dc9b91d9551d19513d0cb97209ad5..157009ca2de5c6192a4c905b82401f20f6725abf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * sgen-los.c: Simple generational GC.
+ * sgen-los.c: Large objects space.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
  * Copyright (c) 2000-2004 by Hewlett-Packard Company.  All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -308,7 +292,7 @@ sgen_los_free_object (LOSObject *obj)
 {
 #ifndef LOS_DUMMY
        size_t size = obj->size;
-       DEBUG (4, fprintf (gc_debug_file, "Freed large object %p, size %lu\n", obj->data, (unsigned long)obj->size));
+       SGEN_LOG (4, "Freed large object %p, size %lu", obj->data, (unsigned long)obj->size);
        binary_protocol_empty (obj->data, obj->size);
 
        los_memory_usage -= size;
@@ -394,7 +378,7 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t size)
        los_object_list = obj;
        los_memory_usage += size;
        los_num_objects++;
-       DEBUG (4, fprintf (gc_debug_file, "Allocated large object %p, vtable: %p (%s), size: %zd\n", obj->data, vtable, vtable->klass->name, size));
+       SGEN_LOG (4, "Allocated large object %p, vtable: %p (%s), size: %zd", obj->data, vtable, vtable->klass->name, size);
        binary_protocol_alloc (obj->data, vtable, size);
 
 #ifdef LOS_CONSISTENCY_CHECK
@@ -509,22 +493,23 @@ mono_sgen_los_describe_pointer (char *ptr)
 
        for (obj = los_object_list; obj; obj = obj->next) {
                MonoVTable *vtable;
+               const char *los_kind;
                if (obj->data > ptr || obj->data + obj->size <= ptr)
                        continue;
 
                if (obj->size > LOS_SECTION_OBJECT_LIMIT)
-                       fprintf (gc_debug_file, "huge-los-ptr ");
+                       los_kind = "huge-los-ptr ";
                else
-                       fprintf (gc_debug_file, "los-ptr ");
+                       los_kind = "los-ptr ";
 
                vtable = (MonoVTable*)SGEN_LOAD_VTABLE (obj->data);
 
                if (obj->data == ptr)
-                       fprintf (gc_debug_file, "(object %s.%s size %d)", 
-                                        vtable->klass->name_space, vtable->klass->name, (int)obj->size);
+                       SGEN_LOG (1, "%s (object %s.%s size %d)", 
+                                        los_kind, vtable->klass->name_space, vtable->klass->name, (int)obj->size);
                else
-                       fprintf (gc_debug_file, "(interior-ptr offset %td of %p (%s.%s) size %d)",
-                                        ptr - obj->data, obj->data,
+                       SGEN_LOG (1, "%s (interior-ptr offset %td of %p (%s.%s) size %d)",
+                                        los_kind, ptr - obj->data, obj->data,
                                         vtable->klass->name_space, vtable->klass->name, (int)obj->size);
 
                return TRUE;
index 0575743f31731c8be0b243a7afc9d8c87bc129b3..e912be704c21dd8baa4635b845f33b9c635c07af 100644 (file)
@@ -1,25 +1,22 @@
 /*
+ * sgen-major-copy-object.h: Object copying in the major collectors.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #define collector_pin_object(obj, queue) do { \
@@ -31,8 +28,8 @@
        }       \
 } while (0)
 
-#define collector_serial_alloc_for_promotion sgen_minor_collector.alloc_for_promotion
-#define collector_parallel_alloc_for_promotion sgen_minor_collector.par_alloc_for_promotion
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION sgen_minor_collector.alloc_for_promotion
+#define COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION sgen_minor_collector.par_alloc_for_promotion
 
 
 #include "sgen-copy-object.h"
index e52c26903c37a6fe422c6a98cc44ab38ef7ffbd5..22dafc4e03b025f187cc0bbd6e4b6dd2673b2edb 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * sgen-major-copying.c: Simple generational GC.
+ * sgen-major-copying.c: The copying major collector.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
  *
  * Copyright 2005-2010 Novell, Inc (http://www.novell.com)
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
  * Thread start/stop adapted from Boehm's GC:
  * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
  * Copyright (c) 2000-2004 by Hewlett-Packard Company.  All rights reserved.
  *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
  *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
  *
- *
- * Copyright 2001-2003 Ximian, Inc
- * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -59,6 +43,8 @@
 #include "metadata/profiler-private.h"
 #include "metadata/sgen-memory-governor.h"
 
+#ifndef DISABLE_SGEN_MAJOR_COPYING
+
 #define MAJOR_SECTION_SIZE             SGEN_PINNED_CHUNK_SIZE
 #define BLOCK_FOR_OBJECT(o)            SGEN_PINNED_CHUNK_FOR_PTR ((o))
 #define MAJOR_SECTION_FOR_OBJECT(o)    ((GCMemSection*)BLOCK_FOR_OBJECT ((o)))
@@ -135,7 +121,7 @@ alloc_major_section (void)
        section->size = MAJOR_SECTION_SIZE - SGEN_SIZEOF_GC_MEM_SECTION;
        section->end_data = section->data + section->size;
        sgen_update_heap_boundaries ((mword)section->data, (mword)section->end_data);
-       DEBUG (3, fprintf (gc_debug_file, "New major heap section: (%p-%p), total: %lld\n", section->data, section->end_data, (long long int)mono_gc_get_heap_size ()));
+       SGEN_LOG (3, "New major heap section: (%p-%p), total: %lld", section->data, section->end_data, (long long int)mono_gc_get_heap_size ());
        scan_starts = (section->size + SGEN_SCAN_START_SIZE - 1) / SGEN_SCAN_START_SIZE;
        section->scan_starts = sgen_alloc_internal_dynamic (sizeof (char*) * scan_starts, INTERNAL_MEM_SCAN_STARTS, TRUE);
        section->num_scan_start = scan_starts;
@@ -154,7 +140,7 @@ alloc_major_section (void)
 static void
 free_major_section (GCMemSection *section)
 {
-       DEBUG (3, fprintf (gc_debug_file, "Freed major section %p (%p-%p)\n", section, section->data, section->end_data));
+       SGEN_LOG (3, "Freed major section %p (%p-%p)", section, section->data, section->end_data);
        sgen_free_internal_dynamic (section->scan_starts,
                        (section->size + SGEN_SCAN_START_SIZE - 1) / SGEN_SCAN_START_SIZE * sizeof (char*), INTERNAL_MEM_SCAN_STARTS);
        sgen_free_os_memory (section, MAJOR_SECTION_SIZE, SGEN_ALLOC_HEAP);
@@ -199,10 +185,10 @@ major_alloc_object (int size, gboolean has_references)
        if (dest + size > to_space_top) {
                to_space_expand ();
                (dest) = to_space_bumper;
-               DEBUG (8, g_assert (dest + size <= to_space_top));
+               SGEN_ASSERT (8, dest + size <= to_space_top, "space allocation overflow dest %p size %d to-space-top %p", dest, size, to_space_top);
        }
        to_space_bumper += size;
-       DEBUG (8, g_assert (to_space_bumper <= to_space_top));
+       SGEN_ASSERT (8, to_space_bumper <= to_space_top, "to-space-bumper %p overflow to-space-top %p", to_space_bumper, to_space_top);
        to_space_section->scan_starts [(dest - (char*)to_space_section->data)/SGEN_SCAN_START_SIZE] = dest;
        return dest;
 }
@@ -275,7 +261,7 @@ major_alloc_degraded (MonoVTable *vtable, size_t size)
                sgen_register_major_sections_alloced (1);
        }
        section->next_data += size;
-       DEBUG (3, fprintf (gc_debug_file, "Allocated (degraded) object %p, vtable: %p (%s), size: %zd in section %p\n", p, vtable, vtable->klass->name, size, section));
+       SGEN_LOG (3, "Allocated (degraded) object %p, vtable: %p (%s), size: %zd in section %p", p, vtable, vtable->klass->name, size, section);
        *p = vtable;
        return p;
 }
@@ -295,11 +281,11 @@ major_copy_or_mark_object (void **obj_slot, SgenGrayQueue *queue)
        char *obj = *obj_slot;
        mword objsize;
 
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
 
        HEAVY_STAT (++stat_copy_object_called_major);
 
-       DEBUG (9, fprintf (gc_debug_file, "Precise copy of %p from %p", obj, obj_slot));
+       SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
 
        /*
         * obj must belong to one of:
@@ -327,23 +313,26 @@ major_copy_or_mark_object (void **obj_slot, SgenGrayQueue *queue)
         */
 
        if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
-               DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
-               DEBUG (9, fprintf (gc_debug_file, " (already forwarded to %p)\n", forwarded));
+               SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr,  "forwarded object %p has no gc descriptor", forwarded);
+               SGEN_LOG (9, " (already forwarded to %p)", forwarded);
                HEAVY_STAT (++stat_major_copy_object_failed_forwarded);
                *obj_slot = forwarded;
                return;
        }
        if (SGEN_OBJECT_IS_PINNED (obj)) {
-               DEBUG (9, g_assert (((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr));
-               DEBUG (9, fprintf (gc_debug_file, " (pinned, no change)\n"));
+               SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+               SGEN_LOG (9, " (pinned, no change)");
                HEAVY_STAT (++stat_major_copy_object_failed_pinned);
                return;
        }
 
        if (ptr_in_nursery (obj)) {
                /* A To Space object is already on its final destination for the current collection. */
-               if (sgen_nursery_is_to_space (obj))
+               if (sgen_nursery_is_to_space (obj)) {
+                       SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+                       SGEN_LOG (9, " (tospace, no change)");
                        return;
+               }
                goto copy;
        }
 
@@ -368,7 +357,7 @@ major_copy_or_mark_object (void **obj_slot, SgenGrayQueue *queue)
        if (G_UNLIKELY (objsize > SGEN_MAX_SMALL_OBJ_SIZE || obj_is_from_pinned_alloc (obj))) {
                if (SGEN_OBJECT_IS_PINNED (obj))
                        return;
-               DEBUG (9, fprintf (gc_debug_file, " (marked LOS/Pinned %p (%s), size: %td)\n", obj, sgen_safe_name (obj), objsize));
+               SGEN_LOG (9, " (marked LOS/Pinned %p (%s), size: %td)", obj, sgen_safe_name (obj), objsize);
                binary_protocol_pin (obj, (gpointer)SGEN_LOAD_VTABLE (obj), sgen_safe_object_get_size ((MonoObject*)obj));
                SGEN_PIN_OBJECT (obj);
                GRAY_OBJECT_ENQUEUE (queue, obj);
@@ -382,8 +371,8 @@ major_copy_or_mark_object (void **obj_slot, SgenGrayQueue *queue)
         * not (4).
         */
        if (MAJOR_OBJ_IS_IN_TO_SPACE (obj)) {
-               DEBUG (9, g_assert (objsize <= SGEN_MAX_SMALL_OBJ_SIZE));
-               DEBUG (9, fprintf (gc_debug_file, " (already copied)\n"));
+               SGEN_ASSERT (9, objsize <= SGEN_MAX_SMALL_OBJ_SIZE, "object %p in to space is too big, size %d", objsize);
+               SGEN_LOG (9, " (already copied)");
                HEAVY_STAT (++stat_major_copy_object_failed_to_space);
                return;
        }
@@ -442,9 +431,9 @@ sweep_pinned_objects_callback (char *ptr, size_t size, void *data)
 {
        if (SGEN_OBJECT_IS_PINNED (ptr)) {
                SGEN_UNPIN_OBJECT (ptr);
-               DEBUG (6, fprintf (gc_debug_file, "Unmarked pinned object %p (%s)\n", ptr, sgen_safe_name (ptr)));
+               SGEN_LOG (6, "Unmarked pinned object %p (%s)", ptr, sgen_safe_name (ptr));
        } else {
-               DEBUG (6, fprintf (gc_debug_file, "Freeing unmarked pinned object %p (%s)\n", ptr, sgen_safe_name (ptr)));
+               SGEN_LOG (6, "Freeing unmarked pinned object %p (%s)", ptr, sgen_safe_name (ptr));
                free_pinned_object (ptr, size);
        }
 }
@@ -481,7 +470,7 @@ pin_pinned_object_callback (void *addr, size_t slot_size, SgenGrayQueue *queue)
                sgen_pin_stats_register_object ((char*) addr, sgen_safe_object_get_size ((MonoObject*) addr));
        SGEN_PIN_OBJECT (addr);
        GRAY_OBJECT_ENQUEUE (queue, addr);
-       DEBUG (6, fprintf (gc_debug_file, "Marked pinned object %p (%s) from roots\n", addr, sgen_safe_name (addr)));
+       SGEN_LOG (6, "Marked pinned object %p (%s) from roots", addr, sgen_safe_name (addr));
 }
 
 static void
@@ -547,7 +536,7 @@ major_sweep (void)
                        free_major_section (to_free);
                        continue;
                } else {
-                       DEBUG (6, fprintf (gc_debug_file, "Section %p has still pinned objects (%d)\n", section, section->pin_queue_num_entries));
+                       SGEN_LOG (6, "Section %p has still pinned objects (%d)", section, section->pin_queue_num_entries);
                        build_section_fragments (section);
                }
                prev_section = section;
@@ -630,9 +619,12 @@ major_finish_major_collection (void)
 }
 
 static gboolean
-major_ptr_is_in_non_pinned_space (char *ptr)
+major_ptr_is_in_non_pinned_space (char *ptr, char **start)
 {
        GCMemSection *section;
+
+       // FIXME:
+       *start = NULL;
        for (section = section_list; section;) {
                if (ptr >= section->data && ptr < section->data + section->size)
                        return TRUE;
@@ -699,4 +691,15 @@ sgen_copying_init (SgenMajorCollector *collector)
        collector->major_ops.scan_object = major_scan_object;
 }
 
+#else /* DISABLE_SGEN_MAJOR_COPYING */
+
+void
+sgen_copying_init (SgenMajorCollector *collector)
+{
+       fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_copying.\n");
+       exit (1);
+}
+
+#endif /* DISABLE_SGEN_MAJOR_COPYING */
+
 #endif
index 9266a6cae241dfd8e1de79f08d200937dd8b9f14..bea59c52a1b83bb3816fcbac49d24fcea8af3fc0 100644 (file)
@@ -1,26 +1,24 @@
 /*
+ * sgen-major-scan-object.h: Object scanning in the major collectors.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+
 extern long long stat_scan_object_called_major;
 
 #ifdef FIXED_HEAP
@@ -37,7 +35,7 @@ extern long long stat_scan_object_called_major;
                        PREFETCH_DYNAMIC_HEAP (__old);                  \
                        major_copy_or_mark_object ((ptr), queue);       \
                        __copy = *(ptr);                                \
-                       DEBUG (9, if (__old != __copy) sgen_debug_printf (9, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old)); \
+                       SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
                        if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
                                sgen_add_to_global_remset ((ptr));      \
                }                                                       \
index b023a6124dd5dcc740605a03f44f3df4462972a7..1d93023b514d04f08110168ae8fba5e457eb2c7f 100644 (file)
@@ -1,4 +1,25 @@
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MARKSWEEP_FIXED_PAR
+
 #define SGEN_PARALLEL_MARK
 #define FIXED_HEAP
 
 #include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_fixed_par_init (SgenMajorCollector *collector)
+{
+       fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_fixed_par.\n");
+       exit (1);
+}      
+
+#endif
+
+#endif
index 875a18a4c295c2be19a3ae3f29cdbf9fe15b7a28..732d29c511cf779c10ba9d4b46739028d71a2235 100644 (file)
@@ -1,3 +1,24 @@
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MARKSWEEP_FIXED
+
 #define FIXED_HEAP
 
 #include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_fixed_init (SgenMajorCollector *collector)
+{
+       fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_fixed.\n");
+       exit (1);
+}      
+
+#endif
+
+#endif
index e728ee34dfac6bc223af9f2f13ba2d9894b2e890..5bc7805c870382161815486b01628957d6d2b253 100644 (file)
@@ -1,3 +1,24 @@
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#ifndef DISABLE_SGEN_MAJOR_MARKSWEEP_PAR
+
 #define SGEN_PARALLEL_MARK
 
 #include "sgen-marksweep.c"
+
+#else
+
+#include "metadata/sgen-gc.h"
+
+void
+sgen_marksweep_par_init (SgenMajorCollector *collector)
+{
+       fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_marksweep_par.\n");
+       exit (1);
+}      
+
+#endif /* DISABLE_SGEN_MAJOR_MARKSWEEP_PAR */
+
+#endif
index d861f22f2528d2856afed04dbf608787f66d5059..6f440a87a6fe4b2fe6075e3f111eec18bbe851a7 100644 (file)
@@ -1,29 +1,24 @@
 /*
- * sgen-marksweep.c: Simple generational GC.
+ * sgen-marksweep.c: The Mark & Sweep major collector.
  *
  * Author:
  *     Mark Probst <mark.probst@gmail.com>
  *
  * Copyright 2009-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -88,6 +83,7 @@ struct _MSBlockInfo {
        unsigned int has_references : 1;
        unsigned int has_pinned : 1;    /* means cannot evacuate */
        unsigned int is_to_space : 1;
+       unsigned int swept : 1;
 #ifdef FIXED_HEAP
        unsigned int used : 1;
        unsigned int zeroed : 1;
@@ -113,6 +109,7 @@ static MSBlockInfo *block_infos;
 #endif
 
 #define MS_BLOCK_OBJ(b,i)              ((b)->block + MS_BLOCK_SKIP + (b)->obj_size * (i))
+#define MS_BLOCK_OBJ_FOR_SIZE(b,i,obj_size)            ((b)->block + MS_BLOCK_SKIP + (obj_size) * (i))
 #define MS_BLOCK_DATA_FOR_OBJ(o)       ((char*)((mword)(o) & ~(mword)(MS_BLOCK_SIZE - 1)))
 
 #ifdef FIXED_HEAP
@@ -185,6 +182,7 @@ static gboolean *evacuate_block_obj_sizes;
 static float evacuation_threshold = 0.666;
 
 static gboolean concurrent_sweep = FALSE;
+static gboolean lazy_sweep = TRUE;
 static gboolean have_swept;
 
 /* all allocated blocks in the system */
@@ -216,6 +214,7 @@ static MonoNativeTlsKey workers_free_block_lists_key;
 
 static long long stat_major_blocks_alloced = 0;
 static long long stat_major_blocks_freed = 0;
+static long long stat_major_blocks_lazy_swept = 0;
 static long long stat_major_objects_evacuated = 0;
 static long long stat_time_wait_for_sweep = 0;
 
@@ -224,6 +223,9 @@ static MonoNativeThreadId ms_sweep_thread;
 static MonoSemType ms_sweep_cmd_semaphore;
 static MonoSemType ms_sweep_done_semaphore;
 
+static void
+sweep_block (MSBlockInfo *block);
+
 static void
 ms_signal_sweep_command (void)
 {
@@ -273,7 +275,7 @@ static int
 ms_find_block_obj_size_index (int size)
 {
        int i;
-       DEBUG (9, g_assert (size <= SGEN_MAX_SMALL_OBJ_SIZE));
+       SGEN_ASSERT (9, size <= SGEN_MAX_SMALL_OBJ_SIZE, "size %d is bigger than max small object size %d", size, SGEN_MAX_SMALL_OBJ_SIZE);
        for (i = 0; i < num_block_obj_sizes; ++i)
                if (block_obj_sizes [i] >= size)
                        return i;
@@ -458,7 +460,8 @@ check_block_free_list (MSBlockInfo *block, int size, gboolean pinned)
 
                /* blocks in the free lists must have at least
                   one free slot */
-               g_assert (block->free_list);
+               if (block->swept)
+                       g_assert (block->free_list);
 
 #ifdef FIXED_HEAP
                /* the block must not be in the empty_blocks list */
@@ -518,8 +521,10 @@ consistency_check (void)
                g_assert (num_free == 0);
 
                /* check all mark words are zero */
-               for (i = 0; i < MS_NUM_MARK_WORDS; ++i)
-                       g_assert (block->mark_words [i] == 0);
+               if (block->swept) {
+                       for (i = 0; i < MS_NUM_MARK_WORDS; ++i)
+                               g_assert (block->mark_words [i] == 0);
+               }
        } END_FOREACH_BLOCK;
 
        /* check free blocks */
@@ -558,7 +563,7 @@ ms_alloc_block (int size_index, gboolean pinned, gboolean has_references)
        info = sgen_alloc_internal (INTERNAL_MEM_MS_BLOCK_INFO);
 #endif
 
-       DEBUG (9, g_assert (count >= 2));
+       SGEN_ASSERT (9, count >= 2, "block with %d objects, it must hold at least 2", count);
 
        info->obj_size = size;
        info->obj_size_index = size_index;
@@ -566,6 +571,7 @@ ms_alloc_block (int size_index, gboolean pinned, gboolean has_references)
        info->has_references = has_references;
        info->has_pinned = pinned;
        info->is_to_space = (sgen_get_current_collection_generation () == GENERATION_OLD); /*FIXME WHY??? */
+       info->swept = 1;
 #ifndef FIXED_HEAP
        info->block = ms_get_empty_block ();
 
@@ -626,10 +632,15 @@ unlink_slot_from_free_list_uncontested (MSBlockInfo **free_blocks, int size_inde
        void *obj;
 
        block = free_blocks [size_index];
-       DEBUG (9, g_assert (block));
+       SGEN_ASSERT (9, block, "no free block to unlink from free_blocks %p size_index %d", free_blocks, size_index);
+
+       if (G_UNLIKELY (!block->swept)) {
+               stat_major_blocks_lazy_swept ++;
+               sweep_block (block);
+       }
 
        obj = block->free_list;
-       DEBUG (9, g_assert (obj));
+       SGEN_ASSERT (9, obj, "block %p in free list had no available object to alloc from", block);
 
        block->free_list = *(void**)obj;
        if (!block->free_list) {
@@ -669,8 +680,8 @@ alloc_obj_par (int size, gboolean pinned, gboolean has_references)
        MSBlockInfo *block;
        void *obj;
 
-       DEBUG (9, g_assert (!ms_sweep_in_progress));
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+       SGEN_ASSERT (9, !ms_sweep_in_progress, "concurrent sweep in progress with concurrent allocation");
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
 
        if (free_blocks_local [size_index]) {
        get_slot:
@@ -728,10 +739,11 @@ alloc_obj (int size, gboolean pinned, gboolean has_references)
        void *obj;
 
 #ifdef SGEN_PARALLEL_MARK
-       DEBUG (9, g_assert (current_collection_generation != GENERATION_OLD));
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
+
 #endif
 
-       DEBUG (9, g_assert (!ms_sweep_in_progress));
+       SGEN_ASSERT (9, !ms_sweep_in_progress, "concurrent sweep in progress with concurrent allocation");
 
        if (!free_blocks [size_index]) {
                if (G_UNLIKELY (!ms_alloc_block (size_index, pinned, has_references)))
@@ -767,14 +779,17 @@ free_object (char *obj, size_t size, gboolean pinned)
 {
        MSBlockInfo *block = MS_BLOCK_FOR_OBJ (obj);
        int word, bit;
-       DEBUG (9, g_assert ((pinned && block->pinned) || (!pinned && !block->pinned)));
-       DEBUG (9, g_assert (MS_OBJ_ALLOCED (obj, block)));
+
+       if (!block->swept)
+               sweep_block (block);
+       SGEN_ASSERT (9, (pinned && block->pinned) || (!pinned && !block->pinned), "free-object pinning mixup object %p pinned %d block %p pinned %d", obj, pinned, block, block->pinned);
+       SGEN_ASSERT (9, MS_OBJ_ALLOCED (obj, block), "object %p is already free", obj);
        MS_CALC_MARK_BIT (word, bit, obj);
-       DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+       SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p has mark bit set");
        if (!block->free_list) {
                MSBlockInfo **free_blocks = FREE_BLOCKS (pinned, block->has_references);
                int size_index = MS_BLOCK_OBJ_SIZE_INDEX (size);
-               DEBUG (9, g_assert (!block->next_free));
+               SGEN_ASSERT (9, !block->next_free, "block %p doesn't have a free-list of object but belongs to a free-list of blocks");
                block->next_free = free_blocks [size_index];
                free_blocks [size_index] = block;
        }
@@ -871,19 +886,30 @@ major_is_object_live (char *obj)
 
        /* now we know it's in a major block */
        block = MS_BLOCK_FOR_OBJ (obj);
-       DEBUG (9, g_assert (!block->pinned));
+       SGEN_ASSERT (9, !block->pinned, "block %p is pinned, BTW why is this bad?");
        MS_CALC_MARK_BIT (word, bit, obj);
        return MS_MARK_BIT (block, word, bit) ? TRUE : FALSE;
 }
 
 static gboolean
-major_ptr_is_in_non_pinned_space (char *ptr)
+major_ptr_is_in_non_pinned_space (char *ptr, char **start)
 {
        MSBlockInfo *block;
 
        FOREACH_BLOCK (block) {
-               if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE)
+               if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE) {
+                       int count = MS_BLOCK_FREE / block->obj_size;
+                       int i;
+
+                       *start = NULL;
+                       for (i = 0; i <= count; ++i) {
+                               if (ptr >= MS_BLOCK_OBJ (block, i) && ptr < MS_BLOCK_OBJ (block, i + 1)) {
+                                       *start = MS_BLOCK_OBJ (block, i);
+                                       break;
+                               }
+                       }
                        return !block->pinned;
+               }
        } END_FOREACH_BLOCK;
        return FALSE;
 }
@@ -903,6 +929,8 @@ major_iterate_objects (gboolean non_pinned, gboolean pinned, IterateObjectCallba
                        continue;
                if (!block->pinned && !non_pinned)
                        continue;
+               if (lazy_sweep)
+                       sweep_block (block);
 
                for (i = 0; i < count; ++i) {
                        void **obj = (void**) MS_BLOCK_OBJ (block, i);
@@ -950,7 +978,7 @@ major_describe_pointer (char *ptr)
                if ((block->block > ptr) || ((block->block + MS_BLOCK_SIZE) <= ptr))
                        continue;
 
-               fprintf (gc_debug_file, "major-ptr (block %p sz %d pin %d ref %d) ",
+               SGEN_LOG (1, "major-ptr (block %p sz %d pin %d ref %d) ",
                        block->block, block->obj_size, block->pinned, block->has_references);
 
                idx = MS_BLOCK_OBJ_INDEX (ptr, block);
@@ -960,16 +988,16 @@ major_describe_pointer (char *ptr)
                
                if (obj == ptr) {
                        if (live)
-                               fprintf (gc_debug_file, "(object %s.%s)", vtable->klass->name_space, vtable->klass->name);
+                               SGEN_LOG (1, "\t(object %s.%s)", vtable->klass->name_space, vtable->klass->name);
                        else
-                               fprintf (gc_debug_file, "(dead-object)");
+                               SGEN_LOG (1, "(dead-object)");
                } else {
                        if (live)
-                               fprintf (gc_debug_file, "(interior-ptr offset %td of %p %s.%s)",
+                               SGEN_LOG (1, "(interior-ptr offset %td of %p %s.%s)",
                                        ptr - obj,
                                        obj, vtable->klass->name_space, vtable->klass->name);
                        else
-                               fprintf (gc_debug_file, "(dead-interior-ptr to %td to %p)",
+                               SGEN_LOG (1, "(dead-interior-ptr to %td to %p)",
                                        ptr - obj, obj);
                }
 
@@ -1051,7 +1079,7 @@ major_dump_heap (FILE *heap_dump_file)
 #define MS_MARK_OBJECT_AND_ENQUEUE(obj,block,queue) do {               \
                int __word, __bit;                                      \
                MS_CALC_MARK_BIT (__word, __bit, (obj));                \
-               DEBUG (9, g_assert (MS_OBJ_ALLOCED ((obj), (block))));  \
+               SGEN_ASSERT (9, MS_OBJ_ALLOCED ((obj), (block)), "object %p not allocated", obj);       \
                if (!MS_MARK_BIT ((block), __word, __bit)) {            \
                        MS_SET_MARK_BIT ((block), __word, __bit);       \
                        if ((block)->has_references)                    \
@@ -1062,7 +1090,7 @@ major_dump_heap (FILE *heap_dump_file)
 #define MS_PAR_MARK_OBJECT_AND_ENQUEUE(obj,block,queue) do {           \
                int __word, __bit;                                      \
                gboolean __was_marked;                                  \
-               DEBUG (9, g_assert (MS_OBJ_ALLOCED ((obj), (block))));  \
+               SGEN_ASSERT (9, MS_OBJ_ALLOCED ((obj), (block)), "object %p not allocated", obj);       \
                MS_CALC_MARK_BIT (__word, __bit, (obj));                \
                MS_PAR_SET_MARK_BIT (__was_marked, (block), __word, __bit); \
                if (!__was_marked) {                                    \
@@ -1093,8 +1121,8 @@ major_copy_or_mark_object (void **ptr, SgenGrayQueue *queue)
 
        HEAVY_STAT (++stat_copy_object_called_major);
 
-       DEBUG (9, g_assert (obj));
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+       SGEN_ASSERT (9, obj, "null object from pointer %p", ptr);
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
 
        if (sgen_ptr_in_nursery (obj)) {
                int word, bit;
@@ -1166,7 +1194,7 @@ major_copy_or_mark_object (void **ptr, SgenGrayQueue *queue)
                        if (!sgen_ptr_in_nursery (obj)) {
                                block = MS_BLOCK_FOR_OBJ (obj);
                                MS_CALC_MARK_BIT (word, bit, obj);
-                               DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+                               SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p already marked", obj);
                                MS_PAR_SET_MARK_BIT (was_marked, block, word, bit);
                        }
                } else {
@@ -1256,8 +1284,8 @@ major_copy_or_mark_object (void **ptr, SgenGrayQueue *queue)
 
        HEAVY_STAT (++stat_copy_object_called_major);
 
-       DEBUG (9, g_assert (obj));
-       DEBUG (9, g_assert (current_collection_generation == GENERATION_OLD));
+       SGEN_ASSERT (9, obj, "null object from pointer %p", ptr);
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_OLD, "old gen parallel allocator called from a %d collection", current_collection_generation);
 
        if (sgen_ptr_in_nursery (obj)) {
                int word, bit;
@@ -1308,7 +1336,7 @@ major_copy_or_mark_object (void **ptr, SgenGrayQueue *queue)
                if (!sgen_ptr_in_nursery (obj)) {
                        block = MS_BLOCK_FOR_OBJ (obj);
                        MS_CALC_MARK_BIT (word, bit, obj);
-                       DEBUG (9, g_assert (!MS_MARK_BIT (block, word, bit)));
+                       SGEN_ASSERT (9, !MS_MARK_BIT (block, word, bit), "object %p already marked", obj);
                        MS_SET_MARK_BIT (block, word, bit);
                }
        } else {
@@ -1397,7 +1425,7 @@ mark_pinned_objects_in_block (MSBlockInfo *block, SgenGrayQueue *queue)
 
        for (i = 0; i < block->pin_queue_num_entries; ++i) {
                int index = MS_BLOCK_OBJ_INDEX (block->pin_queue_start [i], block);
-               DEBUG (9, g_assert (index >= 0 && index < MS_BLOCK_FREE / block->obj_size));
+               SGEN_ASSERT (9, index >= 0 && index < MS_BLOCK_FREE / block->obj_size, "invalid object %p index %d max-index %d", block->pin_queue_start [i], index, MS_BLOCK_FREE / block->obj_size);
                if (index == last_index)
                        continue;
                MS_MARK_OBJECT_AND_ENQUEUE_CHECKED (MS_BLOCK_OBJ (block, index), block, queue);
@@ -1405,6 +1433,97 @@ mark_pinned_objects_in_block (MSBlockInfo *block, SgenGrayQueue *queue)
        }
 }
 
+static inline void
+sweep_block_for_size (MSBlockInfo *block, int count, int obj_size)
+{
+       int obj_index;
+
+       for (obj_index = 0; obj_index < count; ++obj_index) {
+               int word, bit;
+               void *obj = MS_BLOCK_OBJ_FOR_SIZE (block, obj_index, obj_size);
+
+               MS_CALC_MARK_BIT (word, bit, obj);
+               if (MS_MARK_BIT (block, word, bit)) {
+                       SGEN_ASSERT (9, MS_OBJ_ALLOCED (obj, block), "object %p not allocated", obj);
+               } else {
+                       /* an unmarked object */
+                       if (MS_OBJ_ALLOCED (obj, block)) {
+                               /*
+                                * FIXME: Merge consecutive
+                                * slots for lower reporting
+                                * overhead.  Maybe memset
+                                * will also benefit?
+                                */
+                               binary_protocol_empty (obj, obj_size);
+                               MONO_GC_MAJOR_SWEPT ((mword)obj, obj_size);
+                               memset (obj, 0, obj_size);
+                       }
+                       *(void**)obj = block->free_list;
+                       block->free_list = obj;
+               }
+       }
+}
+
+/*
+ * sweep_block:
+ *
+ *   Traverse BLOCK, freeing and zeroing unused objects.
+ */
+static void
+sweep_block (MSBlockInfo *block)
+{
+       int count;
+
+       if (block->swept)
+               return;
+
+       count = MS_BLOCK_FREE / block->obj_size;
+
+       block->free_list = NULL;
+
+       /* Use inline instances specialized to constant sizes, this allows the compiler to replace the memset calls with inline code */
+       // FIXME: Add more sizes
+       switch (block->obj_size) {
+       case 16:
+               sweep_block_for_size (block, count, 16);
+               break;
+       default:
+               sweep_block_for_size (block, count, block->obj_size);
+               break;
+       }
+
+       /* reset mark bits */
+       memset (block->mark_words, 0, sizeof (mword) * MS_NUM_MARK_WORDS);
+
+       /*
+        * FIXME: reverse free list so that it's in address
+        * order
+        */
+
+       block->swept = 1;
+}
+
+static inline int
+bitcount (mword d)
+{
+#if SIZEOF_VOID_P == 8
+       /* http://www.jjj.de/bitwizardry/bitwizardrypage.html */
+       d -=  (d>>1) & 0x5555555555555555;
+       d  = ((d>>2) & 0x3333333333333333) + (d & 0x3333333333333333);
+       d  = ((d>>4) + d) & 0x0f0f0f0f0f0f0f0f;
+       d *= 0x0101010101010101;
+       return d >> 56;
+#else
+       /* http://aggregate.org/MAGIC/ */
+       d -= ((d >> 1) & 0x55555555);
+       d = (((d >> 2) & 0x33333333) + (d & 0x33333333));
+       d = (((d >> 4) + d) & 0x0f0f0f0f);
+       d += (d >> 8);
+       d += (d >> 16);
+       return (d & 0x0000003f);
+#endif
+}
+
 static void
 ms_sweep (void)
 {
@@ -1434,8 +1553,9 @@ ms_sweep (void)
                int count;
                gboolean have_live = FALSE;
                gboolean has_pinned;
-               int obj_index;
+               gboolean have_free = FALSE;
                int obj_size_index;
+               int nused = 0;
 
                obj_size_index = block->obj_size_index;
 
@@ -1443,49 +1563,27 @@ ms_sweep (void)
                block->has_pinned = block->pinned;
 
                block->is_to_space = FALSE;
+               block->swept = 0;
 
                count = MS_BLOCK_FREE / block->obj_size;
-               block->free_list = NULL;
-
-               for (obj_index = 0; obj_index < count; ++obj_index) {
-                       int word, bit;
-                       void *obj = MS_BLOCK_OBJ (block, obj_index);
 
-                       MS_CALC_MARK_BIT (word, bit, obj);
-                       if (MS_MARK_BIT (block, word, bit)) {
-                               DEBUG (9, g_assert (MS_OBJ_ALLOCED (obj, block)));
-                               have_live = TRUE;
-                               if (!has_pinned)
-                                       ++slots_used [obj_size_index];
-                       } else {
-                               /* an unmarked object */
-                               if (MS_OBJ_ALLOCED (obj, block)) {
-                                       /*
-                                        * FIXME: Merge consecutive
-                                        * slots for lower reporting
-                                        * overhead.  Maybe memset
-                                        * will also benefit?
-                                        */
-                                       binary_protocol_empty (obj, block->obj_size);
-                                       MONO_GC_MAJOR_SWEPT ((mword)obj, block->obj_size);
-                                       memset (obj, 0, block->obj_size);
-                               }
-                               *(void**)obj = block->free_list;
-                               block->free_list = obj;
-                       }
+               /* Count marked objects in the block */
+               for (i = 0; i < MS_NUM_MARK_WORDS; ++i) {
+                       nused += bitcount (block->mark_words [i]);
                }
+               if (nused) {
+                       have_live = TRUE;
+               }
+               if (nused < count)
+                       have_free = TRUE;
 
-               /* reset mark bits */
-               memset (block->mark_words, 0, sizeof (mword) * MS_NUM_MARK_WORDS);
-
-               /*
-                * FIXME: reverse free list so that it's in address
-                * order
-                */
+               if (!lazy_sweep)
+                       sweep_block (block);
 
                if (have_live) {
                        if (!has_pinned) {
                                ++num_blocks [obj_size_index];
+                               slots_used [obj_size_index] += nused;
                                slots_available [obj_size_index] += count;
                        }
 
@@ -1495,7 +1593,7 @@ ms_sweep (void)
                         * If there are free slots in the block, add
                         * the block to the corresponding free list.
                         */
-                       if (block->free_list) {
+                       if (have_free) {
                                MSBlockInfo **free_blocks = FREE_BLOCKS (block->pinned, block->has_references);
                                int index = MS_BLOCK_OBJ_SIZE_INDEX (block->obj_size);
                                block->next_free = free_blocks [index];
@@ -1521,7 +1619,6 @@ ms_sweep (void)
                        --num_major_sections;
                }
        }
-
        for (i = 0; i < num_block_obj_sizes; ++i) {
                float usage = (float)slots_used [i] / (float)slots_available [i];
                if (num_blocks [i] > 5 && usage < evacuation_threshold) {
@@ -1681,6 +1778,20 @@ major_start_major_collection (void)
                free_block_lists [0][i] = NULL;
                free_block_lists [MS_BLOCK_FLAG_REFS][i] = NULL;
        }
+
+       // Sweep all unswept blocks
+       if (lazy_sweep) {
+               MSBlockInfo **iter;
+
+               iter = &all_blocks;
+               while (*iter) {
+                       MSBlockInfo *block = *iter;
+
+                       sweep_block (block);
+
+                       iter = &block->next;
+               }
+       }
 }
 
 static void
@@ -1923,6 +2034,9 @@ major_scan_card_table (SgenGrayQueue *queue)
                                continue;
 #endif
 
+                       if (!block->swept)
+                               sweep_block (block);
+
                        obj = (char*)MS_BLOCK_OBJ_FAST (block_start, block_obj_size, 0);
                        end = block_start + MS_BLOCK_SIZE;
                        base = sgen_card_table_align_pointer (obj);
@@ -1960,6 +2074,9 @@ major_scan_card_table (SgenGrayQueue *queue)
                                if (!*card_data)
                                        continue;
 
+                               if (!block->swept)
+                                       sweep_block (block);
+
                                HEAVY_STAT (++marked_cards);
 
                                sgen_card_table_prepare_card_for_scanning (card_data);
@@ -2109,6 +2226,7 @@ sgen_marksweep_init
 
        mono_counters_register ("# major blocks allocated", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_alloced);
        mono_counters_register ("# major blocks freed", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_freed);
+       mono_counters_register ("# major blocks lazy swept", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_blocks_lazy_swept);
        mono_counters_register ("# major objects evacuated", MONO_COUNTER_GC | MONO_COUNTER_LONG, &stat_major_objects_evacuated);
        mono_counters_register ("Wait for sweep time", MONO_COUNTER_GC | MONO_COUNTER_TIME_INTERVAL, &stat_time_wait_for_sweep);
 #ifdef SGEN_PARALLEL_MARK
index 7fff99a6b73f7dc99de52097b950286a01760857..445328c193e0a0696c2324d901905b2fd25c5482 100644 (file)
@@ -1,33 +1,27 @@
 /*
- * sgen-cardtable.c: Card table implementation for sgen
+ * sgen-memory-governor.c: When to schedule collections based on
+ * memory usage.
  *
  * Author:
  *     Rodrigo Kumpera (rkumpera@novell.com)
  *
- * SGen is licensed under the terms of the MIT X11 license
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -145,11 +139,11 @@ sgen_memgov_try_calculate_minor_collection_allowance (gboolean overwrite)
        if (debug_print_allowance) {
                mword old_major = last_collection_old_num_major_sections * major_collector.section_size;
 
-               fprintf (gc_debug_file, "Before collection: %td bytes (%td major, %td LOS)\n",
+               SGEN_LOG (1, "Before collection: %td bytes (%td major, %td LOS)",
                                old_major + last_collection_old_los_memory_usage, old_major, last_collection_old_los_memory_usage);
-               fprintf (gc_debug_file, "After collection: %td bytes (%td major, %td LOS)\n",
+               SGEN_LOG (1, "After collection: %td bytes (%td major, %td LOS)",
                                new_heap_size, new_major, last_collection_los_memory_usage);
-               fprintf (gc_debug_file, "Allowance: %td bytes\n", minor_collection_allowance);
+               SGEN_LOG (1, "Allowance: %td bytes", minor_collection_allowance);
        }
 
        if (major_collector.have_computed_minor_collection_allowance)
@@ -222,7 +216,7 @@ log_timming (GGTimingInfo *info)
        if (info->generation == GENERATION_OLD)
                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR%s: (%s) pause %.2fms, %s major %dK/%dK los %dK/%dK",
                        info->is_overflow ? "_OVERFLOW" : "",
-                       info->reason,
+                       info->reason ? info->reason : "",
                        (int)info->total_time / 1000.0f,
                        full_timing_buff,
                        major_collector.section_size * num_major_sections / 1024,
@@ -232,7 +226,7 @@ log_timming (GGTimingInfo *info)
        else
                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) pause %.2fms, %s promoted %dK major %dK los %dK",
                                info->is_overflow ? "_OVERFLOW" : "",
-                       info->reason,
+                       info->reason ? info->reason : "",
                        (int)info->total_time / 1000.0f,
                        full_timing_buff,
                        (num_major_sections - last_major_num_sections) * major_collector.section_size / 1024,
@@ -245,7 +239,7 @@ sgen_memgov_collection_end (int generation, GGTimingInfo* info, int info_count)
 {
        int i;
        for (i = 0; i < info_count; ++i) {
-               if (info->generation != -1)
+               if (info[i].generation != -1)
                        log_timming (&info [i]);
        }
 }
index 0546201f76a834bb47c6d593985c11fb38327ef3..5b03713840e3fd0ed329dd5fc85230e223779a64 100644 (file)
 /*
+ * sgen-minor-copy-object.h: Copy functions for nursery collections.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
-#define collector_serial_alloc_for_promotion alloc_for_promotion
-#define collector_parallel_alloc_for_promotion par_alloc_for_promotion
-
-#define GENERATE_COPY_FUNCTIONS 1
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+#define COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION par_alloc_for_promotion
 
+extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
 
 #include "sgen-copy-object.h"
 
+/*
+ * This is how the copying happens from the nursery to the old generation.
+ * We assume that at this time all the pinned objects have been identified and
+ * marked as such.
+ * We run scan_object() for each pinned object so that each referenced
+ * objects if possible are copied. The new gray objects created can have
+ * scan_object() run on them right away, too.
+ * Then we run copy_object() for the precisely tracked roots. At this point
+ * all the roots are either gray or black. We run scan_object() on the gray
+ * objects until no more gray objects are created.
+ * At the end of the process we walk again the pinned list and we unmark
+ * the pinned flag. As we go we also create the list of free space for use
+ * in the next allocation runs.
+ *
+ * We need to remember objects from the old generation that point to the new one
+ * (or just addresses?).
+ *
+ * copy_object could be made into a macro once debugged (use inline for now).
+ */
+
+#ifdef _MSC_VER
+static __forceinline void
+#else
+static inline void __attribute__((always_inline))
+#endif
+SERIAL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue) 
+{
+       char *forwarded;
+       char *obj = *obj_slot;
+
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-serial-copy from a %d generation collection", current_collection_generation);
+
+       HEAVY_STAT (++stat_copy_object_called_nursery);
+
+       if (!sgen_ptr_in_nursery (obj)) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+               return;
+       }
+
+       SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
+
+       /*
+        * Before we can copy the object we must make sure that we are
+        * allowed to, i.e. that the object not pinned, not already
+        * forwarded or belongs to the nursery To Space.
+        */
+
+       if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
+               SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr,  "forwarded object %p has no gc descriptor", forwarded);
+               SGEN_LOG (9, " (already forwarded to %p)", forwarded);
+               HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+               *obj_slot = forwarded;
+               return;
+       }
+       if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
+               SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+               SGEN_LOG (9, " (pinned, no change)");
+               HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+               return;
+       }
+
+#ifndef SGEN_SIMPLE_NURSERY
+       if (sgen_nursery_is_to_space (obj)) {
+               SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+               SGEN_LOG (9, " (tospace, no change)");
+               HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);                
+               return;
+       }
+#endif
+
+       HEAVY_STAT (++stat_objects_copied_nursery);
+
+       *obj_slot = copy_object_no_checks (obj, queue);
+}
+
+/*
+ * SERIAL_COPY_OBJECT_FROM_OBJ:
+ *
+ *   Similar to SERIAL_COPY_OBJECT, but assumes that OBJ_SLOT is part of an object, so it handles global remsets as well.
+ */
+#ifdef _MSC_VER
+static __forceinline void
+#else
+static inline void __attribute__((always_inline))
+#endif
+SERIAL_COPY_OBJECT_FROM_OBJ (void **obj_slot, SgenGrayQueue *queue) 
+{
+       char *forwarded;
+       char *obj = *obj_slot;
+       void *copy;
+
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-serial-copy-from-obj from a %d generation collection", current_collection_generation);
+
+       HEAVY_STAT (++stat_copy_object_called_nursery);
+
+       if (!sgen_ptr_in_nursery (obj)) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+               return;
+       }
+
+       SGEN_LOG (9, "Precise copy of %p from %p", obj, obj_slot);
+
+       /*
+        * Before we can copy the object we must make sure that we are
+        * allowed to, i.e. that the object not pinned, not already
+        * forwarded or belongs to the nursery To Space.
+        */
+
+       if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj))) {
+               SGEN_ASSERT (9, (*(MonoVTable**)SGEN_LOAD_VTABLE (obj))->gc_descr,  "forwarded object %p has no gc descriptor", forwarded);
+               SGEN_LOG (9, " (already forwarded to %p)", forwarded);
+               HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+               *obj_slot = forwarded;
+#ifndef SGEN_SIMPLE_NURSERY
+               if (G_UNLIKELY (sgen_ptr_in_nursery (forwarded) && !sgen_ptr_in_nursery (obj_slot)))
+                       sgen_add_to_global_remset (obj_slot);
+#endif
+               return;
+       }
+       if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
+               SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "pinned object %p has no gc descriptor", obj);
+               SGEN_LOG (9, " (pinned, no change)");
+               HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+               if (!sgen_ptr_in_nursery (obj_slot))
+                       sgen_add_to_global_remset (obj_slot);
+               return;
+       }
+
+#ifndef SGEN_SIMPLE_NURSERY
+       if (sgen_nursery_is_to_space (obj)) {
+               SGEN_ASSERT (9, ((MonoVTable*)SGEN_LOAD_VTABLE(obj))->gc_descr, "to space object %p has no gc descriptor", obj);
+               SGEN_LOG (9, " (tospace, no change)");
+               HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);                
+               return;
+       }
+#endif
+
+       HEAVY_STAT (++stat_objects_copied_nursery);
+
+       copy = copy_object_no_checks (obj, queue);
+       *obj_slot = copy;
+#ifndef SGEN_SIMPLE_NURSERY
+       if (G_UNLIKELY (sgen_ptr_in_nursery (copy) && !sgen_ptr_in_nursery (obj_slot)))
+               sgen_add_to_global_remset (obj_slot);
+#else
+       /* copy_object_no_checks () can return obj on OOM */
+       if (G_UNLIKELY (obj == copy)) {
+               if (G_UNLIKELY (sgen_ptr_in_nursery (copy) && !sgen_ptr_in_nursery (obj_slot)))
+                       sgen_add_to_global_remset (obj_slot);
+       }
+#endif
+}
+
+static void
+PARALLEL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue)
+{
+       char *obj = *obj_slot;
+       mword vtable_word, objsize;
+       MonoVTable *vt;
+       void *destination;
+       gboolean has_references;
+
+       SGEN_ASSERT (9, current_collection_generation == GENERATION_NURSERY, "calling minor-par-copy from a %d generation collection", current_collection_generation);
+
+       HEAVY_STAT (++stat_copy_object_called_nursery);
+
+       if (!sgen_ptr_in_nursery (obj)) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_from_space);
+               return;
+       }
+
+       vtable_word = *(mword*)obj;
+       vt = (MonoVTable*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
+
+       /*
+        * Before we can copy the object we must make sure that we are
+        * allowed to, i.e. that the object not pinned, not already
+        * forwarded and not in the nursery To Space.
+        */
+
+       if (vtable_word & SGEN_FORWARDED_BIT) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+               *obj_slot = vt;
+               return;
+       }
+       if (vtable_word & SGEN_PINNED_BIT) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
+               return;
+       }
+
+       if (sgen_nursery_is_to_space (obj)) {
+               HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);                
+               return;
+       }
+
+       HEAVY_STAT (++stat_objects_copied_nursery);
+
+       objsize = SGEN_ALIGN_UP (sgen_par_object_get_size (vt, (MonoObject*)obj));
+       has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
+
+       destination = COLLECTOR_PARALLEL_ALLOC_FOR_PROMOTION (obj, objsize, has_references);
+
+       if (G_UNLIKELY (!destination)) {
+               sgen_parallel_pin_or_update (obj_slot, obj, vt, queue);
+               return;
+       }
+
+       *(MonoVTable**)destination = vt;
+
+       if (SGEN_CAS_PTR ((void*)obj, (void*)((mword)destination | SGEN_FORWARDED_BIT), vt) == vt) {
+               par_copy_object_no_checks (destination, vt, obj, objsize, has_references ? queue : NULL);
+               obj = destination;
+               *obj_slot = obj;
+       } else {
+               /* FIXME: unify with code in major_copy_or_mark_object() */
+
+               /* FIXME: Give destination back to the allocator. */
+               /*The major collector only needs the first word zeroed and nursery requires all bits to be. */
+               if (!sgen_ptr_in_nursery (destination))
+                       *(void**)destination = NULL;
+               else
+                       memset (destination, 0, objsize);
+
+               vtable_word = *(mword*)obj;
+               g_assert (vtable_word & SGEN_FORWARDED_BIT);
+
+               obj = (void*)(vtable_word & ~SGEN_VTABLE_BITS_MASK);
+
+               *obj_slot = obj;
+
+               HEAVY_STAT (++stat_slots_allocated_in_vain);
+       }
+}
+
 #define FILL_MINOR_COLLECTOR_COPY_OBJECT(collector)    do {                    \
-               (collector)->serial_ops.copy_or_mark_object = serial_copy_object;                       \
-               (collector)->parallel_ops.copy_or_mark_object = parallel_copy_object;   \
+               (collector)->serial_ops.copy_or_mark_object = SERIAL_COPY_OBJECT;                       \
+               (collector)->parallel_ops.copy_or_mark_object = PARALLEL_COPY_OBJECT;   \
        } while (0)
index 89841202a0eca96757e4d9a0b2bd52aaeb5a10af..47c9be9fa31d806c6ede98976659ae3360827f4a 100644 (file)
@@ -1,39 +1,37 @@
 /*
+ * sgen-minor-scan-object.h: Object scanning in the nursery collectors.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+
 extern long long stat_scan_object_called_nursery;
 
 #if defined(SGEN_SIMPLE_NURSERY)
-#define serial_scan_object simple_nursery_serial_scan_object
-#define serial_scan_vtype simple_nursery_serial_scan_vtype
-#define parallel_scan_object simple_nursery_parallel_scan_object
-#define parallel_scan_vtype simple_nursery_parallel_scan_vtype
+#define SERIAL_SCAN_OBJECT simple_nursery_serial_scan_object
+#define SERIAL_SCAN_VTYPE simple_nursery_serial_scan_vtype
+#define PARALLEL_SCAN_OBJECT simple_nursery_parallel_scan_object
+#define PARALLEL_SCAN_VTYPE simple_nursery_parallel_scan_vtype
 
 #elif defined (SGEN_SPLIT_NURSERY)
-#define serial_scan_object split_nursery_serial_scan_object
-#define serial_scan_vtype split_nursery_serial_scan_vtype
-#define parallel_scan_object split_nursery_parallel_scan_object
-#define parallel_scan_vtype split_nursery_parallel_scan_vtype
+#define SERIAL_SCAN_OBJECT split_nursery_serial_scan_object
+#define SERIAL_SCAN_VTYPE split_nursery_serial_scan_vtype
+#define PARALLEL_SCAN_OBJECT split_nursery_parallel_scan_object
+#define PARALLEL_SCAN_VTYPE split_nursery_parallel_scan_vtype
 
 #else
 #error "Please define GC_CONF_NAME"
@@ -44,9 +42,9 @@ extern long long stat_scan_object_called_nursery;
                void *__old = *(ptr);   \
                void *__copy;           \
                if (__old) {    \
-                       parallel_copy_object ((ptr), queue);    \
+                       PARALLEL_COPY_OBJECT ((ptr), queue);    \
                        __copy = *(ptr);        \
-                       DEBUG (9, if (__old != __copy) fprintf (gc_debug_file, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old));     \
+                       SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old);    \
                        if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
                                sgen_add_to_global_remset ((ptr));      \
                }       \
@@ -58,7 +56,7 @@ extern long long stat_scan_object_called_nursery;
  * them to the gray_objects area.
  */
 static void
-parallel_scan_object (char *start, SgenGrayQueue *queue)
+PARALLEL_SCAN_OBJECT (char *start, SgenGrayQueue *queue)
 {
 #include "sgen-scan-object.h"
 
@@ -73,7 +71,7 @@ parallel_scan_object (char *start, SgenGrayQueue *queue)
  * Returns a pointer to the end of the object.
  */
 static void
-parallel_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
+PARALLEL_SCAN_VTYPE (char *start, mword desc, SgenGrayQueue *queue)
 {
        /* The descriptors include info about the MonoObject header as well */
        start -= sizeof (MonoObject);
@@ -83,20 +81,17 @@ parallel_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
 }
 
 #undef HANDLE_PTR
+/* Global remsets are handled in SERIAL_COPY_OBJECT_FROM_OBJ */
 #define HANDLE_PTR(ptr,obj)    do {    \
                void *__old = *(ptr);   \
-               void *__copy;           \
                if (__old) {    \
-                       serial_copy_object ((ptr), queue);      \
-                       __copy = *(ptr);        \
-                       DEBUG (9, if (__old != __copy) fprintf (gc_debug_file, "Overwrote field at %p with %p (was: %p)\n", (ptr), *(ptr), __old));     \
-                       if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
-                               sgen_add_to_global_remset ((ptr));      \
+                       SERIAL_COPY_OBJECT_FROM_OBJ ((ptr), queue);     \
+                       SGEN_COND_LOG (9, __old != *(ptr), "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
                }       \
        } while (0)
 
 static void
-serial_scan_object (char *start, SgenGrayQueue *queue)
+SERIAL_SCAN_OBJECT (char *start, SgenGrayQueue *queue)
 {
 #include "sgen-scan-object.h"
 
@@ -104,7 +99,7 @@ serial_scan_object (char *start, SgenGrayQueue *queue)
 }
 
 static void
-serial_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
+SERIAL_SCAN_VTYPE (char *start, mword desc, SgenGrayQueue *queue)
 {
        /* The descriptors include info about the MonoObject header as well */
        start -= sizeof (MonoObject);
@@ -114,8 +109,8 @@ serial_scan_vtype (char *start, mword desc, SgenGrayQueue *queue)
 }
 
 #define FILL_MINOR_COLLECTOR_SCAN_OBJECT(collector)    do {                    \
-               (collector)->parallel_ops.scan_object = parallel_scan_object;   \
-               (collector)->parallel_ops.scan_vtype = parallel_scan_vtype;     \
-               (collector)->serial_ops.scan_object = serial_scan_object;       \
-               (collector)->serial_ops.scan_vtype = serial_scan_vtype; \
+               (collector)->parallel_ops.scan_object = PARALLEL_SCAN_OBJECT;   \
+               (collector)->parallel_ops.scan_vtype = PARALLEL_SCAN_VTYPE;     \
+               (collector)->serial_ops.scan_object = SERIAL_SCAN_OBJECT;       \
+               (collector)->serial_ops.scan_vtype = SERIAL_SCAN_VTYPE; \
        } while (0)
index 73901bcbd9ebd234ce183a22cce089ba1fb35d38..03e41566f35606441a41c09718ce6f7d76fefbef 100644 (file)
@@ -1,31 +1,24 @@
 /*
  * sgen-nursery-allocator.c: Nursery allocation code.
  *
- *
  * Copyright 2009-2010 Novell, Inc.
  *           2011 Rodrigo Kumpera
  * 
  * Copyright 2011 Xamarin Inc  (http://www.xamarin.com)
+ * Copyright (C) 2012 Xamarin Inc
  *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /*
@@ -643,7 +636,7 @@ sgen_clear_allocator_fragments (SgenFragmentAllocator *allocator)
        SgenFragment *frag;
 
        for (frag = unmask (allocator->alloc_head); frag; frag = unmask (frag->next)) {
-               DEBUG (4, fprintf (gc_debug_file, "Clear nursery frag %p-%p\n", frag->fragment_next, frag->fragment_end));
+               SGEN_LOG (4, "Clear nursery frag %p-%p", frag->fragment_next, frag->fragment_end);
                sgen_clear_range (frag->fragment_next, frag->fragment_end);
 #ifdef NALLOC_DEBUG
                add_alloc_record (frag->fragment_next, frag->fragment_end - frag->fragment_next, CLEAR_NURSERY_FRAGS);
@@ -710,7 +703,7 @@ static mword fragment_total = 0;
 static void
 add_nursery_frag (SgenFragmentAllocator *allocator, size_t frag_size, char* frag_start, char* frag_end)
 {
-       DEBUG (4, fprintf (gc_debug_file, "Found empty fragment: %p-%p, size: %zd\n", frag_start, frag_end, frag_size));
+       SGEN_LOG (4, "Found empty fragment: %p-%p, size: %zd", frag_start, frag_end, frag_size);
        binary_protocol_empty (frag_start, frag_size);
        MONO_GC_NURSERY_SWEPT ((mword)frag_start, frag_end - frag_start);
        /* Not worth dealing with smaller fragments: need to tune */
@@ -828,9 +821,9 @@ sgen_build_nursery_fragments (GCMemSection *nursery_section, void **start, int n
        sgen_minor_collector.build_fragments_finish (&mutator_allocator);
 
        if (!unmask (mutator_allocator.alloc_head)) {
-               DEBUG (1, fprintf (gc_debug_file, "Nursery fully pinned (%d)\n", num_entries));
+               SGEN_LOG (1, "Nursery fully pinned (%d)", num_entries);
                for (i = 0; i < num_entries; ++i) {
-                       DEBUG (3, fprintf (gc_debug_file, "Bastard pinning obj %p (%s), size: %d\n", start [i], sgen_safe_name (start [i]), sgen_safe_object_get_size (start [i])));
+                       SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %d", start [i], sgen_safe_name (start [i]), sgen_safe_object_get_size (start [i]));
                }
        }
        return fragment_total;
@@ -866,7 +859,7 @@ sgen_can_alloc_size (size_t size)
 void*
 sgen_nursery_alloc (size_t size)
 {
-       DEBUG (4, fprintf (gc_debug_file, "Searching nursery for size: %zd\n", size));
+       SGEN_LOG (4, "Searching nursery for size: %zd", size);
        size = SGEN_ALIGN_UP (size);
 
        HEAVY_STAT (InterlockedIncrement (&stat_nursery_alloc_requests));
@@ -877,7 +870,7 @@ sgen_nursery_alloc (size_t size)
 void*
 sgen_nursery_alloc_range (size_t desired_size, size_t minimum_size, size_t *out_alloc_size)
 {
-       DEBUG (4, fprintf (gc_debug_file, "Searching for byte range desired size: %zd minimum size %zd\n", desired_size, minimum_size));
+       SGEN_LOG (4, "Searching for byte range desired size: %zd minimum size %zd", desired_size, minimum_size);
 
        HEAVY_STAT (InterlockedIncrement (&stat_nursery_alloc_range_requests));
 
index 868f798261c231df1a875cc88af6dd25e4c5f79a..14290d373d682bcbd84eb3e69ade4960a5ef27e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * sgen-os-mach.c: Simple generational GC.
+ * sgen-os-mach.c: Mach-OS support.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
@@ -7,25 +7,20 @@
  *     Geoff Norton (gnorton@novell.com)
  *
  * Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -76,7 +71,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
        ctx.uc_mcontext = mctx;
 
        info->stopped_domain = mono_mach_arch_get_tls_value_from_thread (
-               mono_thread_info_get_tid (info), mono_domain_get_tls_offset ());
+               mono_thread_info_get_tid (info), mono_domain_get_tls_key ());
        info->stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
        info->stack_start = NULL;
        stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
@@ -97,7 +92,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
        if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
                mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, &ctx, NULL);
 
-       DEBUG (1, fprintf (gc_debug_file, "thread %p stopped at %p stack_start=%p\n", (void*)info->info.native_handle, info->stopped_ip, info->stack_start));
+       SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)info->info.native_handle, info->stopped_ip, info->stack_start);
 
        binary_protocol_thread_suspend ((gpointer)mono_thread_info_get_tid (info), info->stopped_ip);
 
index 1b1f2a5641942064cbc65318ce22ae24a8fdc474..b4f84d3899ae3689cbe781349b2533a53779a14b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * sgen-os-posix.c: Simple generational GC.
+ * sgen-os-posix.c: Posix support.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
@@ -7,25 +7,20 @@
  *     Geoff Norton (gnorton@novell.com)
  *
  * Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -101,7 +96,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
                mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, context, NULL);
 
-       DEBUG (4, fprintf (gc_debug_file, "Posting suspend_ack_semaphore for suspend from %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+       SGEN_LOG (4, "Posting suspend_ack_semaphore for suspend from %p %p", info, (gpointer)mono_native_thread_id_get ());
 
        /*
        Block the restart signal. 
@@ -123,7 +118,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        /* Unblock the restart signal. */
        pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
 
-       DEBUG (4, fprintf (gc_debug_file, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+       SGEN_LOG (4, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer)mono_native_thread_id_get ());
        /* notify the waiting thread */
        MONO_SEM_POST (suspend_ack_semaphore_ptr);
 }
@@ -170,7 +165,7 @@ restart_handler (int sig)
         */
        if (info) {
                info->signal = restart_signal_num;
-               DEBUG (4, fprintf (gc_debug_file, "Restart handler in %p %p\n", info, (gpointer)mono_native_thread_id_get ()));
+               SGEN_LOG (4, "Restart handler in %p %p", info, (gpointer)mono_native_thread_id_get ());
        }
        errno = old_errno;
 }
index 31d3cd678df4a224e78b79c3a03f4d60523888f1..275e750cb305cab96f5cbdc666c38a101b21d2d0 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * sgen-pinned-allocator.c: Simple generational GC.
+ * sgen-pinned-allocator.c: Allocator for small pinned objects.
+ * Only used in the copying major collector.
  *
  * Author:
  *     Paolo Molaro (lupus@ximian.com)
  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
  * Copyright (c) 2000-2004 by Hewlett-Packard Company.  All rights reserved.
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
  *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
  *
- * Copyright 2001-2003 Ximian, Inc
- * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -241,7 +226,7 @@ alloc_pinned_chunk (SgenPinnedAllocator *alc)
        chunk->page_sizes [0] = PINNED_FIRST_SLOT_SIZE;
        build_freelist (alc, chunk, slot_for_size (PINNED_FIRST_SLOT_SIZE), PINNED_FIRST_SLOT_SIZE,
                        chunk->start_data, ((char*)chunk + FREELIST_PAGESIZE));
-       sgen_debug_printf (4, "Allocated pinned chunk %p, size: %d\n", chunk, size);
+       SGEN_LOG (4, "Allocated pinned chunk %p, size: %d", chunk, size);
 
        chunk->block.next = alc->chunk_list;
        alc->chunk_list = chunk;
@@ -408,14 +393,14 @@ sgen_pinned_scan_objects (SgenPinnedAllocator *alc, IterateObjectCallbackFunc ca
        void *end_chunk;
        for (chunk = alc->chunk_list; chunk; chunk = chunk->block.next) {
                end_chunk = (char*)chunk + chunk->num_pages * FREELIST_PAGESIZE;
-               sgen_debug_printf (6, "Scanning pinned chunk %p (range: %p-%p)\n", chunk, chunk->start_data, end_chunk);
+               SGEN_LOG (6, "Scanning pinned chunk %p (range: %p-%p)", chunk, chunk->start_data, end_chunk);
                for (i = 0; i < chunk->num_pages; ++i) {
                        obj_size = chunk->page_sizes [i];
                        if (!obj_size)
                                continue;
                        p = i? (char*)chunk + i * FREELIST_PAGESIZE: chunk->start_data;
                        endp = i? p + FREELIST_PAGESIZE: (char*)chunk + FREELIST_PAGESIZE;
-                       sgen_debug_printf (6, "Page %d (size: %d, range: %p-%p)\n", i, obj_size, p, endp);
+                       SGEN_LOG (6, "Page %d (size: %d, range: %p-%p)", i, obj_size, p, endp);
                        while (p + obj_size <= endp) {
                                ptr = (void**)p;
                                /* if the first word (the vtable) is outside the chunk we have an object */
@@ -485,7 +470,7 @@ sgen_pinned_scan_pinned_objects (SgenPinnedAllocator *alc, IterateObjectCallback
        SgenPinnedChunk *chunk;
 
        /* look for pinned addresses for pinned-alloc objects */
-       sgen_debug_printf (6, "Pinning from pinned-alloc objects\n");
+       SGEN_LOG (6, "Pinning from pinned-alloc objects");
        for (chunk = alc->chunk_list; chunk; chunk = chunk->block.next) {
                int num_pinned;
                void **pinned = sgen_find_optimized_pin_queue_area (chunk->start_data,
index 0484500798a5ed5602b1fb7c10ea4bfd2ace4572..3b1556bef5269da15ae14ab5c6f7cfd37ed40f56 100644 (file)
@@ -1,25 +1,22 @@
 /*
+ * sgen-pinning.c: The pin queue.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -58,7 +55,7 @@ realloc_pin_queue (void)
        sgen_free_internal_dynamic (pin_queue, sizeof (void*) * pin_queue_size, INTERNAL_MEM_PIN_QUEUE);
        pin_queue = new_pin;
        pin_queue_size = new_size;
-       DEBUG (4, fprintf (gc_debug_file, "Reallocated pin queue to size: %d\n", new_size));
+       SGEN_LOG (4, "Reallocated pin queue to size: %d", new_size);
 }
 
 void
@@ -107,9 +104,9 @@ sgen_find_optimized_pin_queue_area (void *start, void *end, int *num)
 void
 sgen_find_section_pin_queue_start_end (GCMemSection *section)
 {
-       DEBUG (6, fprintf (gc_debug_file, "Pinning from section %p (%p-%p)\n", section, section->data, section->end_data));
+       SGEN_LOG (6, "Pinning from section %p (%p-%p)", section, section->data, section->end_data);
        section->pin_queue_start = sgen_find_optimized_pin_queue_area (section->data, section->end_data, &section->pin_queue_num_entries);
-       DEBUG (6, fprintf (gc_debug_file, "Found %d pinning addresses in section %p\n", section->pin_queue_num_entries, section));
+       SGEN_LOG (6, "Found %d pinning addresses in section %p", section->pin_queue_num_entries, section);
 }
 
 /*This will setup the given section for the while pin queue. */
@@ -144,21 +141,6 @@ sgen_pin_queue_clear_discarded_entries (GCMemSection *section, int max_pin_slot)
        }
 }
 
-static G_GNUC_UNUSED void
-print_nursery_gaps (void* start_nursery, void *end_nursery)
-{
-       int i;
-       gpointer first = start_nursery;
-       gpointer next;
-       for (i = 0; i < next_pin_slot; ++i) {
-               next = pin_queue [i];
-               fprintf (gc_debug_file, "Nursery range: %p-%p, size: %td\n", first, next, (char*)next-(char*)first);
-               first = next;
-       }
-       next = end_nursery;
-       fprintf (gc_debug_file, "Nursery range: %p-%p, size: %td\n", first, next, (char*)next-(char*)first);
-}
-
 /* reduce the info in the pin queue, removing duplicate pointers and sorting them */
 void
 sgen_optimize_pin_queue (int start_slot)
@@ -166,7 +148,7 @@ sgen_optimize_pin_queue (int start_slot)
        void **start, **cur, **end;
        /* sort and uniq pin_queue: we just sort and we let the rest discard multiple values */
        /* it may be better to keep ranges of pinned memory instead of individually pinning objects */
-       DEBUG (5, fprintf (gc_debug_file, "Sorting pin queue, size: %d\n", next_pin_slot));
+       SGEN_LOG (5, "Sorting pin queue, size: %d", next_pin_slot);
        if ((next_pin_slot - start_slot) > 1)
                sgen_sort_addresses (pin_queue + start_slot, next_pin_slot - start_slot);
        start = cur = pin_queue + start_slot;
@@ -178,8 +160,7 @@ sgen_optimize_pin_queue (int start_slot)
                start++;
        };
        next_pin_slot = start - pin_queue;
-       DEBUG (5, fprintf (gc_debug_file, "Pin queue reduced to size: %d\n", next_pin_slot));
-       //DEBUG (6, print_nursery_gaps (start_nursery, end_nursery));   
+       SGEN_LOG (5, "Pin queue reduced to size: %d", next_pin_slot);
 }
 
 int
@@ -194,7 +175,7 @@ sgen_dump_pin_queue (void)
        int i;
 
        for (i = 0; i < last_num_pinned; ++i) {
-               DEBUG (3, fprintf (gc_debug_file, "Bastard pinning obj %p (%s), size: %d\n", pin_queue [i], sgen_safe_name (pin_queue [i]), sgen_safe_object_get_size (pin_queue [i])));
+               SGEN_LOG (3, "Bastard pinning obj %p (%s), size: %d", pin_queue [i], sgen_safe_name (pin_queue [i]), sgen_safe_object_get_size (pin_queue [i]));
        }       
 }
 
index 3c4ec7cd8fc9eadb586a7ff07496c1ea81d62858..1dc06202e5aa03095983567a2472f8f784d6c485 100644 (file)
@@ -1,31 +1,23 @@
 /*
  * sgen-simple-nursery.c: Simple always promote nursery.
  *
- *
- * SGen is licensed under the terms of the MIT X11 license
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -85,6 +77,10 @@ init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
 
 #define SGEN_SIMPLE_NURSERY
 
+#define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
+#define PARALLEL_COPY_OBJECT simple_nursery_parallel_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
+
 #include "sgen-minor-copy-object.h"
 #include "sgen-minor-scan-object.h"
 
index 60e4621330de173b38df1e4c58eb9f021531f8aa..2d812767d3f97d438cb20f366634ae538cfe6c15 100644 (file)
@@ -4,30 +4,23 @@
  * Author:
  *     Rodrigo Kumpera Kumpera <kumpera@gmail.com>
  *
- * SGen is licensed under the terms of the MIT X11 license
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -523,10 +516,13 @@ print_gc_param_usage (void)
 
 #define SGEN_SPLIT_NURSERY
 
+#define SERIAL_COPY_OBJECT split_nursery_serial_copy_object
+#define PARALLEL_COPY_OBJECT split_nursery_parallel_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_copy_object_from_obj
+
 #include "sgen-minor-copy-object.h"
 #include "sgen-minor-scan-object.h"
 
-
 void
 sgen_split_nursery_init (SgenMinorCollector *collector)
 {
index 0128fe5db15565d1f3b1f250af73659c0212d8d4..0a2a752591e7fe90d8be9b42f20d11c3a11d7426 100644 (file)
@@ -1,33 +1,26 @@
 /*
- * sgen-cardtable.c: Card table implementation for sgen
+ * sgen-ssb.c: Remembered sets - sequential store buffer
  *
  * Author:
  *     Rodrigo Kumpera (rkumpera@novell.com)
  *
- * SGen is licensed under the terms of the MIT X11 license
- *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -38,6 +31,8 @@
 #include "metadata/sgen-protocol.h"
 #include "utils/mono-counters.h"
 
+#ifndef DISABLE_SGEN_REMSET
+
 /*A two slots cache for recently inserted remsets */
 static gpointer global_remset_cache [2];
 
@@ -120,7 +115,7 @@ sgen_alloc_remset (int size, gpointer id, gboolean global)
        res->store_next = res->data;
        res->end_set = res->data + size;
        res->next = NULL;
-       DEBUG (4, fprintf (gc_debug_file, "Allocated%s remset size %d at %p for %p\n", global ? " global" : "", size, res->data, id));
+       SGEN_LOG (4, "Allocated%s remset size %d at %p for %p", global ? " global" : "", size, res->data, id);
        return res;
 }
 
@@ -185,7 +180,7 @@ sgen_ssb_wbarrier_arrayref_copy (gpointer dest_ptr, gpointer src_ptr, int count)
        mono_gc_memmove (dest_ptr, src_ptr, count * sizeof (gpointer));
 
        rs = REMEMBERED_SET;
-       DEBUG (8, fprintf (gc_debug_file, "Adding remset at %p, %d\n", dest_ptr, count));
+       SGEN_LOG (8, "Adding remset at %p, %d", dest_ptr, count);
        if (rs->store_next + 1 < rs->end_set) {
                *(rs->store_next++) = (mword)dest_ptr | REMSET_RANGE;
                *(rs->store_next++) = count;
@@ -249,7 +244,7 @@ sgen_ssb_wbarrier_object_copy (MonoObject* obj, MonoObject *src)
        size = mono_object_class (obj)->instance_size;
 
        rs = REMEMBERED_SET;
-       DEBUG (6, fprintf (gc_debug_file, "Adding object remset for %p\n", obj));
+       SGEN_LOG (6, "Adding object remset for %p", obj);
 
        LOCK_GC;
        /* do not copy the sync state */
@@ -417,7 +412,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                        gpointer old = *ptr;
 
                        sgen_get_current_object_ops ()->copy_or_mark_object (ptr, queue);
-                       DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p\n", ptr, *ptr));
+                       SGEN_LOG (9, "Overwrote remset at %p with %p", ptr, *ptr);
                        if (old)
                                binary_protocol_ptr_update (ptr, old, *ptr, (gpointer)SGEN_LOAD_VTABLE (*ptr), sgen_safe_object_get_size (*ptr));
                        if (!global && *ptr >= start_nursery && *ptr < end_nursery) {
@@ -425,11 +420,11 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                                 * If the object is pinned, each reference to it from nonpinned objects
                                 * becomes part of the global remset, which can grow very large.
                                 */
-                               DEBUG (9, fprintf (gc_debug_file, "Add to global remset because of pinning %p (%p %s)\n", ptr, *ptr, sgen_safe_name (*ptr)));
+                               SGEN_LOG (9, "Add to global remset because of pinning %p (%p %s)", ptr, *ptr, sgen_safe_name (*ptr));
                                sgen_add_to_global_remset (ptr);
                        }
                } else {
-                       DEBUG (9, fprintf (gc_debug_file, "Skipping remset at %p holding %p\n", ptr, *ptr));
+                       SGEN_LOG (9, "Skipping remset at %p holding %p", ptr, *ptr);
                }
                return p + 1;
        case REMSET_RANGE: {
@@ -441,7 +436,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                count = p [1];
                while (count-- > 0) {
                        copy_func (ptr, queue);
-                       DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p (count: %d)\n", ptr, *ptr, (int)count));
+                       SGEN_LOG (9, "Overwrote remset at %p with %p (count: %d)", ptr, *ptr, (int)count);
                        if (!global && *ptr >= start_nursery && *ptr < end_nursery)
                                sgen_add_to_global_remset (ptr);
                        ++ptr;
@@ -483,7 +478,7 @@ sgen_ssb_begin_scan_remsets (void *start_nursery, void *end_nursery, SgenGrayQue
 
        /* the global one */
        for (remset = global_remset; remset; remset = remset->next) {
-               DEBUG (4, fprintf (gc_debug_file, "Scanning global remset range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+               SGEN_LOG (4, "Scanning global remset range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
                store_pos = remset->data;
                for (p = remset->data; p < remset->store_next; p = next_p) {
                        void **ptr = (void**)p [0];
@@ -549,14 +544,14 @@ sgen_ssb_finish_scan_remsets (void *start_nursery, void *end_nursery, SgenGrayQu
                RememberedSet *next;
                int j;
                for (remset = info->remset; remset; remset = next) {
-                       DEBUG (4, fprintf (gc_debug_file, "Scanning remset for thread %p, range: %p-%p, size: %td\n", info, remset->data, remset->store_next, remset->store_next - remset->data));
+                       SGEN_LOG (4, "Scanning remset for thread %p, range: %p-%p, size: %td", info, remset->data, remset->store_next, remset->store_next - remset->data);
                        for (p = remset->data; p < remset->store_next;)
                                p = handle_remset (p, start_nursery, end_nursery, FALSE, queue);
                        remset->store_next = remset->data;
                        next = remset->next;
                        remset->next = NULL;
                        if (remset != info->remset) {
-                               DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+                               SGEN_LOG (4, "Freed remset at %p", remset->data);
                                sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
                        }
                }
@@ -569,11 +564,11 @@ sgen_ssb_finish_scan_remsets (void *start_nursery, void *end_nursery, SgenGrayQu
        while (freed_thread_remsets) {
                RememberedSet *next;
                remset = freed_thread_remsets;
-               DEBUG (4, fprintf (gc_debug_file, "Scanning remset for freed thread, range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+               SGEN_LOG (4, "Scanning remset for freed thread, range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
                for (p = remset->data; p < remset->store_next;)
                        p = handle_remset (p, start_nursery, end_nursery, FALSE, queue);
                next = remset->next;
-               DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+               SGEN_LOG (4, "Freed remset at %p", remset->data);
                sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
                freed_thread_remsets = next;
        }
@@ -663,7 +658,7 @@ sgen_ssb_prepare_for_major_collection (void)
                next = remset->next;
                remset->next = NULL;
                if (remset != global_remset) {
-                       DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+                       SGEN_LOG (4, "Freed remset at %p", remset->data);
                        sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
                }
        }
@@ -680,7 +675,7 @@ sgen_ssb_prepare_for_major_collection (void)
                        next = remset->next;
                        remset->next = NULL;
                        if (remset != info->remset) {
-                               DEBUG (3, fprintf (gc_debug_file, "Freed remset at %p\n", remset->data));
+                               SGEN_LOG (3, "Freed remset at %p", remset->data);
                                sgen_free_internal_dynamic (remset, remset_byte_size (remset), INTERNAL_MEM_REMSET);
                        }
                }
@@ -690,7 +685,7 @@ sgen_ssb_prepare_for_major_collection (void)
        /* the freed thread ones */
        while (freed_thread_remsets) {
                next = freed_thread_remsets->next;
-               DEBUG (4, fprintf (gc_debug_file, "Freed remset at %p\n", freed_thread_remsets->data));
+               SGEN_LOG (4, "Freed remset at %p", freed_thread_remsets->data);
                sgen_free_internal_dynamic (freed_thread_remsets, remset_byte_size (freed_thread_remsets), INTERNAL_MEM_REMSET);
                freed_thread_remsets = next;
        }
@@ -751,7 +746,7 @@ sgen_ssb_record_pointer (gpointer ptr)
        if (G_UNLIKELY (do_pin_stats))
                sgen_pin_stats_register_global_remset (obj);
 
-       DEBUG (8, fprintf (gc_debug_file, "Adding global remset for %p\n", ptr));
+       SGEN_LOG (8, "Adding global remset for %p", ptr);
        binary_protocol_global_remset (ptr, *(gpointer*)ptr, (gpointer)SGEN_LOAD_VTABLE (obj));
 
        HEAVY_STAT (++stat_global_remsets_added);
@@ -769,14 +764,16 @@ sgen_ssb_record_pointer (gpointer ptr)
        global_remset = rs;
        *(global_remset->store_next++) = (mword)ptr;
 
+#if SGEN_MAX_DEBUG_LEVEL >= 4
        {
                int global_rs_size = 0;
 
                for (rs = global_remset; rs; rs = rs->next) {
                        global_rs_size += rs->store_next - rs->data;
                }
-               DEBUG (4, fprintf (gc_debug_file, "Global remset now has size %d\n", global_rs_size));
+               SGEN_LOG (4, "Global remset now has size %d", global_rs_size);
        }
+#endif
 
  done:
        if (lock)
@@ -848,7 +845,7 @@ sgen_ssb_find_address (char *addr)
 
        /* the global one */
        for (remset = global_remset; remset; remset = remset->next) {
-               DEBUG (4, fprintf (gc_debug_file, "Scanning global remset range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+               SGEN_LOG (4, "Scanning global remset range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
                for (p = remset->data; p < remset->store_next;) {
                        p = find_in_remset_loc (p, addr, &found);
                        if (found)
@@ -868,7 +865,7 @@ sgen_ssb_find_address (char *addr)
        FOREACH_THREAD (info) {
                int j;
                for (remset = info->remset; remset; remset = remset->next) {
-                       DEBUG (4, fprintf (gc_debug_file, "Scanning remset for thread %p, range: %p-%p, size: %td\n", info, remset->data, remset->store_next, remset->store_next - remset->data));
+                       SGEN_LOG (4, "Scanning remset for thread %p, range: %p-%p, size: %td", info, remset->data, remset->store_next, remset->store_next - remset->data);
                        for (p = remset->data; p < remset->store_next;) {
                                p = find_in_remset_loc (p, addr, &found);
                                if (found)
@@ -883,7 +880,7 @@ sgen_ssb_find_address (char *addr)
 
        /* the freed thread ones */
        for (remset = freed_thread_remsets; remset; remset = remset->next) {
-               DEBUG (4, fprintf (gc_debug_file, "Scanning remset for freed thread, range: %p-%p, size: %td\n", remset->data, remset->store_next, remset->store_next - remset->data));
+               SGEN_LOG (4, "Scanning remset for freed thread, range: %p-%p, size: %td", remset->data, remset->store_next, remset->store_next - remset->data);
                for (p = remset->data; p < remset->store_next;) {
                        p = find_in_remset_loc (p, addr, &found);
                        if (found)
@@ -894,7 +891,6 @@ sgen_ssb_find_address (char *addr)
        return FALSE;
 }
 
-
 void
 sgen_ssb_init (SgenRemeberedSet *remset)
 {
@@ -941,4 +937,16 @@ sgen_ssb_init (SgenRemeberedSet *remset)
 
        remset->find_address = sgen_ssb_find_address;
 }
-#endif
+
+#else
+
+void
+sgen_ssb_init (SgenRemeberedSet *remset)
+{
+       fprintf (stderr, "Error: Mono was configured using --enable-minimal=sgen_wbarrier.\n");
+       exit (1);
+}
+
+#endif /* DISABLE_SGEN_REMSET */
+
+#endif /* HAVE_SGEN_GC */
index 6a1238ab869353cff122933da857b0b2812a9391..0e870e97c8dfdaa62521457374bd66e551c05917 100644 (file)
@@ -8,25 +8,20 @@
  * Copyright 2005-2011 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
  * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "config.h"
@@ -121,7 +116,7 @@ restart_threads_until_none_in_managed_allocator (void)
                        if (!info->thread_is_dying && (!info->stack_start || info->in_critical_region ||
                                        is_ip_in_managed_allocator (info->stopped_domain, info->stopped_ip))) {
                                binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
-                               DEBUG (3, fprintf (gc_debug_file, "thread %p resumed.\n", (void*)info->info.native_handle));
+                               SGEN_LOG (3, "thread %p resumed.", (void*)info->info.native_handle);
                                result = sgen_resume_thread (info);
                                if (result) {
                                        ++restart_count;
@@ -224,7 +219,7 @@ sgen_stop_world (int generation)
        update_current_thread_stack (&count);
 
        sgen_global_stop_count++;
-       DEBUG (3, fprintf (gc_debug_file, "stopping world n %d from %p %p\n", sgen_global_stop_count, mono_thread_info_current (), (gpointer)mono_native_thread_id_get ()));
+       SGEN_LOG (3, "stopping world n %d from %p %p", sgen_global_stop_count, mono_thread_info_current (), (gpointer)mono_native_thread_id_get ());
        TV_GETTIME (stop_world_time);
        count = sgen_thread_handshake (TRUE);
        dead = restart_threads_until_none_in_managed_allocator ();
@@ -232,7 +227,7 @@ sgen_stop_world (int generation)
                g_error ("More threads have died (%d) that been initialy suspended %d", dead, count);
        count -= dead;
 
-       DEBUG (3, fprintf (gc_debug_file, "world stopped %d thread(s)\n", count));
+       SGEN_LOG (3, "world stopped %d thread(s)", count);
        mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
 
        sgen_memgov_collection_start (generation);
@@ -270,7 +265,7 @@ sgen_restart_world (int generation, GGTimingInfo *timing)
        TV_GETTIME (end_sw);
        usec = TV_ELAPSED (stop_world_time, end_sw);
        max_pause_usec = MAX (usec, max_pause_usec);
-       DEBUG (2, fprintf (gc_debug_file, "restarted %d thread(s) (pause time: %d usec, max: %d)\n", count, (int)usec, (int)max_pause_usec));
+       SGEN_LOG (2, "restarted %d thread(s) (pause time: %d usec, max: %d)", count, (int)usec, (int)max_pause_usec);
        mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
 
        bridge_process (generation);
index ec1cb8be3e6df9a842738745b03a7be4b95d79cb..10f263affe5e992b90b066a37a8c18886804d855 100644 (file)
@@ -1,33 +1,26 @@
 /*
- *
  * sgen-toggleref.c: toggleref support for sgen
  *
- * Copyright 2011 Xamarin, Inc.
- *
  * Author:
  *  Rodrigo Kumpera (kumpera@gmail.com)
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright 2011 Xamarin, Inc.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-
 #include "config.h"
 
 #ifdef HAVE_SGEN_GC
@@ -53,7 +46,7 @@ sgen_process_togglerefs (void)
        int i, w;
        int toggle_ref_counts [3] = { 0, 0, 0 };
 
-       DEBUG (4, fprintf (gc_debug_file, "Proccessing ToggleRefs %d\n", toggleref_array_size));
+       SGEN_LOG (4, "Proccessing ToggleRefs %d", toggleref_array_size);
 
        for (i = w = 0; i < toggleref_array_size; ++i) {
                int res;
@@ -90,11 +83,11 @@ sgen_process_togglerefs (void)
 
        toggleref_array_size = w;
 
-       DEBUG (4, fprintf (gc_debug_file, "Done Proccessing ToggleRefs dropped %d strong %d weak %d final size %d\n",
+       SGEN_LOG (4, "Done Proccessing ToggleRefs dropped %d strong %d weak %d final size %d",
                toggle_ref_counts [MONO_TOGGLE_REF_DROP],
                toggle_ref_counts [MONO_TOGGLE_REF_STRONG],
                toggle_ref_counts [MONO_TOGGLE_REF_WEAK],
-               w));
+               w);
 }
 
 void
@@ -102,13 +95,13 @@ sgen_scan_togglerefs (CopyOrMarkObjectFunc copy_func, char *start, char *end, Sg
 {
        int i;
 
-       DEBUG (4, fprintf (gc_debug_file, "Scanning ToggleRefs %d\n", toggleref_array_size));
+       SGEN_LOG (4, "Scanning ToggleRefs %d", toggleref_array_size);
 
        for (i = 0; i < toggleref_array_size; ++i) {
                if (toggleref_array [i].strong_ref) {
                        char *object = toggleref_array [i].strong_ref;
                        if (object >= start && object < end) {
-                               DEBUG (6, fprintf (gc_debug_file, "\tcopying strong slot %d\n", i));
+                               SGEN_LOG (6, "\tcopying strong slot %d", i);
                                copy_func (&toggleref_array [i].strong_ref, queue);
                        }
                } else if (toggleref_array [i].weak_ref) {
@@ -116,10 +109,10 @@ sgen_scan_togglerefs (CopyOrMarkObjectFunc copy_func, char *start, char *end, Sg
 
                        if (object >= start && object < end) {
                                if (sgen_gc_is_object_ready_for_finalization (object)) {
-                                       DEBUG (6, fprintf (gc_debug_file, "\tcleaning weak slot %d\n", i));
+                                       SGEN_LOG (6, "\tcleaning weak slot %d", i);
                                        toggleref_array [i].weak_ref = NULL; /* We defer compaction to only happen on the callback step. */
                                } else {
-                                       DEBUG (6, fprintf (gc_debug_file, "\tkeeping weak slot %d\n", i));
+                                       SGEN_LOG (6, "\tkeeping weak slot %d", i);
                                        copy_func (&toggleref_array [i].weak_ref, queue);
                                }
                        }
@@ -169,7 +162,7 @@ mono_gc_toggleref_add (MonoObject *object, mono_bool strong_ref)
        if (!toggleref_callback)
                return;
 
-       DEBUG (4, fprintf (gc_debug_file, "Adding toggleref %p %d\n", object, strong_ref));
+       SGEN_LOG (4, "Adding toggleref %p %d", object, strong_ref);
 
        sgen_gc_lock ();
 
index c71fd74a328436ea463acc1651363c70bb5c5a3d..5a6848ea1c1ac28cff0037795a399caf63eadd94 100644 (file)
@@ -50,6 +50,7 @@
 #include <mono/metadata/threadpool-internals.h>
 #include <mono/metadata/domain-internals.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-memory-model.h>
 
 #include <time.h>
 #ifdef HAVE_SYS_TIME_H
@@ -664,43 +665,22 @@ static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level,
 
 static MonoImage *get_socket_assembly (void)
 {
-       static const char *version = NULL;
-       static gboolean moonlight;
        MonoDomain *domain = mono_domain_get ();
        
-       if (version == NULL) {
-               version = mono_get_runtime_info ()->framework_version;
-               moonlight = !strcmp (version, "2.1");
-       }
-       
        if (domain->socket_assembly == NULL) {
                MonoImage *socket_assembly;
 
-               if (moonlight) {
-                       socket_assembly = mono_image_loaded ("System.Net");
-                       if (!socket_assembly) {
-                               MonoAssembly *sa = mono_assembly_open ("System.Net.dll", NULL);
-                       
-                               if (!sa) {
-                                       g_assert_not_reached ();
-                               } else {
-                                       socket_assembly = mono_assembly_get_image (sa);
-                               }
-                       }
-               } else {
-                       socket_assembly = mono_image_loaded ("System");
-                       if (!socket_assembly) {
-                               MonoAssembly *sa = mono_assembly_open ("System.dll", NULL);
-                       
-                               if (!sa) {
-                                       g_assert_not_reached ();
-                               } else {
-                                       socket_assembly = mono_assembly_get_image (sa);
-                               }
+               socket_assembly = mono_image_loaded ("System");
+               if (!socket_assembly) {
+                       MonoAssembly *sa = mono_assembly_open ("System.dll", NULL);
+               
+                       if (!sa) {
+                               g_assert_not_reached ();
+                       } else {
+                               socket_assembly = mono_assembly_get_image (sa);
                        }
                }
-
-               domain->socket_assembly = socket_assembly;
+               mono_atomic_store_release (&domain->socket_assembly, socket_assembly);
        }
        
        return domain->socket_assembly;
@@ -950,20 +930,11 @@ static MonoObject *create_object_from_sockaddr(struct sockaddr *saddr,
                g_assert (domain->sockaddr_data_field);
        }
 
-       /* Make sure there is space for the family and size bytes */
-#ifdef HAVE_SYS_UN_H
-       if (saddr->sa_family == AF_UNIX) {
-               /* sa_len includes the entire sockaddr size, so we don't need the
-                * N bytes (sizeof (unsigned short)) of the family. */
-               data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size);
-       } else
-#endif
-       {
-               /* May be the +2 here is too conservative, as sa_len returns
-                * the length of the entire sockaddr_in/in6, including
-                * sizeof (unsigned short) of the family */
-               data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size+2);
-       }
+       /* May be the +2 here is too conservative, as sa_len returns
+        * the length of the entire sockaddr_in/in6, including
+        * sizeof (unsigned short) of the family */
+       /* We can't really avoid the +2 as all code below depends on this size - INCLUDING unix domain sockets.*/
+       data=mono_array_new_cached(domain, mono_get_byte_class (), sa_size+2);
 
        /* The data buffer is laid out as follows:
         * bytes 0 and 1 are the address family
index ad2b3de06a0e155fe9558b6f2cd67bcba1f5f273..85ae229e37afba5ba83006b23beeae50dbd2dc92 100644 (file)
@@ -189,7 +189,7 @@ enum {
 #include <mono/metadata/tpool-poll.c>
 #ifdef HAVE_EPOLL
 #include <mono/metadata/tpool-epoll.c>
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
 #include <mono/metadata/tpool-kqueue.c>
 #endif
 /*
@@ -215,30 +215,11 @@ is_corlib_type (MonoDomain *domain, MonoClass *klass)
 /*
  * Note that we call it is_socket_type() where 'socket' refers to the image
  * that contains the System.Net.Sockets.Socket type.
- * For moonlight there is a System.Net.Sockets.Socket class in both System.dll and System.Net.dll.
 */
 static gboolean
 is_socket_type (MonoDomain *domain, MonoClass *klass)
 {
-       static const char *version = NULL;
-       static gboolean moonlight;
-
-       if (is_system_type (domain, klass))
-               return TRUE;
-
-       /* If moonlight, check if the type is in System.Net.dll too */
-       if (version == NULL) {
-               version = mono_get_runtime_info ()->framework_version;
-               moonlight = !strcmp (version, "2.1");
-       }
-
-       if (!moonlight)
-               return FALSE;
-
-       if (domain->system_net_dll == NULL)
-               domain->system_net_dll = mono_image_loaded ("System.Net");
-       
-       return klass->image == domain->system_net_dll;
+       return is_system_type (domain, klass);
 }
 
 #define check_type_cached(domain, ASSEMBLY, _class, _namespace, _name, loc) do { \
@@ -496,7 +477,7 @@ init_event_system (SocketIOData *data)
                        data->event_system = POLL_BACKEND;
                }
        }
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
        if (data->event_system == KQUEUE_BACKEND)
                data->event_data = tp_kqueue_init (data);
 #endif
@@ -525,7 +506,7 @@ socket_io_init (SocketIOData *data)
        data->sock_to_state = mono_g_hash_table_new_type (g_direct_hash, g_direct_equal, MONO_HASH_VALUE_GC);
 #ifdef HAVE_EPOLL
        data->event_system = EPOLL_BACKEND;
-#elif defined(HAVE_KQUEUE)
+#elif defined(USE_KQUEUE_FOR_THREADPOOL)
        data->event_system = KQUEUE_BACKEND;
 #else
        data->event_system = POLL_BACKEND;
@@ -683,7 +664,9 @@ threadpool_start_idle_threads (ThreadPool *tp)
                        if (InterlockedCompareExchange (&tp->nthreads, n + 1, n) == n)
                                break;
                }
+#ifndef DISABLE_PERFCOUNTERS
                mono_perfcounter_update_value (tp->pc_nthreads, TRUE, 1);
+#endif
                mono_thread_create_internal (mono_get_root_domain (), tp->async_invoke, tp, TRUE, stack_size);
                SleepEx (100, TRUE);
        } while (1);
@@ -700,6 +683,7 @@ threadpool_init (ThreadPool *tp, int min_threads, int max_threads, void (*async_
        MONO_SEM_INIT (&tp->new_job, 0);
 }
 
+#ifndef DISABLE_PERFCOUNTERS
 static void *
 init_perf_counter (const char *category, const char *counter)
 {
@@ -718,6 +702,7 @@ init_perf_counter (const char *category, const char *counter)
        machine = mono_string_new (root, ".");
        return mono_perfcounter_get_impl (category_str, counter_str, NULL, machine, &type, &custom);
 }
+#endif
 
 #ifdef DEBUG
 static void
@@ -856,6 +841,7 @@ mono_thread_pool_init ()
        wsqs = g_ptr_array_sized_new (MAX (100 * cpu_count, thread_count));
        mono_wsq_init ();
 
+#ifndef DISABLE_PERFCOUNTERS
        async_tp.pc_nitems = init_perf_counter ("Mono Threadpool", "Work Items Added");
        g_assert (async_tp.pc_nitems);
 
@@ -867,6 +853,7 @@ mono_thread_pool_init ()
 
        async_io_tp.pc_nthreads = init_perf_counter ("Mono Threadpool", "# of IO Threads");
        g_assert (async_io_tp.pc_nthreads);
+#endif
        tp_inited = 2;
 #ifdef DEBUG
        signal (SIGALRM, signal_handler);
@@ -1019,7 +1006,9 @@ threadpool_start_thread (ThreadPool *tp)
        stack_size = (!tp->is_io) ? 0 : SMALL_STACK;
        while (!mono_runtime_is_shutting_down () && (n = tp->nthreads) < tp->max_threads) {
                if (InterlockedCompareExchange (&tp->nthreads, n + 1, n) == n) {
+#ifndef DISABLE_PERFCOUNTERS
                        mono_perfcounter_update_value (tp->pc_nthreads, TRUE, 1);
+#endif
                        mono_thread_create_internal (mono_get_root_domain (), tp->async_invoke, tp, TRUE, stack_size);
                        return TRUE;
                }
@@ -1077,7 +1066,9 @@ threadpool_append_jobs (ThreadPool *tp, MonoObject **jobs, gint njobs)
                        o->add_time = mono_100ns_ticks ();
                }
                threadpool_jobs_inc (ar); 
+#ifndef DISABLE_PERFCOUNTERS
                mono_perfcounter_update_value (tp->pc_nitems, TRUE, 1);
+#endif
                if (!tp->is_io && mono_wsq_local_push (ar))
                        continue;
 
@@ -1545,7 +1536,9 @@ async_invoke_thread (gpointer data)
                                if (!down && nt <= tp->min_threads)
                                        break;
                                if (down || InterlockedCompareExchange (&tp->nthreads, nt - 1, nt) == nt) {
+#ifndef DISABLE_PERFCOUNTERS
                                        mono_perfcounter_update_value (tp->pc_nthreads, TRUE, -1);
+#endif
                                        if (!tp->is_io) {
                                                remove_wsq (wsq);
                                        }
index 0b1d72f05b78f371d264a78632054bb0363c6d64..2e05a9357930978ab2af75e1f0eee831ae411f46 100644 (file)
@@ -1362,6 +1362,44 @@ gboolean ves_icall_System_Threading_Thread_Join_internal(MonoInternalThread *thi
        return(FALSE);
 }
 
+static gint32
+mono_wait_uninterrupted (MonoInternalThread *thread, gboolean multiple, guint32 numhandles, gpointer *handles, gboolean waitall, gint32 ms, gboolean alertable)
+{
+       MonoException *exc;
+       guint32 ret;
+       gint64 start;
+       gint32 diff_ms;
+       gint32 wait = ms;
+
+       start = (ms == -1) ? 0 : mono_100ns_ticks ();
+       do {
+               if (multiple)
+                       ret = WaitForMultipleObjectsEx (numhandles, handles, waitall, wait, alertable);
+               else
+                       ret = WaitForSingleObjectEx (handles [0], ms, alertable);
+
+               if (ret != WAIT_IO_COMPLETION)
+                       break;
+
+               exc = mono_thread_execute_interruption (thread);
+               if (exc)
+                       mono_raise_exception (exc);
+
+               if (ms == -1)
+                       continue;
+
+               /* Re-calculate ms according to the time passed */
+               diff_ms = (mono_100ns_ticks () - start) / 10000;
+               if (diff_ms >= ms) {
+                       ret = WAIT_TIMEOUT;
+                       break;
+               }
+               wait = ms - diff_ms;
+       } while (TRUE);
+       
+       return ret;
+}
+
 /* FIXME: exitContext isnt documented */
 gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
 {
@@ -1389,7 +1427,7 @@ gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_
 
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
        
-       ret=WaitForMultipleObjectsEx(numhandles, handles, TRUE, ms, TRUE);
+       ret = mono_wait_uninterrupted (thread, TRUE, numhandles, handles, TRUE, ms, TRUE);
 
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
 
@@ -1398,12 +1436,7 @@ gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_
        if(ret==WAIT_FAILED) {
                THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait failed", __func__, GetCurrentThreadId ()));
                return(FALSE);
-       } else if(ret==WAIT_TIMEOUT || ret == WAIT_IO_COMPLETION) {
-               /* Do we want to try again if we get
-                * WAIT_IO_COMPLETION? The documentation for
-                * WaitHandle doesn't give any clues.  (We'd have to
-                * fiddle with the timeout if we retry.)
-                */
+       } else if(ret==WAIT_TIMEOUT) {
                THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait timed out", __func__, GetCurrentThreadId ()));
                return(FALSE);
        }
@@ -1420,7 +1453,6 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_ha
        guint32 i;
        MonoObject *waitHandle;
        MonoInternalThread *thread = mono_thread_internal_current ();
-       guint32 start;
 
        /* Do this WaitSleepJoin check before creating objects */
        mono_thread_current_check_pending_interrupt ();
@@ -1440,20 +1472,7 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_ha
 
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
 
-       start = (ms == -1) ? 0 : mono_msec_ticks ();
-       do {
-               ret = WaitForMultipleObjectsEx (numhandles, handles, FALSE, ms, TRUE);
-               if (ret != WAIT_IO_COMPLETION)
-                       break;
-               if (ms != -1) {
-                       guint32 diff;
-
-                       diff = mono_msec_ticks () - start;
-                       ms -= diff;
-                       if (ms <= 0)
-                               break;
-               }
-       } while (ms == -1 || ms > 0);
+       ret = mono_wait_uninterrupted (thread, TRUE, numhandles, handles, FALSE, ms, TRUE);
 
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
 
@@ -1489,19 +1508,14 @@ gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this
 
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
        
-       ret=WaitForSingleObjectEx (handle, ms, TRUE);
+       ret = mono_wait_uninterrupted (thread, FALSE, 1, &handle, FALSE, ms, TRUE);
        
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
        
        if(ret==WAIT_FAILED) {
                THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait failed", __func__, GetCurrentThreadId ()));
                return(FALSE);
-       } else if(ret==WAIT_TIMEOUT || ret == WAIT_IO_COMPLETION) {
-               /* Do we want to try again if we get
-                * WAIT_IO_COMPLETION? The documentation for
-                * WaitHandle doesn't give any clues.  (We'd have to
-                * fiddle with the timeout if we retry.)
-                */
+       } else if(ret==WAIT_TIMEOUT) {
                THREAD_WAIT_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Wait timed out", __func__, GetCurrentThreadId ()));
                return(FALSE);
        }
index 148ffbcbcb347e293c5850748e5d4522b51a0214..f4e6a71804e9417ee4bd9015c00ece2a761d9c31 100644 (file)
@@ -112,9 +112,13 @@ endif
 
 noinst_PROGRAMS = genmdesc
 
+if DISABLE_EXECUTABLES
+shared_libraries = $(boehm_libraries) $(sgen_libraries)
+else
 if SHARED_MONO
 shared_libraries = $(boehm_libraries) $(sgen_libraries)
 endif
+endif
 
 lib_LTLIBRARIES = $(shared_libraries)
 
@@ -543,6 +547,10 @@ libmonosgen_2_0_la_SOURCES =
 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
 
+if PLATFORM_ANDROID
+libmonosgen_2_0_la_LDFLAGS = -avoid-version
+endif
+
 if MOONLIGHT
 libmono_moon_la_SOURCES = $(libmini_la_SOURCES)
 if MOONLIGHT_BOEHM
@@ -662,10 +670,10 @@ gctest: mono gc-test.exe
 LLVM_AOT_RUNTIME_OPTS=$(if $(LLVM),--llvm,)
 
 aotcheck: mono $(regtests)
-       rm -f *.exe.so *.exe.dylib *.exe.dylib.dSYM
+       rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
        $(RUNTIME) $(LLVM_AOT_RUNTIME_OPTS) --aot $(regtests) || exit 1
        for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
-       rm -f *.exe.so *.exe.dylib *.exe.dylib.dSYM
+       rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
 
 llvmaotcheck:
        $(MAKE) aotcheck LLVM=1
index ee8834a56ee5806b44c5b341e92bb3741c4b0562..d897f13e11e7f0a9bde889d27adc79b756db3904 100644 (file)
@@ -125,6 +125,7 @@ typedef struct MonoAotOptions {
        gboolean log_generics;
        gboolean direct_pinvoke;
        gboolean direct_icalls;
+       gboolean no_direct_calls;
        int nthreads;
        int ntrampolines;
        int nrgctx_trampolines;
@@ -217,6 +218,10 @@ typedef struct MonoAotCompile {
        GHashTable *plt_entry_debug_sym_cache;
        gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
        GHashTable *ginst_hash;
+       gboolean global_symbols;
+#ifdef MONOTOUCH
+       gboolean direct_method_addresses;
+#endif
 } MonoAotCompile;
 
 typedef struct {
@@ -609,6 +614,11 @@ arch_init (MonoAotCompile *acfg)
 #if defined(__linux__) && !defined(TARGET_ARM)
        acfg->need_pt_gnu_stack = TRUE;
 #endif
+
+#ifdef MONOTOUCH
+       acfg->direct_method_addresses = TRUE;
+       acfg->global_symbols = TRUE;
+#endif
 }
 
 /*
@@ -3703,7 +3713,7 @@ is_direct_callable (MonoAotCompile *acfg, MonoMethod *method, MonoJumpInfo *patc
                                // FIXME: Maybe call the wrapper directly ?
                                direct_callable = FALSE;
 
-                       if (acfg->aot_opts.soft_debug) {
+                       if (acfg->aot_opts.soft_debug || acfg->aot_opts.no_direct_calls) {
                                /* Disable this so all calls go through load_method (), see the
                                 * mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; line in
                                 * mono_debugger_agent_init ().
@@ -3773,7 +3783,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
        MonoMethodHeader *header;
        gboolean skip, direct_call;
        guint32 got_slot;
-       char direct_call_target [1024];
+       const char *direct_call_target;
        const char *direct_pinvoke;
 
        if (method) {
@@ -3826,8 +3836,9 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                                                MonoCompile *callee_cfg = g_hash_table_lookup (acfg->method_to_cfg, patch_info->data.method);
                                                //printf ("DIRECT: %s %s\n", method ? mono_method_full_name (method, TRUE) : "", mono_method_full_name (callee_cfg->method, TRUE));
                                                direct_call = TRUE;
-                                               g_assert (strlen (callee_cfg->asm_symbol) < 1000);
-                                               sprintf (direct_call_target, "%s", callee_cfg->asm_symbol);
+                                               direct_call_target = callee_cfg->asm_symbol;
+                                               patch_info->type = MONO_PATCH_INFO_NONE;
+                                               acfg->stats.direct_calls ++;
                                        }
 
                                        acfg->stats.all_calls ++;
@@ -3846,7 +3857,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
 #endif
                                                        direct_call = TRUE;
                                                        g_assert (strlen (direct_pinvoke) < 1000);
-                                                       sprintf (direct_call_target, "%s%s", prefix, direct_pinvoke);
+                                                       direct_call_target = g_strdup_printf ("%s%s", prefix, direct_pinvoke);
                                                }
                                        }
                                }
@@ -3861,7 +3872,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                                        if (plt_entry) {
                                                /* This patch has a PLT entry, so we must emit a call to the PLT entry */
                                                direct_call = TRUE;
-                                               sprintf (direct_call_target, "%s", plt_entry->symbol);
+                                               direct_call_target = plt_entry->symbol;
                
                                                /* Nullify the patch */
                                                patch_info->type = MONO_PATCH_INFO_NONE;
@@ -3969,7 +3980,7 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
        int method_index;
        guint8 *code;
        char *debug_sym = NULL;
-       char symbol [128];
+       char *symbol = NULL;
        int func_alignment = AOT_FUNC_ALIGNMENT;
        MonoMethodHeader *header;
        char *export_name;
@@ -3979,15 +3990,19 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
        header = cfg->header;
 
        method_index = get_method_index (acfg, method);
+       symbol = g_strdup_printf ("%sme_%x", acfg->temp_prefix, method_index);
 
-       /* Make the labels local */
-       sprintf (symbol, "%s", cfg->asm_symbol);
 
+       /* Make the labels local */
        emit_section_change (acfg, ".text", 0);
        emit_alignment (acfg, func_alignment);
-       emit_label (acfg, symbol);
+       
+       if (acfg->global_symbols && acfg->need_no_dead_strip)
+               fprintf (acfg->fp, "    .no_dead_strip %s\n", cfg->asm_symbol);
+       
+       emit_label (acfg, cfg->asm_symbol);
 
-       if (acfg->aot_opts.write_symbols) {
+       if (acfg->aot_opts.write_symbols && !acfg->global_symbols) {
                /* 
                 * Write a C style symbol for every method, this has two uses:
                 * - it works on platforms where the dwarf debugging info is not
@@ -3996,7 +4011,6 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
                 */
                debug_sym = get_debug_sym (method, "", acfg->method_label_hash);
 
-               sprintf (symbol, "%sme_%x", acfg->temp_prefix, method_index);
                if (acfg->need_no_dead_strip)
                        fprintf (acfg->fp, "    .no_dead_strip %s\n", debug_sym);
                emit_local_symbol (acfg, debug_sym, symbol, TRUE);
@@ -4011,7 +4025,7 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
        }
 
        if (cfg->verbose_level > 0)
-               g_print ("Method %s emitted as %s\n", mono_method_full_name (method, TRUE), symbol);
+               g_print ("Method %s emitted as %s\n", mono_method_full_name (method, TRUE), cfg->asm_symbol);
 
        acfg->stats.code_size += cfg->code_len;
 
@@ -4026,8 +4040,8 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
                g_free (debug_sym);
        }
 
-       sprintf (symbol, "%sme_%x", acfg->temp_prefix, method_index);
        emit_label (acfg, symbol);
+       g_free (symbol);
 }
 
 /**
@@ -4755,12 +4769,14 @@ emit_plt (MonoAotCompile *acfg)
                        /* Emit only a thumb version */
                        continue;
 
-               if (!acfg->thumb_mixed)
+               if (acfg->llvm && !acfg->thumb_mixed)
                        emit_label (acfg, plt_entry->llvm_symbol);
 
                if (debug_sym) {
-                       if (acfg->need_no_dead_strip)
+                       if (acfg->need_no_dead_strip) {
+                               img_writer_emit_unset_mode (acfg->w);
                                fprintf (acfg->fp, "    .no_dead_strip %s\n", debug_sym);
+                       }
                        emit_local_symbol (acfg, debug_sym, NULL, TRUE);
                        emit_label (acfg, debug_sym);
                }
@@ -5246,6 +5262,12 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        opts->direct_pinvoke = TRUE;
                } else if (str_begins_with (arg, "direct-icalls")) {
                        opts->direct_icalls = TRUE;
+#if defined(TARGET_ARM)
+               } else if (str_begins_with (arg, "iphone-abi")) {
+                       // older full-aot users did depend on this.
+#endif
+               } else if (str_begins_with (arg, "no-direct-calls")) {
+                       opts->no_direct_calls = TRUE;
                } else if (str_begins_with (arg, "print-skipped")) {
                        opts->print_skipped_methods = TRUE;
                } else if (str_begins_with (arg, "stats")) {
@@ -5872,7 +5894,7 @@ mono_aot_patch_info_dup (MonoJumpInfo* ji)
 static void
 emit_llvm_file (MonoAotCompile *acfg)
 {
-       char *command, *opts;
+       char *command, *opts, *tempbc;
        int i;
        MonoJumpInfo *patch_info;
 
@@ -5906,7 +5928,7 @@ emit_llvm_file (MonoAotCompile *acfg)
                 */
                if (strcmp (acfg->image->assembly->aname.name, "mscorlib") == 0) {
                        /* For the generic + rgctx trampolines */
-                       acfg->final_got_size += 200;
+                       acfg->final_got_size += 400;
                        /* For the specific trampolines */
                        for (ntype = 0; ntype < MONO_AOT_TRAMP_NUM; ++ntype)
                                acfg->final_got_size += acfg->num_trampolines [ntype] * 2;
@@ -5914,7 +5936,9 @@ emit_llvm_file (MonoAotCompile *acfg)
        }
 
 
-       mono_llvm_emit_aot_module ("temp.bc", acfg->final_got_size);
+       tempbc = g_strdup_printf ("%s.bc", acfg->tmpfname);
+       mono_llvm_emit_aot_module (tempbc, acfg->final_got_size);
+       g_free (tempbc);
 
        /*
         * FIXME: Experiment with adding optimizations, the -std-compile-opts set takes
@@ -5933,7 +5957,7 @@ emit_llvm_file (MonoAotCompile *acfg)
        opts = g_strdup ("-instcombine -simplifycfg");
        opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify -domtree -verify");
 #if 1
-       command = g_strdup_printf ("%sopt -f %s -o temp.opt.bc temp.bc", acfg->aot_opts.llvm_path, opts);
+       command = g_strdup_printf ("%sopt -f %s -o %s.opt.bc %s.bc", acfg->aot_opts.llvm_path, opts, acfg->tmpfname, acfg->tmpfname);
        printf ("Executing opt: %s\n", command);
        if (system (command) != 0) {
                exit (1);
@@ -5956,7 +5980,7 @@ emit_llvm_file (MonoAotCompile *acfg)
                g_string_append_printf (acfg->llc_args, " -relocation-model=pic");
        unlink (acfg->tmpfname);
 
-       command = g_strdup_printf ("%sllc %s -disable-gnu-eh-frame -enable-mono-eh-frame -o %s temp.opt.bc", acfg->aot_opts.llvm_path, acfg->llc_args->str, acfg->tmpfname);
+       command = g_strdup_printf ("%sllc %s -disable-gnu-eh-frame -enable-mono-eh-frame -o %s %s.opt.bc", acfg->aot_opts.llvm_path, acfg->llc_args->str, acfg->tmpfname, acfg->tmpfname);
 
        printf ("Executing llc: %s\n", command);
 
@@ -6074,6 +6098,46 @@ emit_code (MonoAotCompile *acfg)
                }
        }
 
+#ifdef MONOTOUCH
+       if (acfg->direct_method_addresses) {
+               acfg->flags |= MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES;
+
+               sprintf (symbol, "method_addresses");
+               emit_section_change (acfg, RODATA_SECT, 1);
+               emit_alignment (acfg, 8);
+               emit_label (acfg, symbol);
+
+               for (i = 0; i < acfg->nmethods; ++i) {
+                       if (acfg->cfgs [i]) {
+                               emit_pointer (acfg, acfg->cfgs [i]->asm_symbol);
+                       } else {
+                               emit_pointer (acfg, NULL);
+                       }
+               }
+
+               /* Empty */
+               sprintf (symbol, "code_offsets");
+               emit_section_change (acfg, RODATA_SECT, 1);
+               emit_alignment (acfg, 8);
+               emit_label (acfg, symbol);
+       } else {
+               sprintf (symbol, "code_offsets");
+               emit_section_change (acfg, RODATA_SECT, 1);
+               emit_alignment (acfg, 8);
+               emit_label (acfg, symbol);
+
+               acfg->stats.offsets_size += acfg->nmethods * 4;
+
+               sprintf (end_symbol, "methods");
+               for (i = 0; i < acfg->nmethods; ++i) {
+                       if (acfg->cfgs [i]) {
+                               emit_symbol_diff (acfg, acfg->cfgs [i]->asm_symbol, end_symbol, 0);
+                       } else {
+                               emit_int32 (acfg, 0xffffffff);
+                       }
+               }
+       }
+#else
        sprintf (symbol, "code_offsets");
        emit_section_change (acfg, RODATA_SECT, 1);
        emit_alignment (acfg, 8);
@@ -6089,6 +6153,7 @@ emit_code (MonoAotCompile *acfg)
                        emit_int32 (acfg, 0xffffffff);
                }
        }
+#endif
        emit_line (acfg);
 
        /* Emit a sorted table mapping methods to their unbox trampolines */
@@ -6997,6 +7062,9 @@ emit_file_info (MonoAotCompile *acfg)
        emit_pointer (acfg, "method_info_offsets");
        emit_pointer (acfg, "ex_info_offsets");
        emit_pointer (acfg, "code_offsets");
+#ifdef MONOTOUCH
+       emit_pointer (acfg, "method_addresses");
+#endif
        emit_pointer (acfg, "extra_method_info_offsets");
        emit_pointer (acfg, "extra_method_table");
        emit_pointer (acfg, "got_info_offsets");
@@ -7048,20 +7116,22 @@ emit_file_info (MonoAotCompile *acfg)
                emit_int32 (acfg, acfg->trampoline_size [i]);
 
 #if defined (TARGET_ARM) && defined (TARGET_MACH)
-       {
-               MonoType t;
-               int align = 0;
+       {
+               MonoType t;
+               int align = 0;
 
-               t.type = MONO_TYPE_R8;
-               mono_type_size (&t, &align);
+               memset (&t, 0, sizeof (MonoType));
+               t.type = MONO_TYPE_R8;
+               mono_type_size (&t, &align);
 
-               emit_int32 (acfg, align);
+               emit_int32 (acfg, align);
 
-               t.type = MONO_TYPE_I8;
-               mono_type_size (&t, &align);
+               memset (&t, 0, sizeof (MonoType));
+               t.type = MONO_TYPE_I8;
+               mono_type_size (&t, &align);
 
-               emit_int32 (acfg, align);
-       }
+               emit_int32 (acfg, align);
+       }
 #else
        emit_int32 (acfg, __alignof__ (double));
        emit_int32 (acfg, __alignof__ (gint64));
@@ -7112,7 +7182,7 @@ emit_dwarf_info (MonoAotCompile *acfg)
 {
 #ifdef EMIT_DWARF_INFO
        int i;
-       char symbol [128], symbol2 [128];
+       char symbol2 [128];
 
        /* DIEs for methods */
        for (i = 0; i < acfg->nmethods; ++i) {
@@ -7125,10 +7195,9 @@ emit_dwarf_info (MonoAotCompile *acfg)
                if (cfg->compile_llvm)
                        continue;
 
-               sprintf (symbol, "%s", cfg->asm_symbol);
                sprintf (symbol2, "%sme_%x", acfg->temp_prefix, i);
 
-               mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, symbol, symbol2, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->method, mono_domain_get ()));
+               mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, cfg->asm_symbol, symbol2, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->method, mono_domain_get ()));
        }
 #endif
 }
@@ -7694,6 +7763,8 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
                        if (COMPILE_LLVM (cfg))
                                cfg->asm_symbol = g_strdup_printf ("%s%s", acfg->llvm_label_prefix, cfg->llvm_method_name);
+                       else if (acfg->global_symbols)
+                               cfg->asm_symbol = get_debug_sym (cfg->method, "", acfg->method_label_hash);
                        else
                                cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index);
                }
index 0a51626141dfc6f64b9af4413a05d1a0e7671186..c6866c4a9ad3091ac32a26103d23e05d119acf47 100644 (file)
@@ -98,6 +98,9 @@ typedef struct MonoAotModule {
        guint8 *plt_end;
        guint8 *blob;
        gint32 *code_offsets;
+#ifdef MONOTOUCH
+       gpointer *method_addresses;
+#endif
        /* This contains <offset, index> pairs sorted by offset */
        /* This is needed because LLVM emitted methods can be in any order */
        gint32 *sorted_code_offsets;
@@ -1568,6 +1571,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        }
 
        amodule->code_offsets = info->code_offsets;
+#ifdef MONOTOUCH
+       amodule->method_addresses = info->method_addresses;
+#endif
        amodule->code = info->methods;
 #ifdef TARGET_ARM
        /* Mask out thumb interop bit */
@@ -1594,6 +1600,19 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        amodule->trampolines [MONO_AOT_TRAMP_IMT_THUNK] = info->imt_thunks;
        amodule->thumb_end = info->thumb_end;
 
+#ifdef MONOTOUCH
+       if (info->flags & MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES) {
+               /* Compute code_offsets from the method addresses */
+               amodule->code_offsets = g_malloc0 (amodule->info.nmethods * sizeof (gint32));
+               for (i = 0; i < amodule->info.nmethods; ++i) {
+                       if (!amodule->method_addresses [i])
+                               amodule->code_offsets [i] = 0xffffffff;
+                       else
+                               amodule->code_offsets [i] = (char*)amodule->method_addresses [i] - (char*)amodule->code;
+               }
+       }
+#endif
+
        if (make_unreadable) {
 #ifndef TARGET_WIN32
                guint8 *addr;
@@ -2946,7 +2965,7 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                        if (!method)
                                method = mono_get_method (image, token, NULL);
                        full_name = mono_method_full_name (method, TRUE);
-                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT NOT FOUND: %s.\n", full_name);
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT NOT FOUND: %s.", full_name);
                        g_free (full_name);
                }
                return NULL;
@@ -2956,7 +2975,7 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
 
        info = &amodule->blob [mono_aot_get_offset (amodule->method_info_offsets, method_index)];
 
-       if (amodule->thumb_end && code < amodule->thumb_end) {
+       if (amodule->thumb_end && code < amodule->thumb_end && ((amodule->info.flags & MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES) == 0)) {
                /* Convert this into a thumb address */
                g_assert ((amodule->code_offsets [method_index] & 0x1) == 0);
                code = &amodule->code [amodule->code_offsets [method_index] + 1];
@@ -3058,7 +3077,7 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                if (!jinfo)
                        jinfo = mono_aot_find_jit_info (domain, amodule->assembly->image, code);
 
-               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT FOUND method %s [%p - %p %p]\n", full_name, code, code + jinfo->code_size, info);
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT FOUND method %s [%p - %p %p]", full_name, code, code + jinfo->code_size, info);
                g_free (full_name);
        }
 
@@ -3653,10 +3672,23 @@ mono_aot_get_plt_entry (guint8 *code)
        g_assert_not_reached ();
 #endif
 
+#ifdef MONOTOUCH
+       while (target != NULL) {
+               if ((target >= (guint8*)(amodule->plt)) && (target < (guint8*)(amodule->plt_end)))
+                       return target;
+               
+               // Add 4 since mono_arch_get_call_target assumes we're passing
+               // the instruction after the actual branch instruction.
+               target = mono_arch_get_call_target (target + 4);
+       }
+
+       return NULL;
+#else
        if ((target >= (guint8*)(amodule->plt)) && (target < (guint8*)(amodule->plt_end)))
                return target;
        else
                return NULL;
+#endif
 }
 
 /*
@@ -3869,9 +3901,16 @@ get_numerous_trampoline (MonoAotTrampoline tramp_type, int n_got_slots, MonoAotM
 
        *out_amodule = amodule;
 
-       if (amodule->trampoline_index [tramp_type] == amodule->info.num_trampolines [tramp_type])
-               g_error ("Ran out of trampolines of type %d in '%s' (%d)\n", tramp_type, image->name, amodule->info.num_trampolines [tramp_type]);
-
+       if (amodule->trampoline_index [tramp_type] == amodule->info.num_trampolines [tramp_type]) {
+               g_error ("Ran out of trampolines of type %d in '%s' (%d)%s\n", 
+                        tramp_type, image->name, amodule->info.num_trampolines [tramp_type],
+#ifdef MONOTOUCH
+                        ". See http://docs.xamarin.com/ios/troubleshooting for instruction on how to fix this condition"
+#else
+                        ""
+#endif
+                        );
+       }
        index = amodule->trampoline_index [tramp_type] ++;
 
        mono_aot_unlock ();
index 2c47fa815020437f13709f6fb4c3748bd5d7279a..080b88263217d9892cb76d2dc749f9df5197fd0d 100644 (file)
@@ -80,6 +80,15 @@ int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
 #include "debugger-agent.h"
 #include "mini.h"
 
+/*
+On iOS we can't use System.Environment.Exit () as it will do the wrong
+shutdown sequence.
+*/
+#if !defined (TARGET_IOS)
+#define TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
+#endif
+
+
 #ifndef MONO_ARCH_SOFT_DEBUG_SUPPORTED
 #define DISABLE_DEBUGGER_AGENT 1
 #endif
@@ -1376,6 +1385,15 @@ static DebuggerTransport *transport;
 static DebuggerTransport transports [MAX_TRANSPORTS];
 static int ntransports;
 
+void
+mono_debugger_agent_register_transport (DebuggerTransport *trans);
+
+void
+mono_debugger_agent_register_transport (DebuggerTransport *trans)
+{
+       register_transport (trans);
+}
+
 static void
 register_transport (DebuggerTransport *trans)
 {
@@ -1438,6 +1456,12 @@ transport_recv (void *buf, int len)
        return transport->recv (buf, len);
 }
 
+gboolean
+mono_debugger_agent_transport_handshake (void)
+{
+       return transport_handshake ();
+}
+
 static gboolean
 transport_handshake (void)
 {
@@ -2536,13 +2560,19 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
                MonoJitInfo *ji;
 
                info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gpointer)(gsize)thread->tid, FALSE);
-               g_assert (info);
-
-               ji = mono_jit_info_table_find (info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
+               if (!info) {
+                       DEBUG(1, fprintf (log_file, "[%p] mono_thread_info_suspend_sync () failed for %p...\n", (gpointer)GetCurrentThreadId (), (gpointer)tid));
+                       /* 
+                        * Attached thread which died without detaching.
+                        */
+                       tls->terminated = TRUE;
+               } else {
+                       ji = mono_jit_info_table_find (info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
 
-               thread_interrupt (tls, info, NULL, ji);
+                       thread_interrupt (tls, info, NULL, ji);
 
-               mono_thread_info_resume (mono_thread_info_get_tid (info));
+                       mono_thread_info_resume (mono_thread_info_get_tid (info));
+               }
        } else {
                res = mono_thread_kill (thread, mono_thread_get_abort_signal ());
                if (res) {
@@ -5095,13 +5125,35 @@ mono_debugger_agent_debug_log_is_enabled (void)
        return agent_config.enabled;
 }
 
+#ifdef PLATFORM_ANDROID
+void
+mono_debugger_agent_unhandled_exception (MonoException *exc)
+{
+       int suspend_policy;
+       GSList *events;
+       EventInfo ei;
+
+       if (!inited)
+               return;
+
+       memset (&ei, 0, sizeof (EventInfo));
+       ei.exc = (MonoObject*)exc;
+
+       mono_loader_lock ();
+       events = create_event_list (EVENT_KIND_EXCEPTION, NULL, NULL, &ei, &suspend_policy);
+       mono_loader_unlock ();
+
+       process_event (EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy);
+}
+#endif
+
 void
 mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx, 
                                      MonoContext *catch_ctx)
 {
-       int suspend_policy;
+       int i, j, suspend_policy;
        GSList *events;
-       MonoJitInfo *ji;
+       MonoJitInfo *ji, *catch_ji;
        EventInfo ei;
        DebuggerTlsData *tls = NULL;
 
@@ -5164,15 +5216,45 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx
                return;
 
        ji = mini_jit_info_table_find (mono_domain_get (), MONO_CONTEXT_GET_IP (throw_ctx), NULL);
+       if (catch_ctx)
+               catch_ji = mini_jit_info_table_find (mono_domain_get (), MONO_CONTEXT_GET_IP (catch_ctx), NULL);
+       else
+               catch_ji = NULL;
 
        ei.exc = (MonoObject*)exc;
        ei.caught = catch_ctx != NULL;
 
        mono_loader_lock ();
+
+       /* Treat exceptions which are caught in non-user code as unhandled */
+       for (i = 0; i < event_requests->len; ++i) {
+               EventRequest *req = g_ptr_array_index (event_requests, i);
+               if (req->event_kind != EVENT_KIND_EXCEPTION)
+                       continue;
+
+               for (j = 0; j < req->nmodifiers; ++j) {
+                       Modifier *mod = &req->modifiers [j];
+
+                       if (mod->kind == MOD_KIND_ASSEMBLY_ONLY && catch_ji) {
+                               int k;
+                               gboolean found = FALSE;
+                               MonoAssembly **assemblies = mod->data.assemblies;
+
+                               if (assemblies) {
+                                       for (k = 0; assemblies [k]; ++k)
+                                               if (assemblies [k] == catch_ji->method->klass->image->assembly)
+                                                       found = TRUE;
+                               }
+                               if (!found)
+                                       ei.caught = FALSE;
+                       }
+               }
+       }
+
        events = create_event_list (EVENT_KIND_EXCEPTION, NULL, ji, &ei, &suspend_policy);
        mono_loader_unlock ();
 
-       if (tls && catch_ctx) {
+       if (tls && ei.caught && catch_ctx) {
                tls->catch_ctx = *catch_ctx;
                tls->has_catch_ctx = TRUE;
        }
@@ -6278,9 +6360,11 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
                suspend_vm ();
                wait_for_suspend ();
 
+#ifdef TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
                env_class = mono_class_from_name (mono_defaults.corlib, "System", "Environment");
                if (env_class)
                        exit_method = mono_class_get_method_from_name (env_class, "Exit", 1);
+#endif
 
                mono_loader_lock ();
                thread = mono_g_hash_table_find (tid_to_thread, is_really_suspended, NULL);
@@ -8574,8 +8658,10 @@ debugger_thread (void *arg)
                res = transport_recv (header, HEADER_LENGTH);
 
                /* This will break if the socket is closed during shutdown too */
-               if (res != HEADER_LENGTH)
+               if (res != HEADER_LENGTH) {
+                       DEBUG (1, fprintf (log_file, "[dbg] transport_recv () returned %d, expected %d.\n", res, HEADER_LENGTH));
                        break;
+               }
 
                p = header;
                end = header + HEADER_LENGTH;
@@ -8605,8 +8691,10 @@ debugger_thread (void *arg)
                if (len - HEADER_LENGTH > 0)
                {
                        res = transport_recv (data, len - HEADER_LENGTH);
-                       if (res != len - HEADER_LENGTH)
+                       if (res != len - HEADER_LENGTH) {
+                               DEBUG (1, fprintf (log_file, "[dbg] transport_recv () returned %d, expected %d.\n", res, len - HEADER_LENGTH));
                                break;
+                       }
                }
 
                p = data;
index cc0a2b97804b941689f1c203b328b52de188ce5a..7a7b9473a030166fbc2bfad1dfef82aded818b60 100644 (file)
@@ -30,6 +30,11 @@ mono_debugger_agent_free_domain_info (MonoDomain *domain) MONO_INTERNAL;
 
 gboolean mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji) MONO_INTERNAL;
 
+#ifdef PLATFORM_ANDROID
+void
+mono_debugger_agent_unhandled_exception (MonoException *exc);
+#endif
+
 void
 mono_debugger_agent_handle_exception (MonoException *ext, MonoContext *throw_ctx, MonoContext *catch_ctx) MONO_INTERNAL;
 
@@ -48,4 +53,7 @@ mono_debugger_agent_debug_log (int level, MonoString *category, MonoString *mess
 gboolean
 mono_debugger_agent_debug_log_is_enabled (void) MONO_INTERNAL;
 
+gboolean
+mono_debugger_agent_transport_handshake (void) MONO_INTERNAL;
+
 #endif
index f0cfe10d08856ff8b55aee7beb6b88b020354a9b..2f216dda226e0456f03c6df7c38fda188a367ed3 100644 (file)
@@ -52,6 +52,7 @@ struct _MonoDwarfWriter
        const char *temp_prefix;
        gboolean emit_line, appending, collect_line_info;
        GSList *line_info;
+       int cur_file_index;
 };
 
 static void
@@ -111,6 +112,7 @@ mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_st
        w->class_to_vtype_die = g_hash_table_new (NULL, NULL);
        w->class_to_pointer_die = g_hash_table_new (NULL, NULL);
        w->class_to_reference_die = g_hash_table_new (NULL, NULL);
+       w->cur_file_index = -1;
 
        return w;
 }
@@ -449,7 +451,9 @@ static int compile_unit_attr [] = {
 
 static int subprogram_attr [] = {
        DW_AT_name         , DW_FORM_string,
+#ifndef TARGET_IOS
        DW_AT_description  , DW_FORM_string,
+#endif
     DW_AT_low_pc       , DW_FORM_addr,
     DW_AT_high_pc      , DW_FORM_addr,
        DW_AT_frame_base   , DW_FORM_block1
@@ -457,7 +461,9 @@ static int subprogram_attr [] = {
 
 static int tramp_subprogram_attr [] = {
        DW_AT_name         , DW_FORM_string,
+#ifndef TARGET_IOS
        DW_AT_description  , DW_FORM_string,
+#endif
     DW_AT_low_pc       , DW_FORM_addr,
     DW_AT_high_pc      , DW_FORM_addr,
 };
@@ -759,14 +765,15 @@ emit_all_line_number_info (MonoDwarfWriter *w)
        int i;
        GHashTable *dir_to_index, *index_to_dir;
        GSList *l;
+       GSList *info_list;
 
        g_assert (w->collect_line_info);
 
        add_line_number_file_name (w, "<unknown>", 0, 0);
 
        /* Collect files */
-       // FIXME: Revert list
-       for (l = w->line_info; l; l = l->next) {
+       info_list = g_slist_reverse (w->line_info);
+       for (l = info_list; l; l = l->next) {
                MethodLineNumberInfo *info = l->data;
                MonoDebugMethodInfo *minfo;
                char *source_file;
@@ -873,11 +880,12 @@ emit_all_line_number_info (MonoDwarfWriter *w)
        emit_label (w, ".Ldebug_line_header_end");
 
        /* Emit line number table */
-       for (l = w->line_info; l; l = l->next) {
+       for (l = info_list; l; l = l->next) {
                MethodLineNumberInfo *info = l->data;
 
                emit_line_number_info (w, info->method, info->start_symbol, info->end_symbol, info->code, info->code_size, info->debug_info);
        }
+       g_slist_free (info_list);
 
        emit_byte (w, 0);
        emit_byte (w, 1);
@@ -1593,6 +1601,7 @@ emit_advance_op (MonoDwarfWriter *w, int line_diff, int addr_diff)
        if (opcode != 0) {
                emit_byte (w, opcode);
        } else {
+               //printf ("large: %d %d %d\n", line_diff, addr_diff, max_special_addr_diff);
                emit_byte (w, DW_LNS_advance_line);
                emit_sleb128 (w, line_diff);
                emit_byte (w, DW_LNS_advance_pc);
@@ -1626,7 +1635,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
        MonoDebugMethodInfo *minfo;
        MonoDebugLineNumberEntry *ln_array;
        int *native_to_il_offset = NULL;
-
+       
        if (!w->emit_line) {
                mono_metadata_free_mh (header);
                return;
@@ -1670,6 +1679,8 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
        prev_il_offset = -1;
 
        for (i = 0; i < code_size; ++i) {
+               int line_diff, addr_diff;
+
                if (!minfo)
                        continue;
 
@@ -1696,57 +1707,60 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
                prev_il_offset = il_offset;
 
                loc = mono_debug_symfile_lookup_location (minfo, il_offset);
-               if (loc && loc->source_file) {
-                       int line_diff = (gint32)loc->row - (gint32)prev_line;
-                       int addr_diff = i - prev_native_offset;
-
-                       if (first) {    
-                               emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
-
-                               emit_byte (w, 0);
-                               emit_byte (w, sizeof (gpointer) + 1);
-                               emit_byte (w, DW_LNE_set_address);
-                               if (start_symbol)
-                                       emit_pointer_unaligned (w, start_symbol);
-                               else
-                                       emit_pointer_value (w, code);
+               if (!(loc && loc->source_file))
+                       continue;
 
-                               /* 
-                                * The prolog+initlocals region does not have a line number, this
-                                * makes them belong to the first line of the method.
-                                */
-                               emit_byte (w, DW_LNS_advance_line);
-                               emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
-                               prev_line = loc->row;
-                       }
+               line_diff = (gint32)loc->row - (gint32)prev_line;
+               addr_diff = i - prev_native_offset;
+
+               if (first) {    
+                       emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
 
-                       if (loc->row != prev_line) {
-                               if (!prev_file_name || strcmp (loc->source_file, prev_file_name) != 0) {
-                                       /* Add an entry to the file table */
-                                       /* FIXME: Avoid duplicates */
-                                       if (w->collect_line_info)
-                                               file_index = get_line_number_file_name (w, loc->source_file) + 1;
-                                       else
-                                               file_index = emit_line_number_file_name (w, loc->source_file, 0, 0);
-                                       g_free (prev_file_name);
-                                       prev_file_name = g_strdup (loc->source_file);
+                       emit_byte (w, 0);
+                       emit_byte (w, sizeof (gpointer) + 1);
+                       emit_byte (w, DW_LNE_set_address);
+                       if (start_symbol)
+                               emit_pointer_unaligned (w, start_symbol);
+                       else
+                               emit_pointer_value (w, code);
+
+                       /* 
+                        * The prolog+initlocals region does not have a line number, this
+                        * makes them belong to the first line of the method.
+                        */
+                       emit_byte (w, DW_LNS_advance_line);
+                       //printf ("FIRST: %d %d %d\n", prev_line, loc->row, il_offset);
+                       emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
+                       prev_line = loc->row;
+                       first = FALSE;
+               }
 
+               if (loc->row != prev_line) {
+                       if (!prev_file_name || strcmp (loc->source_file, prev_file_name) != 0) {
+                               /* Add an entry to the file table */
+                               /* FIXME: Avoid duplicates */
+                               if (w->collect_line_info)
+                                       file_index = get_line_number_file_name (w, loc->source_file) + 1;
+                               else
+                                       file_index = emit_line_number_file_name (w, loc->source_file, 0, 0);
+                               g_free (prev_file_name);
+                               prev_file_name = g_strdup (loc->source_file);
+
+                               if (w->cur_file_index != file_index) {
                                        emit_byte (w, DW_LNS_set_file);
                                        emit_uleb128 (w, file_index);
                                        emit_byte (w, DW_LNS_copy);
-                               }
-                               //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
-
-                               emit_advance_op (w, line_diff, addr_diff);
-
-                               prev_line = loc->row;
-                               prev_native_offset = i;
+                                       w->cur_file_index = file_index;
+                               }                                       
                        }
+                       //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
+                       emit_advance_op (w, line_diff, addr_diff);
 
-                       first = FALSE;
-
-                       mono_debug_symfile_free_location (loc);
+                       prev_line = loc->row;
+                       prev_native_offset = i;
                }
+
+               mono_debug_symfile_free_location (loc);
        }
 
        g_free (native_to_il_offset);
@@ -1909,7 +1923,9 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod
        emit_uleb128 (w, ABBREV_SUBPROGRAM);
        name = mono_method_full_name (method, FALSE);
        emit_string (w, name);
+#ifndef TARGET_IOS
        emit_string (w, name);
+#endif
        g_free (name);
        if (start_symbol) {
                emit_pointer_unaligned (w, start_symbol);
index dc2cbb3f4452f1af4522cfb5a4ba71e56cd38b05..a8c8c0f2bd4c94c129c7645923f4a0668af3a874 100644 (file)
@@ -627,7 +627,7 @@ get_throw_trampoline (const char *name, gboolean rethrow, gboolean llvm, gboolea
                code = mono_arch_emit_load_aotconst (start, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, corlib ? "mono_x86_throw_corlib_exception" : "mono_x86_throw_exception");
                x86_call_reg (code, X86_EAX);
        } else {
-               x86_call_code (code, resume_unwind ? (mono_x86_resume_unwind) : (corlib ? (gpointer)mono_x86_throw_corlib_exception : (gpointer)mono_x86_throw_exception));
+               x86_call_code (code, resume_unwind ? (gpointer)(mono_x86_resume_unwind) : (corlib ? (gpointer)mono_x86_throw_corlib_exception : (gpointer)mono_x86_throw_exception));
        }
        x86_breakpoint (code);
 
@@ -867,6 +867,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
                        /* Pop arguments off the stack */
                        /* FIXME: Handle the delegate case too ((*lmf)->method == NULL) */
                        /* FIXME: Handle the IMT/vtable case too */
+#if 0
 #ifndef ENABLE_LLVM
                        if ((*lmf)->method) {
                                MonoMethod *method = (*lmf)->method;
@@ -875,6 +876,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
                                guint32 stack_to_pop = mono_arch_get_argument_info (NULL, mono_method_signature (method), mono_method_signature (method)->param_count, arg_info);
                                new_ctx->esp += stack_to_pop;
                        }
+#endif
 #endif
                }
                else
index c847d2d609ca6da004286685f27117a03741b278..8ea5c06d27d9cd60facb5d53be76dccae498183f 100644 (file)
@@ -2602,6 +2602,13 @@ END:
                ret
        }
 
+       .method public static default int32 test_1_sizeof_ref () cil managed {
+           call   int32 Tests::SizeOfT<object>()
+               sizeof [mscorlib]System.IntPtr
+               ceq
+               ret
+       }
+
   .field static public int32 volatile_int
 
        .method public static default int32 test_5_volatile_load_store () cil managed {
index de9413a871dcde746f3965788e0afb8f1598f300..e6d6d928142b51340c5c74658219982eb448b4ca 100644 (file)
@@ -1624,7 +1624,7 @@ asm_writer_emit_label (MonoImageWriter *acfg, const char *name)
 #if (defined(TARGET_X86) && defined(TARGET_ASM_APPLE))
         name = get_label(name);
         fprintf (acfg->fp, "%s:\n", name);
-        if (name[0] != 'L')
+        if (name[0] != 'L' && name[0] != '_')
             fprintf (acfg->fp, "_%s:\n", name);
 
 #elif (defined(HOST_WIN32) && (defined(TARGET_X86) || defined(TARGET_AMD64))) || (defined(TARGET_X86) && defined(TARGET_ASM_APPLE))
@@ -1789,7 +1789,7 @@ asm_writer_emit_symbol_diff (MonoImageWriter *acfg, const char *end, const char*
 
        if (offset == 0 && strcmp (start, ".") != 0) {
                char symbol [128];
-               sprintf (symbol, ".LDIFF_SYM%d", acfg->label_gen);
+               sprintf (symbol, "%sDIFF_SYM%d", AS_TEMP_LABEL_PREFIX, acfg->label_gen);
                acfg->label_gen ++;
                fprintf (acfg->fp, "\n%s=%s - %s", symbol, end, start);
                fprintf (acfg->fp, "\n\t%s ", AS_INT32_DIRECTIVE);
index d7cb2cbc82d26b4dc7f283da32cddcbfffcd40e7..5d80af79fd50dd8e25f027c59e491ed09ba7786a 100644 (file)
@@ -10,4 +10,5 @@ _MONO_DEBUGGER__notification_function:
 _MONO_DEBUGGER__debugger_info_ptr:
                .long   _MONO_DEBUGGER__debugger_info
 _MONO_DEBUGGER__using_debugger:
-               .quad   0
+               .long   0
+               .long   0
index 4df5f0af05aeb7a3f03b4b03be4eabd258dd755a..f8e641a2d275a8265d387bbaa9cf15a9b2e5b10e 100644 (file)
@@ -3920,6 +3920,7 @@ mono_emit_load_got_addr (MonoCompile *cfg)
                return;
 
        MONO_INST_NEW (cfg, getaddr, OP_LOAD_GOTADDR);
+       getaddr->cil_code = cfg->header->code;
        getaddr->dreg = cfg->got_var->dreg;
 
        /* Add it to the start of the first bblock */
@@ -5990,6 +5991,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        init_locals = header->init_locals;
 
        seq_points = cfg->gen_seq_points && cfg->method == method;
+#ifdef PLATFORM_ANDROID
+       seq_points &= cfg->method->wrapper_type == MONO_WRAPPER_NONE;
+#endif
 
        if (cfg->gen_seq_points && cfg->method == method) {
                minfo = mono_debug_lookup_method (method);
@@ -10088,6 +10092,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                token = read32 (ip + 2);
                                func = mono_method_get_wrapper_data (method, token);
                                info = mono_find_jit_icall_by_addr (func);
+                               if (!info)
+                                       g_error ("Could not find icall address in wrapper %s", mono_method_full_name (method, 1));
                                g_assert (info);
 
                                CHECK_STACK (info->sig->param_count);
@@ -10844,7 +10850,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                break;
                        }
                        case CEE_SIZEOF: {
-                               guint32 align;
+                               guint32 val;
                                int ialign;
 
                                CHECK_STACK_OVF (1);
@@ -10852,14 +10858,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                token = read32 (ip + 2);
                                if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !method->klass->image->dynamic && !generic_context) {
                                        MonoType *type = mono_type_create_from_typespec (image, token);
-                                       token = mono_type_size (type, &ialign);
+                                       val = mono_type_size (type, &ialign);
                                } else {
                                        MonoClass *klass = mono_class_get_full (image, token, generic_context);
                                        CHECK_TYPELOAD (klass);
                                        mono_class_init (klass);
-                                       token = mono_class_value_size (klass, &align);
+                                       val = mono_type_size (&klass->byval_arg, &ialign);
                                }
-                               EMIT_NEW_ICONST (cfg, ins, token);
+                               EMIT_NEW_ICONST (cfg, ins, val);
                                *sp++= ins;
                                ip += 6;
                                break;
index 0a9cd51a8defd81cc996626bd8461d78f09b2ad8..84e6bfd0c992773d57e708c9b4a37078d4db6b66 100644 (file)
@@ -387,6 +387,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_GC_MAPS_SUPPORTED 1
 #define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
+#define MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK 1
 
 gboolean
 mono_amd64_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
index 762a178c195873d3931ea8aa52a4b4dd5c3fbfa7..5d29dd4144c606ff1a176ae9489b3359247a7c18 100644 (file)
 
 #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1))
 
+#if __APPLE__
+void sys_icache_invalidate (void *start, size_t len);
+#endif
+
 static gint lmf_tls_offset = -1;
 static gint lmf_addr_tls_offset = -1;
 
index 027b0872049e1df1c0496b23d7c656b1cfe5a899..5ec06d20a748c8036e64b9900bbc623f3a47b723 100644 (file)
@@ -69,7 +69,7 @@
 #include <dlfcn.h>
 #include <AvailabilityMacros.h>
 
-#if (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5) && !defined (TARGET_ARM)
+#if defined (TARGET_OSX) && (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5)
 #define NEEDS_EXCEPTION_THREAD
 #endif
 
@@ -307,7 +307,7 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThrea
 
        mono_sigctx_to_monoctx (&ctx, &tctx->ctx);
 
-       domain_key = mono_domain_get_tls_offset ();
+       domain_key = mono_domain_get_tls_key ();
        jit_key = mono_get_jit_tls_key ();
 
        jit_tls = mono_mach_arch_get_tls_value_from_thread (thread_id, jit_key);
index 76414e7691ebecdd3d368d5b1ba5553f7c72a6c6..86dc4340937bcc24395c7e12137ba5f0cbe82edc 100644 (file)
@@ -47,6 +47,7 @@
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/environment.h>
 #include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-logger-internal.h>
 
 #include "mini.h"
 #include "debug-mini.h"
@@ -1366,7 +1367,9 @@ mono_handle_exception_internal_first_pass (MonoContext *ctx, gpointer obj, gint3
 
                                if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
                                        gboolean is_user_frame = ji->method->wrapper_type == MONO_WRAPPER_NONE || ji->method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD;
+#ifndef DISABLE_PERFCOUNTERS
                                        mono_perfcounters->exceptions_filters++;
+#endif
                                        mono_debugger_call_exception_handler (ei->data.filter, MONO_CONTEXT_GET_SP (ctx), ex_obj);
 
                                        /*
@@ -1560,7 +1563,7 @@ mono_handle_exception_internal (MonoContext *ctx, gpointer obj, gboolean resume,
                        mono_debugger_agent_handle_exception (obj, ctx, NULL);
 
                        if (mini_get_debug_options ()->suspend_on_unhandled) {
-                               fprintf (stderr, "Unhandled exception, suspending...");
+                               mono_runtime_printf_err ("Unhandled exception, suspending...");
                                while (1)
                                        ;
                        }
@@ -1723,7 +1726,9 @@ mono_handle_exception_internal (MonoContext *ctx, gpointer obj, gboolean resume,
                                        mono_debugger_call_exception_handler (ei->handler_start, MONO_CONTEXT_GET_SP (ctx), ex_obj);
                                        MONO_CONTEXT_SET_IP (ctx, ei->handler_start);
                                        *(mono_get_lmf_addr ()) = lmf;
+#ifndef DISABLE_PERFCOUNTERS
                                        mono_perfcounters->exceptions_depth += frame_count;
+#endif
                                        if (obj == domain->stack_overflow_ex)
                                                jit_tls->handling_stack_ovf = FALSE;
 
@@ -1747,7 +1752,9 @@ mono_handle_exception_internal (MonoContext *ctx, gpointer obj, gboolean resume,
                                        mono_profiler_exception_clause_handler (ji->method, ei->flags, i);
                                        jit_tls->orig_ex_ctx_set = FALSE;
                                        mono_debugger_call_exception_handler (ei->handler_start, MONO_CONTEXT_GET_SP (ctx), ex_obj);
+#ifndef DISABLE_PERFCOUNTERS
                                        mono_perfcounters->exceptions_finallys++;
+#endif
                                        *(mono_get_lmf_addr ()) = lmf;
                                        if (ji->from_llvm) {
                                                /* 
@@ -1900,7 +1907,9 @@ mono_debugger_run_finally (MonoContext *start_ctx)
 gboolean
 mono_handle_exception (MonoContext *ctx, gpointer obj)
 {
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->exceptions_thrown++;
+#endif
 
        return mono_handle_exception_internal (ctx, obj, FALSE, NULL);
 }
@@ -2084,7 +2093,7 @@ mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx,
                        /* We print a message: after this even managed stack overflows
                         * may crash the runtime
                         */
-                       fprintf (stderr, "Stack overflow in unmanaged: IP: %p, fault addr: %p\n", mono_arch_ip_from_context (ctx), fault_addr);
+                       mono_runtime_printf_err ("Stack overflow in unmanaged: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr);
                        if (!jit_tls->handling_stack_ovf) {
                                jit_tls->restore_stack_prot = restore_stack_protection_tramp;
                                jit_tls->handling_stack_ovf = 1;
@@ -2098,7 +2107,6 @@ mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx,
 }
 
 typedef struct {
-       FILE *stream;
        MonoMethod *omethod;
        int count;
 } PrintOverflowUserData;
@@ -2108,7 +2116,6 @@ print_overflow_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer da
 {
        MonoMethod *method = NULL;
        PrintOverflowUserData *user_data = data;
-       FILE *stream = user_data->stream;
        gchar *location;
 
        if (frame->ji)
@@ -2126,11 +2133,11 @@ print_overflow_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer da
                        return FALSE;
 
                location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ());
-               fprintf (stream, "  %s\n", location);
+               mono_runtime_printf_err ("  %s", location);
                g_free (location);
 
                if (user_data->count == 1) {
-                       fprintf (stream, "  <...>\n");
+                       mono_runtime_printf_err ("  <...>");
                        user_data->omethod = method;
                } else {
                        user_data->omethod = NULL;
@@ -2138,7 +2145,7 @@ print_overflow_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer da
 
                user_data->count ++;
        } else
-               fprintf (stream, "  at <unknown> <0x%05x>\n", frame->native_offset);
+               mono_runtime_printf_err ("  at <unknown> <0x%05x>", frame->native_offset);
 
        return FALSE;
 }
@@ -2150,41 +2157,39 @@ mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx,
        MonoContext mctx;
 
        /* we don't do much now, but we can warn the user with a useful message */
-       fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", mono_arch_ip_from_context (ctx), fault_addr);
+       mono_runtime_printf_err ("Stack overflow: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr);
 
 #ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
        mono_arch_sigctx_to_monoctx (ctx, &mctx);
                        
-       fprintf (stderr, "Stacktrace:\n");
+       mono_runtime_printf_err ("Stacktrace:");
 
        memset (&ud, 0, sizeof (ud));
-       ud.stream = stderr;
 
        mono_walk_stack_with_ctx (print_overflow_stack_frame, &mctx, MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud);
 #else
        if (ji && ji->method)
-               fprintf (stderr, "At %s\n", mono_method_full_name (ji->method, TRUE));
+               mono_runtime_printf_err ("At %s", mono_method_full_name (ji->method, TRUE));
        else
-               fprintf (stderr, "At <unmanaged>.\n");
+               mono_runtime_printf_err ("At <unmanaged>.");
 #endif
 
        _exit (1);
 }
 
 static gboolean
-print_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
+print_stack_frame_to_stderr (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
 {
-       FILE *stream = (FILE*)data;
        MonoMethod *method = NULL;
        if (frame->ji)
                method = frame->ji->method;
 
        if (method) {
                gchar *location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ());
-               fprintf (stream, "  %s\n", location);
+               mono_runtime_printf_err ("  %s", location);
                g_free (location);
        } else
-               fprintf (stream, "  at <unknown> <0x%05x>\n", frame->native_offset);
+               mono_runtime_printf_err ("  at <unknown> <0x%05x>", frame->native_offset);
 
        return FALSE;
 }
@@ -2227,7 +2232,7 @@ mono_handle_native_sigsegv (int signal, void *ctx)
                return;
 
        if (mini_get_debug_options ()->suspend_on_sigsegv) {
-               fprintf (stderr, "Received SIGSEGV, suspending...");
+               mono_runtime_printf_err ("Received SIGSEGV, suspending...");
                while (1)
                        ;
        }
@@ -2237,11 +2242,9 @@ mono_handle_native_sigsegv (int signal, void *ctx)
 
        /* !jit_tls means the thread was not registered with the runtime */
        if (jit_tls && mono_thread_internal_current ()) {
-               fprintf (stderr, "Stacktrace:\n\n");
-
-               mono_walk_stack (print_stack_frame, TRUE, stderr);
+               mono_runtime_printf_err ("Stacktrace:\n");
 
-               fflush (stderr);
+               mono_walk_stack (print_stack_frame_to_stderr, TRUE, NULL);
        }
 
 #ifdef HAVE_BACKTRACE_SYMBOLS
@@ -2251,17 +2254,15 @@ mono_handle_native_sigsegv (int signal, void *ctx)
        int i, size;
        const char *signal_str = (signal == SIGSEGV) ? "SIGSEGV" : "SIGABRT";
 
-       fprintf (stderr, "\nNative stacktrace:\n\n");
+       mono_runtime_printf_err ("\nNative stacktrace:\n");
 
        size = backtrace (array, 256);
        names = backtrace_symbols (array, size);
        for (i =0; i < size; ++i) {
-               fprintf (stderr, "\t%s\n", names [i]);
+               mono_runtime_printf_err ("\t%s", names [i]);
        }
        free (names);
 
-       fflush (stderr);
-
        /* Try to get more meaningful information using gdb */
 
 #if !defined(HOST_WIN32) && defined(HAVE_SYS_SYSCALL_H) && defined(SYS_fork)
@@ -2285,7 +2286,7 @@ mono_handle_native_sigsegv (int signal, void *ctx)
                        exit (1);
                }
 
-               fprintf (stderr, "\nDebug info from gdb:\n\n");
+               mono_runtime_printf_err ("\nDebug info from gdb:\n");
                waitpid (pid, &status, 0);
        }
 #endif
@@ -2294,14 +2295,14 @@ mono_handle_native_sigsegv (int signal, void *ctx)
         * on anything working. So try to print out lots of diagnostics, starting 
         * with ones which have a greater chance of working.
         */
-       fprintf (stderr,
+       mono_runtime_printf_err (
                         "\n"
                         "=================================================================\n"
                         "Got a %s while executing native code. This usually indicates\n"
                         "a fatal error in the mono runtime or one of the native libraries \n"
                         "used by your application.\n"
-                        "=================================================================\n"
-                        "\n", signal_str);
+                        "=================================================================\n",
+                       signal_str);
 
  }
 #endif
@@ -2358,17 +2359,17 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
 
        mono_walk_stack_with_ctx (print_stack_frame_to_string, &ctx, MONO_UNWIND_LOOKUP_ALL, text);
 #else
-       printf ("\t<Stack traces in thread dumps not supported on this platform>\n");
+       mono_runtime_printf ("\t<Stack traces in thread dumps not supported on this platform>");
 #endif
 
-       fprintf (stdout, "%s", text->str);
+       mono_runtime_printf ("%s", text->str);
 
 #if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG
        OutputDebugStringA(text->str);
 #endif
 
        g_string_free (text, TRUE);
-       fflush (stdout);
+       mono_runtime_stdout_fflush ();
 }
 
 /*
@@ -2658,12 +2659,15 @@ mono_invoke_unhandled_exception_hook (MonoObject *exc)
                MonoString *str = mono_object_to_string (exc, &other);
                if (str) {
                        char *msg = mono_string_to_utf8 (str);
-                       fprintf (stderr, "[ERROR] FATAL UNHANDLED EXCEPTION: %s\n", msg);
-                       fflush (stderr);
+                       mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
                        g_free (msg);
                }
 
+#if defined(__APPLE__) && defined(__arm__)
+               g_assertion_message ("Terminating runtime due to unhandled exception");
+#else
                exit (mono_environment_exitcode_get ());
+#endif
        }
 
        g_assert_not_reached ();
index f1121d079a3e42400d7006b3181255c18a410b75..b3c1519ddc80461929d9cd9f6ea670f3fe0bd2e9 100644 (file)
@@ -781,6 +781,8 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end)
 
                ji = frame.ji;
 
+               // FIXME: For skipped frames, scan the param area of the parent frame conservatively ?
+
                if (frame.type == FRAME_TYPE_MANAGED_TO_NATIVE) {
                        /*
                         * These frames are problematic for several reasons:
@@ -1304,30 +1306,50 @@ slot_to_fp_offset (MonoCompile *cfg, int slot)
        return (slot * SIZEOF_SLOT) + gcfg->min_offset;
 }
 
-static inline void
+static inline MONO_ALWAYS_INLINE void
 set_slot (MonoCompileGC *gcfg, int slot, int callsite_index, GCSlotType type)
 {
        g_assert (slot >= 0 && slot < gcfg->nslots);
 
        if (type == SLOT_PIN) {
-               clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
-               set_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+               clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+               set_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
        } else if (type == SLOT_REF) {
-               set_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
-               clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+               set_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+               clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
        } else if (type == SLOT_NOREF) {
-               clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
-               clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, callsite_index, slot);
+               clear_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
+               clear_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, slot, callsite_index);
        }
 }
 
 static inline void
 set_slot_everywhere (MonoCompileGC *gcfg, int slot, GCSlotType type)
 {
+       int width, pos;
+       guint8 *ref_bitmap, *pin_bitmap;
+
+       /*
        int cindex;
 
        for (cindex = 0; cindex < gcfg->ncallsites; ++cindex)
                set_slot (gcfg, slot, cindex, type);
+       */
+       ref_bitmap = gcfg->stack_ref_bitmap;
+       pin_bitmap = gcfg->stack_pin_bitmap;
+       width = gcfg->stack_bitmap_width;
+       pos = width * slot;
+
+       if (type == SLOT_PIN) {
+               memset (ref_bitmap + pos, 0, width);
+               memset (pin_bitmap + pos, 0xff, width);
+       } else if (type == SLOT_REF) {
+               memset (ref_bitmap + pos, 0xff, width);
+               memset (pin_bitmap + pos, 0, width);
+       } else if (type == SLOT_NOREF) {
+               memset (ref_bitmap + pos, 0, width);
+               memset (pin_bitmap + pos, 0, width);
+       }
 }
 
 static inline void
@@ -1348,14 +1370,14 @@ set_reg_slot (MonoCompileGC *gcfg, int slot, int callsite_index, GCSlotType type
        g_assert (slot >= 0 && slot < gcfg->nregs);
 
        if (type == SLOT_PIN) {
-               clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
-               set_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+               clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+               set_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
        } else if (type == SLOT_REF) {
-               set_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
-               clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+               set_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+               clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
        } else if (type == SLOT_NOREF) {
-               clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
-               clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, callsite_index, slot);
+               clear_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
+               clear_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, slot, callsite_index);
        }
 }
 
@@ -1648,10 +1670,6 @@ process_variables (MonoCompile *cfg)
                if (ins->inst_offset % SIZEOF_SLOT != 0)
                        continue;
 
-               if (is_arg && ins->inst_offset >= gcfg->max_offset)
-                       /* In parent frame */
-                       continue;
-
                pos = fp_offset_to_slot (cfg, ins->inst_offset);
 
                if (is_arg && ins->flags & MONO_INST_IS_DEAD) {
@@ -1698,11 +1716,13 @@ process_variables (MonoCompile *cfg)
                         * before the liveness pass. We emit OP_GC_LIVENESS_DEF instructions for
                         * them during VZERO decomposition.
                         */
-                       if (!pc_offsets [vmv->vreg])
-                               pin = TRUE;
+                       if (!is_arg) {
+                               if (!pc_offsets [vmv->vreg])
+                                       pin = TRUE;
 
-                       if (ins->backend.is_pinvoke)
-                               pin = TRUE;
+                               if (ins->backend.is_pinvoke)
+                                       pin = TRUE;
+                       }
 
                        if (bitmap) {
                                for (cindex = 0; cindex < gcfg->ncallsites; ++cindex) {
@@ -1772,7 +1792,7 @@ process_variables (MonoCompile *cfg)
                if (!mini_type_is_reference (cfg, t)) {
                        set_slot_everywhere (gcfg, pos, SLOT_NOREF);
                        if (cfg->verbose_level > 1)
-                               printf ("\tnoref at %s0x%x(fp) (R%d, slot = %d): %s\n", ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
+                               printf ("\tnoref%s at %s0x%x(fp) (R%d, slot = %d): %s\n", (is_arg ? " arg" : ""), ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
                        if (!t->byref && sizeof (mgreg_t) == 4 && (t->type == MONO_TYPE_I8 || t->type == MONO_TYPE_U8 || t->type == MONO_TYPE_R8)) {
                                set_slot_everywhere (gcfg, pos + 1, SLOT_NOREF);
                                if (cfg->verbose_level > 1)
@@ -1810,7 +1830,7 @@ process_variables (MonoCompile *cfg)
                }
 
                if (cfg->verbose_level > 1) {
-                       printf ("\tref at %s0x%x(fp) (R%d, slot = %d): %s\n", ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
+                       printf ("\tref%s at %s0x%x(fp) (R%d, slot = %d): %s\n", (is_arg ? " arg" : ""), ins->inst_offset < 0 ? "-" : "", (ins->inst_offset < 0) ? -(int)ins->inst_offset : (int)ins->inst_offset, vmv->vreg, pos, mono_type_full_name (ins->inst_vtype));
                }
        }
 
@@ -1838,28 +1858,6 @@ sp_offset_to_fp_offset (MonoCompile *cfg, int sp_offset)
 #endif
 }
 
-static GCSlotType
-type_to_gc_slot_type (MonoCompile *cfg, MonoType *t)
-{
-       if (t->byref)
-               return SLOT_PIN;
-       t = mini_type_get_underlying_type (NULL, t);
-       if (mini_type_is_reference (cfg, t))
-               return SLOT_REF;
-       else {
-               if (MONO_TYPE_ISSTRUCT (t)) {
-                       MonoClass *klass = mono_class_from_mono_type (t);
-                       if (!klass->has_references) {
-                               return SLOT_NOREF;
-                       } else {
-                               // FIXME:
-                               return SLOT_PIN;
-                       }
-               }
-               return SLOT_NOREF;
-       }
-}
-
 static void
 process_param_area_slots (MonoCompile *cfg)
 {
@@ -1909,54 +1907,10 @@ process_param_area_slots (MonoCompile *cfg)
                        set_slot_everywhere (gcfg, i, SLOT_NOREF);
        }
 
-       for (cindex = 0; cindex < gcfg->ncallsites; ++cindex) {
-               GCCallSite *callsite = gcfg->callsites [cindex];
-               GSList *l;
-
-               for (l = callsite->param_slots; l; l = l->next) {
-                       MonoInst *def = l->data;
-                       MonoType *t = def->inst_vtype;
-                       int sp_offset = def->inst_offset;
-                       int fp_offset = sp_offset_to_fp_offset (cfg, sp_offset);
-                       int slot = fp_offset_to_slot (cfg, fp_offset);
-                       GCSlotType type = type_to_gc_slot_type (cfg, t);
-
-                       if (MONO_TYPE_ISSTRUCT (t)) {
-                               guint32 align;
-                               guint32 size;
-                               int size_in_slots;
-                               gsize *bitmap;
-                               int j, numbits;
-
-                               size = mini_type_stack_size_full (cfg->generic_sharing_context, t, &align, FALSE);
-                               size_in_slots = ALIGN_TO (size, SIZEOF_SLOT) / SIZEOF_SLOT;
-
-                               bitmap = get_vtype_bitmap (t, &numbits);
-                               if (type == SLOT_NOREF || !bitmap) {
-                                       for (i = 0; i < size_in_slots; ++i) {
-                                               set_slot_in_range (gcfg, slot + i, def->backend.pc_offset, callsite->pc_offset + 1, type);
-                                       }
-                                       if (cfg->verbose_level > 1)
-                                               printf ("\t%s param area slots at %s0x%x(fp)=0x%x(sp) (slot = %d-%d) [0x%x-0x%x]\n", slot_type_to_string (type), get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, slot + (size / (int)sizeof (mgreg_t)), def->backend.pc_offset, callsite->pc_offset + 1);
-                               } else {
-                                       for (j = 0; j < numbits; ++j) {
-                                               if (bitmap [j / GC_BITS_PER_WORD] & ((gsize)1 << (j % GC_BITS_PER_WORD))) {
-                                                       /* The descriptor is for the boxed object */
-                                                       set_slot (gcfg, (slot + j - (sizeof (MonoObject) / SIZEOF_SLOT)), cindex, SLOT_REF);
-                                               }
-                                       }
-                                       if (cfg->verbose_level > 1)
-                                               printf ("\tvtype param area slots at %s0x%x(fp)=0x%x(sp) (slot = %d-%d) [0x%x-0x%x]\n", get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, slot + (size / (int)sizeof (mgreg_t)), def->backend.pc_offset, callsite->pc_offset + 1);
-                               }
-                               g_free (bitmap);
-                       } else {
-                               /* The slot is live between the def instruction and the call */
-                               set_slot_in_range (gcfg, slot, def->backend.pc_offset, callsite->pc_offset + 1, type);
-                               if (cfg->verbose_level > 1)
-                                       printf ("\t%s param area slot at %s0x%x(fp)=0x%x(sp) (slot = %d) [0x%x-0x%x]\n", slot_type_to_string (type), get_offset_sign (fp_offset), get_offset_val (fp_offset), sp_offset, slot, def->backend.pc_offset, callsite->pc_offset + 1);
-                       }
-               }
-       }
+       /*
+        * We treat param area slots as being part of the callee's frame, to be able to handle tail calls which overwrite
+        * the argument area of the caller.
+        */
 }
 
 static void
@@ -2047,8 +2001,14 @@ compute_frame_size (MonoCompile *cfg)
        for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
                MonoInst *ins = cfg->args [i];
 
-               if (ins->opcode == OP_REGOFFSET)
+               if (ins->opcode == OP_REGOFFSET) {
+                       int size, size_in_slots;
+                       size = mini_type_stack_size_full (cfg->generic_sharing_context, ins->inst_vtype, NULL, ins->backend.is_pinvoke);
+                       size_in_slots = ALIGN_TO (size, SIZEOF_SLOT) / SIZEOF_SLOT;
+
                        min_offset = MIN (min_offset, ins->inst_offset);
+                       max_offset = MAX ((int)max_offset, (int)(ins->inst_offset + (size_in_slots * SIZEOF_SLOT)));
+               }
        }
 
        /* Cfa slots */
@@ -2143,15 +2103,15 @@ init_gcfg (MonoCompile *cfg)
        gcfg->nregs = nregs;
        gcfg->callsites = callsites;
        gcfg->ncallsites = ncallsites;
-       gcfg->stack_bitmap_width = ALIGN_TO (nslots, 8) / 8;
-       gcfg->reg_bitmap_width = ALIGN_TO (nregs, 8) / 8;
-       gcfg->stack_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * ncallsites);
-       gcfg->stack_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * ncallsites);
-       gcfg->reg_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * ncallsites);
-       gcfg->reg_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * ncallsites);
+       gcfg->stack_bitmap_width = ALIGN_TO (ncallsites, 8) / 8;
+       gcfg->reg_bitmap_width = ALIGN_TO (ncallsites, 8) / 8;
+       gcfg->stack_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * nslots);
+       gcfg->stack_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->stack_bitmap_width * nslots);
+       gcfg->reg_ref_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * nregs);
+       gcfg->reg_pin_bitmap = mono_mempool_alloc0 (cfg->mempool, gcfg->reg_bitmap_width * nregs);
 
        /* All slots start out as PIN */
-       memset (gcfg->stack_pin_bitmap, 0xff, gcfg->stack_bitmap_width * ncallsites);
+       memset (gcfg->stack_pin_bitmap, 0xff, gcfg->stack_bitmap_width * nregs);
        for (i = 0; i < nregs; ++i) {
                /*
                 * By default, registers are NOREF.
@@ -2163,6 +2123,19 @@ init_gcfg (MonoCompile *cfg)
        }
 }
 
+static inline gboolean
+has_bit_set (guint8 *bitmap, int width, int slot)
+{
+       int i;
+       int pos = width * slot;
+
+       for (i = 0; i < width; ++i) {
+               if (bitmap [pos + i])
+                       break;
+       }
+       return i < width;
+}
+
 static void
 create_map (MonoCompile *cfg)
 {
@@ -2197,12 +2170,10 @@ create_map (MonoCompile *cfg)
                gboolean has_ref = FALSE;
                gboolean has_pin = FALSE;
 
-               for (j = 0; j < ncallsites; ++j) {
-                       if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, j, i))
-                               has_pin = TRUE;
-                       if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, j, i))
-                               has_ref = TRUE;
-               }
+               if (has_bit_set (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, i))
+                       has_pin = TRUE;
+               if (has_bit_set (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, i))
+                       has_ref = TRUE;
 
                if (has_ref)
                        has_ref_slots = TRUE;
@@ -2242,18 +2213,10 @@ create_map (MonoCompile *cfg)
                if (!(cfg->used_int_regs & (1 << i)))
                        continue;
 
-               for (j = 0; j < ncallsites; ++j) {
-                       if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, j, i)) {
-                               has_ref = TRUE;
-                               break;
-                       }
-               }
-               for (j = 0; j < ncallsites; ++j) {
-                       if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, j, i)) {
-                               has_pin = TRUE;
-                               break;
-                       }
-               }
+               if (has_bit_set (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, i))
+                       has_pin = TRUE;
+               if (has_bit_set (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, i))
+                       has_ref = TRUE;
 
                if (has_ref) {
                        reg_ref_mask |= (1 << i);
@@ -2272,6 +2235,7 @@ create_map (MonoCompile *cfg)
 
        /* Create the GC Map */
 
+       /* The work bitmaps have one row for each slot, since this is how we access them during construction */
        stack_bitmap_width = ALIGN_TO (end - start, 8) / 8;
        stack_bitmap_size = stack_bitmap_width * ncallsites;
        reg_ref_bitmap_width = ALIGN_TO (nref_regs, 8) / 8;
@@ -2308,7 +2272,7 @@ create_map (MonoCompile *cfg)
                bitmap = &bitmaps [map->stack_ref_bitmap_offset];
                for (i = 0; i < nslots; ++i) {
                        for (j = 0; j < ncallsites; ++j) {
-                               if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, j, i))
+                               if (get_bit (gcfg->stack_ref_bitmap, gcfg->stack_bitmap_width, i, j))
                                        set_bit (bitmap, stack_bitmap_width, j, i - start);
                        }
                }
@@ -2320,7 +2284,7 @@ create_map (MonoCompile *cfg)
                bitmap = &bitmaps [map->stack_pin_bitmap_offset];
                for (i = 0; i < nslots; ++i) {
                        for (j = 0; j < ncallsites; ++j) {
-                               if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, j, i))
+                               if (get_bit (gcfg->stack_pin_bitmap, gcfg->stack_bitmap_width, i, j))
                                        set_bit (bitmap, stack_bitmap_width, j, i - start);
                        }
                }
@@ -2334,7 +2298,7 @@ create_map (MonoCompile *cfg)
                for (i = 0; i < nregs; ++i) {
                        if (reg_ref_mask & (1 << i)) {
                                for (j = 0; j < ncallsites; ++j) {
-                                       if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, j, i))
+                                       if (get_bit (gcfg->reg_ref_bitmap, gcfg->reg_bitmap_width, i, j))
                                                set_bit (bitmap, reg_ref_bitmap_width, j, bindex);
                                }
                                bindex ++;
@@ -2350,7 +2314,7 @@ create_map (MonoCompile *cfg)
                for (i = 0; i < nregs; ++i) {
                        if (reg_pin_mask & (1 << i)) {
                                for (j = 0; j < ncallsites; ++j) {
-                                       if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, j, i))
+                                       if (get_bit (gcfg->reg_pin_bitmap, gcfg->reg_bitmap_width, i, j))
                                                set_bit (bitmap, reg_pin_bitmap_width, j, bindex);
                                }
                                bindex ++;
index 42be2e03cb07512ad6b50ddb7217d1ee26131f6d..2b90cd692daac6ad903e56bbb23cbbb5ff4cc6e2 100644 (file)
 // possible
 //
 
+#include "config.h"
+//undef those as llvm defines them on its own config.h as well.
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
 #include <stdint.h>
 
 #include <llvm/Support/raw_ostream.h>
        ((LLVM_MAJOR_VERSION > (major)) ||                                                                      \
         ((LLVM_MAJOR_VERSION == (major)) && (LLVM_MINOR_VERSION >= (minor))))
 
+// extern "C" void LLVMInitializeARMTargetInfo();
+// extern "C" void LLVMInitializeARMTarget ();
+// extern "C" void LLVMInitializeARMTargetMC ();
+
 using namespace llvm;
 
 class MonoJITMemoryManager : public JITMemoryManager
@@ -122,20 +134,16 @@ public:
        }
 
        virtual void* getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) {
-               if (!strcmp (Name.c_str (), "__bzero")) {
-                       return (void*)bzero;
-               } else {
-                       void *res;
-                       char *err;
-
-                       err = dlsym_cb (Name.c_str (), &res);
-                       if (err) {
-                               outs () << "Unable to resolve: " << Name << ": " << err << "\n";
-                               assert(0);
-                               return NULL;
-                       }
-                       return res;
+               void *res;
+               char *err;
+
+               err = dlsym_cb (Name.c_str (), &res);
+               if (err) {
+                       outs () << "Unable to resolve: " << Name << ": " << err << "\n";
+                       assert(0);
+                       return NULL;
                }
+               return res;
        }
 };
 
@@ -510,9 +518,15 @@ mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, Func
 
   force_pass_linking ();
 
+#ifdef TARGET_ARM
+  LLVMInitializeARMTarget ();
+  LLVMInitializeARMTargetInfo ();
+  LLVMInitializeARMTargetMC ();
+#else
   LLVMInitializeX86Target ();
   LLVMInitializeX86TargetInfo ();
   LLVMInitializeX86TargetMC ();
+#endif
 
   mono_mm = new MonoJITMemoryManager ();
   mono_mm->alloc_cb = alloc_cb;
index f97da754b4010fa5a3f92c46d92b893ac23e7ed9..ba19a35dc1b6d818cb65888686677d6ef877c633 100644 (file)
@@ -641,7 +641,7 @@ static const char*
 simd_op_to_intrins (int opcode)
 {
        switch (opcode) {
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
        case OP_MINPD:
                return "llvm.x86.sse2.min.pd";
        case OP_MINPS:
@@ -772,7 +772,7 @@ simd_op_to_intrins (int opcode)
 static LLVMTypeRef
 simd_op_to_llvm_type (int opcode)
 {
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
        switch (opcode) {
        case OP_EXTRACT_R8:
        case OP_EXPAND_R8:
@@ -1821,7 +1821,7 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
        LLVMValueRef *args;
        LLVMCallInfo *cinfo;
        GSList *l;
-       int i, len;
+       int i, len, nargs;
        gboolean vretaddr;
        LLVMTypeRef llvm_sig;
        gpointer target;
@@ -1943,23 +1943,27 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
        /* 
         * Collect and convert arguments
         */
-       len = sizeof (LLVMValueRef) * ((sig->param_count * 2) + sig->hasthis + vretaddr + call->rgctx_reg);
+       nargs = (sig->param_count * 2) + sig->hasthis + vretaddr + call->rgctx_reg + call->imt_arg_reg;
+       len = sizeof (LLVMValueRef) * nargs;
        args = alloca (len);
        memset (args, 0, len);
        l = call->out_ireg_args;
 
        if (call->rgctx_arg_reg) {
                g_assert (values [call->rgctx_arg_reg]);
+               g_assert (sinfo.rgctx_arg_pindex < nargs);
                args [sinfo.rgctx_arg_pindex] = values [call->rgctx_arg_reg];
        }
        if (call->imt_arg_reg) {
                g_assert (values [call->imt_arg_reg]);
+               g_assert (sinfo.imt_arg_pindex < nargs);
                args [sinfo.imt_arg_pindex] = values [call->imt_arg_reg];
        }
 
        if (vretaddr) {
                if (!addresses [call->inst.dreg])
                        addresses [call->inst.dreg] = build_alloca (ctx, sig->ret);
+               g_assert (sinfo.vret_arg_pindex < nargs);
                args [sinfo.vret_arg_pindex] = LLVMBuildPtrToInt (builder, addresses [call->inst.dreg], IntPtrType (), "");
        }
 
@@ -3428,7 +3432,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        /* 
                         * SIMD
                         */
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
                case OP_XZERO: {
                        values [ins->dreg] = LLVMConstNull (type_to_llvm_type (ctx, &ins->klass->byval_arg));
                        break;
@@ -4112,18 +4116,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 void
 mono_llvm_check_method_supported (MonoCompile *cfg)
 {
-       /*
        MonoMethodHeader *header = cfg->header;
        MonoExceptionClause *clause;
        int i;
-       */
 
        if (cfg->method->save_lmf) {
                cfg->exception_message = g_strdup ("lmf");
                cfg->disable_llvm = TRUE;
        }
 
-#if 0
+#if 1
        for (i = 0; i < header->num_clauses; ++i) {
                clause = &header->clauses [i];
                
@@ -4744,11 +4746,21 @@ static char*
 dlsym_cb (const char *name, void **symbol)
 {
        MonoDl *current;
+       char *err;
 
-       current = mono_dl_open (NULL, 0, NULL);
-       g_assert (current);
+       err = NULL;
+       if (!strcmp (name, "__bzero")) {
+               *symbol = (void*)bzero;
+       } else {
+               current = mono_dl_open (NULL, 0, NULL);
+               g_assert (current);
 
-       return mono_dl_symbol (current, name, symbol);
+               err = mono_dl_symbol (current, name, symbol);
+       }
+#ifdef MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK
+       *symbol = (char*)mono_arch_create_llvm_native_thunk (mono_domain_get (), (guint8*)(*symbol));
+#endif
+       return err;
 }
 
 static inline void
index 18f9a5a6bd58e2de992cba5cc07f868afd92d625..b2b88e9a0fd828098923067eeed9e8de04bd6b66 100644 (file)
@@ -100,7 +100,7 @@ MINI_OP(OP_STOREI8_MEMBASE_REG, "storei8_membase_reg", IREG, LREG, NONE)
 MINI_OP(OP_STORER4_MEMBASE_REG, "storer4_membase_reg", IREG, FREG, NONE)
 MINI_OP(OP_STORER8_MEMBASE_REG, "storer8_membase_reg", IREG, FREG, NONE)
 
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
 MINI_OP(OP_STOREX_MEMBASE_REG, "storex_membase_reg", IREG, XREG, NONE)
 MINI_OP(OP_STOREX_ALIGNED_MEMBASE_REG,     "storex_aligned_membase_reg", IREG, XREG, NONE)
 MINI_OP(OP_STOREX_NTA_MEMBASE_REG,     "storex_nta_membase_reg", IREG, XREG, NONE)
@@ -128,7 +128,7 @@ MINI_OP(OP_LOADR8_MEMBASE,"loadr8_membase", FREG, IREG, NONE)
 
 MINI_OP(OP_LOADX_MEMBASE,                      "loadx_membase", XREG, IREG, NONE)
 
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
 MINI_OP(OP_LOADX_ALIGNED_MEMBASE,  "loadx_aligned_membase", XREG, IREG, NONE)
 #endif
 
@@ -609,7 +609,7 @@ MINI_OP(OP_NOT_NULL, "not_null", NONE, IREG, NONE)
 
 /* SIMD opcodes. */
 
-#ifdef MONO_ARCH_SIMD_INTRINSICS
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
 
 MINI_OP(OP_ADDPS, "addps", XREG, XREG, XREG)
 MINI_OP(OP_DIVPS, "divps", XREG, XREG, XREG)
index f562ea7f5ad924c8a10714f185c3227ccc5e1020..75a6a7a24ad36c4a9a0a6749dc65e8949c692720 100644 (file)
@@ -3158,6 +3158,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        MonoCallInst *call = (MonoCallInst*)ins;
                        int pos = 0, i;
 
+                       ins->flags |= MONO_INST_GC_CALLSITE;
+                       ins->backend.pc_offset = code - cfg->native_code;
+
                        /* FIXME: no tracing support... */
                        if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
                                code = mono_arch_instrument_epilog (cfg, mono_profiler_method_leave, code, FALSE);
@@ -5906,9 +5909,9 @@ mono_arch_get_patch_offset (guint8 *code)
 {
        if ((code [0] == 0x8b) && (x86_modrm_mod (code [1]) == 0x2))
                return 2;
-       else if ((code [0] == 0xba))
+       else if (code [0] == 0xba)
                return 1;
-       else if ((code [0] == 0x68))
+       else if (code [0] == 0x68)
                /* push IMM */
                return 1;
        else if ((code [0] == 0xff) && (x86_modrm_reg (code [1]) == 0x6))
index f52a44fa2152437471def187b4888fc2e146dcdc..a80150fa634f52978c3dacb5f6f61fb61d00a97f 100644 (file)
@@ -5060,8 +5060,10 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, gbool
        }
 
        /* collect statistics */
+#ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->jit_methods++;
        mono_perfcounters->jit_bytes += header->code_size;
+#endif
        mono_jit_stats.allocated_code_size += cfg->code_len;
        code_size_ratio = cfg->code_len;
        if (code_size_ratio > mono_jit_stats.biggest_method_size && mono_jit_stats.enabled) {
@@ -5290,7 +5292,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
 
        if (mono_aot_only) {
                char *fullname = mono_method_full_name (method, TRUE);
-               char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only.\n", fullname);
+               char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.\n", fullname);
 
                *jit_ex = mono_get_exception_execution_engine (msg);
                g_free (fullname);
@@ -5597,7 +5599,7 @@ static void
 invalidated_delegate_trampoline (char *desc)
 {
        g_error ("Unmanaged code called delegate of type %s which was already garbage collected.\n"
-                "See http://www.go-mono.com/delegate.html for an explanation and ways to fix this.",
+                "See http://www.mono-project.com/Diagnostic:Delegate for an explanation and ways to fix this.",
                 desc);
 }
 #endif
@@ -6473,7 +6475,6 @@ mini_init (const char *filename, const char *runtime_version)
                g_thread_init (NULL);
 
        mono_native_tls_alloc (&mono_jit_tls_id, NULL);
-       setup_jit_tls_data ((gpointer)-1, mono_thread_abort);
 
        if (default_opt & MONO_OPT_AOT)
                mono_aot_init ();
@@ -6566,6 +6567,11 @@ mini_init (const char *filename, const char *runtime_version)
        mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers", 
                                mono_runtime_install_handlers);
 
+#ifdef PLATFORM_ANDROID
+       mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
+                               mono_debugger_agent_unhandled_exception);
+#endif
+
        mono_create_helper_signatures ();
 
        register_jit_stats ();
index 18b0050b62548ffe2699a4c4e87f415cac62d538..459589df19868e574794c56ad4d22a366cb686e7 100644 (file)
@@ -177,7 +177,8 @@ typedef enum {
 typedef enum {
        MONO_AOT_FILE_FLAG_WITH_LLVM = 1,
        MONO_AOT_FILE_FLAG_FULL_AOT = 2,
-       MONO_AOT_FILE_FLAG_DEBUG = 4
+       MONO_AOT_FILE_FLAG_DEBUG = 4,
+       MONO_AOT_FILE_FLAG_DIRECT_METHOD_ADDRESSES = 8
 } MonoAotFileFlags;
 
 /* This structure is stored in the AOT file */
@@ -203,6 +204,9 @@ typedef struct MonoAotFileInfo
        gpointer method_info_offsets;
        gpointer ex_info_offsets;
        gpointer code_offsets;
+#ifdef MONOTOUCH
+       gpointer method_addresses;
+#endif
        gpointer extra_method_info_offsets;
        gpointer extra_method_table;
        gpointer got_info_offsets;
@@ -2078,6 +2082,7 @@ gpointer  mono_arch_create_generic_class_init_trampoline (MonoTrampInfo **info,
 gpointer  mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) MONO_INTERNAL;
 gpointer  mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
 gpointer  mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
+guint8   *mono_arch_create_llvm_native_thunk     (MonoDomain *domain, guint8* addr) MONO_LLVM_INTERNAL;
 GList    *mono_arch_get_allocatable_int_vars    (MonoCompile *cfg) MONO_INTERNAL;
 GList    *mono_arch_get_global_int_regs         (MonoCompile *cfg) MONO_INTERNAL;
 GList    *mono_arch_get_global_fp_regs          (MonoCompile *cfg) MONO_INTERNAL;
index f8643d77cdf7acc45e68701666102cd430497dbf..d9a5b50e41fd2b1c4e44bfdf0daa605c99588e93 100644 (file)
 #include <mono/utils/mono-time.h>
 #include "trace.h"
 
+#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+#  undef printf
+#  define printf(...) g_log("mono", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#  undef fprintf
+#  define fprintf(__ignore, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#endif
+
 static MonoTraceSpec trace_spec;
 
 gboolean
index 3c108f307cf0cd91a1141a645ff4eef6f9295454..ee2c8c410c0d279b8ef4292bf084e51a6a9461bb 100644 (file)
@@ -233,6 +233,25 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr)
 #endif
 }
 
+guint8*
+mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr)
+{
+       /*
+        * The caller is LLVM code and the call displacement might exceed 32 bits. We can't determine the caller address, so
+        * we add a thunk every time.
+        * Since the caller is also allocated using the domain code manager, hopefully the displacement will fit into 32 bits.
+        * FIXME: Avoid this if possible if !MONO_ARCH_NOMAP32BIT and ADDR is 32 bits.
+        */
+       guint8 *thunk_start, *thunk_code;
+
+       thunk_start = thunk_code = mono_domain_code_reserve (mono_domain_get (), 32);
+       amd64_jump_membase (thunk_code, AMD64_RIP, 0);
+       *(guint64*)thunk_code = (guint64)addr;
+       addr = thunk_start;
+       mono_arch_flush_icache (thunk_start, thunk_code - thunk_start);
+       return addr;
+}
+
 void
 mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
 {
index 5711ef1f180ddc800105fa07612a4de5a281876d..1aeeeffa6bd5cb8f8a1c6a0977adbdb5c23c1100 100644 (file)
@@ -740,8 +740,13 @@ mono_arch_get_call_target (guint8 *code)
 {
        guint32 ins = ((guint32*)(gpointer)code) [-1];
 
+#if MONOTOUCH
+       /* Should be a 'bl' or a 'b' */
+       if (((ins >> 25) & 0x7) == 0x5) {
+#else
        /* Should be a 'bl' */
        if ((((ins >> 25) & 0x7) == 0x5) && (((ins >> 24) & 0x1) == 0x1)) {
+#endif
                gint32 disp = ((gint32)ins) & 0xffffff;
                guint8 *target = code - 4 + 8 + (disp * 4);
 
index 54079cb200365c6b0c91954bbe2d4d8768fe7128..09dc882e07195a54f2c7db250b9fb6eccfba309f 100644 (file)
@@ -125,7 +125,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr)
         */
        code -= 6;
        orig_code -= 6;
-       if ((code [1] == 0xe8)) {
+       if (code [1] == 0xe8) {
                if (can_write) {
                        InterlockedExchange ((gint32*)(orig_code + 2), (guint)addr - ((guint)orig_code + 1) - 5);
 
index d40e38b8470c561a6a2238e56c7ff442bb171294..64fe072e9a09d9c1623d585fbaf01994761a3c37 100644 (file)
@@ -4,6 +4,9 @@ export HOST_CC
 endif
 
 if JIT_SUPPORTED
+if DISABLE_EXECUTABLES
+runtime_lib=../mini/$(LIBMONO_LA) $(static_libs)
+else
 if !SHARED_MONO
 static_libs=   \
        $(top_builddir)/mono/metadata/libmonoruntime-static.la  \
@@ -16,11 +19,15 @@ runtime_lib=../mini/$(LIBMONO_LA) $(static_libs)
 else
 runtime_lib=../mini/$(LIBMONO_LA)
 endif
+endif
 else
 runtime_lib=../interpreter/libmint.la
 endif
 
+if DISABLE_LIBRARIES
+else
 bin_PROGRAMS = monograph
+endif
 
 AM_CPPFLAGS =                          \
        -I$(top_srcdir)                 \
index 33dda5c379832cae7cb170ff1b4d4ef8346329ba..a6f029ab59049bd9db9348715527bbd936609c9b 100644 (file)
@@ -9,6 +9,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)         \
        $(GLIB_CFLAGS)
 
+if !DISABLE_LIBRARIES
 if !DISABLE_PROFILER
 if JIT_SUPPORTED
 bin_PROGRAMS = mprof-report
@@ -16,6 +17,10 @@ lib_LTLIBRARIES = libmono-profiler-cov.la libmono-profiler-aot.la libmono-profil
 if PLATFORM_DARWIN
 libmono_profiler_log_la_LDFLAGS = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 endif
+if PLATFORM_ANDROID
+libmono_profiler_log_la_LDFLAGS = -avoid-version
+endif
+endif
 endif
 endif
 
@@ -24,6 +29,9 @@ if HAVE_OPROFILE
 endif
 
 if SUPPORT_BOEHM
+if DISABLE_EXECUTABLES
+LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
+else
 if !SHARED_MONO
 static_libs=   \
        $(top_builddir)/mono/metadata/libmonoruntime-static.la  \
@@ -36,6 +44,7 @@ LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs)
 else
 LIBMONO=$(top_builddir)/mono/mini/$(LIBMONO_LA)
 endif
+endif
 else
 LIBMONO=$(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
 endif
@@ -51,6 +60,10 @@ libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_log_la_SOURCES = proflog.c
 libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
 
+if PLATFORM_ANDROID
+libmono_profiler_log_la_LIBADD += $(GLIB_LIBS)
+endif
+
 mprof_report_SOURCES = decode.c
 mprof_report_LDADD = $(Z_LIBS)
 
index bfb9be065089345c736603b245796cad2b865227..57e016c111ef1bc1aea96fd903a4b66c47c6f6e8 100644 (file)
@@ -791,33 +791,34 @@ test-type-load: TestDriver.dll
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
 
 
-EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs
+EXTRA_DIST += sgen-bridge.cs sgen-descriptors.cs sgen-gshared-vtype.cs sgen-bridge-major-fragmentation.cs sgen-domain-unload.cs
 
 SGEN_TESTS =   \
        sgen-descriptors.exe    \
-       sgen-gshared-vtype.exe
+       sgen-gshared-vtype.exe  \
+       sgen-domain-unload.exe
 
 sgen-regular-tests: $(SGEN_TESTS)
        @for fn in $+ ; do      \
                echo "Testing $$fn ...";        \
-               MONO_GC_PARAMS=major=marksweep-par MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
-               MONO_ENV_OPTIONS="--gc=sgen"                                    $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1; \
-               MONO_GC_PARAMS=major=marksweep-par,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;     \
-               MONO_GC_PARAMS=minor=split MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;     \
-               MONO_GC_PARAMS=major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;    \
-               MONO_GC_PARAMS=minor=split,major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;        \
-               MONO_GC_PARAMS=major=marksweep-par,minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;      \
-               MONO_GC_PARAMS=minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.stdout 2> $$fn.stderr || exit 1;      \
+               MONO_GC_PARAMS=major=marksweep-par MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.1.stdout 2> $$fn.1.stderr || exit 1;     \
+               MONO_ENV_OPTIONS="--gc=sgen"                                    $(RUNTIME) $$fn > $$fn.2.stdout 2> $$fn.2.stderr || exit 1;     \
+               MONO_GC_PARAMS=major=marksweep-par,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.3.stdout 2> $$fn.3.stderr || exit 1; \
+               MONO_GC_PARAMS=minor=split MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.4.stdout 2> $$fn.4.stderr || exit 1; \
+               MONO_GC_PARAMS=major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.5.stdout 2> $$fn.5.stderr || exit 1;        \
+               MONO_GC_PARAMS=minor=split,major=marksweep,concurrent-sweep MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.6.stdout 2> $$fn.6.stderr || exit 1;    \
+               MONO_GC_PARAMS=major=marksweep-par,minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) $$fn > $$fn.7.stdout 2> $$fn.7.stderr || exit 1;  \
+               MONO_GC_PARAMS=minor=split,alloc-ratio=95 MONO_ENV_OPTIONS="--gc=sgen"                     $(RUNTIME) $$fn > $$fn.8.stdout 2> $$fn.8.stderr || exit 1;  \
        done
 
 
 sgen-tests: sgen-regular-tests sgen-bridge.exe sgen-bridge-major-fragmentation.exe
        @echo "Testing sgen-bridge.exe ...";    \
-       MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.stdout 2> sgen-bridge.exe.stderr || exit 1;      \
-       MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.stdout 2> sgen-bridge.exe.stderr || exit 1;  \
+       MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.1.stdout 2> sgen-bridge.exe.1.stderr || exit 1;  \
+       MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge.exe > sgen-bridge.exe.2.stdout 2> sgen-bridge.exe.2.stderr || exit 1;      \
        echo "Testing sgen-bridge-major-fragmentation.exe ..."; \
-       MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.stdout 2> sgen-bridge-major-fragmentation.exe.stderr || exit 1;  \
-       MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.stdout 2> sgen-bridge-major-fragmentation.exe.stderr || exit 1;
+       MONO_GC_PARAMS=bridge=Bridge MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.1.stdout 2> sgen-bridge-major-fragmentation.exe.1.stderr || exit 1;      \
+       MONO_GC_PARAMS=bridge=Bridge,minor=split MONO_ENV_OPTIONS="--gc=sgen" $(RUNTIME) sgen-bridge-major-fragmentation.exe > sgen-bridge-major-fragmentation.exe.2.stdout 2> sgen-bridge-major-fragmentation.exe.2.stderr || exit 1;
 
 
 # Generated tests for runtime invoke
index d11e1696f1487540efebaa76a63c95f769e0e5c1..1496dc54b476a8d1e9b3bfe11895500e59a79ea6 100644 (file)
@@ -6,13 +6,25 @@ public class FinalizerException {
                throw new Exception ();
        }
 
+       /*
+        * We allocate the exception object deep down the stack so
+        * that it doesn't get pinned.
+        */
+       public static void MakeException (int depth) {
+               if (depth <= 0) {
+                       new FinalizerException ();
+                       return;
+               }
+               MakeException (depth - 1);
+       }
+
        public static int Main () { 
                AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
                        Console.WriteLine ("caught");
                        Environment.Exit (0);
                };
 
-               new FinalizerException ();
+               MakeException (100);
 
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
diff --git a/mono/tests/sgen-domain-unload.cs b/mono/tests/sgen-domain-unload.cs
new file mode 100644 (file)
index 0000000..670f218
--- /dev/null
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+
+public class Bar {
+       public object a, b, c;
+       
+}
+class Driver {
+       static void ProduceSimpleHeapWithLOS () {
+               Console.WriteLine ("running in {0}", AppDomain.CurrentDomain);
+               byte[] a = new byte [4 * 1000 * 1000];
+               byte[] b = new byte [4 * 1000 * 1000];
+               byte[] c = new byte [4 * 1000 * 1000];
+               var lst = new List<object> ();
+
+               Bar la, lb, lc;
+               la = lb = lc = null;
+               for (int i = 0; i < 1000 * 200; ++i) {
+                       var ba = new Bar ();
+                       var bb = new Bar ();
+                       var bc = new Bar ();
+                       ba.a = la;
+                       ba.b = bb;
+                       ba.c = a;
+
+                       bb.a = bc;
+                       ba.b = b;
+                       bb.c = lb;
+                       
+                       bc.a = c;
+                       bc.b = lc;
+                       bc.c = ba;
+
+                       la = ba;
+                       lb = bb;
+                       lc = bc;
+
+                       lst.Add (ba);
+               }
+               
+       }
+
+       static void SimpleHeapWithLOS () {
+               ProduceSimpleHeapWithLOS ();
+       }
+
+       static void CrossDomainTest (string name, CrossAppDomainDelegate dele) {
+               Console.WriteLine ("----Testing {0}----", name);
+               for (int i = 0; i < 20; ++i) {
+                       var ad = AppDomain.CreateDomain (string.Format ("domain-{0}-{1}", name, i));
+                       ad.DoCallBack (dele);
+                       AppDomain.Unload (ad);
+               }
+       }
+
+       static void Main () {
+               CrossDomainTest ("simple-heap-with-los", Driver.SimpleHeapWithLOS);
+       }
+}
\ No newline at end of file
index 5e078dccfaad6cddcfbe7b0462d2b8e32f59afb3..2745782762e3ed40947febce383f2dcf27761db4 100644 (file)
@@ -103,6 +103,8 @@ monoutils_sources = \
 
 arch_sources = 
 
+if !CROSS_COMPILE
+
 if X86
 arch_sources += mach-support-x86.c
 endif
@@ -115,6 +117,12 @@ if ARM
 arch_sources += mach-support-arm.c
 endif
 
+else
+
+arch_sources += mach-support-unknown.c
+
+endif
+
 libmonoutils_la_SOURCES = $(monoutils_sources) $(arch_sources)
 libmonoutilsincludedir = $(includedir)/mono-$(API_VER)/mono/utils
 
index 4c95990ddee397a9d853ed086f97ee8e5e2d086e..c2058cc17ad5202ad867ad35d1827d71cd634e0c 100644 (file)
@@ -111,14 +111,14 @@ typedef struct _MonoLockFreeAllocDescriptor Descriptor;
 struct _MonoLockFreeAllocDescriptor {
        MonoLockFreeQueueNode node;
        MonoLockFreeAllocator *heap;
-       Anchor anchor;
+       volatile Anchor anchor;
        unsigned int slot_size;
        unsigned int max_count;
        gpointer sb;
 #ifndef DESC_AVAIL_DUMMY
-       Descriptor *next;
+       Descriptor * volatile next;
 #endif
-       gboolean in_use;
+       gboolean in_use;        /* used for debugging only */
 };
 
 #define NUM_DESC_BATCH 64
index 7a494729ef38afb3c0b6c0b8f65d986e35310b5c..32fec4cad3deffd448c6fb00236bd10c0002113b 100644 (file)
@@ -35,7 +35,7 @@
 typedef struct _MonoLockFreeQueueNode MonoLockFreeQueueNode;
 
 struct _MonoLockFreeQueueNode {
-       MonoLockFreeQueueNode *next;
+       MonoLockFreeQueueNode * volatile next;
 #ifdef QUEUE_DEBUG
        gint32 in_queue;
 #endif
@@ -43,16 +43,16 @@ struct _MonoLockFreeQueueNode {
 
 typedef struct {
        MonoLockFreeQueueNode node;
-       gint32 in_use;
+       volatile gint32 in_use;
 } MonoLockFreeQueueDummy;
 
 #define MONO_LOCK_FREE_QUEUE_NUM_DUMMIES       2
 
 typedef struct {
-       volatile MonoLockFreeQueueNode *head;
-       volatile MonoLockFreeQueueNode *tail;
+       MonoLockFreeQueueNode * volatile head;
+       MonoLockFreeQueueNode * volatile tail;
        MonoLockFreeQueueDummy dummies [MONO_LOCK_FREE_QUEUE_NUM_DUMMIES];
-       gint32 has_dummy;
+       volatile gint32 has_dummy;
 } MonoLockFreeQueue;
 
 void mono_lock_free_queue_init (MonoLockFreeQueue *q) MONO_INTERNAL;
index ab59ed5cfdf8a9f29720ac880440021eede6934d..e889a522c496690f3d89fc9dd8932775085deb4d 100644 (file)
@@ -39,7 +39,7 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
@@ -48,7 +48,7 @@ mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t contex
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
 {
        x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
        struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
index cca95abe2ac5884743b9ff1af027527d4e83fa46..bd1c79de85581c155ef8eb32f4c87861cf0293e2 100644 (file)
@@ -41,7 +41,7 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
 {
        arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
        struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
@@ -50,7 +50,7 @@ mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t contex
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
 {
        arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
        struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
@@ -72,7 +72,7 @@ mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mac
 
        *count = ARM_THREAD_STATE_COUNT;
 
-       ret = thread_get_state (thread, ARM_THREAD_STATE_COUNT, (thread_state_t) arch_state, count);
+       ret = thread_get_state (thread, ARM_THREAD_STATE, (thread_state_t) arch_state, count);
 
        return ret;
 }
diff --git a/mono/utils/mach-support-unknown.c b/mono/utils/mach-support-unknown.c
new file mode 100644 (file)
index 0000000..fbba8dc
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * mach-support-unknown.c: mach support for cross compilers (IOW, none)
+ *
+ * Authors:
+ *   Rodrigo Kumpera (kumpera@gmail.com)
+ *
+ * (C) 2012 Xamarin, Inc.
+ */
+
+#include <config.h>
+
+#if defined(__MACH__)
+#include <stdint.h>
+#include <glib.h>
+#include <pthread.h>
+#include "utils/mono-sigcontext.h"
+#include "mach-support.h"
+
+void *
+mono_mach_arch_get_ip (thread_state_t state)
+{
+       g_assert_not_reached ();
+}
+
+void *
+mono_mach_arch_get_sp (thread_state_t state)
+{
+       g_assert_not_reached ();
+}
+
+int
+mono_mach_arch_get_mcontext_size ()
+{
+       g_assert_not_reached ();
+}
+
+void
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
+{
+       g_assert_not_reached ();
+}
+
+void
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
+{
+       g_assert_not_reached ();
+}
+
+
+int
+mono_mach_arch_get_thread_state_size ()
+{
+       g_assert_not_reached ();
+}
+
+kern_return_t
+mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
+{
+       g_assert_not_reached ();
+}
+
+kern_return_t
+mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
+{
+       g_assert_not_reached ();        
+}
+
+void *
+mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
+{
+       g_assert_not_reached ();
+}
+#endif
index d3c967d2ed8019a957721ecf2b2595eaea00ee05..e65fe6bdeefe05a40f603c9d482fedbb2baa8b04 100644 (file)
@@ -39,7 +39,7 @@ mono_mach_arch_get_mcontext_size ()
 }
 
 void
-mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context)
+mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
 {
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
        struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
@@ -48,7 +48,7 @@ mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t contex
 }
 
 void
-mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state)
+mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
 {
        x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
        struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
index 06b34e8689b1aac3837da6c262d681dbd3b27ee4..ffed22f53c994741b4cad802c8340ce62c39e6f8 100644 (file)
@@ -25,8 +25,8 @@ void *mono_mach_arch_get_ip (thread_state_t state) MONO_INTERNAL;
 void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
 
 int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
-void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, mcontext_t context) MONO_INTERNAL;
-void mono_mach_arch_mcontext_to_thread_state (mcontext_t context, thread_state_t state) MONO_INTERNAL;
+void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context) MONO_INTERNAL;
+void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state) MONO_INTERNAL;
 
 int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
 kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) MONO_INTERNAL;
index c89e3a2e178c00de992501a253388244b3959b7d..fcc76446d9cf21a1b26c169fbe305957f30d44d7 100644 (file)
@@ -1,4 +1,4 @@
+
 /*
    ----------------------------------------------------------------
 
@@ -13,7 +13,7 @@
    This file is part of MemCheck, a heavyweight Valgrind tool for
    detecting memory errors.
 
-   Copyright (C) 2000-2009 Julian Seward.  All rights reserved.
+   Copyright (C) 2000-2012 Julian Seward.  All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
@@ -60,7 +60,6 @@
 #ifndef __MEMCHECK_H
 #define __MEMCHECK_H
 
-#ifdef __GNUC__
 
 /* This file is for inclusion into client (your!) code.
 
@@ -108,66 +107,48 @@ typedef
 
 /* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
 #define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len)           \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
                             VG_USERREQ__MAKE_MEM_NOACCESS,       \
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
       
 /* Similarly, mark memory at _qzz_addr as addressable but undefined
    for _qzz_len bytes. */
 #define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len)          \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
                             VG_USERREQ__MAKE_MEM_UNDEFINED,      \
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
 
 /* Similarly, mark memory at _qzz_addr as addressable and defined
    for _qzz_len bytes. */
 #define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len)            \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
                             VG_USERREQ__MAKE_MEM_DEFINED,        \
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
 
 /* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
    not altered: bytes which are addressable are marked as defined,
    but those which are not addressable are left unchanged. */
-#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len) \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len)     \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,              \
                             VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
 
 /* Create a block-description handle.  The description is an ascii
    string which is included in any messages pertaining to addresses
    within the specified memory range.  Has no other effect on the
    properties of the memory range. */
-#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)    \
-       (__extension__({unsigned long _qzz_res;                  \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
-                            VG_USERREQ__CREATE_BLOCK,            \
-                            _qzz_addr, _qzz_len, _qzz_desc,      \
-                            0, 0);                               \
-    _qzz_res;                                                   \
-   }))
+#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)      \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,        \
+                            VG_USERREQ__CREATE_BLOCK,              \
+                            (_qzz_addr), (_qzz_len), (_qzz_desc),  \
+                            0, 0)
 
 /* Discard a block-description-handle. Returns 1 for an
    invalid handle, 0 for a valid handle. */
 #define VALGRIND_DISCARD(_qzz_blkindex)                          \
-   (__extension__ ({unsigned long _qzz_res;                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* default return */, \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
                             VG_USERREQ__DISCARD,                 \
-                            0, _qzz_blkindex, 0, 0, 0);          \
-    _qzz_res;                                                    \
-   }))
+                            0, (_qzz_blkindex), 0, 0, 0)
 
 
 /* Client-code macros to check the state of memory. */
@@ -176,25 +157,19 @@ typedef
    If suitable addressibility is not established, Valgrind prints an
    error message and returns the address of the first offending byte.
    Otherwise it returns zero. */
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)    \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)      \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                             \
+                            VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,  \
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
 
 /* Check that memory at _qzz_addr is addressable and defined for
    _qzz_len bytes.  If suitable addressibility and definedness are not
    established, Valgrind prints an error message and returns the
    address of the first offending byte.  Otherwise it returns zero. */
 #define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len)        \
-   (__extension__({unsigned long _qzz_res;                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                           \
                             VG_USERREQ__CHECK_MEM_IS_DEFINED,    \
-                            _qzz_addr, _qzz_len, 0, 0, 0);       \
-    _qzz_res;                                                    \
-   }))
+                            (_qzz_addr), (_qzz_len), 0, 0, 0)
 
 /* Use this macro to force the definedness and addressibility of an
    lvalue to be checked.  If suitable addressibility and definedness
@@ -209,19 +184,27 @@ typedef
 
 /* Do a full memory leak check (like --leak-check=full) mid-execution. */
 #define VALGRIND_DO_LEAK_CHECK                                   \
-   {unsigned long _qzz_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__DO_LEAK_CHECK,           \
-                            0, 0, 0, 0, 0);                      \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,   \
+                                    0, 0, 0, 0, 0)
+
+/* Same as VALGRIND_DO_LEAK_CHECK but only showing the entries for
+   which there was an increase in leaked bytes or leaked nr of blocks
+   since the previous leak search. */
+#define VALGRIND_DO_ADDED_LEAK_CHECK                            \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,  \
+                                    0, 1, 0, 0, 0)
+
+/* Same as VALGRIND_DO_ADDED_LEAK_CHECK but showing entries with
+   increased or decreased leaked bytes/blocks since previous leak
+   search. */
+#define VALGRIND_DO_CHANGED_LEAK_CHECK                          \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,  \
+                                    0, 2, 0, 0, 0)
 
 /* Do a summary memory leak check (like --leak-check=summary) mid-execution. */
-#define VALGRIND_DO_QUICK_LEAK_CHECK                            \
-   {unsigned long _qzz_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__DO_LEAK_CHECK,           \
-                            1, 0, 0, 0, 0);                      \
-   }
+#define VALGRIND_DO_QUICK_LEAK_CHECK                             \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,   \
+                                    1, 0, 0, 0, 0)
 
 /* Return number of leaked, dubious, reachable and suppressed bytes found by
    all previous leak checks.  They must be lvalues.  */
@@ -232,10 +215,10 @@ typedef
       are.  We also initialise '_qzz_leaked', etc because
       VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
       defined. */                                                        \
-   {unsigned long _qzz_res;                                              \
+   {                                                                     \
     unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \
     unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                              \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(                                     \
                                VG_USERREQ__COUNT_LEAKS,                  \
                                &_qzz_leaked, &_qzz_dubious,              \
                                &_qzz_reachable, &_qzz_suppressed, 0);    \
@@ -254,10 +237,10 @@ typedef
       are.  We also initialise '_qzz_leaked', etc because
       VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
       defined. */                                                        \
-   {unsigned long _qzz_res;                                              \
+   {                                                                     \
     unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \
     unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                              \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(                                     \
                                VG_USERREQ__COUNT_LEAK_BLOCKS,            \
                                &_qzz_leaked, &_qzz_dubious,              \
                                &_qzz_reachable, &_qzz_suppressed, 0);    \
@@ -277,15 +260,12 @@ typedef
    The metadata is not copied in cases 0, 2 or 3 so it should be
    impossible to segfault your system by using this call.
 */
-#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes)                 \
-   (__extension__({unsigned long _qzz_res;                       \
-    char* czza     = (char*)zza;                                 \
-    char* czzvbits = (char*)zzvbits;                             \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__GET_VBITS,               \
-                            czza, czzvbits, zznbytes, 0, 0 );    \
-    _qzz_res;                                                    \
-   }))
+#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes)                \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                \
+                                    VG_USERREQ__GET_VBITS,      \
+                                    (const char*)(zza),         \
+                                    (char*)(zzvbits),           \
+                                    (zznbytes), 0, 0)
 
 /* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
    from the provided zzvbits array.  Return values:
@@ -296,22 +276,12 @@ typedef
    The metadata is not copied in cases 0, 2 or 3 so it should be
    impossible to segfault your system by using this call.
 */
-#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes)                 \
-   (__extension__({unsigned int _qzz_res;                        \
-    char* czza     = (char*)zza;                                 \
-    char* czzvbits = (char*)zzvbits;                             \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__SET_VBITS,               \
-                            czza, czzvbits, zznbytes, 0, 0 );    \
-    _qzz_res;                                                    \
-   }))
-
-#else /* __GNUC__ */
-
-#define RUNNING_ON_VALGRIND 0
-#define VALGRIND_DISCARD_TRANSLATIONS(x,y) do { } while (0)
-
-#endif /* __GNUC__ */
+#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes)                \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                \
+                                    VG_USERREQ__SET_VBITS,      \
+                                    (const char*)(zza),         \
+                                    (const char*)(zzvbits),     \
+                                    (zznbytes), 0, 0 )
 
 #endif
 
index 2d7a545068001ef843af994fcea9b2ca7fca2d6f..cc3d00cc50e27a764e002e3ae6a1bc6ce2564dec 100644 (file)
 #define MONO_DEPRECATED 
 #endif
 
+#ifdef __GNUC__
+#define MONO_ALWAYS_INLINE __attribute__((always_inline))
+#else
+#define MONO_ALWAYS_INLINE
+#endif
+
 #endif /* __UTILS_MONO_COMPILER_H__*/
 
index ef33f23bd95dbf74de646e811851a6d2ede7a39a..81e2fe69b353d55e41be11e2874a025cb9006575 100644 (file)
@@ -245,6 +245,7 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *ctx)
 
 #include <mono/utils/mono-context.h>
 #include <mono/arch/arm/arm-codegen.h>
+#include <mono/arch/arm/arm-vfp-codegen.h>
 
 void
 mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
index 98ae7951d041f92fd00b3cafb827a222d431da0e..1cd7f55e31e0cbf04912a0d9e1a5bc9b20f5b2a5 100644 (file)
@@ -234,11 +234,28 @@ typedef struct {
 #define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ARMREG_FP]))
 #define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->regs [ARMREG_SP]))
 
-// FIXME:
 #define MONO_CONTEXT_GET_CURRENT(ctx)  do {    \
-       g_assert_not_reached (); \
+       __asm__ __volatile__(                   \
+               "push {r0}\n"                           \
+               "push {r1}\n"                           \
+               "mov r1, r0\n"                          \
+               "mov r0, %0\n"                          \
+               "str r1, [r0]!\n"                       \
+               "pop {r1}\n"                            \
+               "str r1, [r0]!\n"                       \
+               "stmia r0!, {r2-r12}\n"         \
+               "str sp, [r0]!\n"                       \
+               "str lr, [r0]!\n"                       \
+               "str pc, [r0]!\n"                       \
+               "pop {r0}\n"                            \
+               :                                                       \
+               : "r" (&ctx.regs)                       \
+               : "memory"                                      \
+       );                                                              \
+       ctx.pc = ctx.regs [15];                 \
 } while (0)
 
+
 #elif defined(__mono_ppc__) /* defined(__arm__) */
 
 /* we define our own structure and we'll copy the data
index 2b9d518f4b0660f361737e09f8227e7621ad18d7..dd29b5267593e288ef4da1245be0dde18e26822f 100644 (file)
@@ -57,7 +57,12 @@ static const char suffixes [][4] = {
 #endif  /* RTLD_LAZY */
 
 #define SO_HANDLE_TYPE void*
-#define LL_SO_OPEN(file,flags) dlopen ((file), (flags))
+#ifdef PLATFORM_ANDROID
+/* Bionic doesn't support NULL filenames */
+#  define LL_SO_OPEN(file,flags) ((file) ? dlopen ((file), (flags)) : NULL)
+#else
+#  define LL_SO_OPEN(file,flags) dlopen ((file), (flags))
+#endif
 #define LL_SO_CLOSE(module) dlclose ((module)->handle)
 #define LL_SO_SYMBOL(module, name) dlsym ((module)->handle, (name))
 #define LL_SO_TRFLAGS(flags) convert_flags ((flags))
index 10bcf17533b1276ede2233e440fdeb28352d08a3..1b50682e43b64dcd620bedcda6f310b981f7643a 100644 (file)
@@ -91,6 +91,27 @@ mono_trace_message(MonoTraceMask mask, const char *format, ...)
 
 #endif /* !__GNUC__ */
 
+#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+
+#define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_ERROR, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { } while (0)
+
+#else
+
+#define mono_gc_printf(gc_log_file, format, ...) do {  \
+       fprintf (gc_log_file, format "\n", ##__VA_ARGS__);      \
+       fflush (gc_log_file);   \
+} while (0)
+
+#define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
+
+#endif
+
+
 G_END_DECLS
 
 #endif /* __MONO_LOGGER_INTERNAL_H__ */
index 8b0634e7257a696b98011b4aed5a794eae69e26e..03247cf02a68d33381c602bbfb89d4a9527e4f2d 100644 (file)
@@ -14,7 +14,7 @@
 #include <signal.h>
 #endif
 
-#if defined(__i386__)
+#if defined(TARGET_X86)
 
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 #include <ucontext.h>
@@ -34,7 +34,7 @@
        #define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_edi)
        #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_eip)
 #elif defined(__APPLE__)
-#  if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+#  if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
        #define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__eax)
        #define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ebx)
        #define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ecx)
@@ -152,7 +152,7 @@ typedef struct ucontext {
        #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EIP])
 #endif
 
-#elif defined(__x86_64__)
+#elif defined(TARGET_AMD64)
 
 #if defined(__FreeBSD__)
 #include <ucontext.h>
@@ -301,7 +301,7 @@ typedef struct ucontext {
        #define UCONTEXT_REG_LNK(ctx)     ((ctx)->uc_mcontext.mc_lr)
 #endif
 
-#elif defined(__arm__)
+#elif defined(TARGET_ARM)
 #if defined(__APPLE__)
        typedef ucontext_t arm_ucontext;
 
index a967f9dfc0da921a5b09683e5276fbb41b3914af..315da5b0fc8eab3d5063d3bb4a6393140d115371 100644 (file)
@@ -12,7 +12,7 @@
    This file is part of Valgrind, a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2000-2009 Julian Seward.  All rights reserved.
+   Copyright (C) 2000-2012 Julian Seward.  All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
 #ifndef __VALGRIND_H
 #define __VALGRIND_H
 
-#ifdef __GNUC__
+
+/* ------------------------------------------------------------------ */
+/* VERSION NUMBER OF VALGRIND                                         */
+/* ------------------------------------------------------------------ */
+
+/* Specify Valgrind's version number, so that user code can
+   conditionally compile based on our version number.  Note that these
+   were introduced at version 3.6 and so do not exist in version 3.5
+   or earlier.  The recommended way to use them to check for "version
+   X.Y or later" is (eg)
+
+#if defined(__VALGRIND_MAJOR__) && defined(__VALGRIND_MINOR__)   \
+    && (__VALGRIND_MAJOR__ > 3                                   \
+        || (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6))
+*/
+#define __VALGRIND_MAJOR__    3
+#define __VALGRIND_MINOR__    8
+
 
 #include <stdarg.h>
 
    identifying architectures, which are different to the ones we use
    within the rest of Valgrind.  Note, __powerpc__ is active for both
    32 and 64-bit PPC, whereas __powerpc64__ is only active for the
-   latter (on Linux, that is). */
+   latter (on Linux, that is).
+
+   Misc note: how to find out what's predefined in gcc by default:
+   gcc -Wp,-dM somefile.c
+*/
+#undef PLAT_x86_darwin
+#undef PLAT_amd64_darwin
+#undef PLAT_x86_win32
 #undef PLAT_x86_linux
 #undef PLAT_amd64_linux
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
+#undef PLAT_arm_linux
+#undef PLAT_s390x_linux
+#undef PLAT_mips32_linux
 
 
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
-#elif defined(__i386__)
+#elif defined(__MINGW32__) || defined(__CYGWIN32__) \
+      || (defined(_WIN32) && defined(_M_IX86))
+#  define PLAT_x86_win32 1
+#elif defined(__linux__) && defined(__i386__)
 #  define PLAT_x86_linux 1
-#elif defined(__x86_64__)
+#elif defined(__linux__) && defined(__x86_64__)
 #  define PLAT_amd64_linux 1
-#elif defined(__powerpc__) && !defined(__powerpc64__)
+#elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
 #  define PLAT_ppc32_linux 1
-#elif defined(__powerpc__) && defined(__powerpc64__)
+#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
 #  define PLAT_ppc64_linux 1
+#elif defined(__linux__) && defined(__arm__)
+#  define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__s390__) && defined(__s390x__)
+#  define PLAT_s390x_linux 1
+#elif defined(__linux__) && defined(__mips__)
+#  define PLAT_mips32_linux 1
 #else
 /* If we're not compiling for our target platform, don't generate
    any inline asms.  */
 /* in here of use to end-users -- skip to the next section.           */
 /* ------------------------------------------------------------------ */
 
+/*
+ * VALGRIND_DO_CLIENT_REQUEST(): a statement that invokes a Valgrind client
+ * request. Accepts both pointers and integers as arguments.
+ *
+ * VALGRIND_DO_CLIENT_REQUEST_STMT(): a statement that invokes a Valgrind
+ * client request that does not return a value.
+
+ * VALGRIND_DO_CLIENT_REQUEST_EXPR(): a C expression that invokes a Valgrind
+ * client request and whose value equals the client request result.  Accepts
+ * both pointers and integers as arguments.  Note that such calls are not
+ * necessarily pure functions -- they may have side effects.
+ */
+
+#define VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default,            \
+                                   _zzq_request, _zzq_arg1, _zzq_arg2,  \
+                                   _zzq_arg3, _zzq_arg4, _zzq_arg5)     \
+  do { (_zzq_rlval) = VALGRIND_DO_CLIENT_REQUEST_EXPR((_zzq_default),   \
+                        (_zzq_request), (_zzq_arg1), (_zzq_arg2),       \
+                        (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
+
+#define VALGRIND_DO_CLIENT_REQUEST_STMT(_zzq_request, _zzq_arg1,        \
+                           _zzq_arg2,  _zzq_arg3, _zzq_arg4, _zzq_arg5) \
+  do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                        \
+                    (_zzq_request), (_zzq_arg1), (_zzq_arg2),           \
+                    (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
+
 #if defined(NVALGRIND)
 
 /* Define NVALGRIND to completely remove the Valgrind magic sequence
    from the compiled code (analogous to NDEBUG's effects on
    assert()) */
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-   {                                                              \
-      (_zzq_rlval) = (_zzq_default);                              \
-   }
+      (_zzq_default)
 
 #else  /* ! NVALGRIND */
 
 
 /* ------------------------- x86-{linux,darwin} ---------------- */
 
-#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)
+#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)  \
+    ||  (defined(PLAT_x86_win32) && defined(__GNUC__))
 
 typedef
    struct { 
@@ -188,10 +243,11 @@ typedef
                      "roll $3,  %%edi ; roll $13, %%edi\n\t"      \
                      "roll $29, %%edi ; roll $19, %%edi\n\t"
 
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-  { volatile unsigned int _zzq_args[6];                           \
+  __extension__                                                   \
+  ({volatile unsigned int _zzq_args[6];                           \
     volatile unsigned int _zzq_result;                            \
     _zzq_args[0] = (unsigned int)(_zzq_request);                  \
     _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
@@ -206,8 +262,8 @@ typedef
                      : "a" (&_zzq_args[0]), "0" (_zzq_default)    \
                      : "cc", "memory"                             \
                     );                                            \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+    _zzq_result;                                                  \
+  })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
@@ -226,7 +282,89 @@ typedef
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* call-noredir *%EAX */                     \
                      "xchgl %%edx,%%edx\n\t"
-#endif /* PLAT_x86_linux || PLAT_x86_darwin */
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "xchgl %%edi,%%edi\n\t"                     \
+                     : : : "cc", "memory"                        \
+                    );                                           \
+ } while (0)
+
+#endif /* PLAT_x86_linux || PLAT_x86_darwin || (PLAT_x86_win32 && __GNUC__) */
+
+/* ------------------------- x86-Win32 ------------------------- */
+
+#if defined(PLAT_x86_win32) && !defined(__GNUC__)
+
+typedef
+   struct { 
+      unsigned int nraddr; /* where's the code? */
+   }
+   OrigFn;
+
+#if defined(_MSC_VER)
+
+#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
+                     __asm rol edi, 3  __asm rol edi, 13          \
+                     __asm rol edi, 29 __asm rol edi, 19
+
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
+        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
+    valgrind_do_client_request_expr((uintptr_t)(_zzq_default),    \
+        (uintptr_t)(_zzq_request), (uintptr_t)(_zzq_arg1),        \
+        (uintptr_t)(_zzq_arg2), (uintptr_t)(_zzq_arg3),           \
+        (uintptr_t)(_zzq_arg4), (uintptr_t)(_zzq_arg5))
+
+static __inline uintptr_t
+valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
+                                uintptr_t _zzq_arg1, uintptr_t _zzq_arg2,
+                                uintptr_t _zzq_arg3, uintptr_t _zzq_arg4,
+                                uintptr_t _zzq_arg5)
+{
+    volatile uintptr_t _zzq_args[6];
+    volatile unsigned int _zzq_result;
+    _zzq_args[0] = (uintptr_t)(_zzq_request);
+    _zzq_args[1] = (uintptr_t)(_zzq_arg1);
+    _zzq_args[2] = (uintptr_t)(_zzq_arg2);
+    _zzq_args[3] = (uintptr_t)(_zzq_arg3);
+    _zzq_args[4] = (uintptr_t)(_zzq_arg4);
+    _zzq_args[5] = (uintptr_t)(_zzq_arg5);
+    __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default
+            __SPECIAL_INSTRUCTION_PREAMBLE
+            /* %EDX = client_request ( %EAX ) */
+            __asm xchg ebx,ebx
+            __asm mov _zzq_result, edx
+    }
+    return _zzq_result;
+}
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
+  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
+    volatile unsigned int __addr;                                 \
+    __asm { __SPECIAL_INSTRUCTION_PREAMBLE                        \
+            /* %EAX = guest_NRADDR */                             \
+            __asm xchg ecx,ecx                                    \
+            __asm mov __addr, eax                                 \
+    }                                                             \
+    _zzq_orig->nraddr = __addr;                                   \
+  }
+
+#define VALGRIND_CALL_NOREDIR_EAX ERROR
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm { __SPECIAL_INSTRUCTION_PREAMBLE                       \
+            __asm xchg edi,edi                                   \
+    }                                                            \
+ } while (0)
+
+#else
+#error Unsupported compiler.
+#endif
+
+#endif /* PLAT_x86_win32 */
 
 /* ------------------------ amd64-{linux,darwin} --------------- */
 
@@ -242,10 +380,11 @@ typedef
                      "rolq $3,  %%rdi ; rolq $13, %%rdi\n\t"      \
                      "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
 
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-  { volatile unsigned long long int _zzq_args[6];                 \
+    __extension__                                                 \
+    ({ volatile unsigned long long int _zzq_args[6];              \
     volatile unsigned long long int _zzq_result;                  \
     _zzq_args[0] = (unsigned long long int)(_zzq_request);        \
     _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \
@@ -260,8 +399,8 @@ typedef
                      : "a" (&_zzq_args[0]), "0" (_zzq_default)    \
                      : "cc", "memory"                             \
                     );                                            \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+    _zzq_result;                                                  \
+    })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
@@ -280,6 +419,15 @@ typedef
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* call-noredir *%RAX */                     \
                      "xchgq %%rdx,%%rdx\n\t"
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "xchgq %%rdi,%%rdi\n\t"                     \
+                     : : : "cc", "memory"                        \
+                    );                                           \
+ } while (0)
+
 #endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
 
 /* ------------------------ ppc32-linux ------------------------ */
@@ -296,11 +444,12 @@ typedef
                      "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
                      "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
 
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
                                                                   \
-  {          unsigned int  _zzq_args[6];                          \
+    __extension__                                                 \
+  ({         unsigned int  _zzq_args[6];                          \
              unsigned int  _zzq_result;                           \
              unsigned int* _zzq_ptr;                              \
     _zzq_args[0] = (unsigned int)(_zzq_request);                  \
@@ -319,8 +468,8 @@ typedef
                      : "=b" (_zzq_result)                         \
                      : "b" (_zzq_default), "b" (_zzq_ptr)         \
                      : "cc", "memory", "r3", "r4");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+    _zzq_result;                                                  \
+    })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
@@ -340,6 +489,14 @@ typedef
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* branch-and-link-to-noredir *%R11 */       \
                      "or 3,3,3\n\t"
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "or 5,5,5\n\t"                              \
+                    );                                           \
+ } while (0)
+
 #endif /* PLAT_ppc32_linux */
 
 /* ------------------------ ppc64-linux ------------------------ */
@@ -357,13 +514,14 @@ typedef
                      "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
                      "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
 
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
                                                                   \
-  {          unsigned long long int  _zzq_args[6];                \
-    register unsigned long long int  _zzq_result __asm__("r3");   \
-    register unsigned long long int* _zzq_ptr __asm__("r4");      \
+  __extension__                                                   \
+  ({         unsigned long long int  _zzq_args[6];                \
+             unsigned long long int  _zzq_result;                 \
+             unsigned long long int* _zzq_ptr;                    \
     _zzq_args[0] = (unsigned long long int)(_zzq_request);        \
     _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \
     _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \
@@ -371,32 +529,37 @@ typedef
     _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \
     _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \
     _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
+    __asm__ volatile("mr 3,%1\n\t" /*default*/                    \
+                     "mr 4,%2\n\t" /*ptr*/                        \
+                     __SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1"                                   \
-                     : "=r" (_zzq_result)                         \
-                     : "0" (_zzq_default), "r" (_zzq_ptr)         \
-                     : "cc", "memory");                           \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+                     "or 1,1,1\n\t"                               \
+                     "mr %0,3"     /*result*/                     \
+                     : "=b" (_zzq_result)                         \
+                     : "b" (_zzq_default), "b" (_zzq_ptr)         \
+                     : "cc", "memory", "r3", "r4");               \
+    _zzq_result;                                                  \
+  })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned long long int __addr __asm__("r3");         \
+    unsigned long long int __addr;                                \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2"                                   \
-                     : "=r" (__addr)                              \
+                     "or 2,2,2\n\t"                               \
+                     "mr %0,3"                                    \
+                     : "=b" (__addr)                              \
                      :                                            \
-                     : "cc", "memory"                             \
+                     : "cc", "memory", "r3"                       \
                     );                                            \
     _zzq_orig->nraddr = __addr;                                   \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
                      /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4"                                   \
-                     : "=r" (__addr)                              \
+                     "or 4,4,4\n\t"                               \
+                     "mr %0,3"                                    \
+                     : "=b" (__addr)                              \
                      :                                            \
-                     : "cc", "memory"                             \
+                     : "cc", "memory", "r3"                       \
                     );                                            \
     _zzq_orig->r2 = __addr;                                       \
   }
@@ -406,151 +569,232 @@ typedef
                      /* branch-and-link-to-noredir *%R11 */       \
                      "or 3,3,3\n\t"
 
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "or 5,5,5\n\t"                              \
+                    );                                           \
+ } while (0)
+
 #endif /* PLAT_ppc64_linux */
 
-/* ------------------------ ppc32-aix5 ------------------------- */
+/* ------------------------- arm-linux ------------------------- */
 
-#if defined(PLAT_ppc32_aix5)
+#if defined(PLAT_arm_linux)
 
 typedef
    struct { 
       unsigned int nraddr; /* where's the code? */
-      unsigned int r2;  /* what tocptr do we need? */
    }
    OrigFn;
 
 #define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
-                     "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
+            "mov r12, r12, ror #3  ; mov r12, r12, ror #13 \n\t"  \
+            "mov r12, r12, ror #29 ; mov r12, r12, ror #19 \n\t"
 
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+        _zzq_default, _zzq_request,                               \
         _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
                                                                   \
-  {          unsigned int  _zzq_args[7];                          \
-    register unsigned int  _zzq_result;                           \
-    register unsigned int* _zzq_ptr;                              \
+  __extension__                                                   \
+  ({volatile unsigned int  _zzq_args[6];                          \
+    volatile unsigned int  _zzq_result;                           \
     _zzq_args[0] = (unsigned int)(_zzq_request);                  \
     _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
     _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
     _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
     _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
     _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    _zzq_args[6] = (unsigned int)(_zzq_default);                  \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "lwz 3, 24(4)\n\t"                           \
+    __asm__ volatile("mov r3, %1\n\t" /*default*/                 \
+                     "mov r4, %2\n\t" /*ptr*/                     \
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+                     /* R3 = client_request ( R4 ) */             \
+                     "orr r10, r10, r10\n\t"                      \
+                     "mov %0, r3"     /*result*/                  \
+                     : "=r" (_zzq_result)                         \
+                     : "r" (_zzq_default), "r" (&_zzq_args[0])    \
+                     : "cc","memory", "r3", "r4");                \
+    _zzq_result;                                                  \
+  })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned int __addr;                                 \
+    unsigned int __addr;                                          \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
+                     /* R3 = guest_NRADDR */                      \
+                     "orr r11, r11, r11\n\t"                      \
+                     "mov %0, r3"                                 \
+                     : "=r" (__addr)                              \
                      :                                            \
-                     : "r3", "cc", "memory"                       \
+                     : "cc", "memory", "r3"                       \
                     );                                            \
     _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
   }
 
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
+#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R                   \
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
+                     /* branch-and-link-to-noredir *%R4 */        \
+                     "orr r12, r12, r12\n\t"
 
-#endif /* PLAT_ppc32_aix5 */
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "orr r9, r9, r9\n\t"                        \
+                     : : : "cc", "memory"                        \
+                    );                                           \
+ } while (0)
 
-/* ------------------------ ppc64-aix5 ------------------------- */
+#endif /* PLAT_arm_linux */
 
-#if defined(PLAT_ppc64_aix5)
+/* ------------------------ s390x-linux ------------------------ */
+
+#if defined(PLAT_s390x_linux)
+
+typedef
+  struct {
+     unsigned long long int nraddr; /* where's the code? */
+  }
+  OrigFn;
+
+/* __SPECIAL_INSTRUCTION_PREAMBLE will be used to identify Valgrind specific
+ * code. This detection is implemented in platform specific toIR.c
+ * (e.g. VEX/priv/guest_s390_decoder.c).
+ */
+#define __SPECIAL_INSTRUCTION_PREAMBLE                           \
+                     "lr 15,15\n\t"                              \
+                     "lr 1,1\n\t"                                \
+                     "lr 2,2\n\t"                                \
+                     "lr 3,3\n\t"
+
+#define __CLIENT_REQUEST_CODE "lr 2,2\n\t"
+#define __GET_NR_CONTEXT_CODE "lr 3,3\n\t"
+#define __CALL_NO_REDIR_CODE  "lr 4,4\n\t"
+#define __VEX_INJECT_IR_CODE  "lr 5,5\n\t"
+
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                         \
+       _zzq_default, _zzq_request,                               \
+       _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
+  __extension__                                                  \
+ ({volatile unsigned long long int _zzq_args[6];                 \
+   volatile unsigned long long int _zzq_result;                  \
+   _zzq_args[0] = (unsigned long long int)(_zzq_request);        \
+   _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \
+   _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \
+   _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \
+   _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \
+   _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \
+   __asm__ volatile(/* r2 = args */                              \
+                    "lgr 2,%1\n\t"                               \
+                    /* r3 = default */                           \
+                    "lgr 3,%2\n\t"                               \
+                    __SPECIAL_INSTRUCTION_PREAMBLE               \
+                    __CLIENT_REQUEST_CODE                        \
+                    /* results = r3 */                           \
+                    "lgr %0, 3\n\t"                              \
+                    : "=d" (_zzq_result)                         \
+                    : "a" (&_zzq_args[0]), "0" (_zzq_default)    \
+                    : "cc", "2", "3", "memory"                   \
+                   );                                            \
+   _zzq_result;                                                  \
+ })
+
+#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                      \
+ { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
+   volatile unsigned long long int __addr;                       \
+   __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
+                    __GET_NR_CONTEXT_CODE                        \
+                    "lgr %0, 3\n\t"                              \
+                    : "=a" (__addr)                              \
+                    :                                            \
+                    : "cc", "3", "memory"                        \
+                   );                                            \
+   _zzq_orig->nraddr = __addr;                                   \
+ }
+
+#define VALGRIND_CALL_NOREDIR_R1                                 \
+                    __SPECIAL_INSTRUCTION_PREAMBLE               \
+                    __CALL_NO_REDIR_CODE
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     __VEX_INJECT_IR_CODE);                      \
+ } while (0)
+
+#endif /* PLAT_s390x_linux */
+
+/* ------------------------- mips32-linux ---------------- */
+
+#if defined(PLAT_mips32_linux)
 
 typedef
    struct { 
-      unsigned long long int nraddr; /* where's the code? */
-      unsigned long long int r2;  /* what tocptr do we need? */
+      unsigned int nraddr; /* where's the code? */
    }
    OrigFn;
 
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
-                     "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  {          unsigned long long int  _zzq_args[7];                \
-    register unsigned long long int  _zzq_result;                 \
-    register unsigned long long int* _zzq_ptr;                    \
-    _zzq_args[0] = (unsigned int long long)(_zzq_request);        \
-    _zzq_args[1] = (unsigned int long long)(_zzq_arg1);           \
-    _zzq_args[2] = (unsigned int long long)(_zzq_arg2);           \
-    _zzq_args[3] = (unsigned int long long)(_zzq_arg3);           \
-    _zzq_args[4] = (unsigned int long long)(_zzq_arg4);           \
-    _zzq_args[5] = (unsigned int long long)(_zzq_arg5);           \
-    _zzq_args[6] = (unsigned int long long)(_zzq_default);        \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "ld 3, 48(4)\n\t"                            \
+/* .word  0x342
+ * .word  0x742
+ * .word  0xC2
+ * .word  0x4C2*/
+#define __SPECIAL_INSTRUCTION_PREAMBLE          \
+                     "srl $0, $0, 13\n\t"       \
+                     "srl $0, $0, 29\n\t"       \
+                     "srl $0, $0, 3\n\t"        \
+                     "srl $0, $0, 19\n\t"
+                    
+#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
+       _zzq_default, _zzq_request,                                \
+       _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)     \
+  __extension__                                                   \
+  ({ volatile unsigned int _zzq_args[6];                          \
+    volatile unsigned int _zzq_result;                            \
+    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
+    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
+    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
+    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
+    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
+    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
+        __asm__ volatile("move $11, %1\n\t" /*default*/           \
+                     "move $12, %2\n\t" /*ptr*/                   \
                      __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
+                     /* T3 = client_request ( T4 ) */             \
+                     "or $13, $13, $13\n\t"                       \
+                     "move %0, $11\n\t"     /*result*/            \
+                     : "=r" (_zzq_result)                         \
+                     : "r" (_zzq_default), "r" (&_zzq_args[0])    \
+                     : "cc","memory", "t3", "t4");                \
+    _zzq_result;                                                  \
+  })
 
 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
   { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned long long int __addr;                       \
+    volatile unsigned int __addr;                                 \
     __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
+                     /* %t9 = guest_NRADDR */                     \
+                     "or $14, $14, $14\n\t"                       \
+                     "move %0, $11"     /*result*/                \
+                     : "=r" (__addr)                              \
                      :                                            \
-                     : "r3", "cc", "memory"                       \
+                     : "cc", "memory" , "t3"                      \
                     );                                            \
     _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
   }
 
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
+#define VALGRIND_CALL_NOREDIR_T9                                 \
+                     __SPECIAL_INSTRUCTION_PREAMBLE              \
+                     /* call-noredir *%t9 */                     \
+                     "or $15, $15, $15\n\t"
+
+#define VALGRIND_VEX_INJECT_IR()                                 \
+ do {                                                            \
+    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE              \
+                     "or $11, $11, $11\n\t"                      \
+                    );                                           \
+ } while (0)
 
-#endif /* PLAT_ppc64_aix5 */
+
+#endif /* PLAT_mips32_linux */
 
 /* Insert assembly code for other platforms here... */
 
@@ -581,17 +825,20 @@ typedef
 */
 
 /* Use these to write the name of your wrapper.  NOTE: duplicates
-   VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+   VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h.  NOTE also: inserts
+   the default behaviour equivalance class tag "0000" into the name.
+   See pub_tool_redir.h for details -- normally you don't need to
+   think about this, though. */
 
 /* Use an extra level of macroisation so as to ensure the soname/fnname
    args are fully macro-expanded before pasting them together. */
 #define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
 
 #define I_WRAP_SONAME_FNNAME_ZU(soname,fnname)                    \
-   VG_CONCAT4(_vgwZU_,soname,_,fnname)
+   VG_CONCAT4(_vgw00000ZU_,soname,_,fnname)
 
 #define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname)                    \
-   VG_CONCAT4(_vgwZZ_,soname,_,fnname)
+   VG_CONCAT4(_vgw00000ZZ_,soname,_,fnname)
 
 /* Use this macro from within a wrapper function to collect the
    context (address and possibly other info) of the original function.
@@ -599,6 +846,18 @@ typedef
    macros.  The type of the argument _lval is OrigFn. */
 #define VALGRIND_GET_ORIG_FN(_lval)  VALGRIND_GET_NR_CONTEXT(_lval)
 
+/* Also provide end-user facilities for function replacement, rather
+   than wrapping.  A replacement function differs from a wrapper in
+   that it has no way to get hold of the original function being
+   called, and hence no way to call onwards to it.  In a replacement
+   function, VALGRIND_GET_ORIG_FN always returns zero. */
+
+#define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname)                 \
+   VG_CONCAT4(_vgr00000ZU_,soname,_,fnname)
+
+#define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname)                 \
+   VG_CONCAT4(_vgr00000ZZ_,soname,_,fnname)
+
 /* Derivatives of the main macros below, for calling functions
    returning void. */
 
@@ -642,6 +901,17 @@ typedef
    as gcc can already see that, plus causes gcc to bomb. */
 #define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
 
+/* Macros to save and align the stack before making a function
+   call and restore it afterwards as gcc may not keep the stack
+   pointer aligned if it doesn't realise calls are being made
+   to other functions. */
+
+#define VALGRIND_ALIGN_STACK               \
+      "movl %%esp,%%edi\n\t"               \
+      "andl $0xfffffff0,%%esp\n\t"
+#define VALGRIND_RESTORE_STACK             \
+      "movl %%edi,%%esp\n\t"
+
 /* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned
    long) == 4. */
 
@@ -652,11 +922,13 @@ typedef
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -669,13 +941,15 @@ typedef
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
       _argvec[1] = (unsigned long)(arg1);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $12, %%esp\n\t"                                    \
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $4, %%esp\n"                                       \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -689,14 +963,16 @@ typedef
       _argvec[1] = (unsigned long)(arg1);                         \
       _argvec[2] = (unsigned long)(arg2);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $8, %%esp\n\t"                                     \
          "pushl 8(%%eax)\n\t"                                     \
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $8, %%esp\n"                                       \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -711,15 +987,17 @@ typedef
       _argvec[2] = (unsigned long)(arg2);                         \
       _argvec[3] = (unsigned long)(arg3);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $4, %%esp\n\t"                                     \
          "pushl 12(%%eax)\n\t"                                    \
          "pushl 8(%%eax)\n\t"                                     \
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $12, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -735,16 +1013,17 @@ typedef
       _argvec[3] = (unsigned long)(arg3);                         \
       _argvec[4] = (unsigned long)(arg4);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "pushl 16(%%eax)\n\t"                                    \
          "pushl 12(%%eax)\n\t"                                    \
          "pushl 8(%%eax)\n\t"                                     \
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $16, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -761,6 +1040,8 @@ typedef
       _argvec[4] = (unsigned long)(arg4);                         \
       _argvec[5] = (unsigned long)(arg5);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $12, %%esp\n\t"                                    \
          "pushl 20(%%eax)\n\t"                                    \
          "pushl 16(%%eax)\n\t"                                    \
          "pushl 12(%%eax)\n\t"                                    \
@@ -768,10 +1049,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $20, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -789,6 +1070,8 @@ typedef
       _argvec[5] = (unsigned long)(arg5);                         \
       _argvec[6] = (unsigned long)(arg6);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $8, %%esp\n\t"                                     \
          "pushl 24(%%eax)\n\t"                                    \
          "pushl 20(%%eax)\n\t"                                    \
          "pushl 16(%%eax)\n\t"                                    \
@@ -797,10 +1080,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $24, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -820,6 +1103,8 @@ typedef
       _argvec[6] = (unsigned long)(arg6);                         \
       _argvec[7] = (unsigned long)(arg7);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $4, %%esp\n\t"                                     \
          "pushl 28(%%eax)\n\t"                                    \
          "pushl 24(%%eax)\n\t"                                    \
          "pushl 20(%%eax)\n\t"                                    \
@@ -829,10 +1114,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $28, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -853,6 +1138,7 @@ typedef
       _argvec[7] = (unsigned long)(arg7);                         \
       _argvec[8] = (unsigned long)(arg8);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "pushl 32(%%eax)\n\t"                                    \
          "pushl 28(%%eax)\n\t"                                    \
          "pushl 24(%%eax)\n\t"                                    \
@@ -863,10 +1149,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $32, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -888,6 +1174,8 @@ typedef
       _argvec[8] = (unsigned long)(arg8);                         \
       _argvec[9] = (unsigned long)(arg9);                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $12, %%esp\n\t"                                    \
          "pushl 36(%%eax)\n\t"                                    \
          "pushl 32(%%eax)\n\t"                                    \
          "pushl 28(%%eax)\n\t"                                    \
@@ -899,10 +1187,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $36, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -925,6 +1213,8 @@ typedef
       _argvec[9] = (unsigned long)(arg9);                         \
       _argvec[10] = (unsigned long)(arg10);                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $8, %%esp\n\t"                                     \
          "pushl 40(%%eax)\n\t"                                    \
          "pushl 36(%%eax)\n\t"                                    \
          "pushl 32(%%eax)\n\t"                                    \
@@ -937,10 +1227,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $40, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -965,6 +1255,8 @@ typedef
       _argvec[10] = (unsigned long)(arg10);                       \
       _argvec[11] = (unsigned long)(arg11);                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
+         "subl $4, %%esp\n\t"                                     \
          "pushl 44(%%eax)\n\t"                                    \
          "pushl 40(%%eax)\n\t"                                    \
          "pushl 36(%%eax)\n\t"                                    \
@@ -978,10 +1270,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $44, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1007,6 +1299,7 @@ typedef
       _argvec[11] = (unsigned long)(arg11);                       \
       _argvec[12] = (unsigned long)(arg12);                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "pushl 48(%%eax)\n\t"                                    \
          "pushl 44(%%eax)\n\t"                                    \
          "pushl 40(%%eax)\n\t"                                    \
@@ -1021,10 +1314,10 @@ typedef
          "pushl 4(%%eax)\n\t"                                     \
          "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
          VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $48, %%esp\n"                                      \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=a" (_res)                                  \
          : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "edi"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1041,6 +1334,88 @@ typedef
 #define __CALLER_SAVED_REGS /*"rax",*/ "rcx", "rdx", "rsi",       \
                             "rdi", "r8", "r9", "r10", "r11"
 
+/* This is all pretty complex.  It's so as to make stack unwinding
+   work reliably.  See bug 243270.  The basic problem is the sub and
+   add of 128 of %rsp in all of the following macros.  If gcc believes
+   the CFA is in %rsp, then unwinding may fail, because what's at the
+   CFA is not what gcc "expected" when it constructs the CFIs for the
+   places where the macros are instantiated.
+
+   But we can't just add a CFI annotation to increase the CFA offset
+   by 128, to match the sub of 128 from %rsp, because we don't know
+   whether gcc has chosen %rsp as the CFA at that point, or whether it
+   has chosen some other register (eg, %rbp).  In the latter case,
+   adding a CFI annotation to change the CFA offset is simply wrong.
+
+   So the solution is to get hold of the CFA using
+   __builtin_dwarf_cfa(), put it in a known register, and add a
+   CFI annotation to say what the register is.  We choose %rbp for
+   this (perhaps perversely), because:
+
+   (1) %rbp is already subject to unwinding.  If a new register was
+       chosen then the unwinder would have to unwind it in all stack
+       traces, which is expensive, and
+
+   (2) %rbp is already subject to precise exception updates in the
+       JIT.  If a new register was chosen, we'd have to have precise
+       exceptions for it too, which reduces performance of the
+       generated code.
+
+   However .. one extra complication.  We can't just whack the result
+   of __builtin_dwarf_cfa() into %rbp and then add %rbp to the
+   list of trashed registers at the end of the inline assembly
+   fragments; gcc won't allow %rbp to appear in that list.  Hence
+   instead we need to stash %rbp in %r15 for the duration of the asm,
+   and say that %r15 is trashed instead.  gcc seems happy to go with
+   that.
+
+   Oh .. and this all needs to be conditionalised so that it is
+   unchanged from before this commit, when compiled with older gccs
+   that don't support __builtin_dwarf_cfa.  Furthermore, since
+   this header file is freestanding, it has to be independent of
+   config.h, and so the following conditionalisation cannot depend on
+   configure time checks.
+
+   Although it's not clear from
+   'defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)',
+   this expression excludes Darwin.
+   .cfi directives in Darwin assembly appear to be completely
+   different and I haven't investigated how they work.
+
+   For even more entertainment value, note we have to use the
+   completely undocumented __builtin_dwarf_cfa(), which appears to
+   really compute the CFA, whereas __builtin_frame_address(0) claims
+   to but actually doesn't.  See
+   https://bugs.kde.org/show_bug.cgi?id=243270#c47
+*/
+#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
+#  define __FRAME_POINTER                                         \
+      ,"r"(__builtin_dwarf_cfa())
+#  define VALGRIND_CFI_PROLOGUE                                   \
+      "movq %%rbp, %%r15\n\t"                                     \
+      "movq %2, %%rbp\n\t"                                        \
+      ".cfi_remember_state\n\t"                                   \
+      ".cfi_def_cfa rbp, 0\n\t"
+#  define VALGRIND_CFI_EPILOGUE                                   \
+      "movq %%r15, %%rbp\n\t"                                     \
+      ".cfi_restore_state\n\t"
+#else
+#  define __FRAME_POINTER
+#  define VALGRIND_CFI_PROLOGUE
+#  define VALGRIND_CFI_EPILOGUE
+#endif
+
+/* Macros to save and align the stack before making a function
+   call and restore it afterwards as gcc may not keep the stack
+   pointer aligned if it doesn't realise calls are being made
+   to other functions. */
+
+#define VALGRIND_ALIGN_STACK               \
+      "movq %%rsp,%%r14\n\t"               \
+      "andq $0xfffffffffffffff0,%%rsp\n\t"
+#define VALGRIND_RESTORE_STACK             \
+      "movq %%r14,%%rsp\n\t"
+
 /* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned
    long) == 8. */
 
@@ -1060,11 +1435,496 @@ typedef
    redzone, for the duration of the hidden call, to make it safe.
 
    Probably the same problem afflicts the other redzone-style ABIs too
-   (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is
+   (ppc64-linux); but for those, the stack is
    self describing (none of this CFI nonsense) so at least messing
    with the stack pointer doesn't give a danger of non-unwindable
    stack. */
 
+#define CALL_FN_W_v(lval, orig)                                        \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[1];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_W(lval, orig, arg1)                                  \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[2];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_WW(lval, orig, arg1,arg2)                            \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[3];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                      \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[4];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)                \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[5];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)             \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[6];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)        \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[7];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,        \
+                                 arg7)                                 \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[8];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $136,%%rsp\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,        \
+                                 arg7,arg8)                            \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[9];                               \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      _argvec[8] = (unsigned long)(arg8);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "pushq 64(%%rax)\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,        \
+                                 arg7,arg8,arg9)                       \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[10];                              \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      _argvec[8] = (unsigned long)(arg8);                              \
+      _argvec[9] = (unsigned long)(arg9);                              \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $136,%%rsp\n\t"                                         \
+         "pushq 72(%%rax)\n\t"                                         \
+         "pushq 64(%%rax)\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,       \
+                                  arg7,arg8,arg9,arg10)                \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[11];                              \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      _argvec[8] = (unsigned long)(arg8);                              \
+      _argvec[9] = (unsigned long)(arg9);                              \
+      _argvec[10] = (unsigned long)(arg10);                            \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "pushq 80(%%rax)\n\t"                                         \
+         "pushq 72(%%rax)\n\t"                                         \
+         "pushq 64(%%rax)\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,       \
+                                  arg7,arg8,arg9,arg10,arg11)          \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[12];                              \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      _argvec[8] = (unsigned long)(arg8);                              \
+      _argvec[9] = (unsigned long)(arg9);                              \
+      _argvec[10] = (unsigned long)(arg10);                            \
+      _argvec[11] = (unsigned long)(arg11);                            \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $136,%%rsp\n\t"                                         \
+         "pushq 88(%%rax)\n\t"                                         \
+         "pushq 80(%%rax)\n\t"                                         \
+         "pushq 72(%%rax)\n\t"                                         \
+         "pushq 64(%%rax)\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,       \
+                                arg7,arg8,arg9,arg10,arg11,arg12)      \
+   do {                                                                \
+      volatile OrigFn        _orig = (orig);                           \
+      volatile unsigned long _argvec[13];                              \
+      volatile unsigned long _res;                                     \
+      _argvec[0] = (unsigned long)_orig.nraddr;                        \
+      _argvec[1] = (unsigned long)(arg1);                              \
+      _argvec[2] = (unsigned long)(arg2);                              \
+      _argvec[3] = (unsigned long)(arg3);                              \
+      _argvec[4] = (unsigned long)(arg4);                              \
+      _argvec[5] = (unsigned long)(arg5);                              \
+      _argvec[6] = (unsigned long)(arg6);                              \
+      _argvec[7] = (unsigned long)(arg7);                              \
+      _argvec[8] = (unsigned long)(arg8);                              \
+      _argvec[9] = (unsigned long)(arg9);                              \
+      _argvec[10] = (unsigned long)(arg10);                            \
+      _argvec[11] = (unsigned long)(arg11);                            \
+      _argvec[12] = (unsigned long)(arg12);                            \
+      __asm__ volatile(                                                \
+         VALGRIND_CFI_PROLOGUE                                         \
+         VALGRIND_ALIGN_STACK                                          \
+         "subq $128,%%rsp\n\t"                                         \
+         "pushq 96(%%rax)\n\t"                                         \
+         "pushq 88(%%rax)\n\t"                                         \
+         "pushq 80(%%rax)\n\t"                                         \
+         "pushq 72(%%rax)\n\t"                                         \
+         "pushq 64(%%rax)\n\t"                                         \
+         "pushq 56(%%rax)\n\t"                                         \
+         "movq 48(%%rax), %%r9\n\t"                                    \
+         "movq 40(%%rax), %%r8\n\t"                                    \
+         "movq 32(%%rax), %%rcx\n\t"                                   \
+         "movq 24(%%rax), %%rdx\n\t"                                   \
+         "movq 16(%%rax), %%rsi\n\t"                                   \
+         "movq 8(%%rax), %%rdi\n\t"                                    \
+         "movq (%%rax), %%rax\n\t"  /* target->%rax */                 \
+         VALGRIND_CALL_NOREDIR_RAX                                     \
+         VALGRIND_RESTORE_STACK                                        \
+         VALGRIND_CFI_EPILOGUE                                         \
+         : /*out*/   "=a" (_res)                                       \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER                 \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
+      );                                                               \
+      lval = (__typeof__(lval)) _res;                                  \
+   } while (0)
+
+#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
+
+/* ------------------------ ppc32-linux ------------------------ */
+
+#if defined(PLAT_ppc32_linux)
+
+/* This is useful for finding out about the on-stack stuff:
+
+   extern int f9  ( int,int,int,int,int,int,int,int,int );
+   extern int f10 ( int,int,int,int,int,int,int,int,int,int );
+   extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
+   extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
+
+   int g9 ( void ) {
+      return f9(11,22,33,44,55,66,77,88,99);
+   }
+   int g10 ( void ) {
+      return f10(11,22,33,44,55,66,77,88,99,110);
+   }
+   int g11 ( void ) {
+      return f11(11,22,33,44,55,66,77,88,99,110,121);
+   }
+   int g12 ( void ) {
+      return f12(11,22,33,44,55,66,77,88,99,110,121,132);
+   }
+*/
+
+/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS                                       \
+   "lr", "ctr", "xer",                                            \
+   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
+   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
+   "r11", "r12", "r13"
+
+/* Macros to save and align the stack before making a function
+   call and restore it afterwards as gcc may not keep the stack
+   pointer aligned if it doesn't realise calls are being made
+   to other functions. */
+
+#define VALGRIND_ALIGN_STACK               \
+      "mr 28,1\n\t"                        \
+      "rlwinm 1,1,0,0,27\n\t"
+#define VALGRIND_RESTORE_STACK             \
+      "mr 1,28\n\t"
+
+/* These CALL_FN_ macros assume that on ppc32-linux, 
+   sizeof(unsigned long) == 4. */
+
 #define CALL_FN_W_v(lval, orig)                                   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
@@ -1072,13 +1932,15 @@ typedef
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1089,38 +1951,42 @@ typedef
       volatile unsigned long _argvec[2];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
+      );                                                          \
+      lval = (__typeof__(lval)) _res;                             \
+   } while (0)
+
 #define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
       volatile unsigned long _argvec[3];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1131,20 +1997,22 @@ typedef
       volatile unsigned long _argvec[4];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1155,22 +2023,24 @@ typedef
       volatile unsigned long _argvec[5];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1181,24 +2051,26 @@ typedef
       volatile unsigned long _argvec[6];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1209,26 +2081,28 @@ typedef
       volatile unsigned long _argvec[7];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1240,29 +2114,30 @@ typedef
       volatile unsigned long _argvec[8];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $8, %%rsp\n"                                       \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1274,31 +2149,32 @@ typedef
       volatile unsigned long _argvec[9];                          \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
+      _argvec[8] = (unsigned long)arg8;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $16, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1310,33 +2186,38 @@ typedef
       volatile unsigned long _argvec[10];                         \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
+      _argvec[8] = (unsigned long)arg8;                           \
+      _argvec[9] = (unsigned long)arg9;                           \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $24, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "addi 1,1,-16\n\t"                                       \
+         /* arg9 */                                               \
+         "lwz 3,36(11)\n\t"                                       \
+         "stw 3,8(1)\n\t"                                         \
+         /* args1-8 */                                            \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1348,77 +2229,93 @@ typedef
       volatile unsigned long _argvec[11];                         \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
+      _argvec[8] = (unsigned long)arg8;                           \
+      _argvec[9] = (unsigned long)arg9;                           \
+      _argvec[10] = (unsigned long)arg10;                         \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $32, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "addi 1,1,-16\n\t"                                       \
+         /* arg10 */                                              \
+         "lwz 3,40(11)\n\t"                                       \
+         "stw 3,12(1)\n\t"                                        \
+         /* arg9 */                                               \
+         "lwz 3,36(11)\n\t"                                       \
+         "stw 3,8(1)\n\t"                                         \
+         /* args1-8 */                                            \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
+      );                                                          \
+      lval = (__typeof__(lval)) _res;                             \
+   } while (0)
+
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
+                                  arg7,arg8,arg9,arg10,arg11)     \
+   do {                                                           \
+      volatile OrigFn        _orig = (orig);                      \
+      volatile unsigned long _argvec[12];                         \
+      volatile unsigned long _res;                                \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
+      _argvec[8] = (unsigned long)arg8;                           \
+      _argvec[9] = (unsigned long)arg9;                           \
+      _argvec[10] = (unsigned long)arg10;                         \
+      _argvec[11] = (unsigned long)arg11;                         \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 88(%%rax)\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $40, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "addi 1,1,-32\n\t"                                       \
+         /* arg11 */                                              \
+         "lwz 3,44(11)\n\t"                                       \
+         "stw 3,16(1)\n\t"                                        \
+         /* arg10 */                                              \
+         "lwz 3,40(11)\n\t"                                       \
+         "stw 3,12(1)\n\t"                                        \
+         /* arg9 */                                               \
+         "lwz 3,36(11)\n\t"                                       \
+         "stw 3,8(1)\n\t"                                         \
+         /* args1-8 */                                            \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1430,69 +2327,59 @@ typedef
       volatile unsigned long _argvec[13];                         \
       volatile unsigned long _res;                                \
       _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      _argvec[12] = (unsigned long)(arg12);                       \
+      _argvec[1] = (unsigned long)arg1;                           \
+      _argvec[2] = (unsigned long)arg2;                           \
+      _argvec[3] = (unsigned long)arg3;                           \
+      _argvec[4] = (unsigned long)arg4;                           \
+      _argvec[5] = (unsigned long)arg5;                           \
+      _argvec[6] = (unsigned long)arg6;                           \
+      _argvec[7] = (unsigned long)arg7;                           \
+      _argvec[8] = (unsigned long)arg8;                           \
+      _argvec[9] = (unsigned long)arg9;                           \
+      _argvec[10] = (unsigned long)arg10;                         \
+      _argvec[11] = (unsigned long)arg11;                         \
+      _argvec[12] = (unsigned long)arg12;                         \
       __asm__ volatile(                                           \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 96(%%rax)\n\t"                                    \
-         "pushq 88(%%rax)\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $48, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         VALGRIND_ALIGN_STACK                                     \
+         "mr 11,%1\n\t"                                           \
+         "addi 1,1,-32\n\t"                                       \
+         /* arg12 */                                              \
+         "lwz 3,48(11)\n\t"                                       \
+         "stw 3,20(1)\n\t"                                        \
+         /* arg11 */                                              \
+         "lwz 3,44(11)\n\t"                                       \
+         "stw 3,16(1)\n\t"                                        \
+         /* arg10 */                                              \
+         "lwz 3,40(11)\n\t"                                       \
+         "stw 3,12(1)\n\t"                                        \
+         /* arg9 */                                               \
+         "lwz 3,36(11)\n\t"                                       \
+         "stw 3,8(1)\n\t"                                         \
+         /* args1-8 */                                            \
+         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
+         "lwz 4,8(11)\n\t"                                        \
+         "lwz 5,12(11)\n\t"                                       \
+         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
+         "lwz 7,20(11)\n\t"                                       \
+         "lwz 8,24(11)\n\t"                                       \
+         "lwz 9,28(11)\n\t"                                       \
+         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
+         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         VALGRIND_RESTORE_STACK                                   \
+         "mr %0,3"                                                \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
-
-/* ------------------------ ppc32-linux ------------------------ */
-
-#if defined(PLAT_ppc32_linux)
-
-/* This is useful for finding out about the on-stack stuff:
+#endif /* PLAT_ppc32_linux */
 
-   extern int f9  ( int,int,int,int,int,int,int,int,int );
-   extern int f10 ( int,int,int,int,int,int,int,int,int,int );
-   extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
-   extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
+/* ------------------------ ppc64-linux ------------------------ */
 
-   int g9 ( void ) {
-      return f9(11,22,33,44,55,66,77,88,99);
-   }
-   int g10 ( void ) {
-      return f10(11,22,33,44,55,66,77,88,99,110);
-   }
-   int g11 ( void ) {
-      return f11(11,22,33,44,55,66,77,88,99,110,121);
-   }
-   int g12 ( void ) {
-      return f12(11,22,33,44,55,66,77,88,99,110,121,132);
-   }
-*/
+#if defined(PLAT_ppc64_linux)
 
 /* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
 
@@ -1503,23 +2390,42 @@ typedef
    "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
    "r11", "r12", "r13"
 
-/* These CALL_FN_ macros assume that on ppc32-linux, 
-   sizeof(unsigned long) == 4. */
+/* Macros to save and align the stack before making a function
+   call and restore it afterwards as gcc may not keep the stack
+   pointer aligned if it doesn't realise calls are being made
+   to other functions. */
+
+#define VALGRIND_ALIGN_STACK               \
+      "mr 28,1\n\t"                        \
+      "rldicr 1,1,0,59\n\t"
+#define VALGRIND_RESTORE_STACK             \
+      "mr 1,28\n\t"
+
+/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
+   long) == 8. */
 
 #define CALL_FN_W_v(lval, orig)                                   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[1];                          \
+      volatile unsigned long _argvec[3+0];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1] = (unsigned long)_orig.r2;                       \
+      _argvec[2] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1527,19 +2433,27 @@ typedef
 #define CALL_FN_W_W(lval, orig, arg1)                             \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[2];                          \
+      volatile unsigned long _argvec[3+1];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1547,21 +2461,29 @@ typedef
 #define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3];                          \
+      volatile unsigned long _argvec[3+2];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1569,23 +2491,31 @@ typedef
 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[4];                          \
+      volatile unsigned long _argvec[3+3];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1593,25 +2523,33 @@ typedef
 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[5];                          \
+      volatile unsigned long _argvec[3+4];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1619,27 +2557,35 @@ typedef
 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[6];                          \
+      volatile unsigned long _argvec[3+5];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1647,29 +2593,37 @@ typedef
 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[7];                          \
+      volatile unsigned long _argvec[3+6];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1678,31 +2632,39 @@ typedef
                                  arg7)                            \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[8];                          \
+      volatile unsigned long _argvec[3+7];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1711,33 +2673,41 @@ typedef
                                  arg7,arg8)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[9];                          \
+      volatile unsigned long _argvec[3+8];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[2+8] = (unsigned long)arg8;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1746,40 +2716,47 @@ typedef
                                  arg7,arg8,arg9)                  \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[10];                         \
+      volatile unsigned long _argvec[3+9];                        \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[2+9] = (unsigned long)arg9;                         \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "addi 1,1,-16\n\t"                                       \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "addi 1,1,-128\n\t"  /* expand stack frame */            \
          /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
+         "ld  3,72(11)\n\t"                                       \
+         "std 3,112(1)\n\t"                                       \
          /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,16\n\t"                                        \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
+         : /*out*/   "=r" (_res)                                  \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1788,44 +2765,51 @@ typedef
                                   arg7,arg8,arg9,arg10)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[11];                         \
+      volatile unsigned long _argvec[3+10];                       \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[2+9] = (unsigned long)arg9;                         \
+      _argvec[2+10] = (unsigned long)arg10;                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "addi 1,1,-16\n\t"                                       \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "addi 1,1,-128\n\t"  /* expand stack frame */            \
          /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
+         "ld  3,80(11)\n\t"                                       \
+         "std 3,120(1)\n\t"                                       \
          /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
+         "ld  3,72(11)\n\t"                                       \
+         "std 3,112(1)\n\t"                                       \
          /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,16\n\t"                                        \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1834,48 +2818,55 @@ typedef
                                   arg7,arg8,arg9,arg10,arg11)     \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
+      volatile unsigned long _argvec[3+11];                       \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
-      _argvec[11] = (unsigned long)arg11;                         \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[2+9] = (unsigned long)arg9;                         \
+      _argvec[2+10] = (unsigned long)arg10;                       \
+      _argvec[2+11] = (unsigned long)arg11;                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "addi 1,1,-32\n\t"                                       \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "addi 1,1,-144\n\t"  /* expand stack frame */            \
          /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,16(1)\n\t"                                        \
+         "ld  3,88(11)\n\t"                                       \
+         "std 3,128(1)\n\t"                                       \
          /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
+         "ld  3,80(11)\n\t"                                       \
+         "std 3,120(1)\n\t"                                       \
          /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
+         "ld  3,72(11)\n\t"                                       \
+         "std 3,112(1)\n\t"                                       \
          /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,32\n\t"                                        \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1884,94 +2875,111 @@ typedef
                                 arg7,arg8,arg9,arg10,arg11,arg12) \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[13];                         \
+      volatile unsigned long _argvec[3+12];                       \
       volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
-      _argvec[11] = (unsigned long)arg11;                         \
-      _argvec[12] = (unsigned long)arg12;                         \
+      /* _argvec[0] holds current r2 across the call */           \
+      _argvec[1]   = (unsigned long)_orig.r2;                     \
+      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
+      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[2+9] = (unsigned long)arg9;                         \
+      _argvec[2+10] = (unsigned long)arg10;                       \
+      _argvec[2+11] = (unsigned long)arg11;                       \
+      _argvec[2+12] = (unsigned long)arg12;                       \
       __asm__ volatile(                                           \
+         VALGRIND_ALIGN_STACK                                     \
          "mr 11,%1\n\t"                                           \
-         "addi 1,1,-32\n\t"                                       \
+         "std 2,-16(11)\n\t"  /* save tocptr */                   \
+         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
+         "addi 1,1,-144\n\t"  /* expand stack frame */            \
          /* arg12 */                                              \
-         "lwz 3,48(11)\n\t"                                       \
-         "stw 3,20(1)\n\t"                                        \
+         "ld  3,96(11)\n\t"                                       \
+         "std 3,136(1)\n\t"                                       \
          /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,16(1)\n\t"                                        \
+         "ld  3,88(11)\n\t"                                       \
+         "std 3,128(1)\n\t"                                       \
          /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
+         "ld  3,80(11)\n\t"                                       \
+         "std 3,120(1)\n\t"                                       \
          /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
+         "ld  3,72(11)\n\t"                                       \
+         "std 3,112(1)\n\t"                                       \
          /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
+         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
+         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
+         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
+         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
+         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
+         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
+         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
+         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
+         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
          VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,32\n\t"                                        \
-         "mr %0,3"                                                \
+         "mr 11,%1\n\t"                                           \
+         "mr %0,3\n\t"                                            \
+         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
+         VALGRIND_RESTORE_STACK                                   \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "r" (&_argvec[2])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r28"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#endif /* PLAT_ppc32_linux */
-
-/* ------------------------ ppc64-linux ------------------------ */
+#endif /* PLAT_ppc64_linux */
 
-#if defined(PLAT_ppc64_linux)
+/* ------------------------- arm-linux ------------------------- */
 
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+#if defined(PLAT_arm_linux)
 
 /* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
-   long) == 8. */
+#define __CALLER_SAVED_REGS "r0", "r1", "r2", "r3","r4","r14"
+
+/* Macros to save and align the stack before making a function
+   call and restore it afterwards as gcc may not keep the stack
+   pointer aligned if it doesn't realise calls are being made
+   to other functions. */
+
+/* This is a bit tricky.  We store the original stack pointer in r10
+   as it is callee-saves.  gcc doesn't allow the use of r11 for some
+   reason.  Also, we can't directly "bic" the stack pointer in thumb
+   mode since r13 isn't an allowed register number in that context.
+   So use r4 as a temporary, since that is about to get trashed
+   anyway, just after each use of this macro.  Side effect is we need
+   to be very careful about any future changes, since
+   VALGRIND_ALIGN_STACK simply assumes r4 is usable. */
+#define VALGRIND_ALIGN_STACK               \
+      "mov r10, sp\n\t"                    \
+      "mov r4,  sp\n\t"                    \
+      "bic r4,  r4, #7\n\t"                \
+      "mov sp,  r4\n\t"
+#define VALGRIND_RESTORE_STACK             \
+      "mov sp,  r10\n\t"
+
+/* These CALL_FN_ macros assume that on arm-linux, sizeof(unsigned
+   long) == 4. */
 
 #define CALL_FN_W_v(lval, orig)                                   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
+      volatile unsigned long _argvec[1];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0\n"                                           \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -1979,25 +2987,20 @@ typedef
 #define CALL_FN_W_W(lval, orig, arg1)                             \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
+      volatile unsigned long _argvec[2];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0\n"                                           \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2005,27 +3008,22 @@ typedef
 #define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
+      volatile unsigned long _argvec[3];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0\n"                                           \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2033,29 +3031,24 @@ typedef
 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
+      volatile unsigned long _argvec[4];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0\n"                                           \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2063,31 +3056,26 @@ typedef
 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
+      volatile unsigned long _argvec[5];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2095,33 +3083,30 @@ typedef
 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
+      volatile unsigned long _argvec[6];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "sub sp, sp, #4 \n\t"                                    \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "push {r0} \n\t"                                         \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2129,35 +3114,31 @@ typedef
 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
+      volatile unsigned long _argvec[7];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "push {r0, r1} \n\t"                                     \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2166,37 +3147,34 @@ typedef
                                  arg7)                            \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
+      volatile unsigned long _argvec[8];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "sub sp, sp, #4 \n\t"                                    \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "push {r0, r1, r2} \n\t"                                 \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2205,39 +3183,35 @@ typedef
                                  arg7,arg8)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
+      volatile unsigned long _argvec[9];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "ldr r3, [%1, #32] \n\t"                                 \
+         "push {r0, r1, r2, r3} \n\t"                             \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2246,46 +3220,38 @@ typedef
                                  arg7,arg8,arg9)                  \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
+      volatile unsigned long _argvec[10];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-128\n\t"  /* expand stack frame */            \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,128"     /* restore frame */                   \
+         VALGRIND_ALIGN_STACK                                     \
+         "sub sp, sp, #4 \n\t"                                    \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "ldr r3, [%1, #32] \n\t"                                 \
+         "ldr r4, [%1, #36] \n\t"                                 \
+         "push {r0, r1, r2, r3, r4} \n\t"                         \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -2294,781 +3260,659 @@ typedef
                                   arg7,arg8,arg9,arg10)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
+      volatile unsigned long _argvec[11];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-128\n\t"  /* expand stack frame */            \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,128"     /* restore frame */                   \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #40] \n\t"                                 \
+         "push {r0} \n\t"                                         \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "ldr r3, [%1, #32] \n\t"                                 \
+         "ldr r4, [%1, #36] \n\t"                                 \
+         "push {r0, r1, r2, r3, r4} \n\t"                         \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
+                                  arg6,arg7,arg8,arg9,arg10,      \
+                                  arg11)                          \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
+      volatile unsigned long _argvec[12];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
+      _argvec[11] = (unsigned long)(arg11);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-144\n\t"  /* expand stack frame */            \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,144"     /* restore frame */                   \
+         VALGRIND_ALIGN_STACK                                     \
+         "sub sp, sp, #4 \n\t"                                    \
+         "ldr r0, [%1, #40] \n\t"                                 \
+         "ldr r1, [%1, #44] \n\t"                                 \
+         "push {r0, r1} \n\t"                                     \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "ldr r3, [%1, #32] \n\t"                                 \
+         "ldr r4, [%1, #36] \n\t"                                 \
+         "push {r0, r1, r2, r3, r4} \n\t"                         \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
+                                  arg6,arg7,arg8,arg9,arg10,      \
+                                  arg11,arg12)                    \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
+      volatile unsigned long _argvec[13];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
+      _argvec[11] = (unsigned long)(arg11);                       \
+      _argvec[12] = (unsigned long)(arg12);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-144\n\t"  /* expand stack frame */            \
-         /* arg12 */                                              \
-         "ld  3,96(11)\n\t"                                       \
-         "std 3,136(1)\n\t"                                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,144"     /* restore frame */                   \
+         VALGRIND_ALIGN_STACK                                     \
+         "ldr r0, [%1, #40] \n\t"                                 \
+         "ldr r1, [%1, #44] \n\t"                                 \
+         "ldr r2, [%1, #48] \n\t"                                 \
+         "push {r0, r1, r2} \n\t"                                 \
+         "ldr r0, [%1, #20] \n\t"                                 \
+         "ldr r1, [%1, #24] \n\t"                                 \
+         "ldr r2, [%1, #28] \n\t"                                 \
+         "ldr r3, [%1, #32] \n\t"                                 \
+         "ldr r4, [%1, #36] \n\t"                                 \
+         "push {r0, r1, r2, r3, r4} \n\t"                         \
+         "ldr r0, [%1, #4] \n\t"                                  \
+         "ldr r1, [%1, #8] \n\t"                                  \
+         "ldr r2, [%1, #12] \n\t"                                 \
+         "ldr r3, [%1, #16] \n\t"                                 \
+         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
+         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
+         VALGRIND_RESTORE_STACK                                   \
+         "mov %0, r0"                                             \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+         : /*in*/    "0" (&_argvec[0])                            \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r10"   \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#endif /* PLAT_ppc64_linux */
+#endif /* PLAT_arm_linux */
+
+/* ------------------------- s390x-linux ------------------------- */
+
+#if defined(PLAT_s390x_linux)
+
+/* Similar workaround as amd64 (see above), but we use r11 as frame
+   pointer and save the old r11 in r7. r11 might be used for
+   argvec, therefore we copy argvec in r1 since r1 is clobbered
+   after the call anyway.  */
+#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
+#  define __FRAME_POINTER                                         \
+      ,"d"(__builtin_dwarf_cfa())
+#  define VALGRIND_CFI_PROLOGUE                                   \
+      ".cfi_remember_state\n\t"                                   \
+      "lgr 1,%1\n\t" /* copy the argvec pointer in r1 */          \
+      "lgr 7,11\n\t"                                              \
+      "lgr 11,%2\n\t"                                             \
+      ".cfi_def_cfa r11, 0\n\t"
+#  define VALGRIND_CFI_EPILOGUE                                   \
+      "lgr 11, 7\n\t"                                             \
+      ".cfi_restore_state\n\t"
+#else
+#  define __FRAME_POINTER
+#  define VALGRIND_CFI_PROLOGUE                                   \
+      "lgr 1,%1\n\t"
+#  define VALGRIND_CFI_EPILOGUE
+#endif
 
-/* ------------------------ ppc32-aix5 ------------------------- */
+/* Nb: On s390 the stack pointer is properly aligned *at all times*
+   according to the s390 GCC maintainer. (The ABI specification is not
+   precise in this regard.) Therefore, VALGRIND_ALIGN_STACK and
+   VALGRIND_RESTORE_STACK are not defined here. */
+
+/* These regs are trashed by the hidden call. Note that we overwrite
+   r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the
+   function a proper return address. All others are ABI defined call
+   clobbers. */
+#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
+                           "f0","f1","f2","f3","f4","f5","f6","f7"
+
+/* Nb: Although r11 is modified in the asm snippets below (inside 
+   VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
+   two reasons:
+   (1) r11 is restored in VALGRIND_CFI_EPILOGUE, so effectively it is not
+       modified
+   (2) GCC will complain that r11 cannot appear inside a clobber section,
+       when compiled with -O -fno-omit-frame-pointer
+ */
+
+#define CALL_FN_W_v(lval, orig)                                  \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long  _argvec[1];                        \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 1, 0(1)\n\t"  /* target->r1 */                      \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "d" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-#if defined(PLAT_ppc32_aix5)
+/* The call abi has the arguments in r2-r6 and stack */
+#define CALL_FN_W_W(lval, orig, arg1)                            \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[2];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
+#define CALL_FN_W_WW(lval, orig, arg1, arg2)                     \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[3];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
+#define CALL_FN_W_WWW(lval, orig, arg1, arg2, arg3)              \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[4];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
+#define CALL_FN_W_WWWW(lval, orig, arg1, arg2, arg3, arg4)       \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[5];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "lwz  3," #_n_fr "(1)\n\t"                               \
-         "stw  3,0(1)\n\t"
+#define CALL_FN_W_5W(lval, orig, arg1, arg2, arg3, arg4, arg5)   \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[6];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-160\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,160\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
+#define CALL_FN_W_6W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \
+                     arg6)                                       \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[7];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-168\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,168\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
-   long) == 4. */
+#define CALL_FN_W_7W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \
+                     arg6, arg7)                                 \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[8];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-176\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,176\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
+   } while (0)
 
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
+#define CALL_FN_W_8W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \
+                     arg6, arg7 ,arg8)                           \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[9];                         \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      _argvec[8] = (unsigned long)arg8;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-184\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "mvc 176(8,15), 64(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,184\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
    } while (0)
 
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
+#define CALL_FN_W_9W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \
+                     arg6, arg7 ,arg8, arg9)                     \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[10];                        \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      _argvec[8] = (unsigned long)arg8;                          \
+      _argvec[9] = (unsigned long)arg9;                          \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-192\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "mvc 176(8,15), 64(1)\n\t"                              \
+         "mvc 184(8,15), 72(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,192\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
    } while (0)
 
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t" /* arg2->r4 */                       \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
+#define CALL_FN_W_10W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \
+                     arg6, arg7 ,arg8, arg9, arg10)              \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[11];                        \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      _argvec[8] = (unsigned long)arg8;                          \
+      _argvec[9] = (unsigned long)arg9;                          \
+      _argvec[10] = (unsigned long)arg10;                        \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-200\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "mvc 176(8,15), 64(1)\n\t"                              \
+         "mvc 184(8,15), 72(1)\n\t"                              \
+         "mvc 192(8,15), 80(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,200\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
    } while (0)
 
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
+#define CALL_FN_W_11W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \
+                     arg6, arg7 ,arg8, arg9, arg10, arg11)       \
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[12];                        \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      _argvec[8] = (unsigned long)arg8;                          \
+      _argvec[9] = (unsigned long)arg9;                          \
+      _argvec[10] = (unsigned long)arg10;                        \
+      _argvec[11] = (unsigned long)arg11;                        \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-208\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "mvc 176(8,15), 64(1)\n\t"                              \
+         "mvc 184(8,15), 72(1)\n\t"                              \
+         "mvc 192(8,15), 80(1)\n\t"                              \
+         "mvc 200(8,15), 88(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,208\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
    } while (0)
 
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
+#define CALL_FN_W_12W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \
+                     arg6, arg7 ,arg8, arg9, arg10, arg11, arg12)\
+   do {                                                          \
+      volatile OrigFn        _orig = (orig);                     \
+      volatile unsigned long _argvec[13];                        \
+      volatile unsigned long _res;                               \
+      _argvec[0] = (unsigned long)_orig.nraddr;                  \
+      _argvec[1] = (unsigned long)arg1;                          \
+      _argvec[2] = (unsigned long)arg2;                          \
+      _argvec[3] = (unsigned long)arg3;                          \
+      _argvec[4] = (unsigned long)arg4;                          \
+      _argvec[5] = (unsigned long)arg5;                          \
+      _argvec[6] = (unsigned long)arg6;                          \
+      _argvec[7] = (unsigned long)arg7;                          \
+      _argvec[8] = (unsigned long)arg8;                          \
+      _argvec[9] = (unsigned long)arg9;                          \
+      _argvec[10] = (unsigned long)arg10;                        \
+      _argvec[11] = (unsigned long)arg11;                        \
+      _argvec[12] = (unsigned long)arg12;                        \
+      __asm__ volatile(                                          \
+         VALGRIND_CFI_PROLOGUE                                   \
+         "aghi 15,-216\n\t"                                      \
+         "lg 2, 8(1)\n\t"                                        \
+         "lg 3,16(1)\n\t"                                        \
+         "lg 4,24(1)\n\t"                                        \
+         "lg 5,32(1)\n\t"                                        \
+         "lg 6,40(1)\n\t"                                        \
+         "mvc 160(8,15), 48(1)\n\t"                              \
+         "mvc 168(8,15), 56(1)\n\t"                              \
+         "mvc 176(8,15), 64(1)\n\t"                              \
+         "mvc 184(8,15), 72(1)\n\t"                              \
+         "mvc 192(8,15), 80(1)\n\t"                              \
+         "mvc 200(8,15), 88(1)\n\t"                              \
+         "mvc 208(8,15), 96(1)\n\t"                              \
+         "lg 1, 0(1)\n\t"                                        \
+         VALGRIND_CALL_NOREDIR_R1                                \
+         "lgr %0, 2\n\t"                                         \
+         "aghi 15,216\n\t"                                       \
+         VALGRIND_CFI_EPILOGUE                                   \
+         : /*out*/   "=d" (_res)                                 \
+         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \
+         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
+      );                                                         \
+      lval = (__typeof__(lval)) _res;                            \
    } while (0)
 
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg12 */                                              \
-         "lwz 3,48(11)\n\t"                                       \
-         "stw 3,68(1)\n\t"                                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
 
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
+#endif /* PLAT_s390x_linux */
 
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "ld   3," #_n_fr "(1)\n\t"                               \
-         "std  3,0(1)\n\t"
+/* ------------------------- mips-linux ------------------------- */
+#if defined(PLAT_mips32_linux)
 
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
+/* These regs are trashed by the hidden call. */
+#define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6",       \
+"$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
+"$25", "$31"
 
-/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
-   long) == 8. */
+/* These CALL_FN_ macros assume that on mips-linux, sizeof(unsigned
+   long) == 4. */
 
 #define CALL_FN_W_v(lval, orig)                                   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
+      volatile unsigned long _argvec[1];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+        "subu $29, $29, 16 \n\t"                                 \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 16\n\t"                                  \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $29, $29, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3077,27 +3921,26 @@ typedef
 #define CALL_FN_W_W(lval, orig, arg1)                             \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
+     volatile unsigned long _argvec[2];                           \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "subu $29, $29, 16 \n\t"                                 \
+         "lw $a0, 4(%1) \n\t"   /* arg1*/                         \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 16 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $29, $29, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
+        : /*in*/    "0" (&_argvec[0])                             \
+         : /*trash*/ "cc", "memory",  __CALLER_SAVED_REGS         \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
@@ -3105,28 +3948,27 @@ typedef
 #define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
+      volatile unsigned long _argvec[3];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "subu $29, $29, 16 \n\t"                                 \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 16 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $29, $29, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3135,30 +3977,29 @@ typedef
 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
+      volatile unsigned long _argvec[4];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "subu $29, $29, 16 \n\t"                                 \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 16 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $29, $29, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3167,32 +4008,31 @@ typedef
 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
+      volatile unsigned long _argvec[5];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "subu $29, $29, 16 \n\t"                                 \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 16 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $29, $29, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3201,72 +4041,73 @@ typedef
 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
+      volatile unsigned long _argvec[6];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 24\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $29, $29, 24 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
-
 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
+      volatile unsigned long _argvec[7];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 32\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "nop\n\t"                                                \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 32 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3276,38 +4117,40 @@ typedef
                                  arg7)                            \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
+      volatile unsigned long _argvec[8];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 32\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 32 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3317,40 +4160,43 @@ typedef
                                  arg7,arg8)                       \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
+      volatile unsigned long _argvec[9];                          \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 40\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 32(%1) \n\t"                                    \
+         "sw $a0, 28($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 40 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3360,47 +4206,46 @@ typedef
                                  arg7,arg8,arg9)                  \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
+      volatile unsigned long _argvec[10];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 40\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 32(%1) \n\t"                                    \
+         "sw $a0, 28($sp) \n\t"                                   \
+         "lw $a0, 36(%1) \n\t"                                    \
+         "sw $a0, 32($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 40 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
@@ -3410,177 +4255,170 @@ typedef
                                   arg7,arg8,arg9,arg10)           \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
+      volatile unsigned long _argvec[11];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 48\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 32(%1) \n\t"                                    \
+         "sw $a0, 28($sp) \n\t"                                   \
+         "lw $a0, 36(%1) \n\t"                                    \
+         "sw $a0, 32($sp) \n\t"                                   \
+         "lw $a0, 40(%1) \n\t"                                    \
+         "sw $a0, 36($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 48 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
+#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
+                                  arg6,arg7,arg8,arg9,arg10,      \
+                                  arg11)                          \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
+      volatile unsigned long _argvec[12];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
+      _argvec[11] = (unsigned long)(arg11);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 48\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 32(%1) \n\t"                                    \
+         "sw $a0, 28($sp) \n\t"                                   \
+         "lw $a0, 36(%1) \n\t"                                    \
+         "sw $a0, 32($sp) \n\t"                                   \
+         "lw $a0, 40(%1) \n\t"                                    \
+         "sw $a0, 36($sp) \n\t"                                   \
+         "lw $a0, 44(%1) \n\t"                                    \
+         "sw $a0, 40($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 48 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
+#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
+                                  arg6,arg7,arg8,arg9,arg10,      \
+                                  arg11,arg12)                    \
    do {                                                           \
       volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
+      volatile unsigned long _argvec[13];                         \
       volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
+      _argvec[0] = (unsigned long)_orig.nraddr;                   \
+      _argvec[1] = (unsigned long)(arg1);                         \
+      _argvec[2] = (unsigned long)(arg2);                         \
+      _argvec[3] = (unsigned long)(arg3);                         \
+      _argvec[4] = (unsigned long)(arg4);                         \
+      _argvec[5] = (unsigned long)(arg5);                         \
+      _argvec[6] = (unsigned long)(arg6);                         \
+      _argvec[7] = (unsigned long)(arg7);                         \
+      _argvec[8] = (unsigned long)(arg8);                         \
+      _argvec[9] = (unsigned long)(arg9);                         \
+      _argvec[10] = (unsigned long)(arg10);                       \
+      _argvec[11] = (unsigned long)(arg11);                       \
+      _argvec[12] = (unsigned long)(arg12);                       \
       __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg12 */                                              \
-         "ld  3,96(11)\n\t"                                       \
-         "std 3,136(1)\n\t"                                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
+         "subu $29, $29, 8 \n\t"                                  \
+         "sw $gp, 0($sp) \n\t"                                    \
+         "sw $ra, 4($sp) \n\t"                                    \
+         "lw $a0, 20(%1) \n\t"                                    \
+         "subu $sp, $sp, 56\n\t"                                  \
+         "sw $a0, 16($sp) \n\t"                                   \
+         "lw $a0, 24(%1) \n\t"                                    \
+         "sw $a0, 20($sp) \n\t"                                   \
+         "lw $a0, 28(%1) \n\t"                                    \
+         "sw $a0, 24($sp) \n\t"                                   \
+         "lw $a0, 32(%1) \n\t"                                    \
+         "sw $a0, 28($sp) \n\t"                                   \
+         "lw $a0, 36(%1) \n\t"                                    \
+         "sw $a0, 32($sp) \n\t"                                   \
+         "lw $a0, 40(%1) \n\t"                                    \
+         "sw $a0, 36($sp) \n\t"                                   \
+         "lw $a0, 44(%1) \n\t"                                    \
+         "sw $a0, 40($sp) \n\t"                                   \
+         "lw $a0, 48(%1) \n\t"                                    \
+         "sw $a0, 44($sp) \n\t"                                   \
+         "lw $a0, 4(%1) \n\t"                                     \
+         "lw $a1, 8(%1) \n\t"                                     \
+         "lw $a2, 12(%1) \n\t"                                    \
+         "lw $a3, 16(%1) \n\t"                                    \
+         "lw $t9, 0(%1) \n\t"  /* target->t9 */                   \
+         VALGRIND_CALL_NOREDIR_T9                                 \
+         "addu $sp, $sp, 56 \n\t"                                 \
+         "lw $gp, 0($sp) \n\t"                                    \
+         "lw $ra, 4($sp) \n\t"                                    \
+         "addu $sp, $sp, 8 \n\t"                                  \
+         "move %0, $v0\n"                                         \
          : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
+         : /*in*/    "0" (&_argvec[0])                            \
          : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
       );                                                          \
       lval = (__typeof__(lval)) _res;                             \
    } while (0)
 
-#endif /* PLAT_ppc64_aix5 */
+#endif /* PLAT_mips32_linux */
 
 
 /* ------------------------------------------------------------------ */
@@ -3626,9 +4464,14 @@ typedef
              errors. */
           VG_USERREQ__COUNT_ERRORS = 0x1201,
 
+          /* Allows a string (gdb monitor command) to be passed to the tool
+             Used for interaction with vgdb/gdb */
+          VG_USERREQ__GDB_MONITOR_COMMAND = 0x1202,
+
           /* These are useful and can be interpreted by any tool that
              tracks malloc() et al, by using vg_replace_malloc.c. */
           VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
+          VG_USERREQ__RESIZEINPLACE_BLOCK = 0x130b,
           VG_USERREQ__FREELIKE_BLOCK   = 0x1302,
           /* Memory pool support. */
           VG_USERREQ__CREATE_MEMPOOL   = 0x1303,
@@ -3641,8 +4484,17 @@ typedef
           VG_USERREQ__MEMPOOL_EXISTS   = 0x130a,
 
           /* Allow printfs to valgrind log. */
+          /* The first two pass the va_list argument by value, which
+             assumes it is the same size as or smaller than a UWord,
+             which generally isn't the case.  Hence are deprecated.
+             The second two pass the vargs by reference and so are
+             immune to this problem. */
+          /* both :: char* fmt, va_list vargs (DEPRECATED) */
           VG_USERREQ__PRINTF           = 0x1401,
           VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
+          /* both :: char* fmt, va_list* vargs */
+          VG_USERREQ__PRINTF_VALIST_BY_REF = 0x1403,
+          VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 0x1404,
 
           /* Stack support. */
           VG_USERREQ__STACK_REGISTER   = 0x1501,
@@ -3650,39 +4502,44 @@ typedef
           VG_USERREQ__STACK_CHANGE     = 0x1503,
 
           /* Wine support */
-          VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601
+          VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,
+
+          /* Querying of debug info. */
+          VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701,
+
+          /* Disable/enable error reporting level.  Takes a single
+             Word arg which is the delta to this thread's error
+             disablement indicator.  Hence 1 disables or further
+             disables errors, and -1 moves back towards enablement.
+             Other values are not allowed. */
+          VG_USERREQ__CHANGE_ERR_DISABLEMENT = 0x1801,
+
+          /* Initialise IR injection */
+          VG_USERREQ__VEX_INIT_FOR_IRI = 0x1901
    } Vg_ClientRequest;
 
 #if !defined(__GNUC__)
 #  define __extension__ /* */
 #endif
 
+
 /* Returns the number of Valgrinds this code is running under.  That
    is, 0 if running natively, 1 if running under Valgrind, 2 if
    running under Valgrind which is running under another Valgrind,
    etc. */
-#if defined(HOST_WIN32) || defined(TARGET_WIN32)
-#define RUNNING_ON_VALGRIND 0
-#else
-#define RUNNING_ON_VALGRIND  __extension__                        \
-   ({unsigned int _qzz_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* if not */,          \
-                               VG_USERREQ__RUNNING_ON_VALGRIND,   \
-                               0, 0, 0, 0, 0);                    \
-    _qzz_res;                                                     \
-   })
-#endif
+#define RUNNING_ON_VALGRIND                                           \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* if not */,         \
+                                    VG_USERREQ__RUNNING_ON_VALGRIND,  \
+                                    0, 0, 0, 0, 0)                    \
+
 
 /* Discard translation of code in the range [_qzz_addr .. _qzz_addr +
    _qzz_len - 1].  Useful if you are debugging a JITter or some such,
    since it provides a way to make sure valgrind will retranslate the
    invalidated area.  Returns no value. */
-#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len)         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__DISCARD_TRANSLATIONS,  \
-                               _qzz_addr, _qzz_len, 0, 0, 0);     \
-   }
+#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len)              \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DISCARD_TRANSLATIONS,  \
+                                    _qzz_addr, _qzz_len, 0, 0, 0)
 
 
 /* These requests are for getting Valgrind itself to print something.
@@ -3690,46 +4547,83 @@ typedef
    is the number of characters printed, excluding the "**<pid>** " part at the
    start and the backtrace (if present). */
 
-#if defined(NVALGRIND)
-
-#  define VALGRIND_PRINTF(...)
-#  define VALGRIND_PRINTF_BACKTRACE(...)
-
-#else /* NVALGRIND */
-
+#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
 /* Modern GCC will optimize the static routine out if unused,
    and unused attribute will shut down warnings about it.  */
 static int VALGRIND_PRINTF(const char *format, ...)
    __attribute__((format(__printf__, 1, 2), __unused__));
+#endif
 static int
+#if defined(_MSC_VER)
+__inline
+#endif
 VALGRIND_PRINTF(const char *format, ...)
 {
+#if defined(NVALGRIND)
+   return 0;
+#else /* NVALGRIND */
+#if defined(_MSC_VER)
+   uintptr_t _qzz_res;
+#else
    unsigned long _qzz_res;
+#endif
    va_list vargs;
    va_start(vargs, format);
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
-                              (unsigned long)format, (unsigned long)vargs, 
+#if defined(_MSC_VER)
+   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+                              VG_USERREQ__PRINTF_VALIST_BY_REF,
+                              (uintptr_t)format,
+                              (uintptr_t)&vargs,
+                              0, 0, 0);
+#else
+   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+                              VG_USERREQ__PRINTF_VALIST_BY_REF,
+                              (unsigned long)format,
+                              (unsigned long)&vargs, 
                               0, 0, 0);
+#endif
    va_end(vargs);
    return (int)_qzz_res;
+#endif /* NVALGRIND */
 }
 
+#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
 static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
    __attribute__((format(__printf__, 1, 2), __unused__));
+#endif
 static int
+#if defined(_MSC_VER)
+__inline
+#endif
 VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
 {
+#if defined(NVALGRIND)
+   return 0;
+#else /* NVALGRIND */
+#if defined(_MSC_VER)
+   uintptr_t _qzz_res;
+#else
    unsigned long _qzz_res;
+#endif
    va_list vargs;
    va_start(vargs, format);
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
-                              (unsigned long)format, (unsigned long)vargs, 
+#if defined(_MSC_VER)
+   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
+                              (uintptr_t)format,
+                              (uintptr_t)&vargs,
+                              0, 0, 0);
+#else
+   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
+                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
+                              (unsigned long)format,
+                              (unsigned long)&vargs, 
                               0, 0, 0);
+#endif
    va_end(vargs);
    return (int)_qzz_res;
-}
-
 #endif /* NVALGRIND */
+}
 
 
 /* These requests allow control to move from the simulated CPU to the
@@ -3756,58 +4650,39 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
    with a lot in the past.
 */
 #define VALGRIND_NON_SIMD_CALL0(_qyy_fn)                          \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL0,          \
-                               _qyy_fn,                           \
-                               0, 0, 0, 0);                       \
-    _qyy_res;                                                     \
-   })
-
-#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1)               \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL1,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, 0, 0, 0);               \
-    _qyy_res;                                                     \
-   })
-
-#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2)    \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL2,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, _qyy_arg2, 0, 0);       \
-    _qyy_res;                                                     \
-   })
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,       \
+                                    VG_USERREQ__CLIENT_CALL0,     \
+                                    _qyy_fn,                      \
+                                    0, 0, 0, 0)
+
+#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1)                    \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,            \
+                                    VG_USERREQ__CLIENT_CALL1,          \
+                                    _qyy_fn,                           \
+                                    _qyy_arg1, 0, 0, 0)
+
+#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2)         \
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,            \
+                                    VG_USERREQ__CLIENT_CALL2,          \
+                                    _qyy_fn,                           \
+                                    _qyy_arg1, _qyy_arg2, 0, 0)
 
 #define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL3,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, _qyy_arg2,              \
-                               _qyy_arg3, 0);                     \
-    _qyy_res;                                                     \
-   })
+    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,             \
+                                    VG_USERREQ__CLIENT_CALL3,           \
+                                    _qyy_fn,                            \
+                                    _qyy_arg1, _qyy_arg2,               \
+                                    _qyy_arg3, 0)
 
 
 /* Counts the number of errors that have been recorded by a tool.  Nb:
    the tool must record the errors with VG_(maybe_record_error)() or
    VG_(unique_error)() for them to be counted. */
 #define VALGRIND_COUNT_ERRORS                                     \
-   __extension__                                                  \
-   ({unsigned int _qyy_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(                    \
+                               0 /* default return */,            \
                                VG_USERREQ__COUNT_ERRORS,          \
-                               0, 0, 0, 0, 0);                    \
-    _qyy_res;                                                     \
-   })
+                               0, 0, 0, 0, 0)
 
 /* Several Valgrind tools (Memcheck, Massif, Helgrind, DRD) rely on knowing
    when heap blocks are allocated in order to give accurate results.  This
@@ -3873,7 +4748,24 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
    VALGRIND_FREELIKE_BLOCK should be put immediately after the point where a
    heap block is deallocated.
 
-   In many cases, these two client requests will not be enough to get your
+   VALGRIND_RESIZEINPLACE_BLOCK informs a tool about reallocation. For
+   Memcheck, it does four things:
+
+   - It records that the size of a block has been changed.  This assumes that
+     the block was annotated as having been allocated via
+     VALGRIND_MALLOCLIKE_BLOCK.  Otherwise, an error will be issued.
+
+   - If the block shrunk, it marks the freed memory as being unaddressable.
+
+   - If the block grew, it marks the new area as undefined and defines a red
+     zone past the end of the new block.
+
+   - The V-bits of the overlap between the old and the new block are preserved.
+
+   VALGRIND_RESIZEINPLACE_BLOCK should be put after allocation of the new block
+   and before deallocation of the old block.
+
+   In many cases, these three client requests will not be enough to get your
    allocator working well with Memcheck.  More specifically, if your allocator
    writes to freed blocks in any way then a VALGRIND_MAKE_MEM_UNDEFINED call
    will be necessary to mark the memory as addressable just before the zeroing
@@ -3891,138 +4783,125 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
    understand the distinction between the allocator and the rest of the
    program.
 
-   Note: there is currently no VALGRIND_REALLOCLIKE_BLOCK client request;  it
-   has to be emulated with MALLOCLIKE/FREELIKE and memory copying.
-   
    Ignored if addr == 0.
 */
-#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)    \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MALLOCLIKE_BLOCK,      \
-                               addr, sizeB, rzB, is_zeroed, 0);   \
-   }
+#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)          \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK,       \
+                                    addr, sizeB, rzB, is_zeroed, 0)
 
 /* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.
    Ignored if addr == 0.
 */
-#define VALGRIND_FREELIKE_BLOCK(addr, rzB)                        \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__FREELIKE_BLOCK,        \
-                               addr, rzB, 0, 0, 0);               \
-   }
+#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB)     \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__RESIZEINPLACE_BLOCK,    \
+                                    addr, oldSizeB, newSizeB, rzB, 0)
+
+/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.
+   Ignored if addr == 0.
+*/
+#define VALGRIND_FREELIKE_BLOCK(addr, rzB)                              \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREELIKE_BLOCK,         \
+                                    addr, rzB, 0, 0, 0)
 
 /* Create a memory pool. */
 #define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed)             \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__CREATE_MEMPOOL,        \
-                               pool, rzB, is_zeroed, 0, 0);       \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL,   \
+                                    pool, rzB, is_zeroed, 0, 0)
 
 /* Destroy a memory pool. */
 #define VALGRIND_DESTROY_MEMPOOL(pool)                            \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__DESTROY_MEMPOOL,       \
-                               pool, 0, 0, 0, 0);                 \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL,  \
+                                    pool, 0, 0, 0, 0)
 
 /* Associate a piece of memory with a memory pool. */
 #define VALGRIND_MEMPOOL_ALLOC(pool, addr, size)                  \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_ALLOC,         \
-                               pool, addr, size, 0, 0);           \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_ALLOC,    \
+                                    pool, addr, size, 0, 0)
 
 /* Disassociate a piece of memory from a memory pool. */
 #define VALGRIND_MEMPOOL_FREE(pool, addr)                         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_FREE,          \
-                               pool, addr, 0, 0, 0);              \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_FREE,     \
+                                    pool, addr, 0, 0, 0)
 
 /* Disassociate any pieces outside a particular range. */
 #define VALGRIND_MEMPOOL_TRIM(pool, addr, size)                   \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_TRIM,          \
-                               pool, addr, size, 0, 0);           \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_TRIM,     \
+                                    pool, addr, size, 0, 0)
 
 /* Resize and/or move a piece associated with a memory pool. */
 #define VALGRIND_MOVE_MEMPOOL(poolA, poolB)                       \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MOVE_MEMPOOL,          \
-                               poolA, poolB, 0, 0, 0);            \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MOVE_MEMPOOL,     \
+                                    poolA, poolB, 0, 0, 0)
 
 /* Resize and/or move a piece associated with a memory pool. */
 #define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size)         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_CHANGE,        \
-                               pool, addrA, addrB, size, 0);      \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_CHANGE,   \
+                                    pool, addrA, addrB, size, 0)
 
 /* Return 1 if a mempool exists, else 0. */
 #define VALGRIND_MEMPOOL_EXISTS(pool)                             \
-   __extension__                                                  \
-   ({unsigned int _qzz_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \
                                VG_USERREQ__MEMPOOL_EXISTS,        \
-                               pool, 0, 0, 0, 0);                 \
-    _qzz_res;                                                     \
-   })
+                               pool, 0, 0, 0, 0)
 
 /* Mark a piece of memory as being a stack. Returns a stack id. */
 #define VALGRIND_STACK_REGISTER(start, end)                       \
-   __extension__                                                  \
-   ({unsigned int _qzz_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \
                                VG_USERREQ__STACK_REGISTER,        \
-                               start, end, 0, 0, 0);              \
-    _qzz_res;                                                     \
-   })
+                               start, end, 0, 0, 0)
 
 /* Unmark the piece of memory associated with a stack id as being a
    stack. */
 #define VALGRIND_STACK_DEREGISTER(id)                             \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__STACK_DEREGISTER,      \
-                               id, 0, 0, 0, 0);                   \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_DEREGISTER, \
+                                    id, 0, 0, 0, 0)
 
 /* Change the start and end address of the stack id. */
 #define VALGRIND_STACK_CHANGE(id, start, end)                     \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__STACK_CHANGE,          \
-                               id, start, end, 0, 0);             \
-   }
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_CHANGE,     \
+                                    id, start, end, 0, 0)
 
 /* Load PDB debug info for Wine PE image_map. */
-#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta)   \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__LOAD_PDB_DEBUGINFO,    \
-                               fd, ptr, total_size, delta, 0);    \
-   }
-
-
+#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta)     \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LOAD_PDB_DEBUGINFO, \
+                                    fd, ptr, total_size, delta, 0)
+
+/* Map a code address to a source file name and line number.  buf64
+   must point to a 64-byte buffer in the caller's address space.  The
+   result will be dumped in there and is guaranteed to be zero
+   terminated.  If no info is found, the first byte is set to zero. */
+#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64)                    \
+    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \
+                               VG_USERREQ__MAP_IP_TO_SRCLOC,      \
+                               addr, buf64, 0, 0, 0)
+
+/* Disable error reporting for this thread.  Behaves in a stack like
+   way, so you can safely call this multiple times provided that
+   VALGRIND_ENABLE_ERROR_REPORTING is called the same number of times
+   to re-enable reporting.  The first call of this macro disables
+   reporting.  Subsequent calls have no effect except to increase the
+   number of VALGRIND_ENABLE_ERROR_REPORTING calls needed to re-enable
+   reporting.  Child threads do not inherit this setting from their
+   parents -- they are always created with reporting enabled. */
+#define VALGRIND_DISABLE_ERROR_REPORTING                                \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
+                                    1, 0, 0, 0, 0)
+
+/* Re-enable error reporting, as per comments on
+   VALGRIND_DISABLE_ERROR_REPORTING. */
+#define VALGRIND_ENABLE_ERROR_REPORTING                                 \
+    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
+                                    -1, 0, 0, 0, 0)
+
+#undef PLAT_x86_darwin
+#undef PLAT_amd64_darwin
+#undef PLAT_x86_win32
 #undef PLAT_x86_linux
 #undef PLAT_amd64_linux
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
+#undef PLAT_arm_linux
+#undef PLAT_s390x_linux
+#undef PLAT_mips32_linux
 
-#else /* __GNUC__ */
-#define RUNNING_ON_VALGRIND 0
-#endif
 #endif   /* __VALGRIND_H */
index 6db6dfe238d567c98ee016cd853040ce2ae308cf..25db51903369f8e49193bbcef7d70e2d53710784 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
 "PO-Revision-Date: 2008-09-26 15:14+0100\n"
 "Last-Translator: Daniel Nauck <dna@mono-project.de>\n"
 "Language-Team: http://www.mono-project.de\n"
@@ -30,7 +30,7 @@ msgid ""
 "mismatch"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
 #, csharp-format
 msgid "Delegate `{0}' does not take `{1}' arguments"
 msgstr ""
@@ -50,44 +50,44 @@ msgstr ""
 msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
 msgid "Async lambda expressions cannot be converted to expression trees"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
 msgid "An anonymous method cannot be converted to an expression tree"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
 #, csharp-format
 msgid ""
 "Cannot convert anonymous method block without a parameter list to delegate "
 "type `{0}' because it has one or more `out' parameters"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
 msgid ""
 "Anonymous methods and lambda expressions cannot be used in the current "
 "context"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
 #, csharp-format
 msgid ""
 "Local variable or parameter `{0}' cannot have their address taken and be "
 "used inside an anonymous method, lambda expression or query expression"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
 #, fuzzy, csharp-format
 msgid "Cannot convert async {0} to delegate type `{1}'"
 msgstr "Kann Typ `{0}'<...> nicht finden"
 
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
 msgid "An expression tree cannot contain an anonymous method expression"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
 #, csharp-format
 msgid ""
 "`{0}': An anonymous type cannot have multiple properties with the same name"
@@ -131,54 +131,54 @@ msgstr ""
 msgid "Cannot assign to `{0}' because it is a `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
 msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
 #, csharp-format
 msgid "A duplicate type forward of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
 #, fuzzy, csharp-format
 msgid "Cannot forward type `{0}' because it is defined in this assembly"
 msgstr ""
 "NULL kann nicht in `{0}' konvertiert werden, da dies ein Werttyp ist, der "
 "nicht auf NULL festgelegt werden kann"
 
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
 #, fuzzy, csharp-format
 msgid "Cannot forward type `{0}' because it is a nested type"
 msgstr ""
 "NULL kann nicht in `{0}' konvertiert werden, da dies ein Werttyp ist, der "
 "nicht auf NULL festgelegt werden kann"
 
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
 "cannot have a version, culture or processor architecture specified"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. Strong named assemblies must "
 "specify a public key in their InternalsVisibleTo declarations"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
 #, csharp-format
 msgid "Referenced assembly `{0}' does not have a strong name"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
 #, csharp-format
 msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
 #, csharp-format
 msgid ""
 "Friend access was granted to `{0}', but the output assembly is named `{1}'. "
@@ -186,151 +186,151 @@ msgid ""
 "it"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
 msgid ""
 "Could not sign the assembly. ECMA key can only be used to delay-sign "
 "assemblies"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
 msgid ""
 "Added modules must be marked with the CLSCompliant attribute to match the "
 "assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
 #, csharp-format
 msgid ""
 "Option `{0}' overrides attribute `{1}' given in a source file or added module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
 msgid "Delay signing was requested but no key file was given"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
 msgid "Cannot link resource file when building a module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
 #, fuzzy, csharp-format
 msgid "Error reading resource file `{0}'"
 msgstr "Fehler beim erstellen der XML-Dokumentationsdatei `{0}' (`{1}')"
 
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
 msgid "Could not write to file `"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
 msgid "Cannot specify -main if building a module or library"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
 #, csharp-format
 msgid "Could not find `{0}' specified for Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
 #, fuzzy, csharp-format
 msgid "`{0}' specified for Main method must be a valid class or struct"
 msgstr "`{0}': Erweiterungsmethoden müssen statisch sein"
 
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
 #, csharp-format
 msgid "`{0}' does not have a suitable static Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
 #, csharp-format
 msgid ""
 "Program `{0}' does not contain a static `Main' method suitable for an entry "
 "point"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
 msgid "Error during assembly signing. "
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
 #, csharp-format
 msgid "Metadata file `{0}' could not be found"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
 #, csharp-format
 msgid "Metadata file `{0}' does not contain valid metadata"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
 #, csharp-format
 msgid ""
 "Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
 "option to add the module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
 #, csharp-format
 msgid ""
 "Added module file `{0}' is an assembly. Consider using `-r' option to "
 "reference the file"
 msgstr ""
 
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
 #, fuzzy
 msgid "The `await' operator cannot be used in the body of a lock statement"
 msgstr ""
 "Die `new()'-Einschränkung kann nicht mit der `struct'-Einschränkung genutzt "
 "werden"
 
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
 #, fuzzy
 msgid "The `await' operator cannot be used in an unsafe context"
 msgstr ""
 "Die `new()'-Einschränkung kann nicht mit der `struct'-Einschränkung genutzt "
 "werden"
 
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
 #, csharp-format
 msgid ""
 "Cannot await void method `{0}'. Consider changing method return type to "
 "`Task'"
 msgstr ""
 
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
 #, csharp-format
 msgid "Cannot await `{0}' expression"
 msgstr ""
 
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
 #, csharp-format
 msgid ""
 "The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
 msgstr ""
 
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
 msgid ""
 "The `await' operator may only be used in a query expression within the first "
 "collection expression of the initial `from' clause or within the collection "
 "expression of a `join' clause"
 msgstr ""
 
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
 #, csharp-format
 msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
 msgstr ""
 
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
 #, fuzzy, csharp-format
 msgid "The awaiter type `{0}' must implement interface `{1}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
 msgid ""
 "Cannot find compiler required types for asynchronous functions support. Are "
 "you targeting the wrong framework version?"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument. Named attribute arguments "
@@ -338,81 +338,81 @@ msgid ""
 "properties which are public and not static"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument because it is not a valid "
 "attribute parameter type"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
 msgid "An attribute argument cannot be dynamic expression"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
 msgid "The Guid attribute must be specified with the ComImport attribute"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
 #, csharp-format
 msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
 #, csharp-format
 msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
 #, csharp-format
 msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
 #, csharp-format
 msgid ""
 "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
 "Attribute'"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
 #, csharp-format
 msgid "`{0}': is not an attribute class"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
 #, csharp-format
 msgid "Cannot apply attribute class `{0}' because it is abstract"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
 #, csharp-format
 msgid "Duplicate named attribute `{0}' argument"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
 #, csharp-format
 msgid ""
 "The attribute `{0}' is not valid on this declaration type. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
 #, csharp-format
 msgid "The argument to the `{0}' attribute must be a valid identifier"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
 #, csharp-format
 msgid "Invalid value for argument to `{0}' attribute"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
 #, csharp-format
 msgid "The attribute `{0}' cannot be applied multiple times"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
 #, csharp-format
 msgid "`{0}' is obsolete: `{1}'"
 msgstr "`{0}' ist veraltet: `{1}'"
@@ -423,114 +423,114 @@ msgid ""
 "`struct', `interface', or `void' keyword"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
 msgid "Invalid number"
 msgstr "Ungültige Zahl"
 
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
 #, csharp-format
 msgid "Unrecognized escape sequence `\\{0}'"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
 msgid "Unrecognized escape sequence"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
 msgid "Filename, single-line comment or end-of-line expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
 #, fuzzy
 msgid "Missing identifier to pre-processor directive"
 msgstr "Ungültige Präprozessor Direktive"
 
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
 #, csharp-format
 msgid "Identifier expected: {0}"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
 #, fuzzy
 msgid "Integral constant is too large"
 msgstr "Numerische Konstante ist zu lang"
 
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
 msgid "Invalid preprocessor directive"
 msgstr "Ungültige Präprozessor Direktive"
 
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
 #, csharp-format
 msgid "Unexpected processor directive ({0})"
 msgstr "Unerwartete Prozessor Direktive ({0})"
 
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
 msgid ""
 "Cannot define or undefine preprocessor symbols after first token in file"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
 msgid ""
 "Preprocessor directives must appear as the first non-whitespace character on "
 "a line"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
 msgid "Single-line comment or end-of-line expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
 msgid "Expected `#endif' directive"
 msgstr "`#endif' Direktive erwartet"
 
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
 msgid "#endregion directive expected"
 msgstr "`#endregion' Direktive erwartet"
 
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
 msgid "Wrong preprocessor directive"
 msgstr "Falsche Präprozessor Direktive"
 
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
 #, csharp-format
 msgid "#error: '{0}'"
 msgstr "#Fehler: '{0}'"
 
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
 msgid "The line number specified for #line directive is missing or invalid"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
 msgid "Newline in constant"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
 msgid "Unterminated string literal"
 msgstr "Nicht beendetes Zeichenfolgeliteral"
 
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
 msgid "Identifier too long (limit is 512 chars)"
 msgstr "Der Bezeichner ist zu lang. (Maximal 512 Zeichen)"
 
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
 msgid "End-of-file found, '*/' expected"
 msgstr "Dateiende gefunden. `*/' erwartet."
 
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
 msgid "Keyword, identifier, or string expected after verbatim specifier: @"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
 #, fuzzy, csharp-format
 msgid "Unexpected character `{0}'"
 msgstr "`{0}' erwartet"
 
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
 msgid "Empty character literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
 msgid "Too many characters in character literal"
 msgstr ""
 
@@ -575,414 +575,421 @@ msgid ""
 "declaration of this type exists"
 msgstr ""
 
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
 #, csharp-format
 msgid ""
 "`{0}': explicit interface declaration can only be declared in a class or "
 "struct"
 msgstr ""
 
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
 #, csharp-format
 msgid "Duplicate type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
 #, csharp-format
 msgid "The type `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
 msgid ""
 "Cannot specify the `DefaultMember' attribute on type containing an indexer"
 msgstr ""
 
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
 msgid "The RequiredAttribute attribute is not permitted on C# types"
 msgstr ""
 
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
 #, csharp-format
 msgid "Class `{0}' cannot derive from the dynamic type"
 msgstr ""
 
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
 #, csharp-format
 msgid "`{0}' is already listed in interface list"
 msgstr ""
 
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base interface `{0}' is less accessible than "
 "interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
 #, csharp-format
 msgid "Type `{0}' in interface list is not an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
 #, csharp-format
 msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
 msgstr ""
 
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
 #, csharp-format
 msgid "`{0}': Base class `{1}' must be specified as first"
 msgstr ""
 
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
 #, csharp-format
 msgid ""
 "The operator `{0}' requires a matching operator `{1}' to also be defined"
 msgstr ""
 
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
 #, csharp-format
 msgid "Partial declarations of `{0}' must not specify different base classes"
 msgstr ""
 
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
 #, csharp-format
 msgid ""
 "Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
 #, csharp-format
 msgid "Circular base class dependency involving `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
 #, csharp-format
 msgid ""
 "Partial declarations of `{0}' have inconsistent constraints for type "
 "parameter `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
 #, fuzzy, csharp-format
 msgid "`{0}': cannot implement a dynamic interface `{1}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
 #, csharp-format
 msgid ""
 "`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
 "type parameter substitutions"
 msgstr ""
 
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
 #, csharp-format
 msgid ""
 "A generic type cannot derive from `{0}' because it is an attribute class"
 msgstr ""
 
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
 msgid ""
 "Two indexers have different names; the IndexerName attribute must be used "
 "with the same name on every indexer within a type"
 msgstr ""
 
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
 #, csharp-format
 msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
 msgstr ""
 
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
 #, csharp-format
 msgid "A member `{0}' marked as override cannot be marked as new or virtual"
 msgstr ""
 
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
 #, csharp-format
 msgid "`{0}' cannot be both extern and abstract"
 msgstr ""
 
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
 #, csharp-format
 msgid "`{0}' cannot be both abstract and sealed"
 msgstr "`{0}' Eine Klasse kann nicht gleichzeitig statisch und versiegelt sein"
 
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
 #, csharp-format
 msgid "The abstract method `{0}' cannot be marked virtual"
 msgstr ""
 
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
 #, csharp-format
 msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
 #, csharp-format
 msgid "`{0}': virtual or abstract members cannot be private"
 msgstr ""
 
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
 #, csharp-format
 msgid "`{0}' cannot be sealed because it is not an override"
 msgstr ""
 
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
 #, csharp-format
 msgid "`{0}': containing type does not implement interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
 #, csharp-format
 msgid "Type parameter `{0}' has same name as containing type, or method"
 msgstr ""
 
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
 #, csharp-format
 msgid "`{0}': member names cannot be the same as their enclosing type"
 msgstr ""
 
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
 msgid ""
 "The class System.Object cannot have a base class or implement an interface."
 msgstr ""
 
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
 #, csharp-format
 msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
 msgstr ""
 
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
 msgid ""
 "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
 "or attribute classes"
 msgstr ""
 
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
 #, csharp-format
 msgid "`{0}': an abstract class cannot be sealed or static"
 msgstr "`{0}': Eine abstrakte Klasse darf nicht versiegelt oder statisch sein"
 
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
 #, csharp-format
 msgid "`{0}': a class cannot be both static and sealed"
 msgstr ""
 
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
 #, csharp-format
 msgid "`{0}': Static classes cannot contain user-defined operators"
 msgstr ""
 "`{0}': Statische Klassen können keine benutzerdefinierten Operatoren "
 "beinhalten"
 
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
 #, csharp-format
 msgid "`{0}': Static classes cannot contain destructor"
 msgstr "`{0}': Statische Klassen können keinen Destruktor enthalten"
 
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
 #, csharp-format
 msgid "`{0}': cannot declare indexers in a static class"
 msgstr ""
 
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
 #, csharp-format
 msgid "`{0}': Static classes cannot have instance constructors"
 msgstr ""
 
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
 #, csharp-format
 msgid "`{0}': cannot declare instance members in a static class"
 msgstr ""
 
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
 #, fuzzy, csharp-format
 msgid "`{0}': Cannot derive from type parameter `{1}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
 #, csharp-format
 msgid "`{0}': Cannot derive from static class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
 #, csharp-format
 msgid "`{0}': cannot derive from sealed type `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
 #, csharp-format
 msgid ""
 "Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
 "from object"
 msgstr ""
 
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
 #, csharp-format
 msgid "`{0}' cannot derive from special class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base class `{0}' is less accessible than class `"
 "{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
 #, csharp-format
 msgid "Static class `{0}' cannot implement interfaces"
 msgstr ""
 
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
 #, csharp-format
 msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
 msgstr ""
 
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
 #, csharp-format
 msgid "`{0}': Structs cannot have instance field initializers"
 msgstr "`{0}': Instanzfeldinitialisierungen können nicht in Strukturen sein"
 
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
 #, csharp-format
 msgid "Do not override `{0}'. Use destructor syntax instead"
 msgstr ""
 
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
 #, csharp-format
 msgid "`{0}' is marked as an override but no suitable {1} found to override"
 msgstr ""
 
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not an event"
 msgstr ""
 
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a property"
 msgstr ""
 
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a method"
 msgstr ""
 
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
 #, csharp-format
 msgid ""
 "`{0}' cannot override inherited members `{1}' and `{2}' because they have "
 "the same signature when used in type `{3}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
 #, csharp-format
 msgid "`{0}' hides inherited abstract member `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
 #, csharp-format
 msgid ""
 "`{0}': cannot override inherited member `{1}' because it is not marked "
 "virtual, abstract or override"
 msgstr ""
 
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
 #, csharp-format
 msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
 msgstr ""
 
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
 #, csharp-format
 msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
 #, csharp-format
 msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
 #, csharp-format
 msgid "A partial method `{0}' cannot explicitly implement an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
 #, csharp-format
 msgid "The type `{0}' in explicit interface declaration is not an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "operator `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "method `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
 #, csharp-format
 msgid ""
 "`{0}': cannot change access modifiers when overriding `{1}' inherited member "
 "`{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
 #, fuzzy, csharp-format
 msgid "`{0}': static types cannot be used as return types"
 msgstr ""
 "`{0}': Statische Klassen können keine benutzerdefinierten Operatoren "
 "beinhalten"
 
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
 #, csharp-format
 msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
 msgid "Inconsistent accessibility: property type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
 msgid "Inconsistent accessibility: indexer return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
 msgid "Inconsistent accessibility: return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
 msgid "Inconsistent accessibility: field type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
 #, csharp-format
 msgid ""
 "Parameters or local variables of type `{0}' cannot be declared in async "
 "methods or iterators"
 msgstr ""
 
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
 #, csharp-format
 msgid ""
 "Local variables of type `{0}' cannot be used inside anonymous methods, "
 "lambda expressions or query expressions"
 msgstr ""
 
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
 #, csharp-format
 msgid "Field or property cannot be of type `{0}'"
 msgstr ""
@@ -1003,19 +1010,19 @@ msgid ""
 "The evaluation of the constant value for `{0}' involves a circular definition"
 msgstr ""
 
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
 #, csharp-format
 msgid "Constant value `{0}' cannot be converted to a `{1}'"
 msgstr ""
 
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
 #, csharp-format
 msgid ""
 "Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
 "to override)"
 msgstr ""
 
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
 #, csharp-format
 msgid ""
 "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
@@ -1084,74 +1091,64 @@ msgid ""
 "Extension method `{0}' of value type `{1}' cannot be used to create delegates"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
 #, csharp-format
 msgid "Cannot create delegate from partial method declaration `{0}'"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
 #, csharp-format
 msgid ""
 "Cannot create delegate with `{0}' because it has a Conditional attribute"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' parameters and return type must be same as "
 "delegate `{2} {3}' parameters and return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
 #, csharp-format
 msgid ""
 "A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
 "return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
 msgid "Method name expected"
 msgstr "Methodennamen erwartet"
 
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
 #, csharp-format
 msgid "Error generating XML documentation file `{0}' (`{1}')"
 msgstr "Fehler beim erstellen der XML-Dokumentationsdatei `{0}' (`{1}')"
 
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
 msgid "Source file `"
 msgstr ""
 
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
 msgid "No files to compile were specified"
 msgstr "Es wurden keine Dateien zum kompilieren angegeben"
 
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
 msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
 msgstr ""
 
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
 msgid ""
 "If no source files are specified you must specify the output file with -out:"
 msgstr ""
 
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
 msgid "Output file name is not valid"
 msgstr ""
 
@@ -1219,73 +1216,59 @@ msgid "`{0}' does not contain a definition for `{1}'"
 msgstr ""
 
 #: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
 msgid ""
 "The left-hand side of an assignment must be a variable, a property or an "
 "indexer"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
 msgid "The operation in question is undefined on void pointers"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
 #, csharp-format
 msgid "Internal compiler error: {0}"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
 msgid "A ref or out argument must be an assignable variable"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
 msgid ""
 "An attribute argument must be a constant expression, typeof expression or "
 "array creation expression"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
 #, csharp-format
 msgid "The class `{0}' has no constructors defined"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
 #, csharp-format
 msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
 msgid "An expression tree cannot contain an unsafe pointer operation"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
 #, csharp-format
 msgid "`{0}' is a `{1}' but a `{2}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
 #, csharp-format
 msgid "Expression denotes a `{0}', where a `{1}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
 msgid "Pointers and fixed size buffers may only be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
 #, fuzzy, csharp-format
 msgid ""
 "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
@@ -1294,109 +1277,123 @@ msgstr ""
 "Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
 "using-Direktive oder ein Assemblyverweis?"
 
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
 #, csharp-format
 msgid ""
 "A local variable `{0}' cannot be used before it is declared. Consider "
 "renaming the local variable when it hides the member `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
 #, csharp-format
 msgid "`{0}' conflicts with a declaration in a child block"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
 #, csharp-format
 msgid "A local variable `{0}' cannot be used before it is declared"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
 #, csharp-format
 msgid "The name `{0}' does not exist in the current context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
 msgid "System.Void cannot be used from C#. Consider using `void'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
 #, csharp-format
 msgid "Cannot call an abstract base member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
 #, csharp-format
 msgid ""
 "Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
 "qualifier must be of type `{2}' or derived from it"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
 #, csharp-format
 msgid ""
 "Static member `{0}' cannot be accessed with an instance reference, qualify "
 "it with a type name instead"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
 #, csharp-format
 msgid ""
 "A field initializer cannot reference the nonstatic field, method, or "
 "property `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
 #, csharp-format
 msgid "An object reference is required to access non-static member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
 #, csharp-format
 msgid ""
 "Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
 msgid "Cannot modify the result of an unboxing conversion"
 msgstr "Das Ergebnis einer Unboxing-Konvertierung kann nicht geändert werden"
 
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
 "overload `{2}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
 #, csharp-format
 msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
 msgid "An expression tree cannot contain an expression with method group"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
 msgid ""
 "Partial methods with only a defining declaration or removed conditional "
 "methods cannot be used in an expression tree"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
 #, csharp-format
 msgid ""
 "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
 "parentheses to invoke the method"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
 #, csharp-format
 msgid ""
 "The type `{0}' does not contain a constructor that takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1404,161 +1401,161 @@ msgid ""
 "without the extension method syntax"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
 #, csharp-format
 msgid ""
 "The call is ambiguous between the following methods or properties: `{0}' and "
 "`{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
 #, csharp-format
 msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
 "`out' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
 #, csharp-format
 msgid ""
 "The best overloaded collection initalizer method `{0}' has some invalid "
 "arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
 #, csharp-format
 msgid "Delegate `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
 #, csharp-format
 msgid "The best overloaded method match for `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
 #, csharp-format
 msgid ""
 "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
 #, csharp-format
 msgid "Argument `#{0}' is missing `{1}' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
 #, csharp-format
 msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
 #, csharp-format
 msgid ""
 "The type arguments for method `{0}' cannot be inferred from the usage. Try "
 "specifying the type arguments explicitly"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
 #, csharp-format
 msgid "No overload for method `{0}' takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
 #, csharp-format
 msgid "The delegate `{0}' does not contain a parameter named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
 #, csharp-format
 msgid ""
 "The best overloaded method match for `{0}' does not contain a parameter "
 "named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
 #, csharp-format
 msgid ""
 "Named argument `{0}' cannot be used for a parameter which has positional "
 "argument specified"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
 msgid ""
 "You cannot use fixed size buffers contained in unfixed expressions. Try "
 "using the fixed statement"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
 #, csharp-format
 msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
 #, fuzzy, csharp-format
 msgid "Use of possibly unassigned field `{0}'"
 msgstr "Verwendung eines möglicherweise nicht zugewiesenen Feldes `"
 
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
 #, fuzzy, csharp-format
 msgid "Property or event `{0}' is not supported by the C# language"
 msgstr ""
 "Die Eigenschaft `{0}' wird von der C# Sprache nicht unterstützt. Rufen Sie "
 "die `{1}'-Accessormethode direkt auf."
 
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
 #, csharp-format
 msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because it "
 "lacks the `get' accessor"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the get "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
 #, csharp-format
 msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the set "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of `+=' or `-=' "
 "operator"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of += or -= when used "
 "outside of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
 #, csharp-format
 msgid ""
 "An implicitly typed local variable declaration cannot be initialized with `"
 "{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
 msgid ""
 "The contextual keyword `var' may only appear within a local variable "
 "declaration"
@@ -1580,7 +1577,7 @@ msgstr ""
 msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
 msgstr "Typ byte, sbyte, short, ushort, int, uint, long oder ulong erwartet"
 
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
 msgid "Detection Parsing Error"
 msgstr ""
 
@@ -1681,203 +1678,203 @@ msgid ""
 "{1}' is used as a short circuit operator"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined as `{0}' and `{1}' "
 "convert implicitly to each other"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined because there is no "
 "implicit conversion between `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
 #, fuzzy, csharp-format
 msgid "Use of unassigned local variable `{0}'"
 msgstr "Verwendung der nicht zugewiesenen lokalen Variable `"
 
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
 #, csharp-format
 msgid ""
 "Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
 "or query expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
 #, csharp-format
 msgid ""
 "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
 #, csharp-format
 msgid "Use of unassigned out parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
 #, fuzzy, csharp-format
 msgid "Cannot invoke a non-delegate type `{0}'"
 msgstr "Kann Typ `{0}'<...> nicht finden"
 
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
 #, csharp-format
 msgid "The member `{0}' cannot be used as method or delegate"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
 msgid ""
 "Do not directly call your base class Finalize method. It is called "
 "automatically from your destructor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
 msgid ""
 "Destructors and object.Finalize cannot be called directly. Consider calling "
 "IDisposable.Dispose if available"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
 #, csharp-format
 msgid ""
 "The base call to method `{0}' cannot be dynamically dispatched. Consider "
 "casting the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
 #, csharp-format
 msgid "`{0}': cannot explicitly call operator or accessor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
 #, csharp-format
 msgid "Unsafe type `{0}' cannot be used in an object creation expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
 #, csharp-format
 msgid ""
 "Cannot create an instance of the variable type `{0}' because it does not "
 "have the new() constraint"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
 #, csharp-format
 msgid ""
 "`{0}': cannot provide arguments when creating an instance of a variable type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
 #, csharp-format
 msgid "Cannot create an instance of the static class `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
 #, csharp-format
 msgid "Cannot create an instance of the abstract class or interface `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
 msgid ""
 "An implicitly typed local variable declarator cannot use an array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
 msgid "A constant value is expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
 #, csharp-format
 msgid "An array initializer of length `{0}' was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
 msgid ""
 "Array initializers can only be used in a variable or field initializer. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
 msgid "A nested array initializer was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
 msgid "An expression tree cannot contain a multidimensional array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
 msgid "Cannot create an array with a negative size"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
 msgid ""
 "Can only use array initializer expressions to assign to array types. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
 msgid ""
 "The type of an implicitly typed array cannot be inferred from the "
 "initializer. Try specifying array type explicitly"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
 msgid ""
 "The `this' object cannot be used before all of its fields are assigned to"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
 msgid ""
 "Keyword `this' is not valid in a static property, static method, or static "
 "field initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
 msgid ""
 "Anonymous methods inside structs cannot access instance members of `this'. "
 "Consider copying `this' to a local variable outside the anonymous method and "
 "using the local instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
 msgid "Keyword `this' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
 msgid "Cannot take the address of `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
 msgid "Cannot pass `this' as a ref or out argument because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
 msgid "Cannot assign to `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
 msgid "The __arglist construct is valid only within a variable argument method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
 msgid "An expression tree cannot contain a method with variable arguments"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
 msgid "The typeof operator cannot be used on the dynamic type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
 #, csharp-format
 msgid "`{0}': an attribute argument cannot use type parameters"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
 #, csharp-format
 msgid ""
 "`{0}' does not have a predefined size, therefore sizeof can only be used in "
@@ -1885,32 +1882,34 @@ msgid ""
 "SizeOf)"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
 #, csharp-format
 msgid "Alias `{0}' not found"
 msgstr "Alias `{0}' wurde nicht gefunden"
 
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
 msgid ""
 "The namespace alias qualifier `::' cannot be used to invoke a method. "
 "Consider using `.' instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
 msgid "Cannot perform member binding on `null' value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
 #, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
 #, csharp-format
 msgid "A nested type cannot be specified through a type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
 #, fuzzy, csharp-format
 msgid ""
 "Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
@@ -1919,120 +1918,119 @@ msgstr ""
 "Der Alias `{0}' kann nicht mit '::' verwendet werden, da der Alias auf einen "
 "Typ verweist. Verwenden Sie '.' stattdessen."
 
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
 #, csharp-format
 msgid "The nested type `{0}' does not exist in the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
 #, csharp-format
 msgid "Cannot apply indexing with [] to an expression of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
 msgid "A pointer must be indexed by only one value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
 msgid "An element access expression cannot use named argument"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
 #, csharp-format
 msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
 msgid ""
 "The indexer base access cannot be dynamically dispatched. Consider casting "
 "the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
 msgid "An expression tree may not contain a base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
 msgid "Keyword `base' is not available in a static method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
 msgid "Keyword `base' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
 msgid ""
 "A property, indexer or dynamic member access may not be passed as `ref' or "
 "`out' parameter"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
 #, csharp-format
 msgid "Array elements cannot be of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
 #, csharp-format
 msgid "Array elements cannot be of static type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
 msgid "Cannot use a negative size with stackalloc"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
 msgid "Cannot use stackalloc in finally or catch"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
 #, csharp-format
 msgid ""
 "Member `{0}' cannot be initialized. An object initializer may only be used "
 "for fields, or properties"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
 #, csharp-format
 msgid ""
 "Static field or property `{0}' cannot be assigned in an object initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
 #, csharp-format
 msgid ""
 "A field or property `{0}' cannot be initialized with a collection object "
 "initializer because type `{1}' does not implement `{2}' interface"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
 #, csharp-format
 msgid "Inconsistent `{0}' member declaration"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
 #, csharp-format
 msgid ""
 "An object initializer includes more than one member `{0}' initialization"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
 #, csharp-format
 msgid "Cannot initialize object of type `{0}' with a collection initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
 msgid "Anonymous types cannot be used in this expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
 #, csharp-format
 msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
 msgstr ""
@@ -2093,12 +2091,12 @@ msgid ""
 "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
 msgstr ""
 
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
 #, csharp-format
 msgid "`{0}': A volatile field cannot be of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
 #, fuzzy, csharp-format
 msgid "`{0}': A field cannot be both volatile and readonly"
 msgstr "`{0}' Eine Klasse kann nicht gleichzeitig statisch und versiegelt sein"
@@ -2153,7 +2151,7 @@ msgid "Cannot yield in the body of a finally clause"
 msgstr ""
 
 #: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
 msgid "Control cannot leave the body of a finally clause"
 msgstr ""
 
@@ -2245,26 +2243,26 @@ msgid ""
 "`{0}' is not a valid constraint. Static classes cannot be used as constraints"
 msgstr ""
 
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
 #, csharp-format
 msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
 #, csharp-format
 msgid "`{0}': static classes cannot be used as generic arguments"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
 #, csharp-format
 msgid "The type `{0}' may not be used as a type argument"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
 msgid "Variant type parameters can only be used with interfaces and delegates"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' must be a reference type in order to use it as type parameter "
@@ -2273,7 +2271,7 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' must be a non-nullable value type in order to use it as type "
@@ -2282,14 +2280,14 @@ msgstr ""
 "Der Typ `{0}' darf keine NULL-Werte zulassen, wenn er als `{1}'-Parameter im "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden soll."
 
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
 #, csharp-format
 msgid ""
 "The type `{0}' must have a public parameterless constructor in order to use "
 "it as parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2299,7 +2297,7 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2309,7 +2307,7 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2318,7 +2316,7 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2327,7 +2325,7 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2336,21 +2334,28 @@ msgstr ""
 "Der Typ `{0}' muss ein Referenztyp sein, damit er als `{1}'-Parameter in "
 "generischen Typ oder in der generischen Methode `{2}' verwendet werden kann."
 
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined in this assembly, but it is not "
 "defined in source or any added modules"
 msgstr ""
 
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
 #, csharp-format
 msgid ""
 "The type `{0}' is defined in an assembly that is not referenced. Consider "
 "adding a reference to assembly `{1}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined assembly `{1}', but it could "
@@ -2380,36 +2385,36 @@ msgstr ""
 msgid "Iterators cannot have unsafe parameters or yield types"
 msgstr ""
 
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
 msgid "Unsafe code may not appear in iterators"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
 msgid "SDK path could not be resolved"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
 #, csharp-format
 msgid ""
 "Assembly `{0}' references `{1}' which has a higher version number than "
 "imported assembly `{2}'"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
 #, csharp-format
 msgid ""
 "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
 "supply runtime policy"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
 #, csharp-format
 msgid ""
 "An assembly with the same name `{0}' has already been imported. Consider "
 "removing one of the references or sign the assembly"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
 #, csharp-format
 msgid ""
 "An assembly with the same identity `{0}' has already been imported. Consider "
@@ -2505,86 +2510,86 @@ msgid ""
 "suffix `{1}' to create a literal of this type"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
 msgid ""
 "A partial method declaration and partial method implementation cannot differ "
 "on use of `params' modifier"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "an extension method or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
 #, csharp-format
 msgid ""
 "Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
 #, csharp-format
 msgid ""
 "Overloaded method `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`static' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`unsafe' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
 #, csharp-format
 msgid "A partial method `{0}' declaration is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
 #, csharp-format
 msgid "A partial method `{0}' implementation is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
 #, csharp-format
 msgid "A member `{0}' is already reserved"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
 #, csharp-format
 msgid "Duplicate user-defined conversion in type `{0}'"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
 #, csharp-format
 msgid ""
 "A member `{0}' is already defined. Rename this member or use different "
 "parameter types"
 msgstr ""
 
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
 #, csharp-format
 msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
 msgstr ""
 
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
 msgid ""
 "The DllImport attribute must be specified on a method marked `static' and "
 "`extern'"
 msgstr ""
 
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
 #, csharp-format
 msgid "`{0}': A partial method parameters cannot use `out' modifier"
 msgstr ""
 
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
 #, csharp-format
 msgid ""
 "Conditional not valid on `{0}' because it is a constructor, destructor, "
@@ -2593,13 +2598,6 @@ msgstr ""
 "Das Conditional-Attribut ist für `{0}' ungültig, weil dies ein Konstruktor, "
 "Destruktor, Operator oder eine explizite Schnittstellenimplementierung ist"
 
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
 #: mcs/mcs/method.cs:865
 msgid ""
 "A partial method cannot define access modifier or any of abstract, extern, "
@@ -2661,14 +2659,14 @@ msgstr ""
 msgid "The return type of an async method must be void, Task, or Task<T>"
 msgstr ""
 
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
 #, fuzzy, csharp-format
 msgid "`{0}': Extension methods cannot be defined in a nested class"
 msgstr ""
 "`{0}': Erweiterungsmethoden müssen in einer nicht generischen statischen "
 "Klasse definiert werden"
 
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
 #, csharp-format
 msgid ""
 "`{0}': Extension methods require `System.Runtime.CompilerServices."
@@ -2676,155 +2674,155 @@ msgid ""
 "reference?"
 msgstr ""
 
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
 #, csharp-format
 msgid "`{0}': Extension methods must be defined in a non-generic static class"
 msgstr ""
 "`{0}': Erweiterungsmethoden müssen in einer nicht generischen statischen "
 "Klasse definiert werden"
 
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
 #, fuzzy, csharp-format
 msgid "`{0}': an entry point cannot be async method"
 msgstr "`{0}': Abstrakte Eigenschaften können keine privaten-Accessoren haben"
 
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
 #, csharp-format
 msgid ""
 "A partial method `{0}' implementation is missing a partial method declaration"
 msgstr ""
 
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
 #, csharp-format
 msgid "Method or delegate cannot return type `{0}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
 msgid ""
 "The constructor call cannot be dynamically dispatched within constructor "
 "initializer"
 msgstr ""
 
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
 #, fuzzy, csharp-format
 msgid "`{0}': Struct constructors cannot call base constructors"
 msgstr "`{0}': Statische Klassen können keinen Destruktor enthalten"
 
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
 #, csharp-format
 msgid "Constructor `{0}' cannot call itself"
 msgstr ""
 
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
 #, csharp-format
 msgid "`{0}': The static constructor must be parameterless"
 msgstr ""
 
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
 msgid "Structs cannot contain explicit parameterless constructors"
 msgstr ""
 
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
 #, csharp-format
 msgid ""
 "`{0}': A class with the ComImport attribute cannot have a user-defined "
 "constructor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
 #, fuzzy, csharp-format
 msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
 #, csharp-format
 msgid ""
 "`{0}.{1}' in explicit interface declaration is not a member of interface"
 msgstr ""
 
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
 #, csharp-format
 msgid ""
 "`{0}' explicit method implementation cannot implement `{1}' because it is an "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
 #, fuzzy, csharp-format
 msgid "Method `{0}' cannot implement interface accessor `{1}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
 #, csharp-format
 msgid ""
 "Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
 "an explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
 #, fuzzy, csharp-format
 msgid ""
 "Accessor `{0}' must be declared public to implement interface member `{1}'"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
 #, csharp-format
 msgid ""
 "`{0}': the explicit interface implementation cannot introduce the params "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
 #, csharp-format
 msgid ""
 "Attribute `{0}' is not valid on property or event accessors. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
 #, csharp-format
 msgid "User-defined operator `{0}' must be declared static and public"
 msgstr ""
 
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
 msgid ""
 "User-defined operator cannot take an object of the enclosing type and "
 "convert to an object of the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
 msgid "User-defined conversion must convert to or from the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from the dynamic type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from an interface type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a base class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
 msgid ""
 "Overloaded shift operator must have the type of the first operand be the "
 "containing type, and the type of the second operand must be int"
 msgstr ""
 
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
 msgid ""
 "The return type for ++ or -- operator must be the containing type or derived "
 "from the containing type"
@@ -2832,20 +2830,20 @@ msgstr ""
 "Der Rückgabetyp für die Operatoren ++ und -- muss der enthaltene Typ sein "
 "oder vom enthaltenen Typ abgeleitet sein"
 
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
 msgid "The parameter type for ++ or -- operator must be the containing type"
 msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
 
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
 #, fuzzy
 msgid "The parameter type of a unary operator must be the containing type"
 msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
 
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
 msgid "The return type of operator True or False must be bool"
 msgstr ""
 
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
 #, fuzzy
 msgid "One of the parameters of a binary operator must be the containing type"
 msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
@@ -2855,72 +2853,63 @@ msgstr "Der Parameter für den ++ oder -- Operator muss der enthaltene Typ sein"
 msgid "The modifier `{0}' is not valid for this item"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:186
-#, csharp-format
+#: mcs/mcs/namespace.cs:263
+#, fuzzy, csharp-format
 msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
 msgstr ""
 "Der Typ oder Namespacename `{0}' konnte im globalen Namesapce nicht gefunden "
 "werden. Fehlt ein Assemblyverweis?"
 
-#: mcs/mcs/namespace.cs:190
-#, csharp-format
+#: mcs/mcs/namespace.cs:267
+#, fuzzy, csharp-format
 msgid ""
 "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
 msgstr ""
 "Der Typ oder Namespacename `{0}' existiert nicht im Namespace `{1}'. Fehlt "
 "ein Assemblyverweis?"
 
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
 #, csharp-format
 msgid "The imported type `{0}' is defined multiple times"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
 msgid ""
 "A using clause must precede all other namespace elements except extern alias "
 "declarations"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
 #, csharp-format
 msgid "The using alias `{0}' appeared previously in this namespace"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
 #, csharp-format
 msgid "The namespace `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
 #, csharp-format
 msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
 #, csharp-format
 msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-"Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
-"using-Direktive oder ein Assemblyverweis?"
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
 #, csharp-format
 msgid ""
 "`{0}' is a type not a namespace. A using namespace directive can only be "
 "applied to namespaces"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
 #, csharp-format
 msgid "The extern alias `{0}' was not specified in -reference option"
 msgstr ""
@@ -3106,66 +3095,66 @@ msgstr ""
 msgid "`{0}': abstract properties cannot have private accessors"
 msgstr "`{0}': Abstrakte Eigenschaften können keine privaten-Accessoren haben"
 
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
 #, csharp-format
 msgid ""
 "The accessibility modifier of the `{0}' accessor must be more restrictive "
 "than the modifier of the property or indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
 #, csharp-format
 msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
 #, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable get "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
 #, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable set "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
 #, csharp-format
 msgid ""
 "`{0}': Cannot specify accessibility modifiers for both accessors of the "
 "property or indexer"
 msgstr ""
 
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
 #, csharp-format
 msgid ""
 "`{0}': accessibility modifiers on accessors may only be used if the property "
 "or indexer has both a get and a set accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
 #, csharp-format
 msgid ""
 "Automatically implemented property `{0}' cannot be used inside a type with "
 "an explicit StructLayout attribute"
 msgstr ""
 
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
 #, csharp-format
 msgid "`{0}': event must be of a delegate type"
 msgstr ""
 
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
 #, csharp-format
 msgid ""
 "The `{0}' attribute is valid only on an indexer that is not an explicit "
 "interface member declaration"
 msgstr ""
 
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
 msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
 msgstr ""
 
@@ -3174,80 +3163,87 @@ msgstr ""
 msgid "Value specified for the argument to `{0}' is not valid"
 msgstr ""
 
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
 msgid ""
 "A lambda expression with statement body cannot be converted to an expresion "
 "tree"
 msgstr ""
 
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
 #, csharp-format
 msgid ""
 "An object of a type convertible to `{0}' is required for the return statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by any expression when method "
 "returns void"
 msgstr ""
 
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by an expression when async "
 "method returns `Task'. Consider using `Task<T>' return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
 #, csharp-format
 msgid ""
 "`{0}': The return expression type of async method must be `{1}' rather than "
 "`Task<{1}>'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
 #, csharp-format
 msgid ""
 "Cannot convert `{0}' to delegate type `{1}' because some of the return types "
 "in the block are not implicitly convertible to the delegate return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
 msgid ""
 "Cannot return a value from iterators. Use the yield return statement to "
 "return a value, or yield break to end the iteration"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
 msgid "A goto case is only valid inside a switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
 msgid "The type caught or thrown must be derived from System.Exception"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
 msgid "A fixed statement cannot use an implicitly typed local variable"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
 msgid "An implicitly typed local variable cannot be a constant"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
 msgid ""
 "An implicitly typed local variable declarator must include an initializer"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
 msgid ""
 "An implicitly typed local variable declaration cannot include multiple "
 "declarators"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
 #, csharp-format
 msgid ""
 "A local variable named `{0}' cannot be declared in this scope because it "
@@ -3255,114 +3251,114 @@ msgid ""
 "scope to denote something else"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
 #, csharp-format
 msgid "A local variable named `{0}' is already defined in this scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
 #, csharp-format
 msgid ""
 "The type parameter name `{0}' is the same as local variable or parameter name"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
 #, csharp-format
 msgid ""
 "The out parameter `{0}' must be assigned to before control leaves the "
 "current method"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
 #, csharp-format
 msgid "`{0}': not all code paths return a value"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
 #, csharp-format
 msgid "Not all code paths return a value in anonymous method of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
 #, fuzzy
 msgid "Async methods cannot have ref or out parameters"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
 msgid "__arglist is not allowed in parameter list of async methods"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
 #, fuzzy
 msgid "Async methods cannot have unsafe parameters"
 msgstr "`{0}' implementiert den Schnittstellenmember `{1}' nicht"
 
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
 #, csharp-format
 msgid "The label `{0}' is a duplicate"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
 #, csharp-format
 msgid ""
 "The label `{0}' shadows another label by the same name in a contained scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
 #, csharp-format
 msgid "The label `case {0}:' already occurs in this switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
 #, csharp-format
 msgid ""
 "A switch expression of type `{0}' cannot be converted to an integral type, "
 "bool, char, string, enum or nullable type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
 #, csharp-format
 msgid "`{0}' is not a reference type as required by the lock statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
 msgid "The type of locals declared in a fixed statement must be a pointer type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
 msgid ""
 "The right hand side of a fixed statement assignment may not be a cast "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
 msgid ""
 "You cannot use the fixed statement to take the address of an already fixed "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
 #, csharp-format
 msgid ""
 "A previous catch clause already catches all exceptions of this or a super "
 "type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
 #, csharp-format
 msgid ""
 "`{0}': type used in a using statement must be implicitly convertible to "
 "`System.IDisposable'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
 #, csharp-format
 msgid ""
 "foreach statement requires that the return type `{0}' of `{1}' must have a "
 "suitable public MoveNext method and public Current property"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it "
@@ -3370,53 +3366,60 @@ msgid ""
 "implementation"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it does "
 "not contain a definition for `{1}' or is inaccessible"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
 msgid "Use of null is not valid in this context"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
 #, csharp-format
 msgid "Foreach statement cannot operate on a `{0}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not defined or imported"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
 #, csharp-format
 msgid ""
 "The predefined type `{0}.{1}' is defined multiple times. Using definition "
 "from `{2}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not declared correctly"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
 #, csharp-format
 msgid ""
 "The compiler required member `{0}.{1}{2}' could not be found or is "
 "inaccessible"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
 #, csharp-format
 msgid ""
 "Cannot take the address of, get the size of, or declare a pointer to a "
 "managed type `{0}'"
 msgstr ""
 
+#~ msgid ""
+#~ "The type or namespace name `{0}' could not be found. Are you missing a "
+#~ "using directive or an assembly reference?"
+#~ msgstr ""
+#~ "Der Typ oder Namespacename `{0}' konnte nicht gefunden werden. Fehlt eine "
+#~ "using-Direktive oder ein Assemblyverweis?"
+
 #, fuzzy
 #~ msgid "An expression tree cannot contain an await operator"
 #~ msgstr ""
index 12df9ff8aebd225294fc52bba2de3696881ee471..bdb5186701e31849e0d7778c045b3a437ab80e61 100644 (file)
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: mono 2.1\n"
 "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
 "PO-Revision-Date: 2008-09-19 13:28-0400\n"
 "Last-Translator: Miguel de Icaza <miguel@novell.com>\n"
 "Language-Team: es <mono-list@lists.ximian.com>\n"
@@ -34,7 +34,7 @@ msgid ""
 "mismatch"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
 #, csharp-format
 msgid "Delegate `{0}' does not take `{1}' arguments"
 msgstr "El delegado `{0} no toma {1} argumentos"
@@ -56,25 +56,25 @@ msgstr ""
 msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
 msgstr "El parámetro `{0}' está declarado con `{1}' pero debería de ser `{2}'"
 
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
 #, fuzzy
 msgid "Async lambda expressions cannot be converted to expression trees"
 msgstr ""
 "Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
 
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
 msgid "An anonymous method cannot be converted to an expression tree"
 msgstr ""
 "Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
 
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
 #, csharp-format
 msgid ""
 "Cannot convert anonymous method block without a parameter list to delegate "
 "type `{0}' because it has one or more `out' parameters"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
 msgid ""
 "Anonymous methods and lambda expressions cannot be used in the current "
 "context"
@@ -82,7 +82,7 @@ msgstr ""
 "Los métodos anónimos y las expresiones lambdas no pueden ser usados en este "
 "contexto"
 
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
 #, fuzzy, csharp-format
 msgid ""
 "Local variable or parameter `{0}' cannot have their address taken and be "
@@ -91,18 +91,18 @@ msgstr ""
 "No se le puede tomar la dirección a la variable local o el parámetro `{0}' y "
 "ser al mismo tiempo usada dentro de un método anónimo o una expresión lambda."
 
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
 #, fuzzy, csharp-format
 msgid "Cannot convert async {0} to delegate type `{1}'"
 msgstr "No es posible convertir `{0}' a un un tipo que no es un delegado `{1}'"
 
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
 msgid "An expression tree cannot contain an anonymous method expression"
 msgstr ""
 "Un árbol de expresiones no puede contener una expresión que sea una método "
 "anónimo"
 
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
 #, csharp-format
 msgid ""
 "`{0}': An anonymous type cannot have multiple properties with the same name"
@@ -153,50 +153,50 @@ msgstr "Un árbol de expresiones no puede contener un operador de asignación"
 msgid "Cannot assign to `{0}' because it is a `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
 msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
 #, csharp-format
 msgid "A duplicate type forward of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is defined in this assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
 #, fuzzy, csharp-format
 msgid "Cannot forward type `{0}' because it is a nested type"
 msgstr "No es posible aplicar el atributo `{0}' ya que es abstracto"
 
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
 "cannot have a version, culture or processor architecture specified"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. Strong named assemblies must "
 "specify a public key in their InternalsVisibleTo declarations"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
 #, csharp-format
 msgid "Referenced assembly `{0}' does not have a strong name"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
 #, csharp-format
 msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
 #, csharp-format
 msgid ""
 "Friend access was granted to `{0}', but the output assembly is named `{1}'. "
@@ -204,150 +204,150 @@ msgid ""
 "it"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
 msgid ""
 "Could not sign the assembly. ECMA key can only be used to delay-sign "
 "assemblies"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
 msgid ""
 "Added modules must be marked with the CLSCompliant attribute to match the "
 "assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
 #, csharp-format
 msgid ""
 "Option `{0}' overrides attribute `{1}' given in a source file or added module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
 msgid "Delay signing was requested but no key file was given"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
 msgid "Cannot link resource file when building a module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
 #, csharp-format
 msgid "Error reading resource file `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
 msgid "Could not write to file `"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
 #, fuzzy
 msgid "Cannot specify -main if building a module or library"
 msgstr ""
 "No puede especificar el atributo `DefaultMember' en un tipo que contiene un "
 "indexador"
 
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
 #, csharp-format
 msgid "Could not find `{0}' specified for Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
 #, fuzzy, csharp-format
 msgid "`{0}' specified for Main method must be a valid class or struct"
 msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
 
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
 #, fuzzy, csharp-format
 msgid "`{0}' does not have a suitable static Main method"
 msgstr ""
 "La palabra reservada `new' no está permitida en los elementos de un espacio "
 "de nombres"
 
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
 #, csharp-format
 msgid ""
 "Program `{0}' does not contain a static `Main' method suitable for an entry "
 "point"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
 msgid "Error during assembly signing. "
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
 #, csharp-format
 msgid "Metadata file `{0}' could not be found"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
 #, fuzzy, csharp-format
 msgid "Metadata file `{0}' does not contain valid metadata"
 msgstr "El delegado `{0} no toma {1} argumentos"
 
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
 #, csharp-format
 msgid ""
 "Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
 "option to add the module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
 #, csharp-format
 msgid ""
 "Added module file `{0}' is an assembly. Consider using `-r' option to "
 "reference the file"
 msgstr ""
 
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
 msgid "The `await' operator cannot be used in the body of a lock statement"
 msgstr ""
 
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
 msgid "The `await' operator cannot be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
 #, csharp-format
 msgid ""
 "Cannot await void method `{0}'. Consider changing method return type to "
 "`Task'"
 msgstr ""
 
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
 #, csharp-format
 msgid "Cannot await `{0}' expression"
 msgstr ""
 
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
 #, csharp-format
 msgid ""
 "The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
 msgstr ""
 
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
 msgid ""
 "The `await' operator may only be used in a query expression within the first "
 "collection expression of the initial `from' clause or within the collection "
 "expression of a `join' clause"
 msgstr ""
 
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
 #, csharp-format
 msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
 msgstr ""
 
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
 #, fuzzy, csharp-format
 msgid "The awaiter type `{0}' must implement interface `{1}'"
 msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
 
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
 msgid ""
 "Cannot find compiler required types for asynchronous functions support. Are "
 "you targeting the wrong framework version?"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument. Named attribute arguments "
@@ -355,44 +355,44 @@ msgid ""
 "properties which are public and not static"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument because it is not a valid "
 "attribute parameter type"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
 #, fuzzy
 msgid "An attribute argument cannot be dynamic expression"
 msgstr ""
 "Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
 
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
 msgid "The Guid attribute must be specified with the ComImport attribute"
 msgstr ""
 "El atributo Guid debe de ser especificado junto con el atributo ComImport"
 
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
 #, csharp-format
 msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
 msgstr ""
 "No use `{0}' directamente.   Use el modificador de parámetro `this' en su "
 "lugar"
 
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
 #, fuzzy, csharp-format
 msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
 msgstr ""
 "No use `{0}' directamente.   Use el modificador de parámetro `this' en su "
 "lugar"
 
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
 #, csharp-format
 msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
 msgstr "Error al emitir el atributo `{0}'.   La razón es `{1}'"
 
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
@@ -401,45 +401,45 @@ msgstr ""
 "`{0}' produce una amiguedad entre `{0}' y `{0}Attribute'.   Use `@{0}' o `{0}"
 "Attribute'"
 
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
 #, csharp-format
 msgid "`{0}': is not an attribute class"
 msgstr "`{0}' no es una clase atributo"
 
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
 #, csharp-format
 msgid "Cannot apply attribute class `{0}' because it is abstract"
 msgstr "No es posible aplicar el atributo `{0}' ya que es abstracto"
 
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
 #, csharp-format
 msgid "Duplicate named attribute `{0}' argument"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
 #, csharp-format
 msgid ""
 "The attribute `{0}' is not valid on this declaration type. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
 #, csharp-format
 msgid "The argument to the `{0}' attribute must be a valid identifier"
 msgstr ""
 "El argumento pasado al atributo `{0}' debe de ser un identificador válido"
 
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
 #, fuzzy, csharp-format
 msgid "Invalid value for argument to `{0}' attribute"
 msgstr "Valor inválido pasado a `System.AttributeUsage'"
 
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
 #, csharp-format
 msgid "The attribute `{0}' cannot be applied multiple times"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
 #, csharp-format
 msgid "`{0}' is obsolete: `{1}'"
 msgstr ""
@@ -452,56 +452,56 @@ msgstr ""
 "El modificador `partial' solamente puede ser utilizado antes de `class', "
 "`struct', `interface' o la palabra clave `void'"
 
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
 msgid "Invalid number"
 msgstr "Número inválido"
 
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
 #, csharp-format
 msgid "Unrecognized escape sequence `\\{0}'"
 msgstr "Secuencia de escape no reconocida: `\\\\{0}'"
 
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
 msgid "Unrecognized escape sequence"
 msgstr "Secuencia de escape no reconocida"
 
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
 #, fuzzy
 msgid "Filename, single-line comment or end-of-line expected"
 msgstr "Esperaba un comentario de una sola línea o el final de archivo"
 
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
 #, fuzzy
 msgid "Missing identifier to pre-processor directive"
 msgstr "La directiva del pre-procesador requiere un identificador"
 
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
 #, csharp-format
 msgid "Identifier expected: {0}"
 msgstr "Esperaba un identificador: {0}."
 
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
 #, fuzzy
 msgid "Integral constant is too large"
 msgstr "La constante numérica es demasiado grande"
 
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
 msgid "Invalid preprocessor directive"
 msgstr "Directiva inválida para el pre-procesador."
 
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
 #, csharp-format
 msgid "Unexpected processor directive ({0})"
 msgstr "Directiva inválida para el pre-procesador ({0})."
 
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
 msgid ""
 "Cannot define or undefine preprocessor symbols after first token in file"
 msgstr ""
 "No es posible definir nuevos símbolos para el preprocesador o elimiar las "
 "definiciones existentes después del primer tóken del archivo"
 
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
 msgid ""
 "Preprocessor directives must appear as the first non-whitespace character on "
 "a line"
@@ -509,66 +509,66 @@ msgstr ""
 "Las directivas del pre-procesador deben aparecer como el primer carácter en "
 "la línea (que no sea un espacio en blanco)"
 
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
 msgid "Single-line comment or end-of-line expected"
 msgstr "Esperaba un comentario de una sola línea o el final de archivo"
 
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
 msgid "Expected `#endif' directive"
 msgstr "Esperaba la directiva `#endif'"
 
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
 msgid "#endregion directive expected"
 msgstr "Esperaba la directiva `#endregion'"
 
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
 msgid "Wrong preprocessor directive"
 msgstr "La directiva del pre-procesador es errónea"
 
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
 #, csharp-format
 msgid "#error: '{0}'"
 msgstr "#error: '{0}'"
 
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
 msgid "The line number specified for #line directive is missing or invalid"
 msgstr ""
 "Falta el número de linea especificado en la directiva #line o el número es "
 "inválido"
 
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
 msgid "Newline in constant"
 msgstr "Hay un carácter nueva-linea en la constante"
 
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
 msgid "Unterminated string literal"
 msgstr "La literal de texto no tiene fin"
 
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
 msgid "Identifier too long (limit is 512 chars)"
 msgstr "El identificador es demasiado grande (el límite son 512 caracteres)"
 
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
 msgid "End-of-file found, '*/' expected"
 msgstr "El archivo se terminó, y esperaba encontrar un `*/'"
 
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
 msgid "Keyword, identifier, or string expected after verbatim specifier: @"
 msgstr ""
 "Esperaba una palabra clave, un identificador o una cadena después del "
 "especificador '@' (al pie de la letra)"
 
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
 #, fuzzy, csharp-format
 msgid "Unexpected character `{0}'"
 msgstr "Esperaba `{0}'"
 
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
 msgid "Empty character literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
 msgid "Too many characters in character literal"
 msgstr ""
 
@@ -623,7 +623,7 @@ msgid ""
 "declaration of this type exists"
 msgstr ""
 
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
 #, csharp-format
 msgid ""
 "`{0}': explicit interface declaration can only be declared in a class or "
@@ -632,38 +632,38 @@ msgstr ""
 "`{0}': las declaraciones explícitas de interfaces solamente pueden ser "
 "declaradas en una clase o estructura"
 
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
 #, csharp-format
 msgid "Duplicate type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
 #, csharp-format
 msgid "The type `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
 msgid ""
 "Cannot specify the `DefaultMember' attribute on type containing an indexer"
 msgstr ""
 "No puede especificar el atributo `DefaultMember' en un tipo que contiene un "
 "indexador"
 
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
 msgid "The RequiredAttribute attribute is not permitted on C# types"
 msgstr ""
 
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
 #, fuzzy, csharp-format
 msgid "Class `{0}' cannot derive from the dynamic type"
 msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
 
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
 #, csharp-format
 msgid "`{0}' is already listed in interface list"
 msgstr "`{0}' ya está listado en la lista de interfaces"
 
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base interface `{0}' is less accessible than "
@@ -672,23 +672,23 @@ msgstr ""
 "Accesibilidad inconsistente: la interface base `{0}' es menos accessible que "
 "la interface `{1}'"
 
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
 #, csharp-format
 msgid "Type `{0}' in interface list is not an interface"
 msgstr "El tipo `{0} en la lista de interfaces no es una interface"
 
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
 #, csharp-format
 msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
 msgstr ""
 "`{0}': las clases no pueden tener múltiples clases base (`{1}' y `{2}')"
 
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
 #, csharp-format
 msgid "`{0}': Base class `{1}' must be specified as first"
 msgstr "`{0}': la clase base `{1}' tiene que ser especificada primero"
 
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
 #, csharp-format
 msgid ""
 "The operator `{0}' requires a matching operator `{1}' to also be defined"
@@ -696,14 +696,14 @@ msgstr ""
 "El operador `{0}' require que el operador correspondiente `{1}' también sea "
 "definido"
 
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
 #, csharp-format
 msgid "Partial declarations of `{0}' must not specify different base classes"
 msgstr ""
 "Las declaraciones parciales de `{0}' no deben de especificar clases bases "
 "distintas"
 
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
 #, csharp-format
 msgid ""
 "Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
@@ -711,12 +711,12 @@ msgstr ""
 "La interface heredada `{0}' produce un ciclo en la jerarquía de la interface "
 "`{1}'"
 
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
 #, csharp-format
 msgid "Circular base class dependency involving `{0}' and `{1}'"
 msgstr "Dependencia circular en la clase base involucrando `{0}' y `{1}'"
 
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
 #, csharp-format
 msgid ""
 "Partial declarations of `{0}' have inconsistent constraints for type "
@@ -725,12 +725,12 @@ msgstr ""
 "Las declaraciones parciales de `{0}' tienen limitaciones inconsistentes para "
 "el tipo parametrizado `{1}'"
 
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
 #, fuzzy, csharp-format
 msgid "`{0}': cannot implement a dynamic interface `{1}'"
 msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
 
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
 #, csharp-format
 msgid ""
 "`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
@@ -739,13 +739,13 @@ msgstr ""
 "`{0}' no es posible implementar tanto `{1}' como `{2}' por que se pueden "
 "unificar en algunos casos"
 
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
 #, csharp-format
 msgid ""
 "A generic type cannot derive from `{0}' because it is an attribute class"
 msgstr "Los tipos genericos no pueden derivad de `{0} ya que es un atributo"
 
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
 msgid ""
 "Two indexers have different names; the IndexerName attribute must be used "
 "with the same name on every indexer within a type"
@@ -753,85 +753,85 @@ msgstr ""
 "Hay dos indexadores con nombres distintos;   El atributo IndexerName debe "
 "ser usado con el mismo nombre en todos los indexadores dentro de un tipo"
 
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
 #, csharp-format
 msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
 msgstr ""
 "El miembro estático `{0}' no puede ser marcado con override, virtual o "
 "abstract"
 
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
 #, csharp-format
 msgid "A member `{0}' marked as override cannot be marked as new or virtual"
 msgstr ""
 "El miembro `{0}' está usa `override' y no puede usar `new' o `virtual' "
 
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
 #, csharp-format
 msgid "`{0}' cannot be both extern and abstract"
 msgstr "`{0}' no puede ser tanto externo como abstracto"
 
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
 #, csharp-format
 msgid "`{0}' cannot be both abstract and sealed"
 msgstr "`{0}'' no puede ser tanto sellado como abstracto"
 
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
 #, csharp-format
 msgid "The abstract method `{0}' cannot be marked virtual"
 msgstr "El método abstracto `{0} no puede ser marcado como virtual"
 
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
 #, csharp-format
 msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
 msgstr ""
 "`{0}' es abstracto pero ha sido declarado dentro de una clase que no es "
 "abstracta (`{1}')"
 
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
 #, csharp-format
 msgid "`{0}': virtual or abstract members cannot be private"
 msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
 
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
 #, csharp-format
 msgid "`{0}' cannot be sealed because it is not an override"
 msgstr "`{0}' no puede sellarse por que no es una sobrecarga"
 
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
 #, csharp-format
 msgid "`{0}': containing type does not implement interface `{1}'"
 msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
 
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
 #, csharp-format
 msgid "Type parameter `{0}' has same name as containing type, or method"
 msgstr ""
 "El tipo parametrizado `{0}' tiene el mimo nombre que el tipo contenedor, o "
 "el método"
 
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
 #, csharp-format
 msgid "`{0}': member names cannot be the same as their enclosing type"
 msgstr ""
 "`{0}': los nombres de los miembros no pueden ser el mismo que el del tipo "
 "contenedor"
 
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
 msgid ""
 "The class System.Object cannot have a base class or implement an interface."
 msgstr ""
 "La clase Syste.Object no puede tener una clase base o implementar una "
 "interface."
 
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
 #, csharp-format
 msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
 msgstr ""
 "El atributo `{0}' solamente es válido en las clases derivadas de System."
 "Attribute"
 
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
 msgid ""
 "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
 "or attribute classes"
@@ -839,61 +839,61 @@ msgstr ""
 "El atributo `System.Diagnostics.ConditionalAttribute' solamente es válido en "
 "métodos o en clases derivadas de System.Attribute"
 
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
 #, csharp-format
 msgid "`{0}': an abstract class cannot be sealed or static"
 msgstr "`{0}': una clase abstracta no puede estar sellada o ser estática"
 
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
 #, csharp-format
 msgid "`{0}': a class cannot be both static and sealed"
 msgstr "`{0}': una clase no puede estar sellada y ser estática al mismo tiempo"
 
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
 #, csharp-format
 msgid "`{0}': Static classes cannot contain user-defined operators"
 msgstr ""
 "`{0}': las clases estáticas no pueden contener operadores definidos por el "
 "usuario"
 
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
 #, csharp-format
 msgid "`{0}': Static classes cannot contain destructor"
 msgstr "`{0}': las clases estáticas no pueden contener un destructor"
 
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
 #, csharp-format
 msgid "`{0}': cannot declare indexers in a static class"
 msgstr "`{0}': no es posible declarar indexadores en una clase estática"
 
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
 #, csharp-format
 msgid "`{0}': Static classes cannot have instance constructors"
 msgstr ""
 "`{0}': las clases estáticas no pueden tener constructores de instancias"
 
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
 #, csharp-format
 msgid "`{0}': cannot declare instance members in a static class"
 msgstr ""
 "`{0}'L no es posible declarar miembros de instancia en una clase estática"
 
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
 #, fuzzy, csharp-format
 msgid "`{0}': Cannot derive from type parameter `{1}'"
 msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
 
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
 #, csharp-format
 msgid "`{0}': Cannot derive from static class `{1}'"
 msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
 
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
 #, fuzzy, csharp-format
 msgid "`{0}': cannot derive from sealed type `{1}'"
 msgstr "`{0}': no es posible derivad de una clase sellada (`{1}')"
 
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
 #, csharp-format
 msgid ""
 "Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
@@ -902,12 +902,12 @@ msgstr ""
 "La clase estática `{0}' no puede derivarse del tipo `{1}'.   Las clases "
 "estáticas deben derivar de `System.Object'"
 
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
 #, csharp-format
 msgid "`{0}' cannot derive from special class `{1}'"
 msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
 
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base class `{0}' is less accessible than class `"
@@ -916,53 +916,53 @@ msgstr ""
 "Accesibilidad inconsistente: la clase base `{0}' es menos accessible que la "
 "clase `{1}'"
 
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
 #, csharp-format
 msgid "Static class `{0}' cannot implement interfaces"
 msgstr "Las clases estáticas no pueden implementar interfaces (`{0}')"
 
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
 #, csharp-format
 msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
 msgstr ""
 
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
 #, csharp-format
 msgid "`{0}': Structs cannot have instance field initializers"
 msgstr ""
 "`{0}': las estructuras no pueden tener inicializadores de campos en "
 "instancias"
 
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
 #, fuzzy, csharp-format
 msgid "Do not override `{0}'. Use destructor syntax instead"
 msgstr ""
 "No use `{0}' directamente.   Use el modificador de parámetro `this' en su "
 "lugar"
 
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
 #, csharp-format
 msgid "`{0}' is marked as an override but no suitable {1} found to override"
 msgstr ""
 "`{0}' está marcado como una sobreescritura pero no es posible encontrar {1} "
 "para usar override"
 
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not an event"
 msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
 
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a property"
 msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es una propiedad"
 
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a method"
 msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es un método"
 
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' cannot override inherited members `{1}' and `{2}' because they have "
@@ -971,12 +971,12 @@ msgstr ""
 "`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este "
 "está sellado"
 
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
 #, csharp-format
 msgid "`{0}' hides inherited abstract member `{1}'"
 msgstr "`{0}' esconde el miembro abstracto heredado `{1}'"
 
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
 #, csharp-format
 msgid ""
 "`{0}': cannot override inherited member `{1}' because it is not marked "
@@ -985,38 +985,38 @@ msgstr ""
 "`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este no "
 "está marcado con `virtual', `abstract' u `override'"
 
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
 #, csharp-format
 msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
 msgstr ""
 "`{0}': no es posible sobreescribir el miembro heredado `{1}' ya que este "
 "está sellado"
 
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
 #, csharp-format
 msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "`{0}': el tipo debe de ser `{1}' para que corresponda con el miembro "
 "sobreescrito `{2}'"
 
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
 #, csharp-format
 msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "`{0}': El tipo de regreso debe de ser `{1}' para qu ecorresponda con el "
 "miembro sobreescrito `{2}'"
 
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
 #, csharp-format
 msgid "A partial method `{0}' cannot explicitly implement an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
 #, fuzzy, csharp-format
 msgid "The type `{0}' in explicit interface declaration is not an interface"
 msgstr "El tipo `{0} en la lista de interfaces no es una interface"
 
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1025,7 +1025,7 @@ msgstr ""
 "Accesibilidad inconsistente: la interface base `{0}' es menos accessible que "
 "el indexador `{1}'"
 
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1034,55 +1034,62 @@ msgstr ""
 "Accesibilidad inconsistente: el tipo del parámetro `{0}' es menos accessible "
 "que el operador `{1}'"
 
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "method `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
 #, csharp-format
 msgid ""
 "`{0}': cannot change access modifiers when overriding `{1}' inherited member "
 "`{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
 #, fuzzy, csharp-format
 msgid "`{0}': static types cannot be used as return types"
 msgstr ""
 "`{0}': las clases estáticas no pueden tener constructores de instancias"
 
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
 #, csharp-format
 msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
 msgid "Inconsistent accessibility: property type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
 msgid "Inconsistent accessibility: indexer return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
 msgid "Inconsistent accessibility: return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
 msgid "Inconsistent accessibility: field type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
 #, csharp-format
 msgid ""
 "Parameters or local variables of type `{0}' cannot be declared in async "
 "methods or iterators"
 msgstr ""
 
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
 #, fuzzy, csharp-format
 msgid ""
 "Local variables of type `{0}' cannot be used inside anonymous methods, "
@@ -1091,7 +1098,7 @@ msgstr ""
 "No se le puede tomar la dirección a la variable local o el parámetro `{0}' y "
 "ser al mismo tiempo usada dentro de un método anónimo o una expresión lambda."
 
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
 #, csharp-format
 msgid "Field or property cannot be of type `{0}'"
 msgstr ""
@@ -1112,19 +1119,19 @@ msgid ""
 "The evaluation of the constant value for `{0}' involves a circular definition"
 msgstr ""
 
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
 #, csharp-format
 msgid "Constant value `{0}' cannot be converted to a `{1}'"
 msgstr ""
 
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
 #, csharp-format
 msgid ""
 "Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
 "to override)"
 msgstr ""
 
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
 #, csharp-format
 msgid ""
 "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
@@ -1195,74 +1202,64 @@ msgid ""
 "Extension method `{0}' of value type `{1}' cannot be used to create delegates"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
 #, csharp-format
 msgid "Cannot create delegate from partial method declaration `{0}'"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
 #, csharp-format
 msgid ""
 "Cannot create delegate with `{0}' because it has a Conditional attribute"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' parameters and return type must be same as "
 "delegate `{2} {3}' parameters and return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
 #, csharp-format
 msgid ""
 "A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
 "return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
 msgid "Method name expected"
 msgstr ""
 
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
 #, csharp-format
 msgid "Error generating XML documentation file `{0}' (`{1}')"
 msgstr ""
 
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
 msgid "Source file `"
 msgstr ""
 
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
 msgid "No files to compile were specified"
 msgstr ""
 
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
 msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
 msgstr ""
 
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
 msgid ""
 "If no source files are specified you must specify the output file with -out:"
 msgstr ""
 
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
 msgid "Output file name is not valid"
 msgstr ""
 
@@ -1331,182 +1328,182 @@ msgid "`{0}' does not contain a definition for `{1}'"
 msgstr ""
 
 #: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
 msgid ""
 "The left-hand side of an assignment must be a variable, a property or an "
 "indexer"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
 msgid "The operation in question is undefined on void pointers"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
 #, csharp-format
 msgid "Internal compiler error: {0}"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
 msgid "A ref or out argument must be an assignable variable"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
 msgid ""
 "An attribute argument must be a constant expression, typeof expression or "
 "array creation expression"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
 #, csharp-format
 msgid "The class `{0}' has no constructors defined"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
 #, csharp-format
 msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
 msgid "An expression tree cannot contain an unsafe pointer operation"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
 #, csharp-format
 msgid "`{0}' is a `{1}' but a `{2}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
 #, csharp-format
 msgid "Expression denotes a `{0}', where a `{1}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
 msgid "Pointers and fixed size buffers may only be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
 #, csharp-format
 msgid ""
 "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
 "dll assembly reference?"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
 #, csharp-format
 msgid ""
 "A local variable `{0}' cannot be used before it is declared. Consider "
 "renaming the local variable when it hides the member `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
 #, csharp-format
 msgid "`{0}' conflicts with a declaration in a child block"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
 #, csharp-format
 msgid "A local variable `{0}' cannot be used before it is declared"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
 #, csharp-format
 msgid "The name `{0}' does not exist in the current context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
 msgid "System.Void cannot be used from C#. Consider using `void'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
 #, csharp-format
 msgid "Cannot call an abstract base member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
 #, csharp-format
 msgid ""
 "Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
 "qualifier must be of type `{2}' or derived from it"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
 #, csharp-format
 msgid ""
 "Static member `{0}' cannot be accessed with an instance reference, qualify "
 "it with a type name instead"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
 #, csharp-format
 msgid ""
 "A field initializer cannot reference the nonstatic field, method, or "
 "property `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
 #, csharp-format
 msgid "An object reference is required to access non-static member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
 #, csharp-format
 msgid ""
 "Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
 msgid "Cannot modify the result of an unboxing conversion"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
 "overload `{2}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
 #, csharp-format
 msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
 msgid "An expression tree cannot contain an expression with method group"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
 msgid ""
 "Partial methods with only a defining declaration or removed conditional "
 "methods cannot be used in an expression tree"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
 #, csharp-format
 msgid ""
 "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
 "parentheses to invoke the method"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
 #, csharp-format
 msgid ""
 "The type `{0}' does not contain a constructor that takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1514,159 +1511,159 @@ msgid ""
 "without the extension method syntax"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
 #, csharp-format
 msgid ""
 "The call is ambiguous between the following methods or properties: `{0}' and "
 "`{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
 #, csharp-format
 msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
 "`out' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
 #, csharp-format
 msgid ""
 "The best overloaded collection initalizer method `{0}' has some invalid "
 "arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
 #, csharp-format
 msgid "Delegate `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
 #, csharp-format
 msgid "The best overloaded method match for `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
 #, csharp-format
 msgid ""
 "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
 #, csharp-format
 msgid "Argument `#{0}' is missing `{1}' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
 #, csharp-format
 msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
 #, csharp-format
 msgid ""
 "The type arguments for method `{0}' cannot be inferred from the usage. Try "
 "specifying the type arguments explicitly"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
 #, csharp-format
 msgid "No overload for method `{0}' takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
 #, fuzzy, csharp-format
 msgid "The delegate `{0}' does not contain a parameter named `{1}'"
 msgstr "El delegado `{0} no toma {1} argumentos"
 
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
 #, csharp-format
 msgid ""
 "The best overloaded method match for `{0}' does not contain a parameter "
 "named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
 #, csharp-format
 msgid ""
 "Named argument `{0}' cannot be used for a parameter which has positional "
 "argument specified"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
 msgid ""
 "You cannot use fixed size buffers contained in unfixed expressions. Try "
 "using the fixed statement"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
 #, csharp-format
 msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
 #, csharp-format
 msgid "Use of possibly unassigned field `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
 #, csharp-format
 msgid "Property or event `{0}' is not supported by the C# language"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
 #, csharp-format
 msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because it "
 "lacks the `get' accessor"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the get "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
 #, csharp-format
 msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the set "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of `+=' or `-=' "
 "operator"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of += or -= when used "
 "outside of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
 #, csharp-format
 msgid ""
 "An implicitly typed local variable declaration cannot be initialized with `"
 "{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
 msgid ""
 "The contextual keyword `var' may only appear within a local variable "
 "declaration"
@@ -1688,7 +1685,7 @@ msgstr ""
 msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
 msgstr ""
 
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
 msgid "Detection Parsing Error"
 msgstr ""
 
@@ -1789,203 +1786,203 @@ msgid ""
 "{1}' is used as a short circuit operator"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined as `{0}' and `{1}' "
 "convert implicitly to each other"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined because there is no "
 "implicit conversion between `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
 #, csharp-format
 msgid "Use of unassigned local variable `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
 #, csharp-format
 msgid ""
 "Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
 "or query expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
 #, csharp-format
 msgid ""
 "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
 #, csharp-format
 msgid "Use of unassigned out parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
 #, fuzzy, csharp-format
 msgid "Cannot invoke a non-delegate type `{0}'"
 msgstr "No es posible convertir `{0}' a un un tipo que no es un delegado `{1}'"
 
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
 #, csharp-format
 msgid "The member `{0}' cannot be used as method or delegate"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
 msgid ""
 "Do not directly call your base class Finalize method. It is called "
 "automatically from your destructor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
 msgid ""
 "Destructors and object.Finalize cannot be called directly. Consider calling "
 "IDisposable.Dispose if available"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
 #, csharp-format
 msgid ""
 "The base call to method `{0}' cannot be dynamically dispatched. Consider "
 "casting the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
 #, csharp-format
 msgid "`{0}': cannot explicitly call operator or accessor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
 #, csharp-format
 msgid "Unsafe type `{0}' cannot be used in an object creation expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
 #, csharp-format
 msgid ""
 "Cannot create an instance of the variable type `{0}' because it does not "
 "have the new() constraint"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
 #, csharp-format
 msgid ""
 "`{0}': cannot provide arguments when creating an instance of a variable type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
 #, csharp-format
 msgid "Cannot create an instance of the static class `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
 #, csharp-format
 msgid "Cannot create an instance of the abstract class or interface `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
 msgid ""
 "An implicitly typed local variable declarator cannot use an array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
 msgid "A constant value is expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
 #, csharp-format
 msgid "An array initializer of length `{0}' was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
 msgid ""
 "Array initializers can only be used in a variable or field initializer. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
 msgid "A nested array initializer was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
 msgid "An expression tree cannot contain a multidimensional array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
 msgid "Cannot create an array with a negative size"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
 msgid ""
 "Can only use array initializer expressions to assign to array types. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
 msgid ""
 "The type of an implicitly typed array cannot be inferred from the "
 "initializer. Try specifying array type explicitly"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
 msgid ""
 "The `this' object cannot be used before all of its fields are assigned to"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
 msgid ""
 "Keyword `this' is not valid in a static property, static method, or static "
 "field initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
 msgid ""
 "Anonymous methods inside structs cannot access instance members of `this'. "
 "Consider copying `this' to a local variable outside the anonymous method and "
 "using the local instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
 msgid "Keyword `this' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
 msgid "Cannot take the address of `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
 msgid "Cannot pass `this' as a ref or out argument because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
 msgid "Cannot assign to `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
 msgid "The __arglist construct is valid only within a variable argument method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
 msgid "An expression tree cannot contain a method with variable arguments"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
 msgid "The typeof operator cannot be used on the dynamic type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
 #, csharp-format
 msgid "`{0}': an attribute argument cannot use type parameters"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
 #, csharp-format
 msgid ""
 "`{0}' does not have a predefined size, therefore sizeof can only be used in "
@@ -1993,160 +1990,161 @@ msgid ""
 "SizeOf)"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
 #, csharp-format
 msgid "Alias `{0}' not found"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
 msgid ""
 "The namespace alias qualifier `::' cannot be used to invoke a method. "
 "Consider using `.' instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
 msgid "Cannot perform member binding on `null' value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
 #, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
 #, csharp-format
 msgid "A nested type cannot be specified through a type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
 #, csharp-format
 msgid ""
 "Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
 "replacing `::' with `.'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
 #, csharp-format
 msgid "The nested type `{0}' does not exist in the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
 #, csharp-format
 msgid "Cannot apply indexing with [] to an expression of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
 msgid "A pointer must be indexed by only one value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
 msgid "An element access expression cannot use named argument"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
 #, csharp-format
 msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
 msgid ""
 "The indexer base access cannot be dynamically dispatched. Consider casting "
 "the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
 msgid "An expression tree may not contain a base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
 #, fuzzy
 msgid "Keyword `base' is not available in a static method"
 msgstr ""
 "La palabra reservada `new' no está permitida en los elementos de un espacio "
 "de nombres"
 
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
 #, fuzzy
 msgid "Keyword `base' is not available in the current context"
 msgstr ""
 "La palabra reservada `new' no está permitida en los elementos de un espacio "
 "de nombres"
 
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
 msgid ""
 "A property, indexer or dynamic member access may not be passed as `ref' or "
 "`out' parameter"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
 #, csharp-format
 msgid "Array elements cannot be of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
 #, csharp-format
 msgid "Array elements cannot be of static type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
 msgid "Cannot use a negative size with stackalloc"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
 msgid "Cannot use stackalloc in finally or catch"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
 #, csharp-format
 msgid ""
 "Member `{0}' cannot be initialized. An object initializer may only be used "
 "for fields, or properties"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
 #, csharp-format
 msgid ""
 "Static field or property `{0}' cannot be assigned in an object initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
 #, csharp-format
 msgid ""
 "A field or property `{0}' cannot be initialized with a collection object "
 "initializer because type `{1}' does not implement `{2}' interface"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
 #, csharp-format
 msgid "Inconsistent `{0}' member declaration"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
 #, csharp-format
 msgid ""
 "An object initializer includes more than one member `{0}' initialization"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
 #, csharp-format
 msgid "Cannot initialize object of type `{0}' with a collection initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
 #, fuzzy
 msgid "Anonymous types cannot be used in this expression"
 msgstr ""
 "Los métodos anónimos no pueden ser convertidos a árboles de expresiones"
 
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
 #, csharp-format
 msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
 msgstr ""
@@ -2207,12 +2205,12 @@ msgid ""
 "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
 msgstr ""
 
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
 #, fuzzy, csharp-format
 msgid "`{0}': A volatile field cannot be of the type `{1}'"
 msgstr "`{0}': no es posible derivad de una clase sellada (`{1}')"
 
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
 #, fuzzy, csharp-format
 msgid "`{0}': A field cannot be both volatile and readonly"
 msgstr "`{0}': una clase no puede estar sellada y ser estática al mismo tiempo"
@@ -2267,7 +2265,7 @@ msgid "Cannot yield in the body of a finally clause"
 msgstr ""
 
 #: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
 msgid "Control cannot leave the body of a finally clause"
 msgstr ""
 
@@ -2357,47 +2355,47 @@ msgid ""
 "`{0}' is not a valid constraint. Static classes cannot be used as constraints"
 msgstr ""
 
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
 #, csharp-format
 msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
 #, csharp-format
 msgid "`{0}': static classes cannot be used as generic arguments"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
 #, csharp-format
 msgid "The type `{0}' may not be used as a type argument"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
 msgid "Variant type parameters can only be used with interfaces and delegates"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
 #, csharp-format
 msgid ""
 "The type `{0}' must be a reference type in order to use it as type parameter "
 "`{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
 #, csharp-format
 msgid ""
 "The type `{0}' must be a non-nullable value type in order to use it as type "
 "parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
 #, csharp-format
 msgid ""
 "The type `{0}' must have a public parameterless constructor in order to use "
 "it as parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2405,7 +2403,7 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2413,42 +2411,49 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined in this assembly, but it is not "
 "defined in source or any added modules"
 msgstr ""
 
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
 #, csharp-format
 msgid ""
 "The type `{0}' is defined in an assembly that is not referenced. Consider "
 "adding a reference to assembly `{1}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined assembly `{1}', but it could "
@@ -2478,36 +2483,36 @@ msgstr ""
 msgid "Iterators cannot have unsafe parameters or yield types"
 msgstr ""
 
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
 msgid "Unsafe code may not appear in iterators"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
 msgid "SDK path could not be resolved"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
 #, csharp-format
 msgid ""
 "Assembly `{0}' references `{1}' which has a higher version number than "
 "imported assembly `{2}'"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
 #, csharp-format
 msgid ""
 "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
 "supply runtime policy"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
 #, csharp-format
 msgid ""
 "An assembly with the same name `{0}' has already been imported. Consider "
 "removing one of the references or sign the assembly"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
 #, csharp-format
 msgid ""
 "An assembly with the same identity `{0}' has already been imported. Consider "
@@ -2601,63 +2606,63 @@ msgid ""
 "suffix `{1}' to create a literal of this type"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
 msgid ""
 "A partial method declaration and partial method implementation cannot differ "
 "on use of `params' modifier"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "an extension method or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
 #, csharp-format
 msgid ""
 "Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
 #, csharp-format
 msgid ""
 "Overloaded method `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`static' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`unsafe' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
 #, csharp-format
 msgid "A partial method `{0}' declaration is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
 #, csharp-format
 msgid "A partial method `{0}' implementation is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
 #, csharp-format
 msgid "A member `{0}' is already reserved"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
 #, csharp-format
 msgid "Duplicate user-defined conversion in type `{0}'"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
 #, csharp-format
 msgid ""
 "A member `{0}' is already defined. Rename this member or use different "
@@ -2666,12 +2671,12 @@ msgstr ""
 "El miembro `{0} ya ha sido definido.   Renombre este miembro o use tipos de "
 "parámetro distintos"
 
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
 #, csharp-format
 msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
 msgstr ""
 
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
 #, fuzzy
 msgid ""
 "The DllImport attribute must be specified on a method marked `static' and "
@@ -2679,25 +2684,18 @@ msgid ""
 msgstr ""
 "El atributo Guid debe de ser especificado junto con el atributo ComImport"
 
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
 #, fuzzy, csharp-format
 msgid "`{0}': A partial method parameters cannot use `out' modifier"
 msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
 
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
 #, csharp-format
 msgid ""
 "Conditional not valid on `{0}' because it is a constructor, destructor, "
 "operator or explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
 #: mcs/mcs/method.cs:865
 msgid ""
 "A partial method cannot define access modifier or any of abstract, extern, "
@@ -2755,12 +2753,12 @@ msgstr ""
 msgid "The return type of an async method must be void, Task, or Task<T>"
 msgstr ""
 
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
 #, fuzzy, csharp-format
 msgid "`{0}': Extension methods cannot be defined in a nested class"
 msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
 
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
 #, csharp-format
 msgid ""
 "`{0}': Extension methods require `System.Runtime.CompilerServices."
@@ -2768,54 +2766,54 @@ msgid ""
 "reference?"
 msgstr ""
 
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
 #, fuzzy, csharp-format
 msgid "`{0}': Extension methods must be defined in a non-generic static class"
 msgstr "`{0}' Los métodos de extensión deben de ser estáticos"
 
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
 #, fuzzy, csharp-format
 msgid "`{0}': an entry point cannot be async method"
 msgstr "`{0}': no es posible sobreescribir `{1}' ya que no es un método"
 
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
 #, csharp-format
 msgid ""
 "A partial method `{0}' implementation is missing a partial method declaration"
 msgstr ""
 
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
 #, csharp-format
 msgid "Method or delegate cannot return type `{0}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
 msgid ""
 "The constructor call cannot be dynamically dispatched within constructor "
 "initializer"
 msgstr ""
 
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
 #, fuzzy, csharp-format
 msgid "`{0}': Struct constructors cannot call base constructors"
 msgstr ""
 "`{0}': las clases estáticas no pueden tener constructores de instancias"
 
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
 #, csharp-format
 msgid "Constructor `{0}' cannot call itself"
 msgstr ""
 
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
 #, csharp-format
 msgid "`{0}': The static constructor must be parameterless"
 msgstr ""
 
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
 msgid "Structs cannot contain explicit parameterless constructors"
 msgstr ""
 
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': A class with the ComImport attribute cannot have a user-defined "
@@ -2823,43 +2821,43 @@ msgid ""
 msgstr ""
 "`{0}': las clases estáticas no pueden tener constructores de instancias"
 
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
 #, fuzzy, csharp-format
 msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
 msgstr "`{0}' esconde el miembro abstracto heredado `{1}'"
 
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
 #, fuzzy, csharp-format
 msgid ""
 "`{0}.{1}' in explicit interface declaration is not a member of interface"
 msgstr "El tipo `{0} en la lista de interfaces no es una interface"
 
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
 #, csharp-format
 msgid ""
 "`{0}' explicit method implementation cannot implement `{1}' because it is an "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
 #, fuzzy, csharp-format
 msgid "Method `{0}' cannot implement interface accessor `{1}'"
 msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
 
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
 #, csharp-format
 msgid ""
 "Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
 "an explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
 #, fuzzy, csharp-format
 msgid ""
 "Accessor `{0}' must be declared public to implement interface member `{1}'"
 msgstr "`{0}': el tipo contenedor no implementa la interface `{1}'"
 
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': the explicit interface implementation cannot introduce the params "
@@ -2868,75 +2866,75 @@ msgstr ""
 "`{0}': las declaraciones explícitas de interfaces solamente pueden ser "
 "declaradas en una clase o estructura"
 
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
 #, csharp-format
 msgid ""
 "Attribute `{0}' is not valid on property or event accessors. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
 #, csharp-format
 msgid "User-defined operator `{0}' must be declared static and public"
 msgstr ""
 
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
 msgid ""
 "User-defined operator cannot take an object of the enclosing type and "
 "convert to an object of the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
 msgid "User-defined conversion must convert to or from the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
 #, fuzzy, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from the dynamic type"
 msgstr "`{0}' no es posible derivad de la clase especial `{1}'"
 
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from an interface type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a base class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
 msgid ""
 "Overloaded shift operator must have the type of the first operand be the "
 "containing type, and the type of the second operand must be int"
 msgstr ""
 
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
 msgid ""
 "The return type for ++ or -- operator must be the containing type or derived "
 "from the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
 msgid "The parameter type for ++ or -- operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
 msgid "The parameter type of a unary operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
 msgid "The return type of operator True or False must be bool"
 msgstr ""
 
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
 msgid "One of the parameters of a binary operator must be the containing type"
 msgstr ""
 
@@ -2945,66 +2943,59 @@ msgstr ""
 msgid "The modifier `{0}' is not valid for this item"
 msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
 
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
 #, csharp-format
 msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
 #, csharp-format
 msgid ""
 "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
 #, csharp-format
 msgid "The imported type `{0}' is defined multiple times"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
 msgid ""
 "A using clause must precede all other namespace elements except extern alias "
 "declarations"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
 #, csharp-format
 msgid "The using alias `{0}' appeared previously in this namespace"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
 #, csharp-format
 msgid "The namespace `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
 #, csharp-format
 msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
 #, csharp-format
 msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
 #, csharp-format
 msgid ""
 "`{0}' is a type not a namespace. A using namespace directive can only be "
 "applied to namespaces"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
 #, csharp-format
 msgid "The extern alias `{0}' was not specified in -reference option"
 msgstr ""
@@ -3191,66 +3182,66 @@ msgstr ""
 msgid "`{0}': abstract properties cannot have private accessors"
 msgstr "`{0}': los miembros virtuales o abstractos no pueden ser privados"
 
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
 #, csharp-format
 msgid ""
 "The accessibility modifier of the `{0}' accessor must be more restrictive "
 "than the modifier of the property or indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
 #, csharp-format
 msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable get "
 "accessor"
 msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
 
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable set "
 "accessor"
 msgstr "`{0}': no es posible sobreescribir ya que `{1}' no es un evento"
 
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
 #, csharp-format
 msgid ""
 "`{0}': Cannot specify accessibility modifiers for both accessors of the "
 "property or indexer"
 msgstr ""
 
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
 #, csharp-format
 msgid ""
 "`{0}': accessibility modifiers on accessors may only be used if the property "
 "or indexer has both a get and a set accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
 #, csharp-format
 msgid ""
 "Automatically implemented property `{0}' cannot be used inside a type with "
 "an explicit StructLayout attribute"
 msgstr ""
 
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
 #, csharp-format
 msgid "`{0}': event must be of a delegate type"
 msgstr ""
 
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
 #, csharp-format
 msgid ""
 "The `{0}' attribute is valid only on an indexer that is not an explicit "
 "interface member declaration"
 msgstr ""
 
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
 #, fuzzy
 msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
 msgstr ""
@@ -3262,80 +3253,87 @@ msgstr ""
 msgid "Value specified for the argument to `{0}' is not valid"
 msgstr ""
 
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
 msgid ""
 "A lambda expression with statement body cannot be converted to an expresion "
 "tree"
 msgstr ""
 
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
 #, csharp-format
 msgid ""
 "An object of a type convertible to `{0}' is required for the return statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by any expression when method "
 "returns void"
 msgstr ""
 
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by an expression when async "
 "method returns `Task'. Consider using `Task<T>' return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
 #, csharp-format
 msgid ""
 "`{0}': The return expression type of async method must be `{1}' rather than "
 "`Task<{1}>'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
 #, csharp-format
 msgid ""
 "Cannot convert `{0}' to delegate type `{1}' because some of the return types "
 "in the block are not implicitly convertible to the delegate return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
 msgid ""
 "Cannot return a value from iterators. Use the yield return statement to "
 "return a value, or yield break to end the iteration"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
 msgid "A goto case is only valid inside a switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
 msgid "The type caught or thrown must be derived from System.Exception"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
 msgid "A fixed statement cannot use an implicitly typed local variable"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
 msgid "An implicitly typed local variable cannot be a constant"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
 msgid ""
 "An implicitly typed local variable declarator must include an initializer"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
 msgid ""
 "An implicitly typed local variable declaration cannot include multiple "
 "declarators"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
 #, csharp-format
 msgid ""
 "A local variable named `{0}' cannot be declared in this scope because it "
@@ -3343,12 +3341,12 @@ msgid ""
 "scope to denote something else"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
 #, csharp-format
 msgid "A local variable named `{0}' is already defined in this scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
 #, fuzzy, csharp-format
 msgid ""
 "The type parameter name `{0}' is the same as local variable or parameter name"
@@ -3356,103 +3354,103 @@ msgstr ""
 "El tipo parametrizado `{0}' tiene el mimo nombre que el tipo contenedor, o "
 "el método"
 
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
 #, csharp-format
 msgid ""
 "The out parameter `{0}' must be assigned to before control leaves the "
 "current method"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
 #, csharp-format
 msgid "`{0}': not all code paths return a value"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
 #, csharp-format
 msgid "Not all code paths return a value in anonymous method of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
 #, fuzzy
 msgid "Async methods cannot have ref or out parameters"
 msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
 
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
 msgid "__arglist is not allowed in parameter list of async methods"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
 #, fuzzy
 msgid "Async methods cannot have unsafe parameters"
 msgstr "`{0}': no es posible derivar de una clase estática (`{1}')"
 
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
 #, csharp-format
 msgid "The label `{0}' is a duplicate"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
 #, csharp-format
 msgid ""
 "The label `{0}' shadows another label by the same name in a contained scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
 #, csharp-format
 msgid "The label `case {0}:' already occurs in this switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
 #, csharp-format
 msgid ""
 "A switch expression of type `{0}' cannot be converted to an integral type, "
 "bool, char, string, enum or nullable type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
 #, csharp-format
 msgid "`{0}' is not a reference type as required by the lock statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
 msgid "The type of locals declared in a fixed statement must be a pointer type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
 msgid ""
 "The right hand side of a fixed statement assignment may not be a cast "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
 msgid ""
 "You cannot use the fixed statement to take the address of an already fixed "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
 #, csharp-format
 msgid ""
 "A previous catch clause already catches all exceptions of this or a super "
 "type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
 #, csharp-format
 msgid ""
 "`{0}': type used in a using statement must be implicitly convertible to "
 "`System.IDisposable'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
 #, csharp-format
 msgid ""
 "foreach statement requires that the return type `{0}' of `{1}' must have a "
 "suitable public MoveNext method and public Current property"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it "
@@ -3460,47 +3458,47 @@ msgid ""
 "implementation"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it does "
 "not contain a definition for `{1}' or is inaccessible"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
 msgid "Use of null is not valid in this context"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
 #, csharp-format
 msgid "Foreach statement cannot operate on a `{0}'"
 msgstr "El mandato `foreach' no puede operar en un `{0}'"
 
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not defined or imported"
 msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
 
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
 #, fuzzy, csharp-format
 msgid ""
 "The predefined type `{0}.{1}' is defined multiple times. Using definition "
 "from `{2}'"
 msgstr "El tipo predefinido `{0}.{1}' no está definido o no ha sido importado"
 
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not declared correctly"
 msgstr "El tipo predefinido `{0}.{1}' fue incorrectamente declarado"
 
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
 #, csharp-format
 msgid ""
 "The compiler required member `{0}.{1}{2}' could not be found or is "
 "inaccessible"
 msgstr "El compilador no encuentra el miembro `{0}.{1}{2}' o no es accessible"
 
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
 #, csharp-format
 msgid ""
 "Cannot take the address of, get the size of, or declare a pointer to a "
index 2b37488ac27d6f9f1d9d11119f01bc56dcc106ae..2fd2fc42088f0a95045a8404db248ea6ace1d07c 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
 "PO-Revision-Date: \n"
 "Last-Translator: Atsushi Eno <atsushi@ximian.com>\n"
 "Language-Team: \n"
@@ -29,7 +29,7 @@ msgid ""
 "mismatch"
 msgstr "パラメータ不一致のため、`{0}' をデリゲート型 `{1}'に変換できません"
 
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
 #, csharp-format
 msgid "Delegate `{0}' does not take `{1}' arguments"
 msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
@@ -50,16 +50,16 @@ msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
 msgstr ""
 "パラメータ `{0}' は型 `{1}' として宣言されていますが、 `{2}' であるはずです"
 
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
 #, fuzzy
 msgid "Async lambda expressions cannot be converted to expression trees"
 msgstr "匿名メソッドを式ツリーに変換することはできません"
 
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
 msgid "An anonymous method cannot be converted to an expression tree"
 msgstr "匿名メソッドを式ツリーに変換することはできません"
 
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
 #, fuzzy, csharp-format
 msgid ""
 "Cannot convert anonymous method block without a parameter list to delegate "
@@ -68,13 +68,13 @@ msgstr ""
 "デリゲート型 `{0}' には引数に`out'パラメータがあるので、パラメータリスト無し"
 "では匿名メソッドのブロックから変換できません"
 
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
 msgid ""
 "Anonymous methods and lambda expressions cannot be used in the current "
 "context"
 msgstr "匿名メソッドとラムダ式は現在の文脈では使用できません"
 
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
 #, fuzzy, csharp-format
 msgid ""
 "Local variable or parameter `{0}' cannot have their address taken and be "
@@ -83,16 +83,16 @@ msgstr ""
 "ローカル変数またはパラメータである `{0}' は、そのアドレスを取得して匿名メソッ"
 "ドあるいはラムダ式の中で使用することができません"
 
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
 #, fuzzy, csharp-format
 msgid "Cannot convert async {0} to delegate type `{1}'"
 msgstr "`{0}' をデリゲートでない型 `{1}'に変換できません"
 
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
 msgid "An expression tree cannot contain an anonymous method expression"
 msgstr "式ツリーに匿名メソッド式を含むことはできません"
 
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
 #, csharp-format
 msgid ""
 "`{0}': An anonymous type cannot have multiple properties with the same name"
@@ -139,50 +139,50 @@ msgstr "式ツリーは代入オペレータを含むことができません"
 msgid "Cannot assign to `{0}' because it is a `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
 msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
 #, fuzzy, csharp-format
 msgid "A duplicate type forward of type `{0}'"
 msgstr "属性の引数名 '{0}' が重複しています"
 
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is defined in this assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
 #, fuzzy, csharp-format
 msgid "Cannot forward type `{0}' because it is a nested type"
 msgstr "`{0}' は型パラメータであるため、ここから派生することはできません"
 
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
 "cannot have a version, culture or processor architecture specified"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. Strong named assemblies must "
 "specify a public key in their InternalsVisibleTo declarations"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
 #, csharp-format
 msgid "Referenced assembly `{0}' does not have a strong name"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
 #, csharp-format
 msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
 #, csharp-format
 msgid ""
 "Friend access was granted to `{0}', but the output assembly is named `{1}'. "
@@ -190,13 +190,13 @@ msgid ""
 "it"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
 msgid ""
 "Could not sign the assembly. ECMA key can only be used to delay-sign "
 "assemblies"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
 msgid ""
 "Added modules must be marked with the CLSCompliant attribute to match the "
 "assembly"
@@ -204,71 +204,71 @@ msgstr ""
 "追加されるモジュールは、アセンブリに適合するCLSCompliant属性でマークされなけ"
 "ればなりません"
 
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
 #, csharp-format
 msgid ""
 "Option `{0}' overrides attribute `{1}' given in a source file or added module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
 msgid "Delay signing was requested but no key file was given"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
 msgid "Cannot link resource file when building a module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
 #, csharp-format
 msgid "Error reading resource file `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
 msgid "Could not write to file `"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
 #, fuzzy
 msgid "Cannot specify -main if building a module or library"
 msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
 
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
 #, csharp-format
 msgid "Could not find `{0}' specified for Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
 #, fuzzy, csharp-format
 msgid "`{0}' specified for Main method must be a valid class or struct"
 msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
 
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
 #, fuzzy, csharp-format
 msgid "`{0}' does not have a suitable static Main method"
 msgstr "キーワード `new' は名前空間要素で認められていません"
 
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
 #, csharp-format
 msgid ""
 "Program `{0}' does not contain a static `Main' method suitable for an entry "
 "point"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
 msgid "Error during assembly signing. "
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
 #, csharp-format
 msgid "Metadata file `{0}' could not be found"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
 #, fuzzy, csharp-format
 msgid "Metadata file `{0}' does not contain valid metadata"
 msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
 
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
 #, fuzzy, csharp-format
 msgid ""
 "Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
@@ -277,7 +277,7 @@ msgstr ""
 "参照ファイル `{0}' はアセンブリではありません。代わりに`-addmodule' オプショ"
 "ンを使用してみてください"
 
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
 #, fuzzy, csharp-format
 msgid ""
 "Added module file `{0}' is an assembly. Consider using `-r' option to "
@@ -286,57 +286,57 @@ msgstr ""
 "参照ファイル `{0}' はアセンブリではありません。代わりに`-addmodule' オプショ"
 "ンを使用してみてください"
 
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
 msgid "The `await' operator cannot be used in the body of a lock statement"
 msgstr ""
 
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
 msgid "The `await' operator cannot be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
 #, csharp-format
 msgid ""
 "Cannot await void method `{0}'. Consider changing method return type to "
 "`Task'"
 msgstr ""
 
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
 #, csharp-format
 msgid "Cannot await `{0}' expression"
 msgstr ""
 
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
 #, csharp-format
 msgid ""
 "The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
 msgstr ""
 
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
 msgid ""
 "The `await' operator may only be used in a query expression within the first "
 "collection expression of the initial `from' clause or within the collection "
 "expression of a `join' clause"
 msgstr ""
 
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
 #, csharp-format
 msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
 msgstr ""
 
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
 #, fuzzy, csharp-format
 msgid "The awaiter type `{0}' must implement interface `{1}'"
 msgstr ""
 "Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
 
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
 msgid ""
 "Cannot find compiler required types for asynchronous functions support. Are "
 "you targeting the wrong framework version?"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument. Named attribute arguments "
@@ -347,7 +347,7 @@ msgstr ""
 "み専用ではなくstaticでも定数でもないフィールドか、またはpublicでstaticではな"
 "い読み書き可能なプロパティでなければなりません"
 
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument because it is not a valid "
@@ -356,33 +356,33 @@ msgstr ""
 "`{0}' は、有効な属性パラメータ型ではないため、有効な名前付き属性の引数ではあ"
 "りません"
 
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
 #, fuzzy
 msgid "An attribute argument cannot be dynamic expression"
 msgstr "匿名メソッドを式ツリーに変換することはできません"
 
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
 msgid "The Guid attribute must be specified with the ComImport attribute"
 msgstr "Guid属性はComImport属性とともに指定されなければなりません"
 
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
 #, csharp-format
 msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
 msgstr ""
 "`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
 
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
 #, fuzzy, csharp-format
 msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
 msgstr ""
 "`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
 
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
 #, csharp-format
 msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
 msgstr "`{0}' の属性の出力中にエラーが発生しました。理由: '{1}'"
 
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
@@ -391,44 +391,44 @@ msgstr ""
 "`{0} は `{0}' と `{0}Attribute' の間で曖昧です。`@{0}' または `{0}Attribute' "
 "を使用してください"
 
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
 #, csharp-format
 msgid "`{0}': is not an attribute class"
 msgstr "`{0}' は属性クラスではありません"
 
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
 #, csharp-format
 msgid "Cannot apply attribute class `{0}' because it is abstract"
 msgstr "属性クラス `{0}' はabstractなので適用できません"
 
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
 #, fuzzy, csharp-format
 msgid "Duplicate named attribute `{0}' argument"
 msgstr "属性の引数名 '{0}' が重複しています"
 
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
 #, csharp-format
 msgid ""
 "The attribute `{0}' is not valid on this declaration type. It is valid on `"
 "{1}' declarations only"
 msgstr "属性 `{0}' はこの宣言型では無効です。 `{1}' の宣言でのみ有効です"
 
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
 #, csharp-format
 msgid "The argument to the `{0}' attribute must be a valid identifier"
 msgstr "`{0}' 属性への引数は有効な識別子である必要があります"
 
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
 #, fuzzy, csharp-format
 msgid "Invalid value for argument to `{0}' attribute"
 msgstr "`System.AttributeUsage' 属性への無効な引数値です"
 
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
 #, csharp-format
 msgid "The attribute `{0}' cannot be applied multiple times"
 msgstr "属性 `{0}' は複数回指定することができません"
 
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
 #, csharp-format
 msgid "`{0}' is obsolete: `{1}'"
 msgstr "`{0}'は廃止されています: `{1}'"
@@ -441,56 +441,56 @@ msgstr ""
 "`partial' 修飾子は `class'、`struct'、`interface'、`void' キーワードの直前で"
 "のみ使用できます"
 
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
 msgid "Invalid number"
 msgstr "無効な数値です"
 
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
 #, csharp-format
 msgid "Unrecognized escape sequence `\\{0}'"
 msgstr "認識できないエスケープシーケンス `\\{0}' です"
 
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
 msgid "Unrecognized escape sequence"
 msgstr "認識できないエスケープシーケンスです"
 
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
 #, fuzzy
 msgid "Filename, single-line comment or end-of-line expected"
 msgstr "1行コメントまたは行末が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
 #, fuzzy
 msgid "Missing identifier to pre-processor directive"
 msgstr "プリプロセッサ指令の識別子がありません"
 
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
 #, csharp-format
 msgid "Identifier expected: {0}"
 msgstr "識別子が必要です: {0}"
 
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
 #, fuzzy
 msgid "Integral constant is too large"
 msgstr "数値定数が長すぎます"
 
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
 msgid "Invalid preprocessor directive"
 msgstr "無効なプリプロセッサ指令です"
 
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
 #, csharp-format
 msgid "Unexpected processor directive ({0})"
 msgstr "予期しないプリプロセッサ指令です({0})"
 
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
 msgid ""
 "Cannot define or undefine preprocessor symbols after first token in file"
 msgstr ""
 "ファイル中の最初のトークンの出現後は、プリプロセッサシンボルを定義または定義"
 "解除することはできません"
 
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
 msgid ""
 "Preprocessor directives must appear as the first non-whitespace character on "
 "a line"
@@ -498,62 +498,62 @@ msgstr ""
 "プリプロセッサ指令は、1行の中で、最初の空白でない文字として出現しなければなり"
 "ません"
 
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
 msgid "Single-line comment or end-of-line expected"
 msgstr "1行コメントまたは行末が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
 msgid "Expected `#endif' directive"
 msgstr "`#endif' 指令が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
 msgid "#endregion directive expected"
 msgstr "#endregion指令が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
 msgid "Wrong preprocessor directive"
 msgstr "正しくないプリプロセッサ指令です"
 
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
 #, csharp-format
 msgid "#error: '{0}'"
 msgstr "#error: `{0}'"
 
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
 msgid "The line number specified for #line directive is missing or invalid"
 msgstr "#line指令で指定される行番号が無いか、または無効です"
 
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
 msgid "Newline in constant"
 msgstr "定数の中に改行文字が含まれています"
 
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
 msgid "Unterminated string literal"
 msgstr "文字列に終端がありません"
 
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
 msgid "Identifier too long (limit is 512 chars)"
 msgstr "識別子が長すぎます(最大512文字)"
 
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
 msgid "End-of-file found, '*/' expected"
 msgstr "ファイルの終端に到達しましたが、 '*/' が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
 msgid "Keyword, identifier, or string expected after verbatim specifier: @"
 msgstr "厳密指定子@の直後には、キーワード、識別子または文字列が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
 #, fuzzy, csharp-format
 msgid "Unexpected character `{0}'"
 msgstr "`{0}' が必要です"
 
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
 msgid "Empty character literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
 msgid "Too many characters in character literal"
 msgstr ""
 
@@ -604,7 +604,7 @@ msgid ""
 "declaration of this type exists"
 msgstr ""
 
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
 #, csharp-format
 msgid ""
 "`{0}': explicit interface declaration can only be declared in a class or "
@@ -612,36 +612,36 @@ msgid ""
 msgstr ""
 "`{0}': インターフェースの明示的な実装は、クラスまたは構造体でのみ宣言できます"
 
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
 #, csharp-format
 msgid "Duplicate type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
 #, csharp-format
 msgid "The type `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
 msgid ""
 "Cannot specify the `DefaultMember' attribute on type containing an indexer"
 msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
 
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
 msgid "The RequiredAttribute attribute is not permitted on C# types"
 msgstr ""
 
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
 #, fuzzy, csharp-format
 msgid "Class `{0}' cannot derive from the dynamic type"
 msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
 
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
 #, csharp-format
 msgid "`{0}' is already listed in interface list"
 msgstr "`{0}'は既にインターフェースのリストに含まれています"
 
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base interface `{0}' is less accessible than "
@@ -650,35 +650,35 @@ msgstr ""
 "一貫性の無いアクセス修飾子です: 基底インターフェース `{0}' はインターフェー"
 "ス `{1}' よりもアクセスが限定的です"
 
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
 #, csharp-format
 msgid "Type `{0}' in interface list is not an interface"
 msgstr ""
 "インターフェースリストに含まれる型 `{0}' はインターフェースではありません"
 
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
 #, csharp-format
 msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
 msgstr ""
 "`{0}': クラスには複数の基底クラスを指定することはできません(`{1}' と `{2}')"
 
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
 #, csharp-format
 msgid "`{0}': Base class `{1}' must be specified as first"
 msgstr "`{0}': 基底クラス `{1}' が先に指定されなければなりません"
 
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
 #, csharp-format
 msgid ""
 "The operator `{0}' requires a matching operator `{1}' to also be defined"
 msgstr "演算子 `{0}' は対応する演算子 `{1}' の定義も必要とします"
 
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
 #, csharp-format
 msgid "Partial declarations of `{0}' must not specify different base classes"
 msgstr "`{0}' の部分的な宣言の間で、別々の基底クラスを指定することはできません"
 
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
 #, csharp-format
 msgid ""
 "Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
@@ -686,12 +686,12 @@ msgstr ""
 "継承されたインターフェース `{0}' で、`{1}' のインターフェース階層構造の循環定"
 "義が生じています"
 
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
 #, csharp-format
 msgid "Circular base class dependency involving `{0}' and `{1}'"
 msgstr "`{0}' と `{1}' の間で基底クラスの循環依存が生じています"
 
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
 #, csharp-format
 msgid ""
 "Partial declarations of `{0}' have inconsistent constraints for type "
@@ -700,12 +700,12 @@ msgstr ""
 "`{0}' の部分的な宣言の間で、型パラメータ `{1}' について一貫性のない制約が含ま"
 "れています"
 
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
 #, fuzzy, csharp-format
 msgid "`{0}': cannot implement a dynamic interface `{1}'"
 msgstr "`{0}' を含む型はインターフェース `{1}' を実装しません"
 
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
 #, csharp-format
 msgid ""
 "`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
@@ -714,14 +714,14 @@ msgstr ""
 "`{0}' は `{1}' と `{2}' が型パラメータ置換後に重複する可能性があるため、これ"
 "らの両方を実装することはできません"
 
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
 #, csharp-format
 msgid ""
 "A generic type cannot derive from `{0}' because it is an attribute class"
 msgstr ""
 "`{0}' は属性クラスなので、ここからジェネリック型を派生することはできません"
 
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
 msgid ""
 "Two indexers have different names; the IndexerName attribute must be used "
 "with the same name on every indexer within a type"
@@ -729,79 +729,79 @@ msgstr ""
 "2つのインデクサ間で別々の名前が定義されています; 1つの型において、IndexerName"
 "属性は全てのインデクサにおいて同一の名前をもたなければなりません"
 
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
 #, csharp-format
 msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
 msgstr ""
 "staticメンバ `{0}' はoverride, virtual, abstractとして宣言することはできませ"
 "ん"
 
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
 #, csharp-format
 msgid "A member `{0}' marked as override cannot be marked as new or virtual"
 msgstr ""
 "overrideとして宣言されたメンバ `{0}' にはnewおよびvirtualを指定できません"
 
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
 #, csharp-format
 msgid "`{0}' cannot be both extern and abstract"
 msgstr "`{0}' はexternかつabstractとすることはできません"
 
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
 #, csharp-format
 msgid "`{0}' cannot be both abstract and sealed"
 msgstr "`{0}' はabstractかつsealedとすることはできません"
 
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
 #, csharp-format
 msgid "The abstract method `{0}' cannot be marked virtual"
 msgstr "abstractメソッド `{0}' はvirtualとすることはできません"
 
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
 #, csharp-format
 msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
 msgstr ""
 "`{0}' はabstractですが、abstractでないクラス `{1}' の中で宣言されています"
 
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
 #, csharp-format
 msgid "`{0}': virtual or abstract members cannot be private"
 msgstr "`{0}': virtualまたはabstractのメンバはprivateにはできません"
 
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
 #, csharp-format
 msgid "`{0}' cannot be sealed because it is not an override"
 msgstr "`{0}' はoverrideではないため、sealedとすることはできません"
 
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
 #, csharp-format
 msgid "`{0}': containing type does not implement interface `{1}'"
 msgstr "`{0}' を含む型はインターフェース `{1}' を実装しません"
 
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
 #, csharp-format
 msgid "Type parameter `{0}' has same name as containing type, or method"
 msgstr ""
 "型パラメータ `{0}' が、その宣言型あるいはメソッドと同じ名前になっています"
 
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
 #, csharp-format
 msgid "`{0}': member names cannot be the same as their enclosing type"
 msgstr "`{0}': メンバ名はその宣言型と同一にはできません"
 
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
 msgid ""
 "The class System.Object cannot have a base class or implement an interface."
 msgstr ""
 "クラス System.Object には基底クラスやインターフェースを指定することはできませ"
 "ん"
 
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
 #, csharp-format
 msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
 msgstr "属性 `{0}' はSystem.Attribute から派生したクラスでのみ有効です"
 
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
 msgid ""
 "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
 "or attribute classes"
@@ -809,57 +809,57 @@ msgstr ""
 "属性 `System.Diagnostics.ConditionalAttribute' はメソッドまたは属性クラスでの"
 "み有効です"
 
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
 #, csharp-format
 msgid "`{0}': an abstract class cannot be sealed or static"
 msgstr "`{0}': abstractクラスはsealedまたはstaticにはできません"
 
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
 #, csharp-format
 msgid "`{0}': a class cannot be both static and sealed"
 msgstr "`{0}': クラスはstaticかつsealedとすることはできません"
 
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
 #, csharp-format
 msgid "`{0}': Static classes cannot contain user-defined operators"
 msgstr "`{0}': staticクラスにはユーザー定義の演算子を含むことはできません"
 
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
 #, csharp-format
 msgid "`{0}': Static classes cannot contain destructor"
 msgstr "`{0}': staticクラスではデストラクタを定義できません"
 
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
 #, csharp-format
 msgid "`{0}': cannot declare indexers in a static class"
 msgstr "`{0}': staticクラスではインデクサを宣言できません"
 
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
 #, csharp-format
 msgid "`{0}': Static classes cannot have instance constructors"
 msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
 
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
 #, csharp-format
 msgid "`{0}': cannot declare instance members in a static class"
 msgstr "`{0}': インスタンス メンバをstaticクラスで宣言することはできません"
 
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
 #, fuzzy, csharp-format
 msgid "`{0}': Cannot derive from type parameter `{1}'"
 msgstr "`{0}': staticクラス '{1}' から派生することはできません"
 
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
 #, csharp-format
 msgid "`{0}': Cannot derive from static class `{1}'"
 msgstr "`{0}': staticクラス '{1}' から派生することはできません"
 
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
 #, fuzzy, csharp-format
 msgid "`{0}': cannot derive from sealed type `{1}'"
 msgstr "`{0}': sealedクラス `{1}' から派生することはできません"
 
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
 #, csharp-format
 msgid ""
 "Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
@@ -868,12 +868,12 @@ msgstr ""
 "staticクラス `{0}' は型 `{1}' から派生できません。staticクラスはobjectから派"
 "生しなければなりません"
 
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
 #, csharp-format
 msgid "`{0}' cannot derive from special class `{1}'"
 msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
 
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base class `{0}' is less accessible than class `"
@@ -882,50 +882,50 @@ msgstr ""
 "一貫性の無いアクセス修飾子: 基底クラス `{0}' はクラス `{1}' よりもアクセスが"
 "限定的です"
 
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
 #, csharp-format
 msgid "Static class `{0}' cannot implement interfaces"
 msgstr "staticクラス `{0}' はインターフェースを実装できません"
 
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
 #, csharp-format
 msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
 msgstr ""
 
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
 #, csharp-format
 msgid "`{0}': Structs cannot have instance field initializers"
 msgstr "`{0}': 構造体ではインスタンス フィールドを初期化できません"
 
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
 #, fuzzy, csharp-format
 msgid "Do not override `{0}'. Use destructor syntax instead"
 msgstr ""
 "`{0}' を直接使用せず、代わりにパラメータ修飾子 `this' を使用してください"
 
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
 #, csharp-format
 msgid "`{0}' is marked as an override but no suitable {1} found to override"
 msgstr ""
 "`{0}' はoverrideとして宣言されていますが、オーバーライドすべき{1}が見つかりま"
 "せん"
 
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not an event"
 msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
 
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a property"
 msgstr "`{0}': `{1}' はプロパティではないため、オーバーライドできません"
 
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a method"
 msgstr "`{0}': `{1}' はメソッドではないため、オーバーライドできません"
 
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' cannot override inherited members `{1}' and `{2}' because they have "
@@ -934,12 +934,12 @@ msgstr ""
 "`{0}': 継承しようとするメンバ `{1}' はsealedであるため、オーバーライドできま"
 "せん"
 
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
 #, csharp-format
 msgid "`{0}' hides inherited abstract member `{1}'"
 msgstr "`{0}' は継承されるabstractメンバ `{1}' を隠蔽してしまいます"
 
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
 #, csharp-format
 msgid ""
 "`{0}': cannot override inherited member `{1}' because it is not marked "
@@ -948,40 +948,40 @@ msgstr ""
 "`{0}': 継承しようとするメンバ `{1}' は、virtual, abstractあるいはoverrideとし"
 "て宣言されていないので、オーバーライドすることはできません"
 
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
 #, csharp-format
 msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
 msgstr ""
 "`{0}': 継承しようとするメンバ `{1}' はsealedであるため、オーバーライドできま"
 "せん"
 
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
 #, csharp-format
 msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "`{0}': オーバーライドされたメンバ `{2}' に適合するためには、型が `{1}' でなけ"
 "ればなりません"
 
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
 #, csharp-format
 msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "`{0}': オーバーライドされたメンバ `{2}' に適合するには、戻り値型は `{1}' でな"
 "ければなりません"
 
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
 #, csharp-format
 msgid "A partial method `{0}' cannot explicitly implement an interface"
 msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
 
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
 #, fuzzy, csharp-format
 msgid "The type `{0}' in explicit interface declaration is not an interface"
 msgstr ""
 "明示的なインターフェース実装で記述された `{0}' は、インターフェースではありま"
 "せん"
 
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -990,7 +990,7 @@ msgstr ""
 "一貫性の無いアクセス制限: パラメータ型 `{0}' はインデクサ '{1}' よりもアクセ"
 "スが限られています"
 
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -999,7 +999,7 @@ msgstr ""
 "一貫性の無いアクセス制限: パラメータ型 `{0}' は演算子 '{1}' よりもアクセスが"
 "限られています"
 
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1008,7 +1008,7 @@ msgstr ""
 "一貫性の無いアクセス制限: パラメータ型 `{0}' はメソッド '{1}' よりもアクセス"
 "が限られています"
 
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
 #, csharp-format
 msgid ""
 "`{0}': cannot change access modifiers when overriding `{1}' inherited member "
@@ -1017,40 +1017,47 @@ msgstr ""
 "`{0}': `{1}' の継承されたメンバー `{2}' をオーバーライドするとき、アクセス修"
 "飾子は変更できません"
 
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
 #, fuzzy, csharp-format
 msgid "`{0}': static types cannot be used as return types"
 msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
 
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
 #, csharp-format
 msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
 msgid "Inconsistent accessibility: property type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
 msgid "Inconsistent accessibility: indexer return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
 msgid "Inconsistent accessibility: return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
 msgid "Inconsistent accessibility: field type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
 #, csharp-format
 msgid ""
 "Parameters or local variables of type `{0}' cannot be declared in async "
 "methods or iterators"
 msgstr ""
 
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
 #, fuzzy, csharp-format
 msgid ""
 "Local variables of type `{0}' cannot be used inside anonymous methods, "
@@ -1059,7 +1066,7 @@ msgstr ""
 "ローカル変数またはパラメータである `{0}' は、そのアドレスを取得して匿名メソッ"
 "ドあるいはラムダ式の中で使用することができません"
 
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
 #, csharp-format
 msgid "Field or property cannot be of type `{0}'"
 msgstr ""
@@ -1080,19 +1087,19 @@ msgid ""
 "The evaluation of the constant value for `{0}' involves a circular definition"
 msgstr ""
 
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
 #, csharp-format
 msgid "Constant value `{0}' cannot be converted to a `{1}'"
 msgstr ""
 
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
 #, csharp-format
 msgid ""
 "Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
 "to override)"
 msgstr ""
 
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
 #, csharp-format
 msgid ""
 "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
@@ -1161,74 +1168,64 @@ msgid ""
 "Extension method `{0}' of value type `{1}' cannot be used to create delegates"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
 #, csharp-format
 msgid "Cannot create delegate from partial method declaration `{0}'"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
 #, csharp-format
 msgid ""
 "Cannot create delegate with `{0}' because it has a Conditional attribute"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' parameters and return type must be same as "
 "delegate `{2} {3}' parameters and return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
 #, csharp-format
 msgid ""
 "A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
 "return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
 msgid "Method name expected"
 msgstr ""
 
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
 #, csharp-format
 msgid "Error generating XML documentation file `{0}' (`{1}')"
 msgstr ""
 
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
 msgid "Source file `"
 msgstr ""
 
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
 msgid "No files to compile were specified"
 msgstr "コンパイルするファイルが指定されていません"
 
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
 msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
 msgstr ""
 
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
 msgid ""
 "If no source files are specified you must specify the output file with -out:"
 msgstr ""
 
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
 msgid "Output file name is not valid"
 msgstr ""
 
@@ -1297,182 +1294,182 @@ msgid "`{0}' does not contain a definition for `{1}'"
 msgstr ""
 
 #: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
 msgid ""
 "The left-hand side of an assignment must be a variable, a property or an "
 "indexer"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
 msgid "The operation in question is undefined on void pointers"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
 #, csharp-format
 msgid "Internal compiler error: {0}"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
 msgid "A ref or out argument must be an assignable variable"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
 msgid ""
 "An attribute argument must be a constant expression, typeof expression or "
 "array creation expression"
 msgstr "属性の引数は定数、typeof式または配列生成式でなければなりません"
 
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
 #, csharp-format
 msgid "The class `{0}' has no constructors defined"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
 #, csharp-format
 msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
 msgid "An expression tree cannot contain an unsafe pointer operation"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
 #, csharp-format
 msgid "`{0}' is a `{1}' but a `{2}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
 #, csharp-format
 msgid "Expression denotes a `{0}', where a `{1}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
 msgid "Pointers and fixed size buffers may only be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
 #, csharp-format
 msgid ""
 "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
 "dll assembly reference?"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
 #, csharp-format
 msgid ""
 "A local variable `{0}' cannot be used before it is declared. Consider "
 "renaming the local variable when it hides the member `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
 #, csharp-format
 msgid "`{0}' conflicts with a declaration in a child block"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
 #, csharp-format
 msgid "A local variable `{0}' cannot be used before it is declared"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
 #, csharp-format
 msgid "The name `{0}' does not exist in the current context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
 msgid "System.Void cannot be used from C#. Consider using `void'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
 #, csharp-format
 msgid "Cannot call an abstract base member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
 #, csharp-format
 msgid ""
 "Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
 "qualifier must be of type `{2}' or derived from it"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
 #, csharp-format
 msgid ""
 "Static member `{0}' cannot be accessed with an instance reference, qualify "
 "it with a type name instead"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
 #, csharp-format
 msgid ""
 "A field initializer cannot reference the nonstatic field, method, or "
 "property `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
 #, csharp-format
 msgid "An object reference is required to access non-static member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
 #, csharp-format
 msgid ""
 "Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
 msgid "Cannot modify the result of an unboxing conversion"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
 "overload `{2}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
 #, csharp-format
 msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
 msgid "An expression tree cannot contain an expression with method group"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
 msgid ""
 "Partial methods with only a defining declaration or removed conditional "
 "methods cannot be used in an expression tree"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
 #, csharp-format
 msgid ""
 "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
 "parentheses to invoke the method"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
 #, csharp-format
 msgid ""
 "The type `{0}' does not contain a constructor that takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1480,159 +1477,159 @@ msgid ""
 "without the extension method syntax"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
 #, csharp-format
 msgid ""
 "The call is ambiguous between the following methods or properties: `{0}' and "
 "`{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
 #, csharp-format
 msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
 "`out' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
 #, csharp-format
 msgid ""
 "The best overloaded collection initalizer method `{0}' has some invalid "
 "arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
 #, csharp-format
 msgid "Delegate `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
 #, csharp-format
 msgid "The best overloaded method match for `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
 #, csharp-format
 msgid ""
 "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
 #, csharp-format
 msgid "Argument `#{0}' is missing `{1}' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
 #, csharp-format
 msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
 #, csharp-format
 msgid ""
 "The type arguments for method `{0}' cannot be inferred from the usage. Try "
 "specifying the type arguments explicitly"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
 #, csharp-format
 msgid "No overload for method `{0}' takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
 #, fuzzy, csharp-format
 msgid "The delegate `{0}' does not contain a parameter named `{1}'"
 msgstr "デリゲート `{0}' は `{1}' 個の引数をもちません"
 
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
 #, csharp-format
 msgid ""
 "The best overloaded method match for `{0}' does not contain a parameter "
 "named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
 #, csharp-format
 msgid ""
 "Named argument `{0}' cannot be used for a parameter which has positional "
 "argument specified"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
 msgid ""
 "You cannot use fixed size buffers contained in unfixed expressions. Try "
 "using the fixed statement"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
 #, csharp-format
 msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
 #, csharp-format
 msgid "Use of possibly unassigned field `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
 #, csharp-format
 msgid "Property or event `{0}' is not supported by the C# language"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
 #, csharp-format
 msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because it "
 "lacks the `get' accessor"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the get "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
 #, csharp-format
 msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the set "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of `+=' or `-=' "
 "operator"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of += or -= when used "
 "outside of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
 #, csharp-format
 msgid ""
 "An implicitly typed local variable declaration cannot be initialized with `"
 "{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
 msgid ""
 "The contextual keyword `var' may only appear within a local variable "
 "declaration"
@@ -1654,7 +1651,7 @@ msgstr ""
 msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
 msgstr ""
 
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
 msgid "Detection Parsing Error"
 msgstr ""
 
@@ -1755,203 +1752,203 @@ msgid ""
 "{1}' is used as a short circuit operator"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined as `{0}' and `{1}' "
 "convert implicitly to each other"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined because there is no "
 "implicit conversion between `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
 #, csharp-format
 msgid "Use of unassigned local variable `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
 #, csharp-format
 msgid ""
 "Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
 "or query expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
 #, csharp-format
 msgid ""
 "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
 #, csharp-format
 msgid "Use of unassigned out parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
 #, fuzzy, csharp-format
 msgid "Cannot invoke a non-delegate type `{0}'"
 msgstr "`{0}' をデリゲートでない型 `{1}'に変換できません"
 
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
 #, csharp-format
 msgid "The member `{0}' cannot be used as method or delegate"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
 msgid ""
 "Do not directly call your base class Finalize method. It is called "
 "automatically from your destructor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
 msgid ""
 "Destructors and object.Finalize cannot be called directly. Consider calling "
 "IDisposable.Dispose if available"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
 #, csharp-format
 msgid ""
 "The base call to method `{0}' cannot be dynamically dispatched. Consider "
 "casting the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
 #, csharp-format
 msgid "`{0}': cannot explicitly call operator or accessor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
 #, csharp-format
 msgid "Unsafe type `{0}' cannot be used in an object creation expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
 #, csharp-format
 msgid ""
 "Cannot create an instance of the variable type `{0}' because it does not "
 "have the new() constraint"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
 #, csharp-format
 msgid ""
 "`{0}': cannot provide arguments when creating an instance of a variable type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
 #, csharp-format
 msgid "Cannot create an instance of the static class `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
 #, csharp-format
 msgid "Cannot create an instance of the abstract class or interface `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
 msgid ""
 "An implicitly typed local variable declarator cannot use an array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
 msgid "A constant value is expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
 #, csharp-format
 msgid "An array initializer of length `{0}' was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
 msgid ""
 "Array initializers can only be used in a variable or field initializer. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
 msgid "A nested array initializer was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
 msgid "An expression tree cannot contain a multidimensional array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
 msgid "Cannot create an array with a negative size"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
 msgid ""
 "Can only use array initializer expressions to assign to array types. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
 msgid ""
 "The type of an implicitly typed array cannot be inferred from the "
 "initializer. Try specifying array type explicitly"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
 msgid ""
 "The `this' object cannot be used before all of its fields are assigned to"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
 msgid ""
 "Keyword `this' is not valid in a static property, static method, or static "
 "field initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
 msgid ""
 "Anonymous methods inside structs cannot access instance members of `this'. "
 "Consider copying `this' to a local variable outside the anonymous method and "
 "using the local instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
 msgid "Keyword `this' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
 msgid "Cannot take the address of `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
 msgid "Cannot pass `this' as a ref or out argument because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
 msgid "Cannot assign to `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
 msgid "The __arglist construct is valid only within a variable argument method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
 msgid "An expression tree cannot contain a method with variable arguments"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
 msgid "The typeof operator cannot be used on the dynamic type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
 #, csharp-format
 msgid "`{0}': an attribute argument cannot use type parameters"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
 #, csharp-format
 msgid ""
 "`{0}' does not have a predefined size, therefore sizeof can only be used in "
@@ -1959,155 +1956,156 @@ msgid ""
 "SizeOf)"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
 #, csharp-format
 msgid "Alias `{0}' not found"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
 msgid ""
 "The namespace alias qualifier `::' cannot be used to invoke a method. "
 "Consider using `.' instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
 msgid "Cannot perform member binding on `null' value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
 #, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
 #, csharp-format
 msgid "A nested type cannot be specified through a type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
 #, csharp-format
 msgid ""
 "Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
 "replacing `::' with `.'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
 #, csharp-format
 msgid "The nested type `{0}' does not exist in the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
 #, csharp-format
 msgid "Cannot apply indexing with [] to an expression of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
 msgid "A pointer must be indexed by only one value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
 msgid "An element access expression cannot use named argument"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
 #, csharp-format
 msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
 msgid ""
 "The indexer base access cannot be dynamically dispatched. Consider casting "
 "the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
 msgid "An expression tree may not contain a base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
 #, fuzzy
 msgid "Keyword `base' is not available in a static method"
 msgstr "キーワード `new' は名前空間要素で認められていません"
 
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
 #, fuzzy
 msgid "Keyword `base' is not available in the current context"
 msgstr "キーワード `new' は名前空間要素で認められていません"
 
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
 msgid ""
 "A property, indexer or dynamic member access may not be passed as `ref' or "
 "`out' parameter"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
 #, csharp-format
 msgid "Array elements cannot be of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
 #, csharp-format
 msgid "Array elements cannot be of static type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
 msgid "Cannot use a negative size with stackalloc"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
 msgid "Cannot use stackalloc in finally or catch"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
 #, csharp-format
 msgid ""
 "Member `{0}' cannot be initialized. An object initializer may only be used "
 "for fields, or properties"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
 #, csharp-format
 msgid ""
 "Static field or property `{0}' cannot be assigned in an object initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
 #, csharp-format
 msgid ""
 "A field or property `{0}' cannot be initialized with a collection object "
 "initializer because type `{1}' does not implement `{2}' interface"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
 #, csharp-format
 msgid "Inconsistent `{0}' member declaration"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
 #, csharp-format
 msgid ""
 "An object initializer includes more than one member `{0}' initialization"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
 #, csharp-format
 msgid "Cannot initialize object of type `{0}' with a collection initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
 #, fuzzy
 msgid "Anonymous types cannot be used in this expression"
 msgstr "匿名メソッドを式ツリーに変換することはできません"
 
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
 #, csharp-format
 msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
 msgstr ""
@@ -2168,12 +2166,12 @@ msgid ""
 "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
 msgstr ""
 
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
 #, fuzzy, csharp-format
 msgid "`{0}': A volatile field cannot be of the type `{1}'"
 msgstr "`{0}': sealedクラス `{1}' から派生することはできません"
 
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
 #, fuzzy, csharp-format
 msgid "`{0}': A field cannot be both volatile and readonly"
 msgstr "`{0}': クラスはstaticかつsealedとすることはできません"
@@ -2228,7 +2226,7 @@ msgid "Cannot yield in the body of a finally clause"
 msgstr ""
 
 #: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
 msgid "Control cannot leave the body of a finally clause"
 msgstr ""
 
@@ -2318,47 +2316,47 @@ msgid ""
 "`{0}' is not a valid constraint. Static classes cannot be used as constraints"
 msgstr ""
 
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
 #, csharp-format
 msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
 #, csharp-format
 msgid "`{0}': static classes cannot be used as generic arguments"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
 #, csharp-format
 msgid "The type `{0}' may not be used as a type argument"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
 msgid "Variant type parameters can only be used with interfaces and delegates"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
 #, csharp-format
 msgid ""
 "The type `{0}' must be a reference type in order to use it as type parameter "
 "`{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
 #, csharp-format
 msgid ""
 "The type `{0}' must be a non-nullable value type in order to use it as type "
 "parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
 #, csharp-format
 msgid ""
 "The type `{0}' must have a public parameterless constructor in order to use "
 "it as parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2366,7 +2364,7 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2374,42 +2372,49 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined in this assembly, but it is not "
 "defined in source or any added modules"
 msgstr ""
 
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
 #, csharp-format
 msgid ""
 "The type `{0}' is defined in an assembly that is not referenced. Consider "
 "adding a reference to assembly `{1}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined assembly `{1}', but it could "
@@ -2439,36 +2444,36 @@ msgstr ""
 msgid "Iterators cannot have unsafe parameters or yield types"
 msgstr ""
 
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
 msgid "Unsafe code may not appear in iterators"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
 msgid "SDK path could not be resolved"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
 #, csharp-format
 msgid ""
 "Assembly `{0}' references `{1}' which has a higher version number than "
 "imported assembly `{2}'"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
 #, csharp-format
 msgid ""
 "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
 "supply runtime policy"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
 #, csharp-format
 msgid ""
 "An assembly with the same name `{0}' has already been imported. Consider "
 "removing one of the references or sign the assembly"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
 #, csharp-format
 msgid ""
 "An assembly with the same identity `{0}' has already been imported. Consider "
@@ -2562,63 +2567,63 @@ msgid ""
 "suffix `{1}' to create a literal of this type"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
 msgid ""
 "A partial method declaration and partial method implementation cannot differ "
 "on use of `params' modifier"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "an extension method or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
 #, csharp-format
 msgid ""
 "Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
 #, fuzzy, csharp-format
 msgid ""
 "Overloaded method `{0}' cannot differ on use of parameter modifiers only"
 msgstr "Conditionalメソッド `{0}' ではoutパラメータを指定できません"
 
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`static' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`unsafe' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
 #, fuzzy, csharp-format
 msgid "A partial method `{0}' declaration is already defined"
 msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
 
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
 #, fuzzy, csharp-format
 msgid "A partial method `{0}' implementation is already defined"
 msgstr "部分メソッド `{0}' はインターフェースを明示的に実装できません"
 
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
 #, csharp-format
 msgid "A member `{0}' is already reserved"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
 #, csharp-format
 msgid "Duplicate user-defined conversion in type `{0}'"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
 #, csharp-format
 msgid ""
 "A member `{0}' is already defined. Rename this member or use different "
@@ -2627,12 +2632,12 @@ msgstr ""
 "メンバ `{0}' が既に定義されています。このメンバの名前を変更するか、別のパラ"
 "メータ型を使用してください"
 
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
 #, csharp-format
 msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
 msgstr ""
 
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
 msgid ""
 "The DllImport attribute must be specified on a method marked `static' and "
 "`extern'"
@@ -2640,12 +2645,12 @@ msgstr ""
 "`static'かつ`extern'で宣言されたメソッドには、DllImport属性が指定されなければ"
 "なりません"
 
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
 #, csharp-format
 msgid "`{0}': A partial method parameters cannot use `out' modifier"
 msgstr "`{0}': 部分メソッドのパラメータで`out'修飾子は使用できません"
 
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
 #, csharp-format
 msgid ""
 "Conditional not valid on `{0}' because it is a constructor, destructor, "
@@ -2654,13 +2659,6 @@ msgstr ""
 "Conditionalは コンストラクタ、デストラクタ、演算子または明示的なインター"
 "フェースの実装である `{0}'  では無効です"
 
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
 #: mcs/mcs/method.cs:865
 msgid ""
 "A partial method cannot define access modifier or any of abstract, extern, "
@@ -2719,12 +2717,12 @@ msgstr ""
 msgid "The return type of an async method must be void, Task, or Task<T>"
 msgstr ""
 
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
 #, fuzzy, csharp-format
 msgid "`{0}': Extension methods cannot be defined in a nested class"
 msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
 
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
 #, csharp-format
 msgid ""
 "`{0}': Extension methods require `System.Runtime.CompilerServices."
@@ -2732,65 +2730,65 @@ msgid ""
 "reference?"
 msgstr ""
 
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
 #, fuzzy, csharp-format
 msgid "`{0}': Extension methods must be defined in a non-generic static class"
 msgstr "`{0}': 拡張メソッドはstaticで宣言されなければなりません"
 
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
 #, fuzzy, csharp-format
 msgid "`{0}': an entry point cannot be async method"
 msgstr "`{0}': `{1}' はメソッドではないため、オーバーライドできません"
 
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
 #, csharp-format
 msgid ""
 "A partial method `{0}' implementation is missing a partial method declaration"
 msgstr ""
 
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
 #, csharp-format
 msgid "Method or delegate cannot return type `{0}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
 msgid ""
 "The constructor call cannot be dynamically dispatched within constructor "
 "initializer"
 msgstr ""
 
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
 #, fuzzy, csharp-format
 msgid "`{0}': Struct constructors cannot call base constructors"
 msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
 
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
 #, csharp-format
 msgid "Constructor `{0}' cannot call itself"
 msgstr ""
 
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
 #, csharp-format
 msgid "`{0}': The static constructor must be parameterless"
 msgstr ""
 
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
 msgid "Structs cannot contain explicit parameterless constructors"
 msgstr ""
 
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': A class with the ComImport attribute cannot have a user-defined "
 "constructor"
 msgstr "`{0}': staticクラスではインスタンス コンストラクタを定義できません"
 
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
 #, fuzzy, csharp-format
 msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
 msgstr "`{0}' は継承されるabstractメンバ `{1}' を隠蔽してしまいます"
 
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
 #, fuzzy, csharp-format
 msgid ""
 "`{0}.{1}' in explicit interface declaration is not a member of interface"
@@ -2798,34 +2796,34 @@ msgstr ""
 "明示的なインターフェースの宣言で記述された `{0}' は、インターフェースではあり"
 "ません"
 
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
 #, csharp-format
 msgid ""
 "`{0}' explicit method implementation cannot implement `{1}' because it is an "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
 #, fuzzy, csharp-format
 msgid "Method `{0}' cannot implement interface accessor `{1}'"
 msgstr ""
 "Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
 
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
 #, csharp-format
 msgid ""
 "Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
 "an explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
 #, fuzzy, csharp-format
 msgid ""
 "Accessor `{0}' must be declared public to implement interface member `{1}'"
 msgstr ""
 "Conditionalメンバ `{0}' はインターフェースメンバ `{1}' を実装できません"
 
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': the explicit interface implementation cannot introduce the params "
@@ -2834,75 +2832,75 @@ msgstr ""
 "明示的なインターフェースの宣言で記述された `{0}' は、インターフェースではあり"
 "ません"
 
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
 #, fuzzy, csharp-format
 msgid ""
 "Attribute `{0}' is not valid on property or event accessors. It is valid on `"
 "{1}' declarations only"
 msgstr "属性 `{0}' はこの宣言型では無効です。 `{1}' の宣言でのみ有効です"
 
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
 #, csharp-format
 msgid "User-defined operator `{0}' must be declared static and public"
 msgstr ""
 
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
 msgid ""
 "User-defined operator cannot take an object of the enclosing type and "
 "convert to an object of the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
 msgid "User-defined conversion must convert to or from the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
 #, fuzzy, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from the dynamic type"
 msgstr "`{0}' は特別なクラス `{1}' から派生することはできません"
 
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from an interface type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a base class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
 msgid ""
 "Overloaded shift operator must have the type of the first operand be the "
 "containing type, and the type of the second operand must be int"
 msgstr ""
 
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
 msgid ""
 "The return type for ++ or -- operator must be the containing type or derived "
 "from the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
 msgid "The parameter type for ++ or -- operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
 msgid "The parameter type of a unary operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
 msgid "The return type of operator True or False must be bool"
 msgstr ""
 
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
 msgid "One of the parameters of a binary operator must be the containing type"
 msgstr ""
 
@@ -2911,66 +2909,59 @@ msgstr ""
 msgid "The modifier `{0}' is not valid for this item"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
 #, csharp-format
 msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
 #, csharp-format
 msgid ""
 "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
 #, csharp-format
 msgid "The imported type `{0}' is defined multiple times"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
 msgid ""
 "A using clause must precede all other namespace elements except extern alias "
 "declarations"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
 #, csharp-format
 msgid "The using alias `{0}' appeared previously in this namespace"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
 #, csharp-format
 msgid "The namespace `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
 #, csharp-format
 msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
 #, csharp-format
 msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
 #, csharp-format
 msgid ""
 "`{0}' is a type not a namespace. A using namespace directive can only be "
 "applied to namespaces"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
 #, csharp-format
 msgid "The extern alias `{0}' was not specified in -reference option"
 msgstr ""
@@ -3155,66 +3146,66 @@ msgstr ""
 msgid "`{0}': abstract properties cannot have private accessors"
 msgstr "`{0}': virtualまたはabstractのメンバはprivateにはできません"
 
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
 #, csharp-format
 msgid ""
 "The accessibility modifier of the `{0}' accessor must be more restrictive "
 "than the modifier of the property or indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
 #, csharp-format
 msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable get "
 "accessor"
 msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
 
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable set "
 "accessor"
 msgstr "`{0}': `{1}' はイベントではないため、オーバーライドできません"
 
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
 #, csharp-format
 msgid ""
 "`{0}': Cannot specify accessibility modifiers for both accessors of the "
 "property or indexer"
 msgstr ""
 
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
 #, csharp-format
 msgid ""
 "`{0}': accessibility modifiers on accessors may only be used if the property "
 "or indexer has both a get and a set accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
 #, csharp-format
 msgid ""
 "Automatically implemented property `{0}' cannot be used inside a type with "
 "an explicit StructLayout attribute"
 msgstr ""
 
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
 #, csharp-format
 msgid "`{0}': event must be of a delegate type"
 msgstr ""
 
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
 #, csharp-format
 msgid ""
 "The `{0}' attribute is valid only on an indexer that is not an explicit "
 "interface member declaration"
 msgstr ""
 
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
 #, fuzzy
 msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
 msgstr "インデクサを含む型には`DefaultMember'属性を指定できません"
@@ -3224,80 +3215,87 @@ msgstr "インデクサを含む型には`DefaultMember'属性を指定できま
 msgid "Value specified for the argument to `{0}' is not valid"
 msgstr ""
 
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
 msgid ""
 "A lambda expression with statement body cannot be converted to an expresion "
 "tree"
 msgstr ""
 
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
 #, csharp-format
 msgid ""
 "An object of a type convertible to `{0}' is required for the return statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by any expression when method "
 "returns void"
 msgstr ""
 
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by an expression when async "
 "method returns `Task'. Consider using `Task<T>' return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
 #, csharp-format
 msgid ""
 "`{0}': The return expression type of async method must be `{1}' rather than "
 "`Task<{1}>'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
 #, csharp-format
 msgid ""
 "Cannot convert `{0}' to delegate type `{1}' because some of the return types "
 "in the block are not implicitly convertible to the delegate return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
 msgid ""
 "Cannot return a value from iterators. Use the yield return statement to "
 "return a value, or yield break to end the iteration"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
 msgid "A goto case is only valid inside a switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
 msgid "The type caught or thrown must be derived from System.Exception"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
 msgid "A fixed statement cannot use an implicitly typed local variable"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
 msgid "An implicitly typed local variable cannot be a constant"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
 msgid ""
 "An implicitly typed local variable declarator must include an initializer"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
 msgid ""
 "An implicitly typed local variable declaration cannot include multiple "
 "declarators"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
 #, csharp-format
 msgid ""
 "A local variable named `{0}' cannot be declared in this scope because it "
@@ -3305,115 +3303,115 @@ msgid ""
 "scope to denote something else"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
 #, csharp-format
 msgid "A local variable named `{0}' is already defined in this scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
 #, fuzzy, csharp-format
 msgid ""
 "The type parameter name `{0}' is the same as local variable or parameter name"
 msgstr ""
 "型パラメータ `{0}' が、その宣言型あるいはメソッドと同じ名前になっています"
 
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
 #, csharp-format
 msgid ""
 "The out parameter `{0}' must be assigned to before control leaves the "
 "current method"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
 #, csharp-format
 msgid "`{0}': not all code paths return a value"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
 #, csharp-format
 msgid "Not all code paths return a value in anonymous method of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
 #, fuzzy
 msgid "Async methods cannot have ref or out parameters"
 msgstr "Conditionalメソッド `{0}' ではoutパラメータを指定できません"
 
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
 msgid "__arglist is not allowed in parameter list of async methods"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
 #, fuzzy
 msgid "Async methods cannot have unsafe parameters"
 msgstr "`{0}': staticクラス '{1}' から派生することはできません"
 
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
 #, csharp-format
 msgid "The label `{0}' is a duplicate"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
 #, csharp-format
 msgid ""
 "The label `{0}' shadows another label by the same name in a contained scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
 #, csharp-format
 msgid "The label `case {0}:' already occurs in this switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
 #, csharp-format
 msgid ""
 "A switch expression of type `{0}' cannot be converted to an integral type, "
 "bool, char, string, enum or nullable type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
 #, csharp-format
 msgid "`{0}' is not a reference type as required by the lock statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
 msgid "The type of locals declared in a fixed statement must be a pointer type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
 msgid ""
 "The right hand side of a fixed statement assignment may not be a cast "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
 msgid ""
 "You cannot use the fixed statement to take the address of an already fixed "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
 #, csharp-format
 msgid ""
 "A previous catch clause already catches all exceptions of this or a super "
 "type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
 #, csharp-format
 msgid ""
 "`{0}': type used in a using statement must be implicitly convertible to "
 "`System.IDisposable'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
 #, csharp-format
 msgid ""
 "foreach statement requires that the return type `{0}' of `{1}' must have a "
 "suitable public MoveNext method and public Current property"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it "
@@ -3421,47 +3419,47 @@ msgid ""
 "implementation"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it does "
 "not contain a definition for `{1}' or is inaccessible"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
 msgid "Use of null is not valid in this context"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
 #, csharp-format
 msgid "Foreach statement cannot operate on a `{0}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not defined or imported"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
 #, csharp-format
 msgid ""
 "The predefined type `{0}.{1}' is defined multiple times. Using definition "
 "from `{2}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not declared correctly"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
 #, csharp-format
 msgid ""
 "The compiler required member `{0}.{1}{2}' could not be found or is "
 "inaccessible"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
 #, csharp-format
 msgid ""
 "Cannot take the address of, get the size of, or declare a pointer to a "
index 075b250ca1b75aa1b4699716deb3bb93b88336eb..6040d0f153ff69d278d51bf87becbbc37c1c2435 100644 (file)
@@ -6,9 +6,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: mono 2.11.2\n"
+"Project-Id-Version: mono 3.0.2\n"
 "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -34,7 +34,7 @@ msgid ""
 "mismatch"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
 #, csharp-format
 msgid "Delegate `{0}' does not take `{1}' arguments"
 msgstr ""
@@ -54,44 +54,44 @@ msgstr ""
 msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
 msgid "Async lambda expressions cannot be converted to expression trees"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
 msgid "An anonymous method cannot be converted to an expression tree"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
 #, csharp-format
 msgid ""
 "Cannot convert anonymous method block without a parameter list to delegate "
 "type `{0}' because it has one or more `out' parameters"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
 msgid ""
 "Anonymous methods and lambda expressions cannot be used in the current "
 "context"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
 #, csharp-format
 msgid ""
 "Local variable or parameter `{0}' cannot have their address taken and be "
 "used inside an anonymous method, lambda expression or query expression"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
 #, csharp-format
 msgid "Cannot convert async {0} to delegate type `{1}'"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
 msgid "An expression tree cannot contain an anonymous method expression"
 msgstr ""
 
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
 #, csharp-format
 msgid ""
 "`{0}': An anonymous type cannot have multiple properties with the same name"
@@ -135,50 +135,50 @@ msgstr ""
 msgid "Cannot assign to `{0}' because it is a `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
 msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
 #, csharp-format
 msgid "A duplicate type forward of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is defined in this assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is a nested type"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
 "cannot have a version, culture or processor architecture specified"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. Strong named assemblies must "
 "specify a public key in their InternalsVisibleTo declarations"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
 #, csharp-format
 msgid "Referenced assembly `{0}' does not have a strong name"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
 #, csharp-format
 msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
 #, csharp-format
 msgid ""
 "Friend access was granted to `{0}', but the output assembly is named `{1}'. "
@@ -186,145 +186,145 @@ msgid ""
 "it"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
 msgid ""
 "Could not sign the assembly. ECMA key can only be used to delay-sign "
 "assemblies"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
 msgid ""
 "Added modules must be marked with the CLSCompliant attribute to match the "
 "assembly"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
 #, csharp-format
 msgid ""
 "Option `{0}' overrides attribute `{1}' given in a source file or added module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
 msgid "Delay signing was requested but no key file was given"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
 msgid "Cannot link resource file when building a module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
 #, csharp-format
 msgid "Error reading resource file `{0}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
 msgid "Could not write to file `"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
 msgid "Cannot specify -main if building a module or library"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
 #, csharp-format
 msgid "Could not find `{0}' specified for Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
 #, csharp-format
 msgid "`{0}' specified for Main method must be a valid class or struct"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
 #, csharp-format
 msgid "`{0}' does not have a suitable static Main method"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
 #, csharp-format
 msgid ""
 "Program `{0}' does not contain a static `Main' method suitable for an entry "
 "point"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
 msgid "Error during assembly signing. "
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
 #, csharp-format
 msgid "Metadata file `{0}' could not be found"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
 #, csharp-format
 msgid "Metadata file `{0}' does not contain valid metadata"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
 #, csharp-format
 msgid ""
 "Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
 "option to add the module"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
 #, csharp-format
 msgid ""
 "Added module file `{0}' is an assembly. Consider using `-r' option to "
 "reference the file"
 msgstr ""
 
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
 msgid "The `await' operator cannot be used in the body of a lock statement"
 msgstr ""
 
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
 msgid "The `await' operator cannot be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
 #, csharp-format
 msgid ""
 "Cannot await void method `{0}'. Consider changing method return type to "
 "`Task'"
 msgstr ""
 
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
 #, csharp-format
 msgid "Cannot await `{0}' expression"
 msgstr ""
 
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
 #, csharp-format
 msgid ""
 "The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
 msgstr ""
 
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
 msgid ""
 "The `await' operator may only be used in a query expression within the first "
 "collection expression of the initial `from' clause or within the collection "
 "expression of a `join' clause"
 msgstr ""
 
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
 #, csharp-format
 msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
 msgstr ""
 
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
 #, csharp-format
 msgid "The awaiter type `{0}' must implement interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
 msgid ""
 "Cannot find compiler required types for asynchronous functions support. Are "
 "you targeting the wrong framework version?"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument. Named attribute arguments "
@@ -332,81 +332,81 @@ msgid ""
 "properties which are public and not static"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument because it is not a valid "
 "attribute parameter type"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
 msgid "An attribute argument cannot be dynamic expression"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
 msgid "The Guid attribute must be specified with the ComImport attribute"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
 #, csharp-format
 msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
 #, csharp-format
 msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
 #, csharp-format
 msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
 #, csharp-format
 msgid ""
 "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
 "Attribute'"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
 #, csharp-format
 msgid "`{0}': is not an attribute class"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
 #, csharp-format
 msgid "Cannot apply attribute class `{0}' because it is abstract"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
 #, csharp-format
 msgid "Duplicate named attribute `{0}' argument"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
 #, csharp-format
 msgid ""
 "The attribute `{0}' is not valid on this declaration type. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
 #, csharp-format
 msgid "The argument to the `{0}' attribute must be a valid identifier"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
 #, csharp-format
 msgid "Invalid value for argument to `{0}' attribute"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
 #, csharp-format
 msgid "The attribute `{0}' cannot be applied multiple times"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
 #, csharp-format
 msgid "`{0}' is obsolete: `{1}'"
 msgstr ""
@@ -417,112 +417,112 @@ msgid ""
 "`struct', `interface', or `void' keyword"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
 msgid "Invalid number"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
 #, csharp-format
 msgid "Unrecognized escape sequence `\\{0}'"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
 msgid "Unrecognized escape sequence"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
 msgid "Filename, single-line comment or end-of-line expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
 msgid "Missing identifier to pre-processor directive"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
 #, csharp-format
 msgid "Identifier expected: {0}"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
 msgid "Integral constant is too large"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
 msgid "Invalid preprocessor directive"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
 #, csharp-format
 msgid "Unexpected processor directive ({0})"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
 msgid ""
 "Cannot define or undefine preprocessor symbols after first token in file"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
 msgid ""
 "Preprocessor directives must appear as the first non-whitespace character on "
 "a line"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
 msgid "Single-line comment or end-of-line expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
 msgid "Expected `#endif' directive"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
 msgid "#endregion directive expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
 msgid "Wrong preprocessor directive"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
 #, csharp-format
 msgid "#error: '{0}'"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
 msgid "The line number specified for #line directive is missing or invalid"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
 msgid "Newline in constant"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
 msgid "Unterminated string literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
 msgid "Identifier too long (limit is 512 chars)"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
 msgid "End-of-file found, '*/' expected"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
 msgid "Keyword, identifier, or string expected after verbatim specifier: @"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
 #, csharp-format
 msgid "Unexpected character `{0}'"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
 msgid "Empty character literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
 msgid "Too many characters in character literal"
 msgstr ""
 
@@ -567,410 +567,417 @@ msgid ""
 "declaration of this type exists"
 msgstr ""
 
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
 #, csharp-format
 msgid ""
 "`{0}': explicit interface declaration can only be declared in a class or "
 "struct"
 msgstr ""
 
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
 #, csharp-format
 msgid "Duplicate type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
 #, csharp-format
 msgid "The type `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
 msgid ""
 "Cannot specify the `DefaultMember' attribute on type containing an indexer"
 msgstr ""
 
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
 msgid "The RequiredAttribute attribute is not permitted on C# types"
 msgstr ""
 
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
 #, csharp-format
 msgid "Class `{0}' cannot derive from the dynamic type"
 msgstr ""
 
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
 #, csharp-format
 msgid "`{0}' is already listed in interface list"
 msgstr ""
 
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base interface `{0}' is less accessible than "
 "interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
 #, csharp-format
 msgid "Type `{0}' in interface list is not an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
 #, csharp-format
 msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
 msgstr ""
 
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
 #, csharp-format
 msgid "`{0}': Base class `{1}' must be specified as first"
 msgstr ""
 
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
 #, csharp-format
 msgid ""
 "The operator `{0}' requires a matching operator `{1}' to also be defined"
 msgstr ""
 
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
 #, csharp-format
 msgid "Partial declarations of `{0}' must not specify different base classes"
 msgstr ""
 
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
 #, csharp-format
 msgid ""
 "Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
 #, csharp-format
 msgid "Circular base class dependency involving `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
 #, csharp-format
 msgid ""
 "Partial declarations of `{0}' have inconsistent constraints for type "
 "parameter `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
 #, csharp-format
 msgid "`{0}': cannot implement a dynamic interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
 #, csharp-format
 msgid ""
 "`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
 "type parameter substitutions"
 msgstr ""
 
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
 #, csharp-format
 msgid ""
 "A generic type cannot derive from `{0}' because it is an attribute class"
 msgstr ""
 
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
 msgid ""
 "Two indexers have different names; the IndexerName attribute must be used "
 "with the same name on every indexer within a type"
 msgstr ""
 
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
 #, csharp-format
 msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
 msgstr ""
 
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
 #, csharp-format
 msgid "A member `{0}' marked as override cannot be marked as new or virtual"
 msgstr ""
 
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
 #, csharp-format
 msgid "`{0}' cannot be both extern and abstract"
 msgstr ""
 
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
 #, csharp-format
 msgid "`{0}' cannot be both abstract and sealed"
 msgstr ""
 
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
 #, csharp-format
 msgid "The abstract method `{0}' cannot be marked virtual"
 msgstr ""
 
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
 #, csharp-format
 msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
 #, csharp-format
 msgid "`{0}': virtual or abstract members cannot be private"
 msgstr ""
 
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
 #, csharp-format
 msgid "`{0}' cannot be sealed because it is not an override"
 msgstr ""
 
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
 #, csharp-format
 msgid "`{0}': containing type does not implement interface `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
 #, csharp-format
 msgid "Type parameter `{0}' has same name as containing type, or method"
 msgstr ""
 
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
 #, csharp-format
 msgid "`{0}': member names cannot be the same as their enclosing type"
 msgstr ""
 
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
 msgid ""
 "The class System.Object cannot have a base class or implement an interface."
 msgstr ""
 
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
 #, csharp-format
 msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
 msgstr ""
 
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
 msgid ""
 "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
 "or attribute classes"
 msgstr ""
 
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
 #, csharp-format
 msgid "`{0}': an abstract class cannot be sealed or static"
 msgstr ""
 
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
 #, csharp-format
 msgid "`{0}': a class cannot be both static and sealed"
 msgstr ""
 
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
 #, csharp-format
 msgid "`{0}': Static classes cannot contain user-defined operators"
 msgstr ""
 
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
 #, csharp-format
 msgid "`{0}': Static classes cannot contain destructor"
 msgstr ""
 
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
 #, csharp-format
 msgid "`{0}': cannot declare indexers in a static class"
 msgstr ""
 
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
 #, csharp-format
 msgid "`{0}': Static classes cannot have instance constructors"
 msgstr ""
 
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
 #, csharp-format
 msgid "`{0}': cannot declare instance members in a static class"
 msgstr ""
 
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
 #, csharp-format
 msgid "`{0}': Cannot derive from type parameter `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
 #, csharp-format
 msgid "`{0}': Cannot derive from static class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
 #, csharp-format
 msgid "`{0}': cannot derive from sealed type `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
 #, csharp-format
 msgid ""
 "Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
 "from object"
 msgstr ""
 
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
 #, csharp-format
 msgid "`{0}' cannot derive from special class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base class `{0}' is less accessible than class `"
 "{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
 #, csharp-format
 msgid "Static class `{0}' cannot implement interfaces"
 msgstr ""
 
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
 #, csharp-format
 msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
 msgstr ""
 
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
 #, csharp-format
 msgid "`{0}': Structs cannot have instance field initializers"
 msgstr ""
 
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
 #, csharp-format
 msgid "Do not override `{0}'. Use destructor syntax instead"
 msgstr ""
 
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
 #, csharp-format
 msgid "`{0}' is marked as an override but no suitable {1} found to override"
 msgstr ""
 
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not an event"
 msgstr ""
 
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a property"
 msgstr ""
 
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a method"
 msgstr ""
 
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
 #, csharp-format
 msgid ""
 "`{0}' cannot override inherited members `{1}' and `{2}' because they have "
 "the same signature when used in type `{3}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
 #, csharp-format
 msgid "`{0}' hides inherited abstract member `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
 #, csharp-format
 msgid ""
 "`{0}': cannot override inherited member `{1}' because it is not marked "
 "virtual, abstract or override"
 msgstr ""
 
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
 #, csharp-format
 msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
 msgstr ""
 
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
 #, csharp-format
 msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
 #, csharp-format
 msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
 #, csharp-format
 msgid "A partial method `{0}' cannot explicitly implement an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
 #, csharp-format
 msgid "The type `{0}' in explicit interface declaration is not an interface"
 msgstr ""
 
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "operator `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
 "method `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
 #, csharp-format
 msgid ""
 "`{0}': cannot change access modifiers when overriding `{1}' inherited member "
 "`{2}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
 #, csharp-format
 msgid "`{0}': static types cannot be used as return types"
 msgstr ""
 
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+
+#: mcs/mcs/class.cs:3504
 #, csharp-format
 msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
 msgstr ""
 
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
 msgid "Inconsistent accessibility: property type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
 msgid "Inconsistent accessibility: indexer return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
 msgid "Inconsistent accessibility: return type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
 msgid "Inconsistent accessibility: field type `"
 msgstr ""
 
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
 #, csharp-format
 msgid ""
 "Parameters or local variables of type `{0}' cannot be declared in async "
 "methods or iterators"
 msgstr ""
 
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
 #, csharp-format
 msgid ""
 "Local variables of type `{0}' cannot be used inside anonymous methods, "
 "lambda expressions or query expressions"
 msgstr ""
 
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
 #, csharp-format
 msgid "Field or property cannot be of type `{0}'"
 msgstr ""
@@ -991,19 +998,19 @@ msgid ""
 "The evaluation of the constant value for `{0}' involves a circular definition"
 msgstr ""
 
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
 #, csharp-format
 msgid "Constant value `{0}' cannot be converted to a `{1}'"
 msgstr ""
 
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
 #, csharp-format
 msgid ""
 "Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
 "to override)"
 msgstr ""
 
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
 #, csharp-format
 msgid ""
 "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
@@ -1072,74 +1079,64 @@ msgid ""
 "Extension method `{0}' of value type `{1}' cannot be used to create delegates"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
 #, csharp-format
 msgid "Cannot create delegate from partial method declaration `{0}'"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
 #, csharp-format
 msgid ""
 "Cannot create delegate with `{0}' because it has a Conditional attribute"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' parameters and return type must be same as "
 "delegate `{2} {3}' parameters and return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
 #, csharp-format
 msgid ""
 "A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
 "return type"
 msgstr ""
 
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
 msgid "Method name expected"
 msgstr ""
 
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
 #, csharp-format
 msgid "Error generating XML documentation file `{0}' (`{1}')"
 msgstr ""
 
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
 msgid "Source file `"
 msgstr ""
 
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr ""
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr ""
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
 msgid "No files to compile were specified"
 msgstr ""
 
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
 msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
 msgstr ""
 
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
 msgid ""
 "If no source files are specified you must specify the output file with -out:"
 msgstr ""
 
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
 msgid "Output file name is not valid"
 msgstr ""
 
@@ -1207,182 +1204,182 @@ msgid "`{0}' does not contain a definition for `{1}'"
 msgstr ""
 
 #: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-
-#: mcs/mcs/ecore.cs:335
 msgid ""
 "The left-hand side of an assignment must be a variable, a property or an "
 "indexer"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
 msgid "The operation in question is undefined on void pointers"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
 #, csharp-format
 msgid "Internal compiler error: {0}"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
 msgid "A ref or out argument must be an assignable variable"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
 msgid ""
 "An attribute argument must be a constant expression, typeof expression or "
 "array creation expression"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
 #, csharp-format
 msgid "The class `{0}' has no constructors defined"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
 #, csharp-format
 msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
 msgid "An expression tree cannot contain an unsafe pointer operation"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
 #, csharp-format
 msgid "`{0}' is a `{1}' but a `{2}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
 #, csharp-format
 msgid "Expression denotes a `{0}', where a `{1}' was expected"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
 msgid "Pointers and fixed size buffers may only be used in an unsafe context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
 #, csharp-format
 msgid ""
 "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
 "dll assembly reference?"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
 #, csharp-format
 msgid ""
 "A local variable `{0}' cannot be used before it is declared. Consider "
 "renaming the local variable when it hides the member `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
 #, csharp-format
 msgid "`{0}' conflicts with a declaration in a child block"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
 #, csharp-format
 msgid "A local variable `{0}' cannot be used before it is declared"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
 #, csharp-format
 msgid "The name `{0}' does not exist in the current context"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
 msgid "System.Void cannot be used from C#. Consider using `void'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
 #, csharp-format
 msgid "Cannot call an abstract base member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
 #, csharp-format
 msgid ""
 "Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
 "qualifier must be of type `{2}' or derived from it"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+
+#: mcs/mcs/ecore.cs:2994
 #, csharp-format
 msgid ""
 "Static member `{0}' cannot be accessed with an instance reference, qualify "
 "it with a type name instead"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
 #, csharp-format
 msgid ""
 "A field initializer cannot reference the nonstatic field, method, or "
 "property `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
 #, csharp-format
 msgid "An object reference is required to access non-static member `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
 #, csharp-format
 msgid ""
 "Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
 msgid "Cannot modify the result of an unboxing conversion"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
 "overload `{2}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
 #, csharp-format
 msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
 msgid "An expression tree cannot contain an expression with method group"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
 msgid ""
 "Partial methods with only a defining declaration or removed conditional "
 "methods cannot be used in an expression tree"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
 #, csharp-format
 msgid ""
 "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
 "parentheses to invoke the method"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
 #, csharp-format
 msgid ""
 "The type `{0}' does not contain a constructor that takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1390,159 +1387,159 @@ msgid ""
 "without the extension method syntax"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
 #, csharp-format
 msgid ""
 "The call is ambiguous between the following methods or properties: `{0}' and "
 "`{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4801
+#: mcs/mcs/ecore.cs:4939
 #, csharp-format
 msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
 "`out' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
 #, csharp-format
 msgid ""
 "The best overloaded collection initalizer method `{0}' has some invalid "
 "arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
 #, csharp-format
 msgid "Delegate `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
 #, csharp-format
 msgid "The best overloaded method match for `{0}' has some invalid arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
 #, csharp-format
 msgid ""
 "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
 #, csharp-format
 msgid "Argument `#{0}' is missing `{1}' modifier"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
 #, csharp-format
 msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
 #, csharp-format
 msgid ""
 "The type arguments for method `{0}' cannot be inferred from the usage. Try "
 "specifying the type arguments explicitly"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
 #, csharp-format
 msgid "No overload for method `{0}' takes `{1}' arguments"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
 #, csharp-format
 msgid "The delegate `{0}' does not contain a parameter named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
 #, csharp-format
 msgid ""
 "The best overloaded method match for `{0}' does not contain a parameter "
 "named `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
 #, csharp-format
 msgid ""
 "Named argument `{0}' cannot be used for a parameter which has positional "
 "argument specified"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
 msgid ""
 "You cannot use fixed size buffers contained in unfixed expressions. Try "
 "using the fixed statement"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
 #, csharp-format
 msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
 #, csharp-format
 msgid "Use of possibly unassigned field `{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
 #, csharp-format
 msgid "Property or event `{0}' is not supported by the C# language"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
 #, csharp-format
 msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because it "
 "lacks the `get' accessor"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the get "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
 #, csharp-format
 msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the set "
 "accessor is inaccessible"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of `+=' or `-=' "
 "operator"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of += or -= when used "
 "outside of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
 #, csharp-format
 msgid ""
 "An implicitly typed local variable declaration cannot be initialized with `"
 "{0}'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
 msgid ""
 "The contextual keyword `var' may only appear within a local variable "
 "declaration"
@@ -1564,7 +1561,7 @@ msgstr ""
 msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
 msgstr ""
 
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
 msgid "Detection Parsing Error"
 msgstr ""
 
@@ -1665,203 +1662,203 @@ msgid ""
 "{1}' is used as a short circuit operator"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined as `{0}' and `{1}' "
 "convert implicitly to each other"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined because there is no "
 "implicit conversion between `{0}' and `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
 #, csharp-format
 msgid "Use of unassigned local variable `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
 #, csharp-format
 msgid ""
 "Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
 "or query expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
 #, csharp-format
 msgid ""
 "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
 #, csharp-format
 msgid "Use of unassigned out parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
 #, csharp-format
 msgid "Cannot invoke a non-delegate type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
 #, csharp-format
 msgid "The member `{0}' cannot be used as method or delegate"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
 msgid ""
 "Do not directly call your base class Finalize method. It is called "
 "automatically from your destructor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
 msgid ""
 "Destructors and object.Finalize cannot be called directly. Consider calling "
 "IDisposable.Dispose if available"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
 #, csharp-format
 msgid ""
 "The base call to method `{0}' cannot be dynamically dispatched. Consider "
 "casting the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
 #, csharp-format
 msgid "`{0}': cannot explicitly call operator or accessor"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
 #, csharp-format
 msgid "Unsafe type `{0}' cannot be used in an object creation expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
 #, csharp-format
 msgid ""
 "Cannot create an instance of the variable type `{0}' because it does not "
 "have the new() constraint"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
 #, csharp-format
 msgid ""
 "`{0}': cannot provide arguments when creating an instance of a variable type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
 #, csharp-format
 msgid "Cannot create an instance of the static class `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
 #, csharp-format
 msgid "Cannot create an instance of the abstract class or interface `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
 msgid ""
 "An implicitly typed local variable declarator cannot use an array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
 msgid "A constant value is expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
 #, csharp-format
 msgid "An array initializer of length `{0}' was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
 msgid ""
 "Array initializers can only be used in a variable or field initializer. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
 msgid "A nested array initializer was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
 msgid "An expression tree cannot contain a multidimensional array initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
 msgid "Cannot create an array with a negative size"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
 msgid ""
 "Can only use array initializer expressions to assign to array types. Try "
 "using a new expression instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
 msgid ""
 "The type of an implicitly typed array cannot be inferred from the "
 "initializer. Try specifying array type explicitly"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
 msgid ""
 "The `this' object cannot be used before all of its fields are assigned to"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
 msgid ""
 "Keyword `this' is not valid in a static property, static method, or static "
 "field initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
 msgid ""
 "Anonymous methods inside structs cannot access instance members of `this'. "
 "Consider copying `this' to a local variable outside the anonymous method and "
 "using the local instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
 msgid "Keyword `this' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
 msgid "Cannot take the address of `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
 msgid "Cannot pass `this' as a ref or out argument because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
 msgid "Cannot assign to `this' because it is read-only"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
 msgid "The __arglist construct is valid only within a variable argument method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
 msgid "An expression tree cannot contain a method with variable arguments"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
 msgid "The typeof operator cannot be used on the dynamic type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
 #, csharp-format
 msgid "`{0}': an attribute argument cannot use type parameters"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
 #, csharp-format
 msgid ""
 "`{0}' does not have a predefined size, therefore sizeof can only be used in "
@@ -1869,152 +1866,153 @@ msgid ""
 "SizeOf)"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
 #, csharp-format
 msgid "Alias `{0}' not found"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
 msgid ""
 "The namespace alias qualifier `::' cannot be used to invoke a method. "
 "Consider using `.' instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
 msgid "Cannot perform member binding on `null' value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8057
+#: mcs/mcs/expression.cs:8068
 #, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
 #, csharp-format
 msgid "A nested type cannot be specified through a type parameter `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
 #, csharp-format
 msgid ""
 "Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
 "replacing `::' with `.'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
 #, csharp-format
 msgid "The nested type `{0}' does not exist in the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8220
+#: mcs/mcs/expression.cs:8239
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
 #, csharp-format
 msgid "Cannot apply indexing with [] to an expression of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
 msgid "A pointer must be indexed by only one value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
 msgid "An element access expression cannot use named argument"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
 #, csharp-format
 msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
 msgid ""
 "The indexer base access cannot be dynamically dispatched. Consider casting "
 "the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
 msgid "An expression tree may not contain a base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
 msgid "Keyword `base' is not available in a static method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
 msgid "Keyword `base' is not available in the current context"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
 msgid ""
 "A property, indexer or dynamic member access may not be passed as `ref' or "
 "`out' parameter"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
 #, csharp-format
 msgid "Array elements cannot be of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
 #, csharp-format
 msgid "Array elements cannot be of static type `{0}'"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
 msgid "Cannot use a negative size with stackalloc"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
 msgid "Cannot use stackalloc in finally or catch"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
 #, csharp-format
 msgid ""
 "Member `{0}' cannot be initialized. An object initializer may only be used "
 "for fields, or properties"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
 #, csharp-format
 msgid ""
 "Static field or property `{0}' cannot be assigned in an object initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
 #, csharp-format
 msgid ""
 "A field or property `{0}' cannot be initialized with a collection object "
 "initializer because type `{1}' does not implement `{2}' interface"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
 #, csharp-format
 msgid "Inconsistent `{0}' member declaration"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
 #, csharp-format
 msgid ""
 "An object initializer includes more than one member `{0}' initialization"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
 #, csharp-format
 msgid "Cannot initialize object of type `{0}' with a collection initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
 msgid "Anonymous types cannot be used in this expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
 #, csharp-format
 msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
 msgstr ""
@@ -2075,12 +2073,12 @@ msgid ""
 "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit"
 msgstr ""
 
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
 #, csharp-format
 msgid "`{0}': A volatile field cannot be of the type `{1}'"
 msgstr ""
 
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
 #, csharp-format
 msgid "`{0}': A field cannot be both volatile and readonly"
 msgstr ""
@@ -2135,7 +2133,7 @@ msgid "Cannot yield in the body of a finally clause"
 msgstr ""
 
 #: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
 msgid "Control cannot leave the body of a finally clause"
 msgstr ""
 
@@ -2223,47 +2221,47 @@ msgid ""
 "`{0}' is not a valid constraint. Static classes cannot be used as constraints"
 msgstr ""
 
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
 #, csharp-format
 msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
 #, csharp-format
 msgid "`{0}': static classes cannot be used as generic arguments"
 msgstr ""
 
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
 #, csharp-format
 msgid "The type `{0}' may not be used as a type argument"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
 msgid "Variant type parameters can only be used with interfaces and delegates"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
 #, csharp-format
 msgid ""
 "The type `{0}' must be a reference type in order to use it as type parameter "
 "`{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
 #, csharp-format
 msgid ""
 "The type `{0}' must be a non-nullable value type in order to use it as type "
 "parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
 #, csharp-format
 msgid ""
 "The type `{0}' must have a public parameterless constructor in order to use "
 "it as parameter `{1}' in the generic type or method `{2}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2271,7 +2269,7 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2279,42 +2277,49 @@ msgid ""
 "{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. The nullable type `{0}' does not satisfy constraint `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no boxing conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
 #, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
 "method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined in this assembly, but it is not "
 "defined in source or any added modules"
 msgstr ""
 
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
 #, csharp-format
 msgid ""
 "The type `{0}' is defined in an assembly that is not referenced. Consider "
 "adding a reference to assembly `{1}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined assembly `{1}', but it could "
@@ -2344,36 +2349,36 @@ msgstr ""
 msgid "Iterators cannot have unsafe parameters or yield types"
 msgstr ""
 
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
 msgid "Unsafe code may not appear in iterators"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
 msgid "SDK path could not be resolved"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
 #, csharp-format
 msgid ""
 "Assembly `{0}' references `{1}' which has a higher version number than "
 "imported assembly `{2}'"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
 #, csharp-format
 msgid ""
 "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
 "supply runtime policy"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
 #, csharp-format
 msgid ""
 "An assembly with the same name `{0}' has already been imported. Consider "
 "removing one of the references or sign the assembly"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
 #, csharp-format
 msgid ""
 "An assembly with the same identity `{0}' has already been imported. Consider "
@@ -2467,99 +2472,92 @@ msgid ""
 "suffix `{1}' to create a literal of this type"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
 msgid ""
 "A partial method declaration and partial method implementation cannot differ "
 "on use of `params' modifier"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "an extension method or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
 #, csharp-format
 msgid ""
 "Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
 #, csharp-format
 msgid ""
 "Overloaded method `{0}' cannot differ on use of parameter modifiers only"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`static' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`unsafe' or neither"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
 #, csharp-format
 msgid "A partial method `{0}' declaration is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
 #, csharp-format
 msgid "A partial method `{0}' implementation is already defined"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
 #, csharp-format
 msgid "A member `{0}' is already reserved"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
 #, csharp-format
 msgid "Duplicate user-defined conversion in type `{0}'"
 msgstr ""
 
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
 #, csharp-format
 msgid ""
 "A member `{0}' is already defined. Rename this member or use different "
 "parameter types"
 msgstr ""
 
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
 #, csharp-format
 msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
 msgstr ""
 
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
 msgid ""
 "The DllImport attribute must be specified on a method marked `static' and "
 "`extern'"
 msgstr ""
 
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
 #, csharp-format
 msgid "`{0}': A partial method parameters cannot use `out' modifier"
 msgstr ""
 
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
 #, csharp-format
 msgid ""
 "Conditional not valid on `{0}' because it is a constructor, destructor, "
 "operator or explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:855
-#, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-
 #: mcs/mcs/method.cs:865
 msgid ""
 "A partial method cannot define access modifier or any of abstract, extern, "
@@ -2617,12 +2615,12 @@ msgstr ""
 msgid "The return type of an async method must be void, Task, or Task<T>"
 msgstr ""
 
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
 #, csharp-format
 msgid "`{0}': Extension methods cannot be defined in a nested class"
 msgstr ""
 
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
 #, csharp-format
 msgid ""
 "`{0}': Extension methods require `System.Runtime.CompilerServices."
@@ -2630,171 +2628,171 @@ msgid ""
 "reference?"
 msgstr ""
 
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
 #, csharp-format
 msgid "`{0}': Extension methods must be defined in a non-generic static class"
 msgstr ""
 
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
 #, csharp-format
 msgid "`{0}': an entry point cannot be async method"
 msgstr ""
 
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
 #, csharp-format
 msgid ""
 "A partial method `{0}' implementation is missing a partial method declaration"
 msgstr ""
 
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
 #, csharp-format
 msgid "Method or delegate cannot return type `{0}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
 msgid ""
 "The constructor call cannot be dynamically dispatched within constructor "
 "initializer"
 msgstr ""
 
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
 #, csharp-format
 msgid "`{0}': Struct constructors cannot call base constructors"
 msgstr ""
 
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
 #, csharp-format
 msgid "Constructor `{0}' cannot call itself"
 msgstr ""
 
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
 #, csharp-format
 msgid "`{0}': The static constructor must be parameterless"
 msgstr ""
 
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
 msgid "Structs cannot contain explicit parameterless constructors"
 msgstr ""
 
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
 #, csharp-format
 msgid ""
 "`{0}': A class with the ComImport attribute cannot have a user-defined "
 "constructor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
 #, csharp-format
 msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
 #, csharp-format
 msgid ""
 "`{0}.{1}' in explicit interface declaration is not a member of interface"
 msgstr ""
 
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
 #, csharp-format
 msgid ""
 "`{0}' explicit method implementation cannot implement `{1}' because it is an "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
 #, csharp-format
 msgid "Method `{0}' cannot implement interface accessor `{1}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
 #, csharp-format
 msgid ""
 "Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
 "an explicit interface implementation"
 msgstr ""
 
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
 #, csharp-format
 msgid ""
 "Accessor `{0}' must be declared public to implement interface member `{1}'"
 msgstr ""
 
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
 #, csharp-format
 msgid ""
 "`{0}': the explicit interface implementation cannot introduce the params "
 "modifier"
 msgstr ""
 
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
 #, csharp-format
 msgid ""
 "Attribute `{0}' is not valid on property or event accessors. It is valid on `"
 "{1}' declarations only"
 msgstr ""
 
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
 #, csharp-format
 msgid "User-defined operator `{0}' must be declared static and public"
 msgstr ""
 
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
 msgid ""
 "User-defined operator cannot take an object of the enclosing type and "
 "convert to an object of the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
 msgid "User-defined conversion must convert to or from the enclosing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from the dynamic type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from an interface type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a base class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
 msgstr ""
 
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
 msgid ""
 "Overloaded shift operator must have the type of the first operand be the "
 "containing type, and the type of the second operand must be int"
 msgstr ""
 
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
 msgid ""
 "The return type for ++ or -- operator must be the containing type or derived "
 "from the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
 msgid "The parameter type for ++ or -- operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
 msgid "The parameter type of a unary operator must be the containing type"
 msgstr ""
 
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
 msgid "The return type of operator True or False must be bool"
 msgstr ""
 
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
 msgid "One of the parameters of a binary operator must be the containing type"
 msgstr ""
 
@@ -2803,66 +2801,59 @@ msgstr ""
 msgid "The modifier `{0}' is not valid for this item"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:186
+#: mcs/mcs/namespace.cs:263
 #, csharp-format
 msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:190
+#: mcs/mcs/namespace.cs:267
 #, csharp-format
 msgid ""
 "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
 #, csharp-format
 msgid "The imported type `{0}' is defined multiple times"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
 msgid ""
 "A using clause must precede all other namespace elements except extern alias "
 "declarations"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
 #, csharp-format
 msgid "The using alias `{0}' appeared previously in this namespace"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
 #, csharp-format
 msgid "The namespace `{0}' already contains a definition for `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
 #, csharp-format
 msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
 #, csharp-format
 msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
 #, csharp-format
 msgid ""
 "`{0}' is a type not a namespace. A using namespace directive can only be "
 "applied to namespaces"
 msgstr ""
 
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
 #, csharp-format
 msgid "The extern alias `{0}' was not specified in -reference option"
 msgstr ""
@@ -3047,66 +3038,66 @@ msgstr ""
 msgid "`{0}': abstract properties cannot have private accessors"
 msgstr ""
 
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
 #, csharp-format
 msgid ""
 "The accessibility modifier of the `{0}' accessor must be more restrictive "
 "than the modifier of the property or indexer `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
 #, csharp-format
 msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
 msgstr ""
 
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
 #, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable get "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
 #, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable set "
 "accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
 #, csharp-format
 msgid ""
 "`{0}': Cannot specify accessibility modifiers for both accessors of the "
 "property or indexer"
 msgstr ""
 
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
 #, csharp-format
 msgid ""
 "`{0}': accessibility modifiers on accessors may only be used if the property "
 "or indexer has both a get and a set accessor"
 msgstr ""
 
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
 #, csharp-format
 msgid ""
 "Automatically implemented property `{0}' cannot be used inside a type with "
 "an explicit StructLayout attribute"
 msgstr ""
 
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
 #, csharp-format
 msgid "`{0}': event must be of a delegate type"
 msgstr ""
 
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
 #, csharp-format
 msgid ""
 "The `{0}' attribute is valid only on an indexer that is not an explicit "
 "interface member declaration"
 msgstr ""
 
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
 msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
 msgstr ""
 
@@ -3115,80 +3106,87 @@ msgstr ""
 msgid "Value specified for the argument to `{0}' is not valid"
 msgstr ""
 
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
 msgid ""
 "A lambda expression with statement body cannot be converted to an expresion "
 "tree"
 msgstr ""
 
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
 #, csharp-format
 msgid ""
 "An object of a type convertible to `{0}' is required for the return statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by any expression when method "
 "returns void"
 msgstr ""
 
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by an expression when async "
 "method returns `Task'. Consider using `Task<T>' return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
 #, csharp-format
 msgid ""
 "`{0}': The return expression type of async method must be `{1}' rather than "
 "`Task<{1}>'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+
+#: mcs/mcs/statement.cs:950
 #, csharp-format
 msgid ""
 "Cannot convert `{0}' to delegate type `{1}' because some of the return types "
 "in the block are not implicitly convertible to the delegate return type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
 msgid ""
 "Cannot return a value from iterators. Use the yield return statement to "
 "return a value, or yield break to end the iteration"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
 msgid "A goto case is only valid inside a switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
 msgid "The type caught or thrown must be derived from System.Exception"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
 msgid "A fixed statement cannot use an implicitly typed local variable"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
 msgid "An implicitly typed local variable cannot be a constant"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
 msgid ""
 "An implicitly typed local variable declarator must include an initializer"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
 msgid ""
 "An implicitly typed local variable declaration cannot include multiple "
 "declarators"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
 #, csharp-format
 msgid ""
 "A local variable named `{0}' cannot be declared in this scope because it "
@@ -3196,112 +3194,112 @@ msgid ""
 "scope to denote something else"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
 #, csharp-format
 msgid "A local variable named `{0}' is already defined in this scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
 #, csharp-format
 msgid ""
 "The type parameter name `{0}' is the same as local variable or parameter name"
 msgstr ""
 
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
 #, csharp-format
 msgid ""
 "The out parameter `{0}' must be assigned to before control leaves the "
 "current method"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
 #, csharp-format
 msgid "`{0}': not all code paths return a value"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
 #, csharp-format
 msgid "Not all code paths return a value in anonymous method of type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
 msgid "Async methods cannot have ref or out parameters"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
 msgid "__arglist is not allowed in parameter list of async methods"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
 msgid "Async methods cannot have unsafe parameters"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
 #, csharp-format
 msgid "The label `{0}' is a duplicate"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
 #, csharp-format
 msgid ""
 "The label `{0}' shadows another label by the same name in a contained scope"
 msgstr ""
 
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
 #, csharp-format
 msgid "The label `case {0}:' already occurs in this switch statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
 #, csharp-format
 msgid ""
 "A switch expression of type `{0}' cannot be converted to an integral type, "
 "bool, char, string, enum or nullable type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
 #, csharp-format
 msgid "`{0}' is not a reference type as required by the lock statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
 msgid "The type of locals declared in a fixed statement must be a pointer type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
 msgid ""
 "The right hand side of a fixed statement assignment may not be a cast "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
 msgid ""
 "You cannot use the fixed statement to take the address of an already fixed "
 "expression"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
 #, csharp-format
 msgid ""
 "A previous catch clause already catches all exceptions of this or a super "
 "type `{0}'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
 #, csharp-format
 msgid ""
 "`{0}': type used in a using statement must be implicitly convertible to "
 "`System.IDisposable'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
 #, csharp-format
 msgid ""
 "foreach statement requires that the return type `{0}' of `{1}' must have a "
 "suitable public MoveNext method and public Current property"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it "
@@ -3309,47 +3307,47 @@ msgid ""
 "implementation"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it does "
 "not contain a definition for `{1}' or is inaccessible"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
 msgid "Use of null is not valid in this context"
 msgstr ""
 
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
 #, csharp-format
 msgid "Foreach statement cannot operate on a `{0}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not defined or imported"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
 #, csharp-format
 msgid ""
 "The predefined type `{0}.{1}' is defined multiple times. Using definition "
 "from `{2}'"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not declared correctly"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
 #, csharp-format
 msgid ""
 "The compiler required member `{0}.{1}{2}' could not be found or is "
 "inaccessible"
 msgstr ""
 
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
 #, csharp-format
 msgid ""
 "Cannot take the address of, get the size of, or declare a pointer to a "
index ce8f2c75181cd9f154cc80cd858be0c963084a81..c2bf606c56a7590dd33afa3950f5f9612970171c 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: mono 2.1\n"
 "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2012-05-30 18:30+0100\n"
+"POT-Creation-Date: 2012-12-05 09:29+0100\n"
 "PO-Revision-Date: 2009-03-01 07:52-0300\n"
 "Last-Translator: Rodrigo Luiz Marques Flores <mail@rodrigoflores.org>\n"
 "Language-Team: pt-BR <mono-list@lists.ximian.com>\n"
@@ -37,7 +37,7 @@ msgstr ""
 "Não foi possível converter \"{0}\" para um tipo delegate \"{1}\"pois os "
 "parâmetros não conferem"
 
-#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:4913
+#: mcs/mcs/anonymous.cs:1027 mcs/mcs/ecore.cs:5056
 #, csharp-format
 msgid "Delegate `{0}' does not take `{1}' arguments"
 msgstr "Delegate \"{0}\" não recebe \"{1}\" argumentos"
@@ -58,18 +58,18 @@ msgid "Parameter `{0}' is declared as type `{1}' but should be `{2}'"
 msgstr ""
 "O parâmetro \"{0}\" é declarado como tipo \"{1}\" mas deveria ser \"{2}\""
 
-#: mcs/mcs/anonymous.cs:1202
+#: mcs/mcs/anonymous.cs:1212
 #, fuzzy
 msgid "Async lambda expressions cannot be converted to expression trees"
 msgstr ""
 "Uma expressão lambda com um corpo de declarações não pode ser convertida "
 "para uma árvore de expressão"
 
-#: mcs/mcs/anonymous.cs:1240
+#: mcs/mcs/anonymous.cs:1250
 msgid "An anonymous method cannot be converted to an expression tree"
 msgstr "Um método anônimo não pode ser convertido para uma árvore de expressão"
 
-#: mcs/mcs/anonymous.cs:1259
+#: mcs/mcs/anonymous.cs:1269
 #, fuzzy, csharp-format
 msgid ""
 "Cannot convert anonymous method block without a parameter list to delegate "
@@ -79,7 +79,7 @@ msgstr ""
 "parâmetros para representar o tipo \"{0}\" por que este possui um ou mais "
 "parâmetros \"externos\"."
 
-#: mcs/mcs/anonymous.cs:1283
+#: mcs/mcs/anonymous.cs:1293
 msgid ""
 "Anonymous methods and lambda expressions cannot be used in the current "
 "context"
@@ -87,7 +87,7 @@ msgstr ""
 "Métodos anônimos ou expressões lambdas não podem ser utilizados no contexto "
 "atual"
 
-#: mcs/mcs/anonymous.cs:1326
+#: mcs/mcs/anonymous.cs:1336
 #, fuzzy, csharp-format
 msgid ""
 "Local variable or parameter `{0}' cannot have their address taken and be "
@@ -96,18 +96,18 @@ msgstr ""
 "A variável local ou parâmetro \"{0}\" não pode ter seu endereço obtido e ser "
 "utilizado dentro de um método anônimo ou expressão lambda"
 
-#: mcs/mcs/anonymous.cs:1346
+#: mcs/mcs/anonymous.cs:1356
 #, fuzzy, csharp-format
 msgid "Cannot convert async {0} to delegate type `{1}'"
 msgstr "Não foi possível converter \"{0}\" para um tipo não-delegate \"{1}\""
 
-#: mcs/mcs/anonymous.cs:1596
+#: mcs/mcs/anonymous.cs:1594
 msgid "An expression tree cannot contain an anonymous method expression"
 msgstr ""
 "Uma árvore de expressão não pode conter uma expressão que seja um método "
 "anônimo"
 
-#: mcs/mcs/anonymous.cs:1879
+#: mcs/mcs/anonymous.cs:1877
 #, csharp-format
 msgid ""
 "`{0}': An anonymous type cannot have multiple properties with the same name"
@@ -161,53 +161,53 @@ msgstr "Uma árvore de expressão não pode conter um operador de atribuição"
 msgid "Cannot assign to `{0}' because it is a `{1}'"
 msgstr "Não foi possível atribuir a \"{0}\" por que este é um \"{1}\""
 
-#: mcs/mcs/assembly.cs:286
+#: mcs/mcs/assembly.cs:279
 msgid "Invalid type specified as an argument for TypeForwardedTo attribute"
 msgstr ""
 "Tipo inválido especificado com um argumento para um atributo TypeForwardedTo"
 
-#: mcs/mcs/assembly.cs:294
+#: mcs/mcs/assembly.cs:287
 #, csharp-format
 msgid "A duplicate type forward of type `{0}'"
 msgstr "Um encaminhamento de tipo duplicado do tipo \"{0}\""
 
-#: mcs/mcs/assembly.cs:303
+#: mcs/mcs/assembly.cs:296
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is defined in this assembly"
 msgstr ""
 "Não foi possível encaminhar o tipo \"{0}\" porque este está definido neste "
 "assembly"
 
-#: mcs/mcs/assembly.cs:309
+#: mcs/mcs/assembly.cs:302
 #, csharp-format
 msgid "Cannot forward type `{0}' because it is a nested type"
 msgstr "Não foi possível encaminhar tipo \"{0}\" por que é um tipo aninhado"
 
-#: mcs/mcs/assembly.cs:338
+#: mcs/mcs/assembly.cs:331
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations "
 "cannot have a version, culture or processor architecture specified"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:346
+#: mcs/mcs/assembly.cs:339
 #, csharp-format
 msgid ""
 "Friend assembly reference `{0}' is invalid. Strong named assemblies must "
 "specify a public key in their InternalsVisibleTo declarations"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:381
+#: mcs/mcs/assembly.cs:374
 #, csharp-format
 msgid "Referenced assembly `{0}' does not have a strong name"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:387
+#: mcs/mcs/assembly.cs:380
 #, csharp-format
 msgid "Referenced assembly `{0}' has different culture setting of `{1}'"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:402
+#: mcs/mcs/assembly.cs:395
 #, csharp-format
 msgid ""
 "Friend access was granted to `{0}', but the output assembly is named `{1}'. "
@@ -218,7 +218,7 @@ msgstr ""
 "nomeada \"{1}\".  Tente adicionar uma referência para \"{0}\"  ou alterar a "
 "saída do assembly para igualar isso"
 
-#: mcs/mcs/assembly.cs:416
+#: mcs/mcs/assembly.cs:409
 msgid ""
 "Could not sign the assembly. ECMA key can only be used to delay-sign "
 "assemblies"
@@ -226,7 +226,7 @@ msgstr ""
 "Não foi possível assinar o assembly. Chave ECMA pode apenas ser utilizada "
 "para assinar o adiamento do assembly"
 
-#: mcs/mcs/assembly.cs:657
+#: mcs/mcs/assembly.cs:650
 msgid ""
 "Added modules must be marked with the CLSCompliant attribute to match the "
 "assembly"
@@ -234,7 +234,7 @@ msgstr ""
 "Módulos adicionados devem ser marcados com o atributo CLSCompliant para "
 "coincidir com o assembly"
 
-#: mcs/mcs/assembly.cs:692 mcs/mcs/assembly.cs:707
+#: mcs/mcs/assembly.cs:685 mcs/mcs/assembly.cs:700
 #, csharp-format
 msgid ""
 "Option `{0}' overrides attribute `{1}' given in a source file or added module"
@@ -242,48 +242,48 @@ msgstr ""
 "Opção \"{0}\" sobrescreve atributo \"{1}\" dado num código-fonte ou módulo "
 "adicionado"
 
-#: mcs/mcs/assembly.cs:742
+#: mcs/mcs/assembly.cs:735
 msgid "Delay signing was requested but no key file was given"
 msgstr ""
 
-#: mcs/mcs/assembly.cs:763
+#: mcs/mcs/assembly.cs:756
 msgid "Cannot link resource file when building a module"
 msgstr ""
 "Não é possível apontar arquivo de recursos quando estiver compilando um "
 "módulo"
 
-#: mcs/mcs/assembly.cs:768
+#: mcs/mcs/assembly.cs:761
 #, csharp-format
 msgid "Error reading resource file `{0}'"
 msgstr "Erro ao ler arquivo de recurso \"{0}\""
 
-#: mcs/mcs/assembly.cs:838
+#: mcs/mcs/assembly.cs:831
 msgid "Could not write to file `"
 msgstr "Não foi possível escrever para o arquivo \""
 
-#: mcs/mcs/assembly.cs:882
+#: mcs/mcs/assembly.cs:875
 msgid "Cannot specify -main if building a module or library"
 msgstr ""
 "Não é possível especificar -main se estiver compilando um módulo ou "
 "biblioteca"
 
-#: mcs/mcs/assembly.cs:908
+#: mcs/mcs/assembly.cs:901
 #, csharp-format
 msgid "Could not find `{0}' specified for Main method"
 msgstr "Não foi possível encontrar o \"{0}\" especificado para o método Main"
 
-#: mcs/mcs/assembly.cs:914
+#: mcs/mcs/assembly.cs:907
 #, csharp-format
 msgid "`{0}' specified for Main method must be a valid class or struct"
 msgstr ""
 "\"{0}\" especificado para o método Main deve ser uma classe válida ou struct"
 
-#: mcs/mcs/assembly.cs:918
+#: mcs/mcs/assembly.cs:911
 #, csharp-format
 msgid "`{0}' does not have a suitable static Main method"
 msgstr "\"{0}\" não possue um método Main estático apropriado"
 
-#: mcs/mcs/assembly.cs:921
+#: mcs/mcs/assembly.cs:914
 #, csharp-format
 msgid ""
 "Program `{0}' does not contain a static `Main' method suitable for an entry "
@@ -292,21 +292,21 @@ msgstr ""
 "Programa \"{0}\" não contém um método estático \"Main\" apropriado para um "
 "ponto de entrada"
 
-#: mcs/mcs/assembly.cs:940
+#: mcs/mcs/assembly.cs:933
 msgid "Error during assembly signing. "
 msgstr "Erro durante a assinatura do assembly. "
 
-#: mcs/mcs/assembly.cs:1125
+#: mcs/mcs/assembly.cs:1118
 #, fuzzy, csharp-format
 msgid "Metadata file `{0}' could not be found"
 msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
 
-#: mcs/mcs/assembly.cs:1130
+#: mcs/mcs/assembly.cs:1123
 #, fuzzy, csharp-format
 msgid "Metadata file `{0}' does not contain valid metadata"
 msgstr "arquivo \"{0}\" possui metadados inválidos \"{1}\""
 
-#: mcs/mcs/assembly.cs:1136
+#: mcs/mcs/assembly.cs:1129
 #, fuzzy, csharp-format
 msgid ""
 "Referenced assembly file `{0}' is a module. Consider using `-addmodule' "
@@ -315,7 +315,7 @@ msgstr ""
 "Arquivo referenciado \"{0}\" não é um assembly. Considere, ao invés disso, "
 "utilizar a opção \"-addmodule\""
 
-#: mcs/mcs/assembly.cs:1143
+#: mcs/mcs/assembly.cs:1136
 #, fuzzy, csharp-format
 msgid ""
 "Added module file `{0}' is an assembly. Consider using `-r' option to "
@@ -324,59 +324,59 @@ msgstr ""
 "Arquivo referenciado \"{0}\" não é um assembly. Considere, ao invés disso, "
 "utilizar a opção \"-addmodule\""
 
-#: mcs/mcs/async.cs:70
+#: mcs/mcs/async.cs:72
 #, fuzzy
 msgid "The `await' operator cannot be used in the body of a lock statement"
 msgstr ""
 "O operador \"{0}\" não pode ser aplicado a um operando de tipo estático"
 
-#: mcs/mcs/async.cs:75
+#: mcs/mcs/async.cs:77
 #, fuzzy
 msgid "The `await' operator cannot be used in an unsafe context"
 msgstr "O controle não pode deixar o corpo de uma cláusula final"
 
-#: mcs/mcs/async.cs:140
+#: mcs/mcs/async.cs:142
 #, csharp-format
 msgid ""
 "Cannot await void method `{0}'. Consider changing method return type to "
 "`Task'"
 msgstr ""
 
-#: mcs/mcs/async.cs:143
+#: mcs/mcs/async.cs:145
 #, csharp-format
 msgid "Cannot await `{0}' expression"
 msgstr ""
 
-#: mcs/mcs/async.cs:293
+#: mcs/mcs/async.cs:291
 #, csharp-format
 msgid ""
 "The awaiter type `{0}' must have suitable IsCompleted and GetResult members"
 msgstr ""
 
-#: mcs/mcs/async.cs:301
+#: mcs/mcs/async.cs:299
 msgid ""
 "The `await' operator may only be used in a query expression within the first "
 "collection expression of the initial `from' clause or within the collection "
 "expression of a `join' clause"
 msgstr ""
 
-#: mcs/mcs/async.cs:335
+#: mcs/mcs/async.cs:333
 #, csharp-format
 msgid "The `await' operand type `{0}' must have suitable GetAwaiter method"
 msgstr ""
 
-#: mcs/mcs/async.cs:374
+#: mcs/mcs/async.cs:372
 #, fuzzy, csharp-format
 msgid "The awaiter type `{0}' must implement interface `{1}'"
 msgstr "\"{0}\" não implementa o membro da interface \"{1}\""
 
-#: mcs/mcs/async.cs:601
+#: mcs/mcs/async.cs:605
 msgid ""
 "Cannot find compiler required types for asynchronous functions support. Are "
 "you targeting the wrong framework version?"
 msgstr ""
 
-#: mcs/mcs/attribute.cs:222
+#: mcs/mcs/attribute.cs:228
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument. Named attribute arguments "
@@ -388,7 +388,7 @@ msgstr ""
 "constantes ou possuir propriedades de leitura-escrita que são públicas e não "
 "estáticas"
 
-#: mcs/mcs/attribute.cs:231
+#: mcs/mcs/attribute.cs:237
 #, csharp-format
 msgid ""
 "`{0}' is not a valid named attribute argument because it is not a valid "
@@ -397,35 +397,35 @@ msgstr ""
 "\"{0}\" não é um atributo nomeado válida para um argumento de atributo por "
 "quê não é um tipo de parâmetro de atributo válido"
 
-#: mcs/mcs/attribute.cs:237
+#: mcs/mcs/attribute.cs:243
 #, fuzzy
 msgid "An attribute argument cannot be dynamic expression"
 msgstr "\"{0}\": um argumento de atributo não pode usar parâmetros de tipo"
 
-#: mcs/mcs/attribute.cs:242
+#: mcs/mcs/attribute.cs:248
 msgid "The Guid attribute must be specified with the ComImport attribute"
 msgstr "O atributo Guid deve ser especificado com o atributo ComImport"
 
-#: mcs/mcs/attribute.cs:247
+#: mcs/mcs/attribute.cs:253
 #, csharp-format
 msgid "Do not use `{0}' directly. Use parameter modifier `this' instead"
 msgstr ""
 "Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
 "\"this\""
 
-#: mcs/mcs/attribute.cs:252
+#: mcs/mcs/attribute.cs:258
 #, fuzzy, csharp-format
 msgid "Do not use `{0}' directly. Use `dynamic' keyword instead"
 msgstr ""
 "Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
 "\"this\""
 
-#: mcs/mcs/attribute.cs:261
+#: mcs/mcs/attribute.cs:267
 #, csharp-format
 msgid "Error during emitting `{0}' attribute. The reason is `{1}'"
 msgstr "Erro enquanto emitia o atributo \"{0}\". O motivo é \"{1}\""
 
-#: mcs/mcs/attribute.cs:314
+#: mcs/mcs/attribute.cs:321
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}"
@@ -434,23 +434,23 @@ msgstr ""
 "\"{0}\" está ambíguo entre \"{0}\" e \"{0}Atributo\". Utilize \"@{0}\" ou "
 "\"{0}Atributo\""
 
-#: mcs/mcs/attribute.cs:336 mcs/mcs/attribute.cs:342
+#: mcs/mcs/attribute.cs:348 mcs/mcs/attribute.cs:354
 #, csharp-format
 msgid "`{0}': is not an attribute class"
 msgstr "\"{0}\" não é uma classe de atributos"
 
-#: mcs/mcs/attribute.cs:434
+#: mcs/mcs/attribute.cs:446
 #, csharp-format
 msgid "Cannot apply attribute class `{0}' because it is abstract"
 msgstr ""
 "Não foi possível aplicar a classe de atributo \"{0}\" por que esta é abstrata"
 
-#: mcs/mcs/attribute.cs:505
+#: mcs/mcs/attribute.cs:517
 #, fuzzy, csharp-format
 msgid "Duplicate named attribute `{0}' argument"
 msgstr "argumento de atributo nomeado \"{0}\" duplicado"
 
-#: mcs/mcs/attribute.cs:964
+#: mcs/mcs/attribute.cs:976
 #, csharp-format
 msgid ""
 "The attribute `{0}' is not valid on this declaration type. It is valid on `"
@@ -459,23 +459,23 @@ msgstr ""
 "O atributo \"{0}\" não é válido neste tipo de declaração. Isso é válido "
 "somente nas declarações \"{1}\""
 
-#: mcs/mcs/attribute.cs:986
+#: mcs/mcs/attribute.cs:998
 #, csharp-format
 msgid "The argument to the `{0}' attribute must be a valid identifier"
 msgstr "O argumento para o atributo \"{0}\" deve ser um identificador válido"
 
-#: mcs/mcs/attribute.cs:1000
+#: mcs/mcs/attribute.cs:1012
 #, fuzzy, csharp-format
 msgid "Invalid value for argument to `{0}' attribute"
 msgstr ""
 "Valor inválido para o argumento para o atributo \"System.AttributeUsage\""
 
-#: mcs/mcs/attribute.cs:1252
+#: mcs/mcs/attribute.cs:1274
 #, csharp-format
 msgid "The attribute `{0}' cannot be applied multiple times"
 msgstr "O atributo \"{0}\" não pode ser aplicado múltiplas vezes"
 
-#: mcs/mcs/attribute.cs:1552
+#: mcs/mcs/attribute.cs:1580
 #, csharp-format
 msgid "`{0}' is obsolete: `{1}'"
 msgstr "\"{0}\" é obsoleto: \"{1}\""
@@ -488,55 +488,55 @@ msgstr ""
 "O modificador \"parcial\" pode ser utilizado somente imediatamente antesdas "
 "palavras chave \"class\", \"struct\", \"interface\" ou \"void\""
 
-#: mcs/mcs/cs-tokenizer.cs:1470 mcs/mcs/cs-tokenizer.cs:1533
+#: mcs/mcs/cs-tokenizer.cs:1478 mcs/mcs/cs-tokenizer.cs:1541
 msgid "Invalid number"
 msgstr "Número inválido"
 
-#: mcs/mcs/cs-tokenizer.cs:1745
+#: mcs/mcs/cs-tokenizer.cs:1753
 #, csharp-format
 msgid "Unrecognized escape sequence `\\{0}'"
 msgstr "Sequência de escape não reconhecida \"\\{0}\""
 
-#: mcs/mcs/cs-tokenizer.cs:1764
+#: mcs/mcs/cs-tokenizer.cs:1772
 msgid "Unrecognized escape sequence"
 msgstr "Sequência de escape não reconhecida"
 
-#: mcs/mcs/cs-tokenizer.cs:2034
+#: mcs/mcs/cs-tokenizer.cs:2041
 #, fuzzy
 msgid "Filename, single-line comment or end-of-line expected"
 msgstr "Comentário de linha única ou fim-de-linha esperado"
 
-#: mcs/mcs/cs-tokenizer.cs:2084
+#: mcs/mcs/cs-tokenizer.cs:2090
 msgid "Missing identifier to pre-processor directive"
 msgstr "Identificador faltando para a diretiva do pré-processador"
 
-#: mcs/mcs/cs-tokenizer.cs:2094 mcs/mcs/cs-tokenizer.cs:2098
+#: mcs/mcs/cs-tokenizer.cs:2100 mcs/mcs/cs-tokenizer.cs:2104
 #, csharp-format
 msgid "Identifier expected: {0}"
 msgstr "Identificador esperado: {0}"
 
-#: mcs/mcs/cs-tokenizer.cs:2587
+#: mcs/mcs/cs-tokenizer.cs:2610
 #, fuzzy
 msgid "Integral constant is too large"
 msgstr "Constante numérica muito longa"
 
-#: mcs/mcs/cs-tokenizer.cs:2592
+#: mcs/mcs/cs-tokenizer.cs:2615
 msgid "Invalid preprocessor directive"
 msgstr "Diretiva de pré-processador inválida"
 
-#: mcs/mcs/cs-tokenizer.cs:2599
+#: mcs/mcs/cs-tokenizer.cs:2622
 #, csharp-format
 msgid "Unexpected processor directive ({0})"
 msgstr "Diretiva de processador inesperada ({0})"
 
-#: mcs/mcs/cs-tokenizer.cs:2605
+#: mcs/mcs/cs-tokenizer.cs:2628
 msgid ""
 "Cannot define or undefine preprocessor symbols after first token in file"
 msgstr ""
 "Não foi possível definir ou indefinir símbolos depois do primeiro token no "
 "arquivo"
 
-#: mcs/mcs/cs-tokenizer.cs:2611
+#: mcs/mcs/cs-tokenizer.cs:2634
 msgid ""
 "Preprocessor directives must appear as the first non-whitespace character on "
 "a line"
@@ -544,66 +544,66 @@ msgstr ""
 "Diretivas de pré-processador devem aparecer como o primeiro caractere não-"
 "branco na linha"
 
-#: mcs/mcs/cs-tokenizer.cs:2616
+#: mcs/mcs/cs-tokenizer.cs:2639
 msgid "Single-line comment or end-of-line expected"
 msgstr "Comentário de linha única ou fim-de-linha esperado"
 
-#: mcs/mcs/cs-tokenizer.cs:2661 mcs/mcs/cs-tokenizer.cs:3679
+#: mcs/mcs/cs-tokenizer.cs:2684 mcs/mcs/cs-tokenizer.cs:3719
 msgid "Expected `#endif' directive"
 msgstr "Esperada diretiva \"#endif\""
 
-#: mcs/mcs/cs-tokenizer.cs:2694 mcs/mcs/cs-tokenizer.cs:2715
-#: mcs/mcs/cs-tokenizer.cs:2746 mcs/mcs/cs-tokenizer.cs:3677
+#: mcs/mcs/cs-tokenizer.cs:2717 mcs/mcs/cs-tokenizer.cs:2738
+#: mcs/mcs/cs-tokenizer.cs:2769 mcs/mcs/cs-tokenizer.cs:3717
 msgid "#endregion directive expected"
 msgstr "diretiva #endregion esperada"
 
-#: mcs/mcs/cs-tokenizer.cs:2793
+#: mcs/mcs/cs-tokenizer.cs:2816
 msgid "Wrong preprocessor directive"
 msgstr "Diretiva do pré-processador incorreta"
 
-#: mcs/mcs/cs-tokenizer.cs:2805
+#: mcs/mcs/cs-tokenizer.cs:2828
 #, csharp-format
 msgid "#error: '{0}'"
 msgstr "#erro: \"{0}\""
 
-#: mcs/mcs/cs-tokenizer.cs:2823
+#: mcs/mcs/cs-tokenizer.cs:2846
 msgid "The line number specified for #line directive is missing or invalid"
 msgstr ""
 "O número da linha especificada para a diretiva #line está faltando ou está "
 "inválida"
 
-#: mcs/mcs/cs-tokenizer.cs:2876 mcs/mcs/cs-tokenizer.cs:3514
+#: mcs/mcs/cs-tokenizer.cs:2908 mcs/mcs/cs-tokenizer.cs:3554
 msgid "Newline in constant"
 msgstr "Quebra de linha em constante"
 
-#: mcs/mcs/cs-tokenizer.cs:2893
+#: mcs/mcs/cs-tokenizer.cs:2934
 msgid "Unterminated string literal"
 msgstr "Literal de string não terminada"
 
-#: mcs/mcs/cs-tokenizer.cs:2968
+#: mcs/mcs/cs-tokenizer.cs:3011
 msgid "Identifier too long (limit is 512 chars)"
 msgstr "Identificador muito longo (o limite é 512 caracteres)"
 
-#: mcs/mcs/cs-tokenizer.cs:3354
+#: mcs/mcs/cs-tokenizer.cs:3394
 msgid "End-of-file found, '*/' expected"
 msgstr "Fim de arquivo encontrado, \"*/\" esperado"
 
-#: mcs/mcs/cs-tokenizer.cs:3463
+#: mcs/mcs/cs-tokenizer.cs:3503
 msgid "Keyword, identifier, or string expected after verbatim specifier: @"
 msgstr ""
 "Palavra-chave, identificador ou string esperado depois do especificador "
 "verbatim: @"
 
-#: mcs/mcs/cs-tokenizer.cs:3484
+#: mcs/mcs/cs-tokenizer.cs:3524
 #, fuzzy, csharp-format
 msgid "Unexpected character `{0}'"
 msgstr "Experado \"{0}\""
 
-#: mcs/mcs/cs-tokenizer.cs:3509
+#: mcs/mcs/cs-tokenizer.cs:3549
 msgid "Empty character literal"
 msgstr ""
 
-#: mcs/mcs/cs-tokenizer.cs:3530
+#: mcs/mcs/cs-tokenizer.cs:3570
 msgid "Too many characters in character literal"
 msgstr ""
 
@@ -658,7 +658,7 @@ msgstr ""
 "Está faltando o modificador parcial na declaração do tipo \"{0}\". Outra "
 "declaração parcial deste tipo existe"
 
-#: mcs/mcs/class.cs:713
+#: mcs/mcs/class.cs:734
 #, csharp-format
 msgid ""
 "`{0}': explicit interface declaration can only be declared in a class or "
@@ -667,38 +667,38 @@ msgstr ""
 "\"{0}\": declaração explícita de interface pode apenas ser declarada em uma "
 "classe ou struct"
 
-#: mcs/mcs/class.cs:772
+#: mcs/mcs/class.cs:793
 #, csharp-format
 msgid "Duplicate type parameter `{0}'"
 msgstr "Tipo de parâmetro duplicado \"{0}\""
 
-#: mcs/mcs/class.cs:775
+#: mcs/mcs/class.cs:796
 #, csharp-format
 msgid "The type `{0}' already contains a definition for `{1}'"
 msgstr "O tipo \"{0}\" já contém uma definição para \"{1}\""
 
-#: mcs/mcs/class.cs:841
+#: mcs/mcs/class.cs:862
 msgid ""
 "Cannot specify the `DefaultMember' attribute on type containing an indexer"
 msgstr ""
 "Não foi possível especificar o atributo \"DefaultMember\" no tipo contendo "
 "um indexador"
 
-#: mcs/mcs/class.cs:846
+#: mcs/mcs/class.cs:867
 msgid "The RequiredAttribute attribute is not permitted on C# types"
 msgstr "O atributo RequiredAttribute não é permitido em tipos de C#"
 
-#: mcs/mcs/class.cs:1069
+#: mcs/mcs/class.cs:1093
 #, fuzzy, csharp-format
 msgid "Class `{0}' cannot derive from the dynamic type"
 msgstr "\"{0}\": não foi possível declarar variáveis de tipo estático"
 
-#: mcs/mcs/class.cs:1086
+#: mcs/mcs/class.cs:1110
 #, csharp-format
 msgid "`{0}' is already listed in interface list"
 msgstr "\"{0}\" já está listado na lista de interfaces"
 
-#: mcs/mcs/class.cs:1094
+#: mcs/mcs/class.cs:1118
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base interface `{0}' is less accessible than "
@@ -707,23 +707,23 @@ msgstr ""
 "Acessibilidade inconsistente: interface base \"{0}\" é menos acessível que a "
 "interface \"{1}\""
 
-#: mcs/mcs/class.cs:1100
+#: mcs/mcs/class.cs:1124
 #, csharp-format
 msgid "Type `{0}' in interface list is not an interface"
 msgstr "Tipo \"{0}\" na lista de interfaces não é uma interface"
 
-#: mcs/mcs/class.cs:1102
+#: mcs/mcs/class.cs:1126
 #, csharp-format
 msgid "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')"
 msgstr ""
 "\"{0}\": Classes não podem ter múltiplas classes base (\"{1}\" e \"{2}\")"
 
-#: mcs/mcs/class.cs:1105
+#: mcs/mcs/class.cs:1129
 #, csharp-format
 msgid "`{0}': Base class `{1}' must be specified as first"
 msgstr "\"{0}\": Classe base \"{1}\" deve ser especificada como primeira"
 
-#: mcs/mcs/class.cs:1166
+#: mcs/mcs/class.cs:1190
 #, csharp-format
 msgid ""
 "The operator `{0}' requires a matching operator `{1}' to also be defined"
@@ -731,13 +731,13 @@ msgstr ""
 "O operador `{0}' necessita um operador correspondente \"{1}\" para também "
 "ser definido"
 
-#: mcs/mcs/class.cs:1397
+#: mcs/mcs/class.cs:1421
 #, csharp-format
 msgid "Partial declarations of `{0}' must not specify different base classes"
 msgstr ""
 "Declarações parciais de \"{0}\" não devem especificar diferentes classes base"
 
-#: mcs/mcs/class.cs:1441
+#: mcs/mcs/class.cs:1465
 #, csharp-format
 msgid ""
 "Inherited interface `{0}' causes a cycle in the interface hierarchy of `{1}'"
@@ -745,12 +745,12 @@ msgstr ""
 "Interface herdada \"{0}\" causa um ciclo na hierarquia de interfaces de "
 "\"{1}\""
 
-#: mcs/mcs/class.cs:1447
+#: mcs/mcs/class.cs:1471
 #, csharp-format
 msgid "Circular base class dependency involving `{0}' and `{1}'"
 msgstr "Dependência circular na classe base envolvendo \"{0}\" e \"{1}\""
 
-#: mcs/mcs/class.cs:1593
+#: mcs/mcs/class.cs:1617
 #, csharp-format
 msgid ""
 "Partial declarations of `{0}' have inconsistent constraints for type "
@@ -759,12 +759,12 @@ msgstr ""
 "Declarações parciais \"{0}\" possuem restrições inconsistentes para o tipo "
 "de parâmetro \"{1}\""
 
-#: mcs/mcs/class.cs:1702
+#: mcs/mcs/class.cs:1726
 #, fuzzy, csharp-format
 msgid "`{0}': cannot implement a dynamic interface `{1}'"
 msgstr "\"{0}\": tipo contendo não implementa interface \"{1}\""
 
-#: mcs/mcs/class.cs:1718
+#: mcs/mcs/class.cs:1742
 #, csharp-format
 msgid ""
 "`{0}' cannot implement both `{1}' and `{2}' because they may unify for some "
@@ -773,14 +773,14 @@ msgstr ""
 "\"{0}\" não pode implementar ambos \"{1}\" e \"{2}\" por que estes devem "
 "unificar para alguma substituição de tipo de parâmetro"
 
-#: mcs/mcs/class.cs:1737
+#: mcs/mcs/class.cs:1761
 #, csharp-format
 msgid ""
 "A generic type cannot derive from `{0}' because it is an attribute class"
 msgstr ""
 "Um tipo genérico não pode derivar de \"{0}\" por que é uma classe de atributo"
 
-#: mcs/mcs/class.cs:1839
+#: mcs/mcs/class.cs:1870
 msgid ""
 "Two indexers have different names; the IndexerName attribute must be used "
 "with the same name on every indexer within a type"
@@ -788,82 +788,82 @@ msgstr ""
 "Dois indexadores tem nomes diferentes; o atributo IndexerName deve ser "
 "utilizado com o mesmo nome em todo indexador de um tipo"
 
-#: mcs/mcs/class.cs:2089
+#: mcs/mcs/class.cs:2120
 #, csharp-format
 msgid "A static member `{0}' cannot be marked as override, virtual or abstract"
 msgstr ""
 "Um membro estático \"{0}\" não pode ser marcado como sobrescrito, virtual ou "
 "abstrato"
 
-#: mcs/mcs/class.cs:2096
+#: mcs/mcs/class.cs:2127
 #, csharp-format
 msgid "A member `{0}' marked as override cannot be marked as new or virtual"
 msgstr ""
 "Um membro \"{0}\" marcado como sobrescrito não pode ser marcado como novo ou "
 "virtual"
 
-#: mcs/mcs/class.cs:2108
+#: mcs/mcs/class.cs:2139
 #, csharp-format
 msgid "`{0}' cannot be both extern and abstract"
 msgstr "\"{0}\" não pode ser externo e abstrato ao mesmo tempo"
 
-#: mcs/mcs/class.cs:2113
+#: mcs/mcs/class.cs:2144
 #, csharp-format
 msgid "`{0}' cannot be both abstract and sealed"
 msgstr "\"{0}\" não pode ser abstrato e selado"
 
-#: mcs/mcs/class.cs:2118
+#: mcs/mcs/class.cs:2149
 #, csharp-format
 msgid "The abstract method `{0}' cannot be marked virtual"
 msgstr "O método abstrato \"{0}\" não pode ser marcado como virtual"
 
-#: mcs/mcs/class.cs:2124
+#: mcs/mcs/class.cs:2155
 #, csharp-format
 msgid "`{0}' is abstract but it is declared in the non-abstract class `{1}'"
 msgstr "\"{0}\" é abstrato mas está declarado na classe não-abstrata \"{1}\""
 
-#: mcs/mcs/class.cs:2132
+#: mcs/mcs/class.cs:2163
 #, csharp-format
 msgid "`{0}': virtual or abstract members cannot be private"
 msgstr "\"{0}\": membros virtuais ou abstratos não podem ser privados"
 
-#: mcs/mcs/class.cs:2139
+#: mcs/mcs/class.cs:2170
 #, csharp-format
 msgid "`{0}' cannot be sealed because it is not an override"
 msgstr "\"{0}\" não pode ser selado por que não é um sobrescrito"
 
-#: mcs/mcs/class.cs:2179
+#: mcs/mcs/class.cs:2210
 #, csharp-format
 msgid "`{0}': containing type does not implement interface `{1}'"
 msgstr "\"{0}\": tipo contendo não implementa interface \"{1}\""
 
-#: mcs/mcs/class.cs:2369
+#: mcs/mcs/class.cs:2400
 #, csharp-format
 msgid "Type parameter `{0}' has same name as containing type, or method"
 msgstr ""
 "Parâmetro de tipo \"{0}\" tem o mesmo nome que o tipo contendo, ou método"
 
-#: mcs/mcs/class.cs:2377
+#: mcs/mcs/class.cs:2408
 #, csharp-format
 msgid "`{0}': member names cannot be the same as their enclosing type"
 msgstr ""
 "\"{0}\": nomes de membros não podem ser os mesmos que seus tipos de "
 "fechamento"
 
-#: mcs/mcs/class.cs:2496
+#: mcs/mcs/class.cs:2527
 msgid ""
 "The class System.Object cannot have a base class or implement an interface."
 msgstr ""
 "A classe System.Object não pode ter uma classe base ou implementar uma "
 "interface."
 
-#: mcs/mcs/class.cs:2505
+#: mcs/mcs/class.cs:2536
 #, csharp-format
 msgid "Attribute `{0}' is only valid on classes derived from System.Attribute"
 msgstr ""
 "Atributo \"{0}\" é válido somente em classes derivadas de System.Attribute"
 
-#: mcs/mcs/class.cs:2510
+#: mcs/mcs/class.cs:2541
 msgid ""
 "Attribute `System.Diagnostics.ConditionalAttribute' is only valid on methods "
 "or attribute classes"
@@ -871,60 +871,60 @@ msgstr ""
 "Atributo \"System.Diagnostics.ConditionalAttribute\" é somente válido em "
 "métodos ou classes de atributos"
 
-#: mcs/mcs/class.cs:2539
+#: mcs/mcs/class.cs:2570
 #, csharp-format
 msgid "`{0}': an abstract class cannot be sealed or static"
 msgstr "\"{0}\": uma classe abstrata não pode ser selada ou estática"
 
-#: mcs/mcs/class.cs:2543
+#: mcs/mcs/class.cs:2574
 #, csharp-format
 msgid "`{0}': a class cannot be both static and sealed"
 msgstr "\"{0}\": uma classe não pode ser estática e selada ao mesmo tempo"
 
-#: mcs/mcs/class.cs:2549
+#: mcs/mcs/class.cs:2580
 #, csharp-format
 msgid "`{0}': Static classes cannot contain user-defined operators"
 msgstr ""
 "\"{0}\": Classes estáticas não podem conter operadores definidos pelo usuário"
 
-#: mcs/mcs/class.cs:2554
+#: mcs/mcs/class.cs:2585
 #, csharp-format
 msgid "`{0}': Static classes cannot contain destructor"
 msgstr "\"{0}\": Classes estáticas não podem conter um destrutor"
 
-#: mcs/mcs/class.cs:2559
+#: mcs/mcs/class.cs:2590
 #, csharp-format
 msgid "`{0}': cannot declare indexers in a static class"
 msgstr "\"{0}\": não é possível declarar indexadores como uma classe estática"
 
-#: mcs/mcs/class.cs:2567
+#: mcs/mcs/class.cs:2598
 #, csharp-format
 msgid "`{0}': Static classes cannot have instance constructors"
 msgstr "\"{0}\": Classes estáticas não podem ter construtores de instâncias"
 
-#: mcs/mcs/class.cs:2571
+#: mcs/mcs/class.cs:2602
 #, csharp-format
 msgid "`{0}': cannot declare instance members in a static class"
 msgstr ""
 "\"{0}\": não foi possível declarar membros de instâncias em uma classe "
 "estática"
 
-#: mcs/mcs/class.cs:2602
+#: mcs/mcs/class.cs:2633
 #, fuzzy, csharp-format
 msgid "`{0}': Cannot derive from type parameter `{1}'"
 msgstr "\"{0}\": Não foi possível derivar da classe estática \"{1}\""
 
-#: mcs/mcs/class.cs:2606
+#: mcs/mcs/class.cs:2637
 #, csharp-format
 msgid "`{0}': Cannot derive from static class `{1}'"
 msgstr "\"{0}\": Não foi possível derivar da classe estática \"{1}\""
 
-#: mcs/mcs/class.cs:2610
+#: mcs/mcs/class.cs:2641
 #, fuzzy, csharp-format
 msgid "`{0}': cannot derive from sealed type `{1}'"
 msgstr "\"{0}\": não foi possível derivar da classe selada \"{1}\""
 
-#: mcs/mcs/class.cs:2613
+#: mcs/mcs/class.cs:2644
 #, csharp-format
 msgid ""
 "Static class `{0}' cannot derive from type `{1}'. Static classes must derive "
@@ -933,12 +933,12 @@ msgstr ""
 "Classe estática \"{0}\" não pode derivar do tipo \"{1}\". Classes estáticas "
 "devem derivar de objetos"
 
-#: mcs/mcs/class.cs:2624
+#: mcs/mcs/class.cs:2655
 #, csharp-format
 msgid "`{0}' cannot derive from special class `{1}'"
 msgstr "\"{0}\" não foi possível derivar da classe especial \"{1}\""
 
-#: mcs/mcs/class.cs:2634
+#: mcs/mcs/class.cs:2665
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: base class `{0}' is less accessible than class `"
@@ -947,54 +947,54 @@ msgstr ""
 "Acessibilidade inconsistente: classe base \"{0}\" é menos acessível que a "
 "classe \"{1}\""
 
-#: mcs/mcs/class.cs:2642
+#: mcs/mcs/class.cs:2673
 #, csharp-format
 msgid "Static class `{0}' cannot implement interfaces"
 msgstr "Classe estática \"{0}\" não pode implementar interfaces"
 
-#: mcs/mcs/class.cs:2753 mcs/mcs/class.cs:2767
+#: mcs/mcs/class.cs:2784 mcs/mcs/class.cs:2798
 #, csharp-format
 msgid "Struct member `{0}' of type `{1}' causes a cycle in the struct layout"
 msgstr ""
 "Membro da estrutura \"{0}\" do tipo \"{1}\" causou um ciclo na disposição de "
 "structs"
 
-#: mcs/mcs/class.cs:2849
+#: mcs/mcs/class.cs:2880
 #, csharp-format
 msgid "`{0}': Structs cannot have instance field initializers"
 msgstr "\"{0}\": Structs não podem ter inicializadores de campos de instância"
 
-#: mcs/mcs/class.cs:3037
+#: mcs/mcs/class.cs:3068
 #, fuzzy, csharp-format
 msgid "Do not override `{0}'. Use destructor syntax instead"
 msgstr ""
 "Não use \"{0}\" diretamente. Ao invés disso, use o modificador de parâmetro "
 "\"this\""
 
-#: mcs/mcs/class.cs:3040
+#: mcs/mcs/class.cs:3071
 #, csharp-format
 msgid "`{0}' is marked as an override but no suitable {1} found to override"
 msgstr ""
 "\"{0}\" está marcado como uma sobrescrita mas nenhuma {1} foi encontrada "
 "para substituir"
 
-#: mcs/mcs/class.cs:3046
+#: mcs/mcs/class.cs:3077
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not an event"
 msgstr "\"{0}\": não foi possível sobrescrever pois \"{1}\" não é um evento"
 
-#: mcs/mcs/class.cs:3049
+#: mcs/mcs/class.cs:3080
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a property"
 msgstr ""
 "\"{0}\": não foi possível sobrescrever pois \"{1}\" não é uma propriedade"
 
-#: mcs/mcs/class.cs:3052
+#: mcs/mcs/class.cs:3083
 #, csharp-format
 msgid "`{0}': cannot override because `{1}' is not a method"
 msgstr "\"{0}\": não foi possível sobrescrever pois \"{1}\" não é um método"
 
-#: mcs/mcs/class.cs:3071
+#: mcs/mcs/class.cs:3102
 #, fuzzy, csharp-format
 msgid ""
 "`{0}' cannot override inherited members `{1}' and `{2}' because they have "
@@ -1003,12 +1003,12 @@ msgstr ""
 "\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" por que está "
 "selado"
 
-#: mcs/mcs/class.cs:3124 mcs/mcs/field.cs:198
+#: mcs/mcs/class.cs:3155 mcs/mcs/field.cs:198
 #, csharp-format
 msgid "`{0}' hides inherited abstract member `{1}'"
 msgstr "\"{0}\" esconde membro abstrato herdado \"{1}\""
 
-#: mcs/mcs/class.cs:3148
+#: mcs/mcs/class.cs:3179
 #, csharp-format
 msgid ""
 "`{0}': cannot override inherited member `{1}' because it is not marked "
@@ -1017,39 +1017,39 @@ msgstr ""
 "\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" porque este "
 "não está marcado como virtual, abstrato ou substituto"
 
-#: mcs/mcs/class.cs:3156
+#: mcs/mcs/class.cs:3187
 #, csharp-format
 msgid "`{0}': cannot override inherited member `{1}' because it is sealed"
 msgstr ""
 "\"{0}\": não foi possível sobrescrever membro herdado \"{1}\" por que está "
 "selado"
 
-#: mcs/mcs/class.cs:3165
+#: mcs/mcs/class.cs:3196
 #, csharp-format
 msgid "`{0}': type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "\"{0}\": o tipo deve ser \"{1}\" para corresponder com o membro da "
 "substituição \"{2}\""
 
-#: mcs/mcs/class.cs:3168
+#: mcs/mcs/class.cs:3199
 #, csharp-format
 msgid "`{0}': return type must be `{1}' to match overridden member `{2}'"
 msgstr ""
 "\"{0}\": tipo de retorno deve ser \"{1}\" para corresponder com o membro da "
 "substituição \"{2}\""
 
-#: mcs/mcs/class.cs:3236
+#: mcs/mcs/class.cs:3267
 #, csharp-format
 msgid "A partial method `{0}' cannot explicitly implement an interface"
 msgstr ""
 "Um método parcial \"{0}\" não pode implementar uma interface explicitamente"
 
-#: mcs/mcs/class.cs:3242
+#: mcs/mcs/class.cs:3273
 #, fuzzy, csharp-format
 msgid "The type `{0}' in explicit interface declaration is not an interface"
 msgstr "\"{0}\" na declaração explícita da interface não é uma interface"
 
-#: mcs/mcs/class.cs:3273
+#: mcs/mcs/class.cs:3304
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1058,7 +1058,7 @@ msgstr ""
 "Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
 "que o indexador \"{1}\""
 
-#: mcs/mcs/class.cs:3277
+#: mcs/mcs/class.cs:3308
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1067,7 +1067,7 @@ msgstr ""
 "Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
 "que o operador \"{1}\""
 
-#: mcs/mcs/class.cs:3281
+#: mcs/mcs/class.cs:3312
 #, csharp-format
 msgid ""
 "Inconsistent accessibility: parameter type `{0}' is less accessible than "
@@ -1076,7 +1076,7 @@ msgstr ""
 "Acessibilidade inconsistente: tipo de parâmetro \"{0}\" é menos acessível "
 "que o método \"{1}\""
 
-#: mcs/mcs/class.cs:3341
+#: mcs/mcs/class.cs:3372
 #, csharp-format
 msgid ""
 "`{0}': cannot change access modifiers when overriding `{1}' inherited member "
@@ -1085,40 +1085,49 @@ msgstr ""
 "\"{0}\": não foi possível alterar modificadores de acesso ao substituir "
 "\"{1}\" membro herdado \"{2}\""
 
-#: mcs/mcs/class.cs:3350
+#: mcs/mcs/class.cs:3381
 #, fuzzy, csharp-format
 msgid "`{0}': static types cannot be used as return types"
 msgstr "\"{0}\": tipos estáticos não podem ser utilizados como parâmetros"
 
-#: mcs/mcs/class.cs:3463
+#: mcs/mcs/class.cs:3442
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': Cannot specify constraints for overrides and explicit interface "
+"implementation methods"
+msgstr ""
+"\"{0}\": Não foi possível especificar restrições para sobrescritos ou "
+"métodos de implementação explícitos de interface"
+
+#: mcs/mcs/class.cs:3504
 #, csharp-format
 msgid "New virtual member `{0}' is declared in a sealed class `{1}'"
 msgstr "Novo membro virtual \"{0}\" é declarado em uma classe selada \"{1}\""
 
-#: mcs/mcs/class.cs:3478
+#: mcs/mcs/class.cs:3519
 msgid "Inconsistent accessibility: property type `"
 msgstr "Acessibilidade inconsistente: tipo da propriedade \""
 
-#: mcs/mcs/class.cs:3483
+#: mcs/mcs/class.cs:3524
 msgid "Inconsistent accessibility: indexer return type `"
 msgstr "Acessibilidade inconsistente: tipo de retorno do indexador \""
 
-#: mcs/mcs/class.cs:3489 mcs/mcs/class.cs:3494 mcs/mcs/delegate.cs:171
+#: mcs/mcs/class.cs:3530 mcs/mcs/class.cs:3535 mcs/mcs/delegate.cs:171
 msgid "Inconsistent accessibility: return type `"
 msgstr "Acessibilidade inconsistente: tipo de retorno \""
 
-#: mcs/mcs/class.cs:3499
+#: mcs/mcs/class.cs:3540
 msgid "Inconsistent accessibility: field type `"
 msgstr "Acessibilidade inconsistente: tipo de campo \""
 
-#: mcs/mcs/class.cs:3511
+#: mcs/mcs/class.cs:3552
 #, csharp-format
 msgid ""
 "Parameters or local variables of type `{0}' cannot be declared in async "
 "methods or iterators"
 msgstr ""
 
-#: mcs/mcs/class.cs:3515
+#: mcs/mcs/class.cs:3556
 #, fuzzy, csharp-format
 msgid ""
 "Local variables of type `{0}' cannot be used inside anonymous methods, "
@@ -1127,7 +1136,7 @@ msgstr ""
 "A variável local ou parâmetro \"{0}\" não pode ter seu endereço obtido e ser "
 "utilizado dentro de um método anônimo ou expressão lambda"
 
-#: mcs/mcs/class.cs:3519
+#: mcs/mcs/class.cs:3560
 #, csharp-format
 msgid "Field or property cannot be of type `{0}'"
 msgstr "Campo ou propriedade não podem ser do tipo \"{0}\""
@@ -1149,12 +1158,12 @@ msgid ""
 msgstr ""
 "O cálculo do valor constante para \"{0}\" involve uma definição circular"
 
-#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:392
+#: mcs/mcs/constant.cs:66 mcs/mcs/constant.cs:403
 #, csharp-format
 msgid "Constant value `{0}' cannot be converted to a `{1}'"
 msgstr "Valor constante \"{0}\" não pode ser convertido para um \"{1}\""
 
-#: mcs/mcs/constant.cs:264
+#: mcs/mcs/constant.cs:266
 #, csharp-format
 msgid ""
 "Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax "
@@ -1163,7 +1172,7 @@ msgstr ""
 "Valor constante \"{0}\" não pode ser convertido para um \"{1}\" (use a "
 "sintaxe \"unchecked\" para sobrescrever)"
 
-#: mcs/mcs/convert.cs:1184
+#: mcs/mcs/convert.cs:1185
 #, csharp-format
 msgid ""
 "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' "
@@ -1243,13 +1252,13 @@ msgstr ""
 "Método de extensão \"{0}\" de tipo de valor \"{1}\" não pode ser utilizado "
 "para criar delegates"
 
-#: mcs/mcs/delegate.cs:532
+#: mcs/mcs/delegate.cs:535
 #, csharp-format
 msgid "Cannot create delegate from partial method declaration `{0}'"
 msgstr ""
 "Não foi possível criar delegate da declaração de método parcial \"{0}\""
 
-#: mcs/mcs/delegate.cs:535
+#: mcs/mcs/delegate.cs:538
 #, csharp-format
 msgid ""
 "Cannot create delegate with `{0}' because it has a Conditional attribute"
@@ -1257,7 +1266,7 @@ msgstr ""
 "Não foi possível criar delegate com \"{0}\" porque este contém um atributo "
 "Conditional"
 
-#: mcs/mcs/delegate.cs:578
+#: mcs/mcs/delegate.cs:581
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' parameters and return type must be same as "
@@ -1267,7 +1276,7 @@ msgstr ""
 "devem ser os mesmos dos parâmetros do delegate \"{2} {3}\" e dos tipos de "
 "retorno"
 
-#: mcs/mcs/delegate.cs:585
+#: mcs/mcs/delegate.cs:588
 #, csharp-format
 msgid ""
 "A method or delegate `{0}' parameters do not match delegate `{1}' parameters"
@@ -1275,7 +1284,7 @@ msgstr ""
 "Os parâmetros do método ou do delegate \"{0}\" não coincidem com os "
 "parâmetros do delegate \"{1}\""
 
-#: mcs/mcs/delegate.cs:590
+#: mcs/mcs/delegate.cs:593
 #, csharp-format
 msgid ""
 "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' "
@@ -1284,45 +1293,35 @@ msgstr ""
 "Os tipos de retorno do método o do delegate \"{0} {1}\" não coincidem com o "
 "tipo de retorno do delegate \"{2} {3}\""
 
-#: mcs/mcs/delegate.cs:673
+#: mcs/mcs/delegate.cs:676
 msgid "Method name expected"
 msgstr "Nome do método esperado"
 
-#: mcs/mcs/doc.cs:613
+#: mcs/mcs/doc.cs:621
 #, csharp-format
 msgid "Error generating XML documentation file `{0}' (`{1}')"
 msgstr "Erro ao gerar arquivo de documentação XML \"{0}\" (\"{1}\")"
 
-#: mcs/mcs/driver.cs:51
+#: mcs/mcs/driver.cs:52
 msgid "Source file `"
 msgstr "Arquivo fonte \""
 
-#: mcs/mcs/driver.cs:96
-#, csharp-format
-msgid "Source file `{0}' could not be found"
-msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
-
-#: mcs/mcs/driver.cs:103
-#, csharp-format
-msgid "Source file `{0}' is a binary file and not a text file"
-msgstr "Arquivo fonte \"{0}\" é um arquivo binário e não um arquivo texto"
-
-#: mcs/mcs/driver.cs:210
+#: mcs/mcs/driver.cs:258
 msgid "No files to compile were specified"
 msgstr "Nenhum arquivo para compilar foi especificado"
 
-#: mcs/mcs/driver.cs:215
+#: mcs/mcs/driver.cs:263
 msgid "Platform option `anycpu32bitpreferred' is valid only for executables"
 msgstr ""
 
-#: mcs/mcs/driver.cs:245
+#: mcs/mcs/driver.cs:293
 msgid ""
 "If no source files are specified you must specify the output file with -out:"
 msgstr ""
 "Se nenhum código fonte for especificado você deve especificar o arquivo de "
 "saída com -out:"
 
-#: mcs/mcs/driver.cs:262
+#: mcs/mcs/driver.cs:310
 msgid "Output file name is not valid"
 msgstr ""
 
@@ -1399,24 +1398,6 @@ msgid "`{0}' does not contain a definition for `{1}'"
 msgstr "\"{0}\" não contém uma definição para \"{1}\""
 
 #: mcs/mcs/ecore.cs:328
-#, csharp-format
-msgid ""
-"Members of value type `{0}' cannot be assigned using a property `{1}' object "
-"initializer"
-msgstr ""
-"Membros do tipo de valor \"{0}\" não podem ser atribuidos usando uma "
-"propriedade \"{1}\" inicializadora de objeto"
-
-#: mcs/mcs/ecore.cs:331
-#, csharp-format
-msgid ""
-"Cannot modify a value type return value of `{0}'. Consider storing the value "
-"in a temporary variable"
-msgstr ""
-"Não foi possível modificar o valor do retorno do tipo de valor de \"{0}\". "
-"Considere guardar o valor em uma variável temporária"
-
-#: mcs/mcs/ecore.cs:335
 msgid ""
 "The left-hand side of an assignment must be a variable, a property or an "
 "indexer"
@@ -1424,20 +1405,20 @@ msgstr ""
 "O lado esquerdo de uma atribuição deve ser uma variável, uma propriedade ou "
 "um indexador"
 
-#: mcs/mcs/ecore.cs:341
+#: mcs/mcs/ecore.cs:334
 msgid "The operation in question is undefined on void pointers"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:408 mcs/mcs/statement.cs:3001 mcs/mcs/statement.cs:3003
+#: mcs/mcs/ecore.cs:422 mcs/mcs/statement.cs:3038 mcs/mcs/statement.cs:3040
 #, csharp-format
 msgid "Internal compiler error: {0}"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:448
+#: mcs/mcs/ecore.cs:462
 msgid "A ref or out argument must be an assignable variable"
 msgstr "Um argumento ref ou out deve ser uma variável atribuível"
 
-#: mcs/mcs/ecore.cs:467
+#: mcs/mcs/ecore.cs:481
 msgid ""
 "An attribute argument must be a constant expression, typeof expression or "
 "array creation expression"
@@ -1445,38 +1426,38 @@ msgstr ""
 "Um argumento de atributo deve ser uma expressão constante, typeof ou "
 "expressão de criação de array"
 
-#: mcs/mcs/ecore.cs:641
+#: mcs/mcs/ecore.cs:655
 #, csharp-format
 msgid "The class `{0}' has no constructors defined"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:763
+#: mcs/mcs/ecore.cs:777
 #, csharp-format
 msgid "The `{0}' operator cannot be applied to operand of type `{1}'"
 msgstr "O operador \"{0}\" não pode ser aplicado ao operando de tipo \"{1}\""
 
-#: mcs/mcs/ecore.cs:769
+#: mcs/mcs/ecore.cs:783
 msgid "An expression tree cannot contain an unsafe pointer operation"
 msgstr ""
 "Uma árvore de expressão não pode conter uma operação de ponteiro insegura"
 
-#: mcs/mcs/ecore.cs:847
+#: mcs/mcs/ecore.cs:861
 #, csharp-format
 msgid "`{0}' is a `{1}' but a `{2}' was expected"
 msgstr "\"{0}\" é um \"{1}\" mas um \"{2}\" era esperado"
 
-#: mcs/mcs/ecore.cs:880
+#: mcs/mcs/ecore.cs:894
 #, csharp-format
 msgid "Expression denotes a `{0}', where a `{1}' was expected"
 msgstr "A expressão denota um \"{0}\", onde um \"{1}\" era esperado"
 
-#: mcs/mcs/ecore.cs:890
+#: mcs/mcs/ecore.cs:904
 msgid "Pointers and fixed size buffers may only be used in an unsafe context"
 msgstr ""
 "Ponteiros e buffers de tamanho fixo devem apenas ser utilizados num contexto "
 "inseguro"
 
-#: mcs/mcs/ecore.cs:2323
+#: mcs/mcs/ecore.cs:2364
 #, fuzzy, csharp-format
 msgid ""
 "Dynamic keyword requires `{0}' to be defined. Are you missing System.Core."
@@ -1485,7 +1466,7 @@ msgstr ""
 "O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
 "esquecendo de uma diretiva em uso ou uma referência do assembly?"
 
-#: mcs/mcs/ecore.cs:2399
+#: mcs/mcs/ecore.cs:2440
 #, fuzzy, csharp-format
 msgid ""
 "A local variable `{0}' cannot be used before it is declared. Consider "
@@ -1494,32 +1475,32 @@ msgstr ""
 "A variável local \"{0}\" não pode ser utilizada antes de ser declarada. "
 "Considere renomear a variável local quando esta esconder o campo \"{1}\""
 
-#: mcs/mcs/ecore.cs:2414 mcs/mcs/ecore.cs:2457
+#: mcs/mcs/ecore.cs:2455 mcs/mcs/ecore.cs:2498
 #, csharp-format
 msgid "`{0}' conflicts with a declaration in a child block"
 msgstr "\"{0}\" conflita com uma declaração em um bloco filho"
 
-#: mcs/mcs/ecore.cs:2466
+#: mcs/mcs/ecore.cs:2507
 #, csharp-format
 msgid "A local variable `{0}' cannot be used before it is declared"
 msgstr ""
 "Uma variável local \"{0}\" não pode ser utilizada antes de ser declarada"
 
-#: mcs/mcs/ecore.cs:2520
+#: mcs/mcs/ecore.cs:2561
 #, csharp-format
 msgid "The name `{0}' does not exist in the current context"
 msgstr "O nome \"{0}\" não existe no contexto atual"
 
-#: mcs/mcs/ecore.cs:2616
+#: mcs/mcs/ecore.cs:2657
 msgid "System.Void cannot be used from C#. Consider using `void'"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:2900
+#: mcs/mcs/ecore.cs:2941
 #, csharp-format
 msgid "Cannot call an abstract base member `{0}'"
 msgstr "Não foi possível chamar um membro abstrato da base \"{0}\""
 
-#: mcs/mcs/ecore.cs:2907
+#: mcs/mcs/ecore.cs:2948
 #, csharp-format
 msgid ""
 "Cannot access protected member `{0}' via a qualifier of type `{1}'. The "
@@ -1529,7 +1510,25 @@ msgstr ""
 "qualificador do tipo \"{1}\". O qualificador deve ser do tipo \"{2}\" ou "
 "derivado deste"
 
-#: mcs/mcs/ecore.cs:2950
+#: mcs/mcs/ecore.cs:2964
+#, csharp-format
+msgid ""
+"Members of value type `{0}' cannot be assigned using a property `{1}' object "
+"initializer"
+msgstr ""
+"Membros do tipo de valor \"{0}\" não podem ser atribuidos usando uma "
+"propriedade \"{1}\" inicializadora de objeto"
+
+#: mcs/mcs/ecore.cs:2968
+#, csharp-format
+msgid ""
+"Cannot modify a value type return value of `{0}'. Consider storing the value "
+"in a temporary variable"
+msgstr ""
+"Não foi possível modificar o valor do retorno do tipo de valor de \"{0}\". "
+"Considere guardar o valor em uma variável temporária"
+
+#: mcs/mcs/ecore.cs:2994
 #, csharp-format
 msgid ""
 "Static member `{0}' cannot be accessed with an instance reference, qualify "
@@ -1538,7 +1537,7 @@ msgstr ""
 "O membro estático \"{0}\" não pode ser acessado com uma referência de "
 "instância, ao invés disso, qualifique com um nome de tipo"
 
-#: mcs/mcs/ecore.cs:2965
+#: mcs/mcs/ecore.cs:3009
 #, csharp-format
 msgid ""
 "A field initializer cannot reference the nonstatic field, method, or "
@@ -1547,14 +1546,14 @@ msgstr ""
 "Um inicializador de campo não pode referenciar um campo não estático, método "
 "ou propriedade \"{0}\""
 
-#: mcs/mcs/ecore.cs:2969
+#: mcs/mcs/ecore.cs:3013
 #, csharp-format
 msgid "An object reference is required to access non-static member `{0}'"
 msgstr ""
 "Uma referência de objeto é necessária para acessar o membro não estático "
 "\"{0}\""
 
-#: mcs/mcs/ecore.cs:2978
+#: mcs/mcs/ecore.cs:3022
 #, csharp-format
 msgid ""
 "Cannot access a nonstatic member of outer type `{0}' via nested type `{1}'"
@@ -1562,11 +1561,11 @@ msgstr ""
 "Não foi possível acessar um membro não estático de um tipo externo \"{0}\" "
 "de um tipo aninhado \"{1}\""
 
-#: mcs/mcs/ecore.cs:3026
+#: mcs/mcs/ecore.cs:3070
 msgid "Cannot modify the result of an unboxing conversion"
 msgstr "Não foi possível modificar o resultado de uma conversão unboxing"
 
-#: mcs/mcs/ecore.cs:3192
+#: mcs/mcs/ecore.cs:3240
 #, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1575,19 +1574,19 @@ msgstr ""
 "Tipo \"{0}\" não contém um membro \"{1}\" e o melhor método de extensão "
 "sobrecarregado \"{2}\" tem alguns argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:3197
+#: mcs/mcs/ecore.cs:3245
 #, csharp-format
 msgid "Extension method instance type `{0}' cannot be converted to `{1}'"
 msgstr ""
 "Tipo de instância do método de extensão \"{0}\" não pode ser convertido para "
 "\"{1}\""
 
-#: mcs/mcs/ecore.cs:3331
+#: mcs/mcs/ecore.cs:3379
 msgid "An expression tree cannot contain an expression with method group"
 msgstr ""
 "Uma árvore de expressão não pode conter uma expressão com um grupo de método"
 
-#: mcs/mcs/ecore.cs:3337
+#: mcs/mcs/ecore.cs:3385
 msgid ""
 "Partial methods with only a defining declaration or removed conditional "
 "methods cannot be used in an expression tree"
@@ -1595,7 +1594,7 @@ msgstr ""
 "Métodos parciais com somente uma declaração de definição ou métodos com "
 "condicionais removidos não podem ser utilizados em uma árvore de expressão"
 
-#: mcs/mcs/ecore.cs:3369
+#: mcs/mcs/ecore.cs:3417
 #, csharp-format
 msgid ""
 "Cannot convert method group `{0}' to non-delegate type `{1}'. Consider using "
@@ -1604,14 +1603,14 @@ msgstr ""
 "Não foi possível converter o grupo de método \"{0}\" para o tipo não-"
 "delegate \"{1}\". Consider a utilização de parênteses quando chamar o método"
 
-#: mcs/mcs/ecore.cs:4049
+#: mcs/mcs/ecore.cs:4150
 #, csharp-format
 msgid ""
 "The type `{0}' does not contain a constructor that takes `{1}' arguments"
 msgstr ""
 "O tipo \"{0}\" não contém um construtor que aceite os argumentos \"{1}\""
 
-#: mcs/mcs/ecore.cs:4715
+#: mcs/mcs/ecore.cs:4837
 #, fuzzy, csharp-format
 msgid ""
 "Type `{0}' does not contain a member `{1}' and the best extension method "
@@ -1621,7 +1620,7 @@ msgstr ""
 "Tipo \"{0}\" não contém um membro \"{1}\" e o melhor método de extensão "
 "sobrecarregado \"{2}\" tem alguns argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:4743
+#: mcs/mcs/ecore.cs:4876
 #, csharp-format
 msgid ""
 "The call is ambiguous between the following methods or properties: `{0}' and "
@@ -1630,16 +1629,16 @@ msgstr ""
 "Essa chamada é ambígua entre os seguintes métodos ou propriedades: \"{0}\" e "
 "\"{1}\""
 
-#: mcs/mcs/ecore.cs:4801
-#, csharp-format
+#: mcs/mcs/ecore.cs:4939
+#, fuzzy, csharp-format
 msgid ""
-"The best overloaded collection initalizer method `{0}' cannot have 'ref', or "
+"The best overloaded collection initalizer method `{0}' cannot have `ref' or "
 "`out' modifier"
 msgstr ""
 "O melhor método sobrecarregado de coleção \"{0}\" não pode ter o modificador "
 "\"ref\" ou \"out\""
 
-#: mcs/mcs/ecore.cs:4805
+#: mcs/mcs/ecore.cs:4943
 #, csharp-format
 msgid ""
 "The best overloaded collection initalizer method `{0}' has some invalid "
@@ -1648,18 +1647,18 @@ msgstr ""
 "O melhor método sobrecarregado inicializador de coleção \"{0}\" tem alguns "
 "argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:4808
+#: mcs/mcs/ecore.cs:4946
 #, csharp-format
 msgid "Delegate `{0}' has some invalid arguments"
 msgstr "Delegate \"{0}\" tem alguns argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:4812
+#: mcs/mcs/ecore.cs:4950
 #, csharp-format
 msgid "The best overloaded method match for `{0}' has some invalid arguments"
 msgstr ""
 "O melhor método sobrecarregado para \"{0}\" tem alguns argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:4821
+#: mcs/mcs/ecore.cs:4959
 #, csharp-format
 msgid ""
 "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' "
@@ -1668,18 +1667,18 @@ msgstr ""
 "Argumento \"#{0}\" não requer o modificador \"{1}\". Considere remover o "
 "modificador \"{1}\""
 
-#: mcs/mcs/ecore.cs:4824
+#: mcs/mcs/ecore.cs:4962
 #, csharp-format
 msgid "Argument `#{0}' is missing `{1}' modifier"
 msgstr "Argumento \"#{0}\" não encontrou o modificador \"{1}\""
 
-#: mcs/mcs/ecore.cs:4836
+#: mcs/mcs/ecore.cs:4979
 #, csharp-format
 msgid "Argument `#{0}' cannot convert `{1}' expression to type `{2}'"
 msgstr ""
 "Argumento \"#{0}\" não pôde converter a expressão \"{1}\" para o tipo \"{2}\""
 
-#: mcs/mcs/ecore.cs:4889
+#: mcs/mcs/ecore.cs:5032
 #, csharp-format
 msgid ""
 "The type arguments for method `{0}' cannot be inferred from the usage. Try "
@@ -1688,17 +1687,17 @@ msgstr ""
 "O argumentos de tipo para o método \"{0}\" não pôde ser inferido do uso. "
 "Tente especificar os tipos dos argumentos explicitamente"
 
-#: mcs/mcs/ecore.cs:4918
+#: mcs/mcs/ecore.cs:5061
 #, csharp-format
 msgid "No overload for method `{0}' takes `{1}' arguments"
 msgstr "Sem sobrecarga para o método \"{0}\" aceitar os argumentos \"{1}\""
 
-#: mcs/mcs/ecore.cs:4971
+#: mcs/mcs/ecore.cs:5114
 #, fuzzy, csharp-format
 msgid "The delegate `{0}' does not contain a parameter named `{1}'"
 msgstr "O tipo aninhado \"{0}\" não existe no tipo \"{1}\""
 
-#: mcs/mcs/ecore.cs:4976
+#: mcs/mcs/ecore.cs:5119
 #, fuzzy, csharp-format
 msgid ""
 "The best overloaded method match for `{0}' does not contain a parameter "
@@ -1706,14 +1705,14 @@ msgid ""
 msgstr ""
 "O melhor método sobrecarregado para \"{0}\" tem alguns argumentos inválidos"
 
-#: mcs/mcs/ecore.cs:4986
+#: mcs/mcs/ecore.cs:5129
 #, csharp-format
 msgid ""
 "Named argument `{0}' cannot be used for a parameter which has positional "
 "argument specified"
 msgstr ""
 
-#: mcs/mcs/ecore.cs:5322
+#: mcs/mcs/ecore.cs:5467
 msgid ""
 "You cannot use fixed size buffers contained in unfixed expressions. Try "
 "using the fixed statement"
@@ -1721,33 +1720,33 @@ msgstr ""
 "Você não pode usar buffers de tamanho fixo contidos em expressões não "
 "fixadas. Tente utilizar a declaração fixa"
 
-#: mcs/mcs/ecore.cs:5327
+#: mcs/mcs/ecore.cs:5472
 #, csharp-format
 msgid "`{0}': Fixed size buffers can only be accessed through locals or fields"
 msgstr ""
 "\"{0}\": Buffers de tamanho fixo podem apenas ser acessados atravéis de "
 "locais ou campos"
 
-#: mcs/mcs/ecore.cs:5363
+#: mcs/mcs/ecore.cs:5508
 #, fuzzy, csharp-format
 msgid "Use of possibly unassigned field `{0}'"
 msgstr "Uso de campo possivelmente não atribuído \""
 
-#: mcs/mcs/ecore.cs:5789
+#: mcs/mcs/ecore.cs:5935
 #, fuzzy, csharp-format
 msgid "Property or event `{0}' is not supported by the C# language"
 msgstr ""
 "A propriedade \"{0}\" não tem suporte na linguagem C#. Tente chamar o método "
 "acessor \"{1}\" diretamente"
 
-#: mcs/mcs/ecore.cs:5969
+#: mcs/mcs/ecore.cs:6131
 #, csharp-format
 msgid "A range variable `{0}' may not be passes as `ref' or `out' parameter"
 msgstr ""
 "Uma variável de intervalo \"{0}\" não deve ser passada como parâmetros \"ref"
 "\" ou \"out\""
 
-#: mcs/mcs/ecore.cs:6047
+#: mcs/mcs/ecore.cs:6204
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because it "
@@ -1756,7 +1755,7 @@ msgstr ""
 "A propriedade ou indexador \"{0}\" não pôde ser utilizada nesse contexto "
 "porque falta o acessor \"get\""
 
-#: mcs/mcs/ecore.cs:6054
+#: mcs/mcs/ecore.cs:6211
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the get "
@@ -1765,14 +1764,14 @@ msgstr ""
 "A propriedade ou indexador \"{0}\" não pôde ser utilizada nesse contexto "
 "porque o acessor get está inacessível"
 
-#: mcs/mcs/ecore.cs:6073
+#: mcs/mcs/ecore.cs:6230
 #, fuzzy, csharp-format
 msgid "Property or indexer `{0}' cannot be assigned to (it is read-only)"
 msgstr ""
 "Propriedade ou indexador \"{0}\" não pôde ser atribuida (ela é somente "
 "leitura)"
 
-#: mcs/mcs/ecore.cs:6081
+#: mcs/mcs/ecore.cs:6238
 #, csharp-format
 msgid ""
 "The property or indexer `{0}' cannot be used in this context because the set "
@@ -1781,7 +1780,7 @@ msgstr ""
 "A propriedade ou indexador \"{0}\" não pôde ser utilizada neste contexto por "
 "que o acessor do conjunto está inacessível"
 
-#: mcs/mcs/ecore.cs:6249
+#: mcs/mcs/ecore.cs:6406
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of `+=' or `-=' "
@@ -1790,7 +1789,7 @@ msgstr ""
 "O evento \"{0}\" pode apenas aparecer no lado esquerdo do operador \"+=\" ou "
 "\"-=\""
 
-#: mcs/mcs/ecore.cs:6253
+#: mcs/mcs/ecore.cs:6410
 #, csharp-format
 msgid ""
 "The event `{0}' can only appear on the left hand side of += or -= when used "
@@ -1799,7 +1798,7 @@ msgstr ""
 "O evento \"{0}\" pode apenas aparecer no lado esquerdo do operador += ou -= "
 "quando utilizado fora do tipo \"{1}\""
 
-#: mcs/mcs/ecore.cs:6423
+#: mcs/mcs/ecore.cs:6580
 #, csharp-format
 msgid ""
 "An implicitly typed local variable declaration cannot be initialized with `"
@@ -1808,7 +1807,7 @@ msgstr ""
 "Uma declaração de variável local tipada implicitamente não pode ser "
 "inicializada com \"{0}\""
 
-#: mcs/mcs/ecore.cs:6437
+#: mcs/mcs/ecore.cs:6594
 msgid ""
 "The contextual keyword `var' may only appear within a local variable "
 "declaration"
@@ -1833,7 +1832,7 @@ msgstr "Um ítem em uma enumeração não pode ter um identificador \"{0}\""
 msgid "Type byte, sbyte, short, ushort, int, uint, long or ulong expected"
 msgstr "Tipo byte, sbyte, short, ushort, int, uint, long ou ulong esperado"
 
-#: mcs/mcs/eval.cs:562
+#: mcs/mcs/eval.cs:563
 msgid "Detection Parsing Error"
 msgstr "Erro na Análise de Detecção"
 
@@ -1961,7 +1960,7 @@ msgstr ""
 "O tipo \"{0}\" deve ter operadores \"true\" e \"false\" definidos quando "
 "\"{1}\" é utilizado como um operador curto circuito"
 
-#: mcs/mcs/expression.cs:4635
+#: mcs/mcs/expression.cs:4656
 #, fuzzy, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined as `{0}' and `{1}' "
@@ -1970,7 +1969,7 @@ msgstr ""
 "Tipo da expressão condicional não pôde ser determinada por que não há uma "
 "conversão implícita entre \"{0}\" e \"{1}\""
 
-#: mcs/mcs/expression.cs:4645
+#: mcs/mcs/expression.cs:4666
 #, csharp-format
 msgid ""
 "Type of conditional expression cannot be determined because there is no "
@@ -1979,19 +1978,19 @@ msgstr ""
 "Tipo da expressão condicional não pôde ser determinada por que não há uma "
 "conversão implícita entre \"{0}\" e \"{1}\""
 
-#: mcs/mcs/expression.cs:4943
+#: mcs/mcs/expression.cs:4964
 #, fuzzy, csharp-format
 msgid "Use of unassigned local variable `{0}'"
 msgstr "Uso de variável não atríbuida \""
 
-#: mcs/mcs/expression.cs:4963
+#: mcs/mcs/expression.cs:4984
 #, csharp-format
 msgid ""
 "Cannot use fixed local `{0}' inside an anonymous method, lambda expression "
 "or query expression"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5156
+#: mcs/mcs/expression.cs:5177
 #, csharp-format
 msgid ""
 "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' "
@@ -2000,22 +1999,22 @@ msgstr ""
 "Parâmetro \"{0}\" não pôde ser utilizado dentro de \"{1}\" quando estiver "
 "usando modificadores \"ref\" ou \"out\""
 
-#: mcs/mcs/expression.cs:5235
+#: mcs/mcs/expression.cs:5256
 #, csharp-format
 msgid "Use of unassigned out parameter `{0}'"
 msgstr "Uso do parâmetro removido \"{0}\""
 
-#: mcs/mcs/expression.cs:5345
+#: mcs/mcs/expression.cs:5368
 #, fuzzy, csharp-format
 msgid "Cannot invoke a non-delegate type `{0}'"
 msgstr "Não foi possível converter \"{0}\" para um tipo não-delegate \"{1}\""
 
-#: mcs/mcs/expression.cs:5356
+#: mcs/mcs/expression.cs:5379
 #, csharp-format
 msgid "The member `{0}' cannot be used as method or delegate"
 msgstr "O membro \"{0}\" não pode ser utilizado como método ou delegate"
 
-#: mcs/mcs/expression.cs:5376
+#: mcs/mcs/expression.cs:5399
 msgid ""
 "Do not directly call your base class Finalize method. It is called "
 "automatically from your destructor"
@@ -2023,7 +2022,7 @@ msgstr ""
 "Não chame diretamente seu método Finalize da classe base. Este é chamado "
 "automaticamente de seu destrutor"
 
-#: mcs/mcs/expression.cs:5378
+#: mcs/mcs/expression.cs:5401
 msgid ""
 "Destructors and object.Finalize cannot be called directly. Consider calling "
 "IDisposable.Dispose if available"
@@ -2031,67 +2030,67 @@ msgstr ""
 "Destrutores e o object.Finalize não podem ser chamados diretamente. "
 "Considere chamar IDisposable.Dispose se disponível"
 
-#: mcs/mcs/expression.cs:5407
+#: mcs/mcs/expression.cs:5430
 #, csharp-format
 msgid ""
 "The base call to method `{0}' cannot be dynamically dispatched. Consider "
 "casting the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5480
+#: mcs/mcs/expression.cs:5503
 #, csharp-format
 msgid "`{0}': cannot explicitly call operator or accessor"
 msgstr "\"{0}\": não foi possível chamar explicitamente operador ou acessor"
 
-#: mcs/mcs/expression.cs:5664
+#: mcs/mcs/expression.cs:5687
 #, csharp-format
 msgid "Unsafe type `{0}' cannot be used in an object creation expression"
 msgstr ""
 "Tipo inseguro \"{0}\" não pode ser utilizado em uma expressão criadora de "
 "objetos"
 
-#: mcs/mcs/expression.cs:5687
+#: mcs/mcs/expression.cs:5710
 #, csharp-format
 msgid ""
 "Cannot create an instance of the variable type `{0}' because it does not "
 "have the new() constraint"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5693
+#: mcs/mcs/expression.cs:5716
 #, csharp-format
 msgid ""
 "`{0}': cannot provide arguments when creating an instance of a variable type"
 msgstr ""
 
-#: mcs/mcs/expression.cs:5702
+#: mcs/mcs/expression.cs:5725
 #, csharp-format
 msgid "Cannot create an instance of the static class `{0}'"
 msgstr "Não foi possível criar uma instância da classe estática \"{0}\""
 
-#: mcs/mcs/expression.cs:5714
+#: mcs/mcs/expression.cs:5737
 #, csharp-format
 msgid "Cannot create an instance of the abstract class or interface `{0}'"
 msgstr ""
 "Não foi possível criar uma instância da classe abstrata ou interface \"{0}\""
 
-#: mcs/mcs/expression.cs:6015
+#: mcs/mcs/expression.cs:6038
 msgid ""
 "An implicitly typed local variable declarator cannot use an array initializer"
 msgstr ""
 "Um declarador de variável local tipada implícitamente não pode usar um "
 "inicializador de array"
 
-#: mcs/mcs/expression.cs:6159 mcs/mcs/expression.cs:6167
-#: mcs/mcs/statement.cs:1206 mcs/mcs/statement.cs:3582
+#: mcs/mcs/expression.cs:6182 mcs/mcs/expression.cs:6190
+#: mcs/mcs/statement.cs:1227 mcs/mcs/statement.cs:3619
 msgid "A constant value is expected"
 msgstr "Um valor constante é esperado"
 
-#: mcs/mcs/expression.cs:6173
+#: mcs/mcs/expression.cs:6196 mcs/mcs/expression.cs:6221
 #, csharp-format
 msgid "An array initializer of length `{0}' was expected"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6189
+#: mcs/mcs/expression.cs:6212
 #, fuzzy
 msgid ""
 "Array initializers can only be used in a variable or field initializer. Try "
@@ -2101,22 +2100,22 @@ msgstr ""
 "atríbui-la a tipos de array. Tente, ao invés disso, utilizar uma nova "
 "expressão"
 
-#: mcs/mcs/expression.cs:6197
+#: mcs/mcs/expression.cs:6229
 #, fuzzy
 msgid "A nested array initializer was expected"
 msgstr "Um valor constante é esperado"
 
-#: mcs/mcs/expression.cs:6244
+#: mcs/mcs/expression.cs:6276
 msgid "An expression tree cannot contain a multidimensional array initializer"
 msgstr ""
 "Uma árvore de expressão não pode contar um inicializador de array "
 "multidimensional"
 
-#: mcs/mcs/expression.cs:6280
+#: mcs/mcs/expression.cs:6312
 msgid "Cannot create an array with a negative size"
 msgstr "Não foi possível criar um array com um tamanho negativo"
 
-#: mcs/mcs/expression.cs:6361
+#: mcs/mcs/expression.cs:6393
 msgid ""
 "Can only use array initializer expressions to assign to array types. Try "
 "using a new expression instead"
@@ -2125,7 +2124,7 @@ msgstr ""
 "atríbui-la a tipos de array. Tente, ao invés disso, utilizar uma nova "
 "expressão"
 
-#: mcs/mcs/expression.cs:6829
+#: mcs/mcs/expression.cs:6830
 msgid ""
 "The type of an implicitly typed array cannot be inferred from the "
 "initializer. Try specifying array type explicitly"
@@ -2133,18 +2132,18 @@ msgstr ""
 "O tipo de um array tipado implicitamente não pode ser inferido do "
 "inicializador. Tente especificar o tipo de array explicitamente"
 
-#: mcs/mcs/expression.cs:6972
+#: mcs/mcs/expression.cs:6973
 msgid ""
 "The `this' object cannot be used before all of its fields are assigned to"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6979
+#: mcs/mcs/expression.cs:6980
 msgid ""
 "Keyword `this' is not valid in a static property, static method, or static "
 "field initializer"
 msgstr ""
 
-#: mcs/mcs/expression.cs:6982
+#: mcs/mcs/expression.cs:6983
 msgid ""
 "Anonymous methods inside structs cannot access instance members of `this'. "
 "Consider copying `this' to a local variable outside the anonymous method and "
@@ -2154,48 +2153,48 @@ msgstr ""
 "Considere copiar \"this\" para um variável local fora do método anônimo e "
 "utilizar, ao invés disso, o local"
 
-#: mcs/mcs/expression.cs:6985
+#: mcs/mcs/expression.cs:6986
 #, fuzzy
 msgid "Keyword `this' is not available in the current context"
 msgstr "O nome \"{0}\" não existe no contexto atual"
 
-#: mcs/mcs/expression.cs:7062
+#: mcs/mcs/expression.cs:7063
 msgid "Cannot take the address of `this' because it is read-only"
 msgstr ""
 "Não foi possível encontrar o endereço de \"this\" por que este é somente "
 "leitura"
 
-#: mcs/mcs/expression.cs:7064
+#: mcs/mcs/expression.cs:7065
 msgid "Cannot pass `this' as a ref or out argument because it is read-only"
 msgstr ""
 "Não foi possível passar \"thus\" com uma ref ou argumento out por que este é "
 "somente leitura"
 
-#: mcs/mcs/expression.cs:7066
+#: mcs/mcs/expression.cs:7067
 msgid "Cannot assign to `this' because it is read-only"
 msgstr "Não foi possível atribuir para \"this\" por que este é somente leitura"
 
-#: mcs/mcs/expression.cs:7138
+#: mcs/mcs/expression.cs:7139
 msgid "The __arglist construct is valid only within a variable argument method"
 msgstr ""
 
-#: mcs/mcs/expression.cs:7199
+#: mcs/mcs/expression.cs:7200
 msgid "An expression tree cannot contain a method with variable arguments"
 msgstr ""
 "Uma árvore de expressão não pode conter um método com argumentos variáveis"
 
-#: mcs/mcs/expression.cs:7436
+#: mcs/mcs/expression.cs:7437
 #, fuzzy
 msgid "The typeof operator cannot be used on the dynamic type"
 msgstr ""
 "O operador \"{0}\" não pode ser aplicado a um operando de tipo estático"
 
-#: mcs/mcs/expression.cs:7477
+#: mcs/mcs/expression.cs:7478
 #, csharp-format
 msgid "`{0}': an attribute argument cannot use type parameters"
 msgstr "\"{0}\": um argumento de atributo não pode usar parâmetros de tipo"
 
-#: mcs/mcs/expression.cs:7692
+#: mcs/mcs/expression.cs:7693
 #, csharp-format
 msgid ""
 "`{0}' does not have a predefined size, therefore sizeof can only be used in "
@@ -2206,12 +2205,12 @@ msgstr ""
 "utilizado em um contexto inseguro (consider utilizar System.Runtime."
 "InteropServices.Marshal.SizeOf)"
 
-#: mcs/mcs/expression.cs:7759
+#: mcs/mcs/expression.cs:7760
 #, csharp-format
 msgid "Alias `{0}' not found"
 msgstr "Apelido \"{0}\" não encontrado"
 
-#: mcs/mcs/expression.cs:7785
+#: mcs/mcs/expression.cs:7786
 #, fuzzy
 msgid ""
 "The namespace alias qualifier `::' cannot be used to invoke a method. "
@@ -2220,25 +2219,27 @@ msgstr ""
 "O qualificador de apelidos do namespace \"{0}\" não resolveu para um "
 "namespace ou um tipo"
 
-#: mcs/mcs/expression.cs:7894
+#: mcs/mcs/expression.cs:7895
 msgid "Cannot perform member binding on `null' value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8057
-#, csharp-format
-msgid "`{0}': cannot reference a type through an expression; try `{1}' instead"
+#: mcs/mcs/expression.cs:8068
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': cannot reference a type through an expression. Consider using `{1}' "
+"instead"
 msgstr ""
 "\"{0}\" não pôde referenciar um tipo através de uma expressão; tente, ao "
 "invés, \"{1}\""
 
-#: mcs/mcs/expression.cs:8138
+#: mcs/mcs/expression.cs:8147
 #, csharp-format
 msgid "A nested type cannot be specified through a type parameter `{0}'"
 msgstr ""
 "Um tipo aninhado não pode ser especificado através de um tipo parâmetro "
 "\"{0}\""
 
-#: mcs/mcs/expression.cs:8146
+#: mcs/mcs/expression.cs:8155
 #, fuzzy, csharp-format
 msgid ""
 "Alias `{0}' cannot be used with `::' since it denotes a type. Consider "
@@ -2247,63 +2248,62 @@ msgstr ""
 "Apelido \"{0}\" não pôde ser utilizado com \"::\" pois denota um tipo. "
 "Considere substituir \"::\" com \".\""
 
-#: mcs/mcs/expression.cs:8211
+#: mcs/mcs/expression.cs:8220
 #, csharp-format
 msgid "The nested type `{0}' does not exist in the type `{1}'"
 msgstr "O tipo aninhado \"{0}\" não existe no tipo \"{1}\""
 
-#: mcs/mcs/expression.cs:8220
-#, csharp-format
+#: mcs/mcs/expression.cs:8239
+#, fuzzy, csharp-format
 msgid ""
 "Type `{0}' does not contain a definition for `{1}' and no extension method `"
-"{1}' of type `{0}' could be found (are you missing a using directive or an "
-"assembly reference?)"
+"{1}' of type `{0}' could be found. Are you missing {2}?"
 msgstr ""
 "O tipo \"{0}\" não contém uma definição para \"{1}\" e nenhuma extensão de "
 "método \"{1}\" do tipo \"{0}\" pôde ser encontrada (você está esquecendo uma "
 "diretiva em uso ou uma referência do assembly?)"
 
-#: mcs/mcs/expression.cs:8432
+#: mcs/mcs/expression.cs:8451
 #, csharp-format
 msgid "Cannot apply indexing with [] to an expression of type `{0}'"
 msgstr ""
 "Não foi possível aplicar uma indexação com [] para uma expressão do tipo "
 "\"{0}\""
 
-#: mcs/mcs/expression.cs:8450
+#: mcs/mcs/expression.cs:8469
 msgid "A pointer must be indexed by only one value"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8504
+#: mcs/mcs/expression.cs:8518
 msgid "An element access expression cannot use named argument"
 msgstr ""
 
-#: mcs/mcs/expression.cs:8582
+#: mcs/mcs/expression.cs:8596
 #, csharp-format
 msgid "Wrong number of indexes `{0}' inside [], expected `{1}'"
 msgstr "Número incorreto de índices \"{0}\" dentro de [], esperados \"{1}\""
 
-#: mcs/mcs/expression.cs:8970
+#: mcs/mcs/expression.cs:8984
 msgid ""
 "The indexer base access cannot be dynamically dispatched. Consider casting "
 "the dynamic arguments or eliminating the base access"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9055
+#: mcs/mcs/expression.cs:9069
 msgid "An expression tree may not contain a base access"
 msgstr "Uma árvore de expressão não deve conter uma acesso de base"
 
-#: mcs/mcs/expression.cs:9073
+#: mcs/mcs/expression.cs:9087
 #, fuzzy
 msgid "Keyword `base' is not available in a static method"
 msgstr "Palavra chave \"new\" não é permitida em elementos do namespace"
 
-#: mcs/mcs/expression.cs:9075
+#: mcs/mcs/expression.cs:9089
 #, fuzzy
 msgid "Keyword `base' is not available in the current context"
 msgstr "O nome \"{0}\" não existe no contexto atual"
 
-#: mcs/mcs/expression.cs:9113
+#: mcs/mcs/expression.cs:9127
 #, fuzzy
 msgid ""
 "A property, indexer or dynamic member access may not be passed as `ref' or "
@@ -2312,25 +2312,25 @@ msgstr ""
 "Uma propriedade ou indexador \"{0}\" não deve ser passada como parâmetos "
 "\"ref\" ou \"out\""
 
-#: mcs/mcs/expression.cs:9438
+#: mcs/mcs/expression.cs:9455
 #, csharp-format
 msgid "Array elements cannot be of type `{0}'"
 msgstr "Elementos de array não podem ser do tipo \"{0}\""
 
-#: mcs/mcs/expression.cs:9441
+#: mcs/mcs/expression.cs:9458
 #, csharp-format
 msgid "Array elements cannot be of static type `{0}'"
 msgstr "Elementos de array não podem ser do tipo estático \"{0}\""
 
-#: mcs/mcs/expression.cs:9617
+#: mcs/mcs/expression.cs:9634
 msgid "Cannot use a negative size with stackalloc"
 msgstr "Não é possível utilizar um tamanho negativo com stackalloc"
 
-#: mcs/mcs/expression.cs:9621
+#: mcs/mcs/expression.cs:9638
 msgid "Cannot use stackalloc in finally or catch"
 msgstr ""
 
-#: mcs/mcs/expression.cs:9738
+#: mcs/mcs/expression.cs:9755
 #, csharp-format
 msgid ""
 "Member `{0}' cannot be initialized. An object initializer may only be used "
@@ -2339,7 +2339,7 @@ msgstr ""
 "Membro \"{0}\" não pode ser inicializado. Um inicializador de objetos pode "
 "apenas ser utilizado para campos, ou propriedades"
 
-#: mcs/mcs/expression.cs:9747
+#: mcs/mcs/expression.cs:9764
 #, fuzzy, csharp-format
 msgid ""
 "Static field or property `{0}' cannot be assigned in an object initializer"
@@ -2347,7 +2347,7 @@ msgstr ""
 " Campo estático ou propriedade \"{0}\" não podem ser atribuídas a um "
 "inicializador de objeto"
 
-#: mcs/mcs/expression.cs:9946
+#: mcs/mcs/expression.cs:9963
 #, csharp-format
 msgid ""
 "A field or property `{0}' cannot be initialized with a collection object "
@@ -2357,30 +2357,30 @@ msgstr ""
 "inicializador de coleção de objetos porque o tipo \"{1}\" não implementa a "
 "interface \"{2}\""
 
-#: mcs/mcs/expression.cs:9957
+#: mcs/mcs/expression.cs:9974
 #, csharp-format
 msgid "Inconsistent `{0}' member declaration"
 msgstr "Declaração do membro \"{0}\" inconsistente"
 
-#: mcs/mcs/expression.cs:9965
+#: mcs/mcs/expression.cs:9982
 #, csharp-format
 msgid ""
 "An object initializer includes more than one member `{0}' initialization"
 msgstr ""
 "Um inicializador de objeto inclui mais que um membro \"{0}\" de inicialização"
 
-#: mcs/mcs/expression.cs:9983
+#: mcs/mcs/expression.cs:10000
 #, csharp-format
 msgid "Cannot initialize object of type `{0}' with a collection initializer"
 msgstr ""
 "Não foi possível inicializar objetos do tipo \"{0}\" com um inicializador de "
 "coleções"
 
-#: mcs/mcs/expression.cs:10268
+#: mcs/mcs/expression.cs:10285
 msgid "Anonymous types cannot be used in this expression"
 msgstr "Tipos anônimos não podem ser utilizados nesta expressão"
 
-#: mcs/mcs/expression.cs:10367
+#: mcs/mcs/expression.cs:10384
 #, csharp-format
 msgid "An anonymous type property `{0}' cannot be initialized with `{1}'"
 msgstr ""
@@ -2458,12 +2458,12 @@ msgstr ""
 "Buffer de tamanho fixo \"{0}\" de comprimento \"{1}\" e tipo \"{2}\" excedeu "
 "o limite de 2^31"
 
-#: mcs/mcs/field.cs:667
+#: mcs/mcs/field.cs:666
 #, csharp-format
 msgid "`{0}': A volatile field cannot be of the type `{1}'"
 msgstr "\"{0}\": Um campo volátil não pode ser do tipo \"{1}\""
 
-#: mcs/mcs/field.cs:672
+#: mcs/mcs/field.cs:671
 #, csharp-format
 msgid "`{0}': A field cannot be both volatile and readonly"
 msgstr ""
@@ -2529,7 +2529,7 @@ msgid "Cannot yield in the body of a finally clause"
 msgstr "Não foi possível deixar no corpo uma cláusula final"
 
 #: mcs/mcs/flowanalysis.cs:996 mcs/mcs/flowanalysis.cs:1012
-#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:782
+#: mcs/mcs/flowanalysis.cs:1048 mcs/mcs/statement.cs:795
 msgid "Control cannot leave the body of a finally clause"
 msgstr "O controle não pode deixar o corpo de uma cláusula final"
 
@@ -2638,27 +2638,27 @@ msgstr ""
 "\"{0}\" não é uma restrição válida. Classes estáticas não pode ser "
 "utilizadas como restrições"
 
-#: mcs/mcs/generic.cs:601
+#: mcs/mcs/generic.cs:613
 #, fuzzy, csharp-format
 msgid "The {2} type parameter `{0}' must be {3} valid on `{1}{4}'"
 msgstr "O nome do tipo parâmetro \"{0}\" é o mesmo que \"{1}\""
 
-#: mcs/mcs/generic.cs:1974
+#: mcs/mcs/generic.cs:2032
 #, csharp-format
 msgid "`{0}': static classes cannot be used as generic arguments"
 msgstr ""
 "\"{0}\": classes estáticas não podem ser utilizadas como argumentos genéricos"
 
-#: mcs/mcs/generic.cs:1981
+#: mcs/mcs/generic.cs:2039
 #, csharp-format
 msgid "The type `{0}' may not be used as a type argument"
 msgstr "O tipo \"{0}\" não deve ser utilizado como um tipo argumento"
 
-#: mcs/mcs/generic.cs:2075
+#: mcs/mcs/generic.cs:2133
 msgid "Variant type parameters can only be used with interfaces and delegates"
 msgstr ""
 
-#: mcs/mcs/generic.cs:2314
+#: mcs/mcs/generic.cs:2354
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' must be a reference type in order to use it as type parameter "
@@ -2667,7 +2667,7 @@ msgstr ""
 "O tipo \"{0}\" deve ser uma refêrencia de tipo para poder utilizá-lo como o "
 "tipo parâmetro \"{1}\" no tipo genérico ou método \"{2}\"."
 
-#: mcs/mcs/generic.cs:2324
+#: mcs/mcs/generic.cs:2364
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' must be a non-nullable value type in order to use it as type "
@@ -2676,7 +2676,7 @@ msgstr ""
 "O tipo \"{0}\" deve ser um tipo de valor não NULL para poder utilizá-lo como "
 "tipo parâmetro \"{1}\" no tipo genérico ou método \"{2}\"."
 
-#: mcs/mcs/generic.cs:2383
+#: mcs/mcs/generic.cs:2423
 #, csharp-format
 msgid ""
 "The type `{0}' must have a public parameterless constructor in order to use "
@@ -2685,7 +2685,7 @@ msgstr ""
 "O tipo \"{0}\" deve ter um construtor público sem parâmetros para poder "
 "utilizá-lo como parâmetro \"{1}\" no tipo genérico ou método \"{2}\""
 
-#: mcs/mcs/generic.cs:2451
+#: mcs/mcs/generic.cs:2479
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2696,7 +2696,7 @@ msgstr ""
 "genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
 "restrição de interface do tipo \"{3}\""
 
-#: mcs/mcs/generic.cs:2457
+#: mcs/mcs/generic.cs:2485
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2707,7 +2707,7 @@ msgstr ""
 "genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
 "restrição de interface do tipo \"{3}\""
 
-#: mcs/mcs/generic.cs:2461
+#: mcs/mcs/generic.cs:2489
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2717,7 +2717,7 @@ msgstr ""
 "genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
 "restrição de interface do tipo \"{3}\""
 
-#: mcs/mcs/generic.cs:2466
+#: mcs/mcs/generic.cs:2494
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2727,7 +2727,7 @@ msgstr ""
 "genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
 "restrição de interface do tipo \"{3}\""
 
-#: mcs/mcs/generic.cs:2471
+#: mcs/mcs/generic.cs:2499
 #, fuzzy, csharp-format
 msgid ""
 "The type `{0}' cannot be used as type parameter `{1}' in the generic type or "
@@ -2737,21 +2737,28 @@ msgstr ""
 "genérico ou método \"{2}\". O tipo anulável \"{0}\" nunca satisfaz a "
 "restrição de interface do tipo \"{3}\""
 
-#: mcs/mcs/import.cs:1818
+#: mcs/mcs/import.cs:1868
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined in this assembly, but it is not "
 "defined in source or any added modules"
 msgstr ""
 
-#: mcs/mcs/import.cs:1822
+#: mcs/mcs/import.cs:1873
+#, csharp-format
+msgid ""
+"The type `{0}' has been forwarded to an assembly that is not referenced. "
+"Consider adding a reference to assembly `{1}'"
+msgstr ""
+
+#: mcs/mcs/import.cs:1877
 #, csharp-format
 msgid ""
 "The type `{0}' is defined in an assembly that is not referenced. Consider "
 "adding a reference to assembly `{1}'"
 msgstr ""
 
-#: mcs/mcs/import.cs:1826
+#: mcs/mcs/import.cs:1882
 #, csharp-format
 msgid ""
 "Reference to type `{0}' claims it is defined assembly `{1}', but it could "
@@ -2784,36 +2791,36 @@ msgstr "__arglist não é permitida em parâmetros de listas de iteradores"
 msgid "Iterators cannot have unsafe parameters or yield types"
 msgstr "Iteradores não podem ter parâmetros inseguros ou tipos yield"
 
-#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4950
+#: mcs/mcs/iterators.cs:1132 mcs/mcs/statement.cs:4987
 msgid "Unsafe code may not appear in iterators"
 msgstr "Código inseguro não pode aparecer em iteradores"
 
-#: mcs/mcs/ikvm.cs:236
+#: mcs/mcs/ikvm.cs:266
 msgid "SDK path could not be resolved"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:314
+#: mcs/mcs/ikvm.cs:344
 #, csharp-format
 msgid ""
 "Assembly `{0}' references `{1}' which has a higher version number than "
 "imported assembly `{2}'"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:323 mcs/mcs/ikvm.cs:327
+#: mcs/mcs/ikvm.cs:353 mcs/mcs/ikvm.cs:357
 #, csharp-format
 msgid ""
 "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to "
 "supply runtime policy"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:413
+#: mcs/mcs/ikvm.cs:444
 #, csharp-format
 msgid ""
 "An assembly with the same name `{0}' has already been imported. Consider "
 "removing one of the references or sign the assembly"
 msgstr ""
 
-#: mcs/mcs/ikvm.cs:422
+#: mcs/mcs/ikvm.cs:453
 #, csharp-format
 msgid ""
 "An assembly with the same identity `{0}' has already been imported. Consider "
@@ -2926,7 +2933,7 @@ msgstr ""
 "Literal do tipo double não pode ser implicitamente convertido para o tipo "
 "\"{0}\". Adicione o sufixo \"{1}\" para criar um literal desse tipo"
 
-#: mcs/mcs/membercache.cs:1388
+#: mcs/mcs/membercache.cs:1391
 msgid ""
 "A partial method declaration and partial method implementation cannot differ "
 "on use of `params' modifier"
@@ -2934,7 +2941,7 @@ msgstr ""
 "Uma declaração de método parcial e uma implementação de método parcial não "
 "podem diferir no uso do modificador \"params\""
 
-#: mcs/mcs/membercache.cs:1391
+#: mcs/mcs/membercache.cs:1394
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "an extension method or neither"
@@ -2942,7 +2949,7 @@ msgstr ""
 "Uma declaração de método parcial e uma implementação de método parcial ou "
 "devem ser ambas um método de extenção ou ambas não serem"
 
-#: mcs/mcs/membercache.cs:1395
+#: mcs/mcs/membercache.cs:1398
 #, fuzzy, csharp-format
 msgid ""
 "Overloaded contructor `{0}' cannot differ on use of parameter modifiers only"
@@ -2950,7 +2957,7 @@ msgstr ""
 "Um método sobrecarregado \"{0}\" não pode diferir no uso de modificadores de "
 "parâmetros somente"
 
-#: mcs/mcs/membercache.cs:1399
+#: mcs/mcs/membercache.cs:1402
 #, fuzzy, csharp-format
 msgid ""
 "Overloaded method `{0}' cannot differ on use of parameter modifiers only"
@@ -2958,7 +2965,7 @@ msgstr ""
 "Um método sobrecarregado \"{0}\" não pode diferir no uso de modificadores de "
 "parâmetros somente"
 
-#: mcs/mcs/membercache.cs:1431
+#: mcs/mcs/membercache.cs:1434
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`static' or neither"
@@ -2966,7 +2973,7 @@ msgstr ""
 "Uma declaração de método parcial e uma implementação de método parcial ou "
 "devem ser ambas estáticas ou ambas não serem"
 
-#: mcs/mcs/membercache.cs:1436
+#: mcs/mcs/membercache.cs:1439
 msgid ""
 "A partial method declaration and partial method implementation must be both "
 "`unsafe' or neither"
@@ -2974,27 +2981,27 @@ msgstr ""
 "Uma declaração de método parcial e uma implementação de método parcial ou "
 "devem ser ambas inseguras ou ambas não serem"
 
-#: mcs/mcs/membercache.cs:1442
+#: mcs/mcs/membercache.cs:1445
 #, csharp-format
 msgid "A partial method `{0}' declaration is already defined"
 msgstr "Uma declaração do método parcial \"{0}\" já está definida"
 
-#: mcs/mcs/membercache.cs:1446
+#: mcs/mcs/membercache.cs:1449
 #, csharp-format
 msgid "A partial method `{0}' implementation is already defined"
 msgstr "Uma implementação do método parcial \"{0}\" já esa definido"
 
-#: mcs/mcs/membercache.cs:1457 mcs/mcs/property.cs:81
+#: mcs/mcs/membercache.cs:1460 mcs/mcs/property.cs:81
 #, csharp-format
 msgid "A member `{0}' is already reserved"
 msgstr "Um membro \"{0}\" já está reservado"
 
-#: mcs/mcs/membercache.cs:1468
+#: mcs/mcs/membercache.cs:1471
 #, csharp-format
 msgid "Duplicate user-defined conversion in type `{0}'"
 msgstr "Conversão definida pelo usuário duplicada no topo \"{0}\""
 
-#: mcs/mcs/membercache.cs:1474
+#: mcs/mcs/membercache.cs:1477
 #, csharp-format
 msgid ""
 "A member `{0}' is already defined. Rename this member or use different "
@@ -3003,12 +3010,12 @@ msgstr ""
 "Um membro \"{0}\" já está definido. Renomeie esse membro ou use tipos de "
 "parâmetros distintos"
 
-#: mcs/mcs/method.cs:552
+#: mcs/mcs/method.cs:558
 #, csharp-format
 msgid "`{0}': Async methods cannot use `MethodImplOptions.Synchronized'"
 msgstr ""
 
-#: mcs/mcs/method.cs:560
+#: mcs/mcs/method.cs:566
 msgid ""
 "The DllImport attribute must be specified on a method marked `static' and "
 "`extern'"
@@ -3016,14 +3023,14 @@ msgstr ""
 "O atributo DllImport deve ser especificado em um método marcado \"estático\" "
 "e \"externo\""
 
-#: mcs/mcs/method.cs:655
+#: mcs/mcs/method.cs:661
 #, csharp-format
 msgid "`{0}': A partial method parameters cannot use `out' modifier"
 msgstr ""
 "\"{0}\": Os parâmetros parciais de um método não podem utilizar o "
 "modificador \"out\""
 
-#: mcs/mcs/method.cs:716
+#: mcs/mcs/method.cs:722
 #, csharp-format
 msgid ""
 "Conditional not valid on `{0}' because it is a constructor, destructor, "
@@ -3032,15 +3039,6 @@ msgstr ""
 "Condicional inválido em \"{0}\" por que é um construtor, destrutor, operador "
 "ou interface explícita de implementação"
 
-#: mcs/mcs/method.cs:855
-#, fuzzy, csharp-format
-msgid ""
-"`{0}': Cannot specify constraints for overrides and explicit interface "
-"implementation methods"
-msgstr ""
-"\"{0}\": Não foi possível especificar restrições para sobrescritos ou "
-"métodos de implementação explícitos de interface"
-
 #: mcs/mcs/method.cs:865
 msgid ""
 "A partial method cannot define access modifier or any of abstract, extern, "
@@ -3103,13 +3101,13 @@ msgstr ""
 msgid "The return type of an async method must be void, Task, or Task<T>"
 msgstr ""
 
-#: mcs/mcs/method.cs:1224
+#: mcs/mcs/method.cs:1227
 #, csharp-format
 msgid "`{0}': Extension methods cannot be defined in a nested class"
 msgstr ""
 "\"{0}\": Métodos de extensão não podem ser definidos em uma classe aninhada"
 
-#: mcs/mcs/method.cs:1230
+#: mcs/mcs/method.cs:1233
 #, csharp-format
 msgid ""
 "`{0}': Extension methods require `System.Runtime.CompilerServices."
@@ -3117,19 +3115,19 @@ msgid ""
 "reference?"
 msgstr ""
 
-#: mcs/mcs/method.cs:1239
+#: mcs/mcs/method.cs:1242
 #, csharp-format
 msgid "`{0}': Extension methods must be defined in a non-generic static class"
 msgstr ""
 "\"{0}\": Métodos de estensão devem ser definidos em uma classe estática não-"
 "genérica"
 
-#: mcs/mcs/method.cs:1255
+#: mcs/mcs/method.cs:1258
 #, fuzzy, csharp-format
 msgid "`{0}': an entry point cannot be async method"
 msgstr "\"{0}\": tipos estáticos não podem ser utilizados como parâmetros"
 
-#: mcs/mcs/method.cs:1292
+#: mcs/mcs/method.cs:1295
 #, csharp-format
 msgid ""
 "A partial method `{0}' implementation is missing a partial method declaration"
@@ -3137,37 +3135,37 @@ msgstr ""
 "Na implementação do método parcial \"{0}\" está faltando a declaração do "
 "método parcial"
 
-#: mcs/mcs/method.cs:1325
+#: mcs/mcs/method.cs:1336
 #, csharp-format
 msgid "Method or delegate cannot return type `{0}'"
 msgstr "Método ou delegate não podem ter um tipo de retorno \"{0}\""
 
-#: mcs/mcs/method.cs:1404
+#: mcs/mcs/method.cs:1415
 msgid ""
 "The constructor call cannot be dynamically dispatched within constructor "
 "initializer"
 msgstr ""
 
-#: mcs/mcs/method.cs:1418
+#: mcs/mcs/method.cs:1429
 #, csharp-format
 msgid "`{0}': Struct constructors cannot call base constructors"
 msgstr "\"{0}\": Construtores de structs não podem chamar construtores da base"
 
-#: mcs/mcs/method.cs:1436
+#: mcs/mcs/method.cs:1447
 #, csharp-format
 msgid "Constructor `{0}' cannot call itself"
 msgstr "Construtor \"{0}\" não pode chamar a si mesmo"
 
-#: mcs/mcs/method.cs:1565
+#: mcs/mcs/method.cs:1576
 #, csharp-format
 msgid "`{0}': The static constructor must be parameterless"
 msgstr "\"{0}\": O construtor estático não deve ter parâmetros"
 
-#: mcs/mcs/method.cs:1586
+#: mcs/mcs/method.cs:1597
 msgid "Structs cannot contain explicit parameterless constructors"
 msgstr "Structs não podem conter construtores explícitos sem parâmetros"
 
-#: mcs/mcs/method.cs:1636
+#: mcs/mcs/method.cs:1652
 #, csharp-format
 msgid ""
 "`{0}': A class with the ComImport attribute cannot have a user-defined "
@@ -3176,19 +3174,19 @@ msgstr ""
 "\"{0}\": Uma classe com o atributo ComImport não pode ter um construtor "
 "definido pelo usuário"
 
-#: mcs/mcs/method.cs:1886
+#: mcs/mcs/method.cs:1902
 #, csharp-format
 msgid "`{0}' is an accessor not found in interface member `{1}{2}'"
 msgstr "\"{0}\" é um acessor não encontrado no membro da interface \"{1}{2}\""
 
-#: mcs/mcs/method.cs:1892
+#: mcs/mcs/method.cs:1908
 #, csharp-format
 msgid ""
 "`{0}.{1}' in explicit interface declaration is not a member of interface"
 msgstr ""
 "\"{0}.{1}\" na declaração da interface explícita não é um membro da interface"
 
-#: mcs/mcs/method.cs:1900
+#: mcs/mcs/method.cs:1916
 #, csharp-format
 msgid ""
 "`{0}' explicit method implementation cannot implement `{1}' because it is an "
@@ -3197,12 +3195,12 @@ msgstr ""
 "\"{0}\" implementação de método explícito não pode implementar \"{1}\" "
 "porque é um acessor"
 
-#: mcs/mcs/method.cs:1910
+#: mcs/mcs/method.cs:1926
 #, fuzzy, csharp-format
 msgid "Method `{0}' cannot implement interface accessor `{1}'"
 msgstr "Método \"{0}\" não pode implementar acessor de interface \"{1}.{2}\""
 
-#: mcs/mcs/method.cs:1917
+#: mcs/mcs/method.cs:1933
 #, csharp-format
 msgid ""
 "Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use "
@@ -3211,7 +3209,7 @@ msgstr ""
 "Acessor \"{0}\" não pode implementar o membro da interface \"{1}\" para o "
 "tipo \"{2}\". Utilize uma implementação explícita da interface"
 
-#: mcs/mcs/method.cs:1924
+#: mcs/mcs/method.cs:1940
 #, csharp-format
 msgid ""
 "Accessor `{0}' must be declared public to implement interface member `{1}'"
@@ -3219,7 +3217,7 @@ msgstr ""
 "Acessor \"{0}\" deve ser declarado público para implementar o membro da "
 "interface \"{1}\""
 
-#: mcs/mcs/method.cs:1944
+#: mcs/mcs/method.cs:1960
 #, csharp-format
 msgid ""
 "`{0}': the explicit interface implementation cannot introduce the params "
@@ -3228,7 +3226,7 @@ msgstr ""
 "\"{0}\": a implementação explicita da interface não pode fornecer o "
 "modificador de parâmetros"
 
-#: mcs/mcs/method.cs:2282
+#: mcs/mcs/method.cs:2308
 #, csharp-format
 msgid ""
 "Attribute `{0}' is not valid on property or event accessors. It is valid on `"
@@ -3237,13 +3235,13 @@ msgstr ""
 "Atributo \"{0}\" não é válido em propriedade ou acessores de evento. É "
 "válido nas declarações \"{1}\" somente"
 
-#: mcs/mcs/method.cs:2510
+#: mcs/mcs/method.cs:2536
 #, csharp-format
 msgid "User-defined operator `{0}' must be declared static and public"
 msgstr ""
 "Operador definido pelo usuário \"{0}\" deve ser declarado estático e público"
 
-#: mcs/mcs/method.cs:2549
+#: mcs/mcs/method.cs:2580
 msgid ""
 "User-defined operator cannot take an object of the enclosing type and "
 "convert to an object of the enclosing type"
@@ -3251,13 +3249,13 @@ msgstr ""
 "Operador definido pelo usuário não pode pegar um objeto de um tipo no qual "
 "está definido e converter para um objeto deste tipo"
 
-#: mcs/mcs/method.cs:2560
+#: mcs/mcs/method.cs:2591
 msgid "User-defined conversion must convert to or from the enclosing type"
 msgstr ""
 "Converção definida pela usuário deve conver para ou a partir de um tipo no "
 "qual está definido"
 
-#: mcs/mcs/method.cs:2566
+#: mcs/mcs/method.cs:2597
 #, fuzzy, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from the dynamic type"
@@ -3265,7 +3263,7 @@ msgstr ""
 "Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
 "de um tipo de interface"
 
-#: mcs/mcs/method.cs:2573
+#: mcs/mcs/method.cs:2604
 #, csharp-format
 msgid ""
 "User-defined conversion `{0}' cannot convert to or from an interface type"
@@ -3273,21 +3271,21 @@ msgstr ""
 "Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
 "de um tipo de interface"
 
-#: mcs/mcs/method.cs:2580
+#: mcs/mcs/method.cs:2611
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a base class"
 msgstr ""
 "Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
 "de uma classe base"
 
-#: mcs/mcs/method.cs:2586
+#: mcs/mcs/method.cs:2617
 #, csharp-format
 msgid "User-defined conversion `{0}' cannot convert to or from a derived class"
 msgstr ""
 "Conversão definida pelo usuário \"{0}\" não pode converter para ou a partir "
 "de uma classe derivada"
 
-#: mcs/mcs/method.cs:2593
+#: mcs/mcs/method.cs:2624
 msgid ""
 "Overloaded shift operator must have the type of the first operand be the "
 "containing type, and the type of the second operand must be int"
@@ -3295,7 +3293,7 @@ msgstr ""
 "Operador de shift sobrecarregado deve ter o tipo do primeiro operando como "
 "sendo o próprio tipo, e o tipo do segundo operando deve ser int"
 
-#: mcs/mcs/method.cs:2602
+#: mcs/mcs/method.cs:2633
 msgid ""
 "The return type for ++ or -- operator must be the containing type or derived "
 "from the containing type"
@@ -3303,19 +3301,19 @@ msgstr ""
 "O tipo de retorno para o operador ++ ou -- deve ser do próprio tipo ou "
 "derivadodo próprio tipo"
 
-#: mcs/mcs/method.cs:2607
+#: mcs/mcs/method.cs:2638
 msgid "The parameter type for ++ or -- operator must be the containing type"
 msgstr "O tipo de parâmetro para o operador ++ ou -- deve ser do próprio tipo"
 
-#: mcs/mcs/method.cs:2614
+#: mcs/mcs/method.cs:2645
 msgid "The parameter type of a unary operator must be the containing type"
 msgstr "O tipo de parâmetro de um operador unário deve ser do próprio tipo"
 
-#: mcs/mcs/method.cs:2622
+#: mcs/mcs/method.cs:2653
 msgid "The return type of operator True or False must be bool"
 msgstr "O tipo de retorno do operador True ou False deve ser bool"
 
-#: mcs/mcs/method.cs:2637
+#: mcs/mcs/method.cs:2668
 msgid "One of the parameters of a binary operator must be the containing type"
 msgstr "Um dos parâmetros de um operador binário deve ser do próprio tipo"
 
@@ -3324,30 +3322,30 @@ msgstr "Um dos parâmetros de um operador binário deve ser do próprio tipo"
 msgid "The modifier `{0}' is not valid for this item"
 msgstr "Código de página \"{0}\" é inválido ou não está instalado"
 
-#: mcs/mcs/namespace.cs:186
-#, csharp-format
+#: mcs/mcs/namespace.cs:263
+#, fuzzy, csharp-format
 msgid ""
-"The type or namespace name `{0}' could not be found in the global namespace "
-"(are you missing an assembly reference?)"
+"The type or namespace name `{0}' could not be found in the global namespace. "
+"Are you missing {1} assembly reference?"
 msgstr ""
 "O tipo ou nome de namespace \"{0}\" não pôde ser encontrado no namespace "
 "global (você não está esquecendo de uma referência do assembly?)"
 
-#: mcs/mcs/namespace.cs:190
-#, csharp-format
+#: mcs/mcs/namespace.cs:267
+#, fuzzy, csharp-format
 msgid ""
 "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are "
-"you missing an assembly reference?"
+"you missing {2} assembly reference?"
 msgstr ""
 "O tipo ou nome do namespace \"{0}\" não existe no namespace \"{1}\". Você "
 "não está esquecendo de uma referência do assembly?"
 
-#: mcs/mcs/namespace.cs:284
+#: mcs/mcs/namespace.cs:367
 #, csharp-format
 msgid "The imported type `{0}' is defined multiple times"
 msgstr "O tipo importado \"{0}\" é definido múltiplas vezes"
 
-#: mcs/mcs/namespace.cs:749 mcs/mcs/namespace.cs:761
+#: mcs/mcs/namespace.cs:839 mcs/mcs/namespace.cs:851
 msgid ""
 "A using clause must precede all other namespace elements except extern alias "
 "declarations"
@@ -3355,37 +3353,28 @@ msgstr ""
 "Uma cláusula em uso deve preceder todos os outros elementos do namespace, "
 "exceto declarações de alias externos"
 
-#: mcs/mcs/namespace.cs:777
+#: mcs/mcs/namespace.cs:867
 #, csharp-format
 msgid "The using alias `{0}' appeared previously in this namespace"
 msgstr "O alias em uso \"{0}\" apareceu antes neste namespace"
 
-#: mcs/mcs/namespace.cs:815
+#: mcs/mcs/namespace.cs:905 mcs/mcs/namespace.cs:928
 #, csharp-format
 msgid "The namespace `{0}' already contains a definition for `{1}'"
 msgstr "O namespace \"{0}\" já contém uma definição para \"{1}\""
 
-#: mcs/mcs/namespace.cs:1037
+#: mcs/mcs/namespace.cs:1147
 #, csharp-format
 msgid "Namespace `{0}' contains a definition with same name as alias `{1}'"
 msgstr ""
 "O namespace \"{0}\" contém uma definição com o mesmo nome do alias \"{1}\""
 
-#: mcs/mcs/namespace.cs:1089
+#: mcs/mcs/namespace.cs:1199
 #, csharp-format
 msgid "`{0}' is an ambiguous reference between `{1}' and `{2}'"
 msgstr "\"{0}\" é uma referência ambígua entre \"{1}\" e \"{2}\""
 
-#: mcs/mcs/namespace.cs:1115
-#, csharp-format
-msgid ""
-"The type or namespace name `{0}' could not be found. Are you missing a using "
-"directive or an assembly reference?"
-msgstr ""
-"O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
-"esquecendo de uma diretiva em uso ou uma referência do assembly?"
-
-#: mcs/mcs/namespace.cs:1317
+#: mcs/mcs/namespace.cs:1390
 #, csharp-format
 msgid ""
 "`{0}' is a type not a namespace. A using namespace directive can only be "
@@ -3394,7 +3383,7 @@ msgstr ""
 "\"{0}\" é um tipo e não um namespace. Uma diretiva de namespace em uso pode "
 "apenas ser aplicado a namespaces"
 
-#: mcs/mcs/namespace.cs:1336
+#: mcs/mcs/namespace.cs:1414
 #, csharp-format
 msgid "The extern alias `{0}' was not specified in -reference option"
 msgstr "O alias externo \"{0}\" não foi especificado na opção -reference"
@@ -3607,7 +3596,7 @@ msgstr ""
 msgid "`{0}': abstract properties cannot have private accessors"
 msgstr "\"{0}\": propriedades abstratas não podem ter acessores privados"
 
-#: mcs/mcs/property.cs:397
+#: mcs/mcs/property.cs:402
 #, csharp-format
 msgid ""
 "The accessibility modifier of the `{0}' accessor must be more restrictive "
@@ -3616,13 +3605,13 @@ msgstr ""
 "O modificador de acessibilidade do acessor \"{0}\" deve ser mais restritivo "
 "que o modificador da propriedade ou indexador \"{1}\""
 
-#: mcs/mcs/property.cs:506
+#: mcs/mcs/property.cs:511
 #, csharp-format
 msgid "Explicit interface implementation `{0}' is missing accessor `{1}'"
 msgstr ""
 "Implementação explícita de interface \"{0}\" está faltando acessor \"{1}\""
 
-#: mcs/mcs/property.cs:525
+#: mcs/mcs/property.cs:530
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable get "
@@ -3631,7 +3620,7 @@ msgstr ""
 "\"{0}.get\": não foi possível sobrescrever porque \"{1}\" não possui um "
 "acessor get que pode ser sobrescrito"
 
-#: mcs/mcs/property.cs:542
+#: mcs/mcs/property.cs:547
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': cannot override because `{1}' does not have an overridable set "
@@ -3640,7 +3629,7 @@ msgstr ""
 "\"{0}.set\": não foi possível substituir porque \"{1}\" não possui um "
 "acessor set que pode ser sobrescrito"
 
-#: mcs/mcs/property.cs:583
+#: mcs/mcs/property.cs:588
 #, csharp-format
 msgid ""
 "`{0}': Cannot specify accessibility modifiers for both accessors of the "
@@ -3649,7 +3638,7 @@ msgstr ""
 "\"{0}\": Não foi possível especificar modificadores de acessibilidade para "
 "ambos os acessores de propriedade ou indexadores"
 
-#: mcs/mcs/property.cs:590
+#: mcs/mcs/property.cs:595
 #, csharp-format
 msgid ""
 "`{0}': accessibility modifiers on accessors may only be used if the property "
@@ -3658,7 +3647,7 @@ msgstr ""
 "\"{0}\": modificadores de acessibilidade em acessores devem apenas ser "
 "utilizados se a propriedade ou indexador tiverem, ambas, um acessor get e set"
 
-#: mcs/mcs/property.cs:818
+#: mcs/mcs/property.cs:823
 #, csharp-format
 msgid ""
 "Automatically implemented property `{0}' cannot be used inside a type with "
@@ -3667,12 +3656,12 @@ msgstr ""
 "Propriedade implementada automaticamente \"{0}\" não pode ser utilizada "
 "dentro de um tipo com um atributo StructLayout explícito"
 
-#: mcs/mcs/property.cs:1305
+#: mcs/mcs/property.cs:1312
 #, csharp-format
 msgid "`{0}': event must be of a delegate type"
 msgstr "\"{0}\": evento deve ser de um tipo delegate"
 
-#: mcs/mcs/property.cs:1581
+#: mcs/mcs/property.cs:1588
 #, fuzzy, csharp-format
 msgid ""
 "The `{0}' attribute is valid only on an indexer that is not an explicit "
@@ -3681,7 +3670,7 @@ msgstr ""
 "O atributo \"IndexerName\" é válido somente em um indexador que não seja uma "
 "declaração explícita de um membro da interface"
 
-#: mcs/mcs/property.cs:1585
+#: mcs/mcs/property.cs:1592
 msgid "Cannot set the `IndexerName' attribute on an indexer marked override"
 msgstr ""
 "Não foi possível definir o atributo \"IndexerName\" em um indexador marcado "
@@ -3694,7 +3683,7 @@ msgstr ""
 "Valor especificado para o argumento ao \"System.Runtime.InteropServices."
 "DefaultCharSetAttribute\" não é válido"
 
-#: mcs/mcs/statement.cs:92
+#: mcs/mcs/statement.cs:100
 msgid ""
 "A lambda expression with statement body cannot be converted to an expresion "
 "tree"
@@ -3702,13 +3691,13 @@ msgstr ""
 "Uma expressão lambda com um corpo de declarações não pode ser convertida "
 "para uma árvore de expressão"
 
-#: mcs/mcs/statement.cs:845
+#: mcs/mcs/statement.cs:858
 #, csharp-format
 msgid ""
 "An object of a type convertible to `{0}' is required for the return statement"
 msgstr ""
 
-#: mcs/mcs/statement.cs:859 mcs/mcs/statement.cs:884
+#: mcs/mcs/statement.cs:872 mcs/mcs/statement.cs:896
 #, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by any expression when method "
@@ -3717,7 +3706,7 @@ msgstr ""
 "\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
 "quando o método retornar void"
 
-#: mcs/mcs/statement.cs:895
+#: mcs/mcs/statement.cs:907
 #, fuzzy, csharp-format
 msgid ""
 "`{0}': A return keyword must not be followed by an expression when async "
@@ -3726,14 +3715,23 @@ msgstr ""
 "\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
 "quando o método retornar void"
 
-#: mcs/mcs/statement.cs:905
+#: mcs/mcs/statement.cs:917
 #, csharp-format
 msgid ""
 "`{0}': The return expression type of async method must be `{1}' rather than "
 "`Task<{1}>'"
 msgstr ""
 
-#: mcs/mcs/statement.cs:929
+#: mcs/mcs/statement.cs:927
+#, fuzzy, csharp-format
+msgid ""
+"`{0}': A return keyword must not be followed by any expression when delegate "
+"returns void"
+msgstr ""
+"\"{0}\": Uma palavra chave return não deve ser seguida por nenhuma expressão "
+"quando o método retornar void"
+
+#: mcs/mcs/statement.cs:950
 #, csharp-format
 msgid ""
 "Cannot convert `{0}' to delegate type `{1}' because some of the return types "
@@ -3743,7 +3741,7 @@ msgstr ""
 "alguns dos tipos de retorno no bloco não são implicitamente conversíveis no "
 "tipo de retorno delegate"
 
-#: mcs/mcs/statement.cs:977
+#: mcs/mcs/statement.cs:998
 msgid ""
 "Cannot return a value from iterators. Use the yield return statement to "
 "return a value, or yield break to end the iteration"
@@ -3751,32 +3749,32 @@ msgstr ""
 "Não foi possível devolver um valor de iteradores. Use a declaração yield do "
 "return para devolver um valor, ou yield break para terminar a iteração"
 
-#: mcs/mcs/statement.cs:1149 mcs/mcs/statement.cs:1194
+#: mcs/mcs/statement.cs:1170 mcs/mcs/statement.cs:1215
 msgid "A goto case is only valid inside a switch statement"
 msgstr "Um case do goto é válido somente dentro de uma declaração switch"
 
-#: mcs/mcs/statement.cs:1282 mcs/mcs/statement.cs:5351
+#: mcs/mcs/statement.cs:1303 mcs/mcs/statement.cs:5388
 msgid "The type caught or thrown must be derived from System.Exception"
 msgstr ""
 
-#: mcs/mcs/statement.cs:1527
+#: mcs/mcs/statement.cs:1548
 msgid "A fixed statement cannot use an implicitly typed local variable"
 msgstr ""
 "Uma declaração fixa não pode utilizar uma variável local tipada "
 "implicitamente"
 
-#: mcs/mcs/statement.cs:1532
+#: mcs/mcs/statement.cs:1553
 msgid "An implicitly typed local variable cannot be a constant"
 msgstr "Uma variável local implicitamente tipada não pode ser uma constante"
 
-#: mcs/mcs/statement.cs:1537
+#: mcs/mcs/statement.cs:1558
 msgid ""
 "An implicitly typed local variable declarator must include an initializer"
 msgstr ""
 "Uma declaração de variável local tipada implicitamente deve incluir um "
 "inicializador"
 
-#: mcs/mcs/statement.cs:1542
+#: mcs/mcs/statement.cs:1563
 msgid ""
 "An implicitly typed local variable declaration cannot include multiple "
 "declarators"
@@ -3784,7 +3782,7 @@ msgstr ""
 "Uma declaração de variável local tipada implicitamente não pode incluir "
 "múltiplos declaradores"
 
-#: mcs/mcs/statement.cs:2164
+#: mcs/mcs/statement.cs:2185
 #, csharp-format
 msgid ""
 "A local variable named `{0}' cannot be declared in this scope because it "
@@ -3795,18 +3793,18 @@ msgstr ""
 "esta daria um significado distinto para \"{0}\", que já é usada em um escopo "
 "\"{1}\" para denotar outra coisa"
 
-#: mcs/mcs/statement.cs:2176
+#: mcs/mcs/statement.cs:2197
 #, csharp-format
 msgid "A local variable named `{0}' is already defined in this scope"
 msgstr "Uma variável local nomeada \"{0}\" já foi definida neste escopo"
 
-#: mcs/mcs/statement.cs:2183
+#: mcs/mcs/statement.cs:2204
 #, fuzzy, csharp-format
 msgid ""
 "The type parameter name `{0}' is the same as local variable or parameter name"
 msgstr "O nome do tipo parâmetro \"{0}\" é o mesmo que \"{1}\""
 
-#: mcs/mcs/statement.cs:2898
+#: mcs/mcs/statement.cs:2935
 #, csharp-format
 msgid ""
 "The out parameter `{0}' must be assigned to before control leaves the "
@@ -3815,75 +3813,75 @@ msgstr ""
 "O parâmetro externo \"{0}\" deve estar atribuída para antes que o controle "
 "deixe o método atual"
 
-#: mcs/mcs/statement.cs:3016
+#: mcs/mcs/statement.cs:3053
 #, csharp-format
 msgid "`{0}': not all code paths return a value"
 msgstr "\"{0}\": nem todos caminhos de códigos devolvem um valor"
 
-#: mcs/mcs/statement.cs:3033
+#: mcs/mcs/statement.cs:3070
 #, csharp-format
 msgid "Not all code paths return a value in anonymous method of type `{0}'"
 msgstr ""
 "Nem todos os caminhos de código devolvem um valor num método anônimo do tipo "
 "\"{0}\""
 
-#: mcs/mcs/statement.cs:3081
+#: mcs/mcs/statement.cs:3118
 #, fuzzy
 msgid "Async methods cannot have ref or out parameters"
 msgstr "Iteradores não podem ter parâmetros ref ou out"
 
-#: mcs/mcs/statement.cs:3087
+#: mcs/mcs/statement.cs:3124
 #, fuzzy
 msgid "__arglist is not allowed in parameter list of async methods"
 msgstr "__arglist não é permitida em parâmetros de listas de iteradores"
 
-#: mcs/mcs/statement.cs:3093
+#: mcs/mcs/statement.cs:3130
 #, fuzzy
 msgid "Async methods cannot have unsafe parameters"
 msgstr "Iteradores não podem ter parâmetros ref ou out"
 
-#: mcs/mcs/statement.cs:3288
+#: mcs/mcs/statement.cs:3325
 #, csharp-format
 msgid "The label `{0}' is a duplicate"
 msgstr "O rótulo \"{0}\" é uma duplicata"
 
-#: mcs/mcs/statement.cs:3297 mcs/mcs/statement.cs:3308
+#: mcs/mcs/statement.cs:3334 mcs/mcs/statement.cs:3345
 #, csharp-format
 msgid ""
 "The label `{0}' shadows another label by the same name in a contained scope"
 msgstr ""
 "O rótulo \"{0}\" esconde outro rótulo pelo mesmo nome em um escopo contido"
 
-#: mcs/mcs/statement.cs:3604
+#: mcs/mcs/statement.cs:3641
 #, csharp-format
 msgid "The label `case {0}:' already occurs in this switch statement"
 msgstr "O rótulo \"case {0}:\" já ocorre nesta declaração de switch"
 
-#: mcs/mcs/statement.cs:4123
+#: mcs/mcs/statement.cs:4160
 #, csharp-format
 msgid ""
 "A switch expression of type `{0}' cannot be converted to an integral type, "
 "bool, char, string, enum or nullable type"
 msgstr ""
 
-#: mcs/mcs/statement.cs:4734
+#: mcs/mcs/statement.cs:4771
 #, csharp-format
 msgid "`{0}' is not a reference type as required by the lock statement"
 msgstr ""
 "\"{0}\" não é um tipo de referência como necessário para a declaração lock"
 
-#: mcs/mcs/statement.cs:5081
+#: mcs/mcs/statement.cs:5118
 msgid "The type of locals declared in a fixed statement must be a pointer type"
 msgstr ""
 "O tipo de locais declarados em uma declaração fixa devem ser tipos ponteiros"
 
-#: mcs/mcs/statement.cs:5097
+#: mcs/mcs/statement.cs:5134
 msgid ""
 "The right hand side of a fixed statement assignment may not be a cast "
 "expression"
 msgstr "O lado direito de uma declaração fixa não deve ser uma expressão cast"
 
-#: mcs/mcs/statement.cs:5167
+#: mcs/mcs/statement.cs:5204
 msgid ""
 "You cannot use the fixed statement to take the address of an already fixed "
 "expression"
@@ -3891,7 +3889,7 @@ msgstr ""
 "Você não pode usar a declaração fixa para pegar o endereço de uma expressão "
 "já fixa"
 
-#: mcs/mcs/statement.cs:5523
+#: mcs/mcs/statement.cs:5560
 #, csharp-format
 msgid ""
 "A previous catch clause already catches all exceptions of this or a super "
@@ -3900,7 +3898,7 @@ msgstr ""
 "Uma cláusula catch anterior já pega todas as exceções do this ou um tipo "
 "super \"{0}\""
 
-#: mcs/mcs/statement.cs:5663
+#: mcs/mcs/statement.cs:5700
 #, csharp-format
 msgid ""
 "`{0}': type used in a using statement must be implicitly convertible to "
@@ -3909,7 +3907,7 @@ msgstr ""
 "\"{0}\": tipo utilizado em uma declaração em uso deve ser implicitamente "
 "conversível para \"System.IDisposable\""
 
-#: mcs/mcs/statement.cs:6067
+#: mcs/mcs/statement.cs:6104
 #, csharp-format
 msgid ""
 "foreach statement requires that the return type `{0}' of `{1}' must have a "
@@ -3918,7 +3916,7 @@ msgstr ""
 "declaração do foreach requer que o tipo de retorno \"{0}\" de \"{1}\" deve "
 "ter um método apropriado público MoveNext e a propriedade pública Current"
 
-#: mcs/mcs/statement.cs:6112
+#: mcs/mcs/statement.cs:6149
 #, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it "
@@ -3929,7 +3927,7 @@ msgstr ""
 "estas contém múltiplas implementações de \"{1}\". Tente um casting para uma "
 "implementação específica"
 
-#: mcs/mcs/statement.cs:6141
+#: mcs/mcs/statement.cs:6178
 #, fuzzy, csharp-format
 msgid ""
 "foreach statement cannot operate on variables of type `{0}' because it does "
@@ -3938,33 +3936,33 @@ msgstr ""
 "declaração do foreach não pode operar em variáveis do tipo \"{0}\" pois "
 "estas não contém uma definição para \"GetEnumerator\" ou não estão acessíveis"
 
-#: mcs/mcs/statement.cs:6372
+#: mcs/mcs/statement.cs:6409
 msgid "Use of null is not valid in this context"
 msgstr "Uso do null é inválido neste contexto"
 
-#: mcs/mcs/statement.cs:6384
+#: mcs/mcs/statement.cs:6421
 #, csharp-format
 msgid "Foreach statement cannot operate on a `{0}'"
 msgstr "Declaração do foreach não pode operar em um \"{0}\""
 
-#: mcs/mcs/typemanager.cs:771
+#: mcs/mcs/typemanager.cs:785
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not defined or imported"
 msgstr "O tipo predefinido \"{0}.{1}\" não está definido ou importado"
 
-#: mcs/mcs/typemanager.cs:816
+#: mcs/mcs/typemanager.cs:830
 #, fuzzy, csharp-format
 msgid ""
 "The predefined type `{0}.{1}' is defined multiple times. Using definition "
 "from `{2}'"
 msgstr "O tipo importado \"{0}\" é definido múltiplas vezes"
 
-#: mcs/mcs/typemanager.cs:831
+#: mcs/mcs/typemanager.cs:845
 #, csharp-format
 msgid "The predefined type `{0}.{1}' is not declared correctly"
 msgstr "O tipo predefinido \"{0}.{1}\" não está declarado corretamente"
 
-#: mcs/mcs/typemanager.cs:956
+#: mcs/mcs/typemanager.cs:970
 #, csharp-format
 msgid ""
 "The compiler required member `{0}.{1}{2}' could not be found or is "
@@ -3973,7 +3971,7 @@ msgstr ""
 "O membro necessário para o compilador \"{0}.{1}{2}\" não pode ser encontrado "
 "ou é inacessível"
 
-#: mcs/mcs/typemanager.cs:1070
+#: mcs/mcs/typemanager.cs:1084
 #, csharp-format
 msgid ""
 "Cannot take the address of, get the size of, or declare a pointer to a "
@@ -3982,6 +3980,19 @@ msgstr ""
 "Não foi possível obter o acesso de, conseguir o tamanho de, ou declarar um "
 "ponteiro para um tipo gerenciado \"{0}\""
 
+#~ msgid "Source file `{0}' could not be found"
+#~ msgstr "Arquivo fonte \"{0}\" não pôde ser encontrado"
+
+#~ msgid "Source file `{0}' is a binary file and not a text file"
+#~ msgstr "Arquivo fonte \"{0}\" é um arquivo binário e não um arquivo texto"
+
+#~ msgid ""
+#~ "The type or namespace name `{0}' could not be found. Are you missing a "
+#~ "using directive or an assembly reference?"
+#~ msgstr ""
+#~ "O tipo ou nome de namespace \"{0}\" não pôde ser encontrado. Você está "
+#~ "esquecendo de uma diretiva em uso ou uma referência do assembly?"
+
 #, fuzzy
 #~ msgid "An expression tree cannot contain an await operator"
 #~ msgstr "Uma árvore de expressão não pode conter um operador de atribuição"
index cd71355c9d89f0418960beee1c42e9a9fccedfde..c12d4a7c89693a6b8db58d063240845399b9df1c 100644 (file)
@@ -34,6 +34,9 @@ moon-do-basic-clean:
        cd $(mcs_topdir)/ && $(MAKE) NO_DIR_CHECK=1 PROFILE=moonlight_raw clean
 endif
 
+if ONLY_MONOTOUCH
+build_profiles = monotouch
+else
 if ONLY_MOONLIGHT
 build_profiles = moonlight_raw
 test_profiles = moonlight_raw
@@ -80,6 +83,7 @@ endif
 
 test_profiles = $(build_profiles)
 
+endif
 endif
 
 if BUILD_MCS